diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7eb4ba41..24569ab3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,11 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Pin syn and quote to meet MSRV + working-directory: lightning-c-bindings + run: | + cargo update -p syn --precise "2.0.106" --verbose + cargo update -p quote --precise "1.0.41" --verbose - name: Sanity test bindings against Cargo.toml RL working-directory: lightning-c-bindings run: | @@ -46,7 +51,9 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.1-bindings + git checkout 0.2-bindings + cargo update -p syn --precise "2.0.106" --verbose + cargo update -p quote --precise "1.0.41" --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 @@ -89,6 +96,11 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - name: Pin syn and quote to meet MSRV + working-directory: lightning-c-bindings + run: | + cargo update -p syn --precise "2.0.106" --verbose + cargo update -p quote --precise "1.0.41" --verbose - name: Sanity test bindings against Cargo.toml RL working-directory: lightning-c-bindings run: | @@ -106,9 +118,16 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.1-bindings + git checkout 0.2-bindings + cargo update -p syn --precise "2.0.106" --verbose + cargo update -p quote --precise "1.0.41" --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 + run: | + cd c-bindings-gen + cargo update -p quote --precise "1.0.30" --verbose + cargo update -p proc-macro2 --precise "1.0.65" --verbose - name: Fetch MacOS SDK run: | wget https://bitcoincore.org/depends-sources/sdks/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz @@ -152,7 +171,7 @@ jobs: run: | git clone https://github.com/rust-bitcoin/rust-lightning cd rust-lightning - git checkout 0.1-bindings + git checkout 0.2-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/blocks.rs b/c-bindings-gen/src/blocks.rs index ce6c2b16..5d7cc695 100644 --- a/c-bindings-gen/src/blocks.rs +++ b/c-bindings-gen/src/blocks.rs @@ -226,13 +226,13 @@ pub fn write_vec_block(w: &mut W, mangled_container: &str, in writeln!(w, "impl {} {{", mangled_container).unwrap(); writeln!(w, "\t#[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec<{}> {{", inner_type).unwrap(); writeln!(w, "\t\tif self.datalen == 0 {{ return Vec::new(); }}").unwrap(); - writeln!(w, "\t\tlet ret = unsafe {{ Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }}.into();").unwrap(); + writeln!(w, "\t\tlet ret = unsafe {{ Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }}.into();").unwrap(); writeln!(w, "\t\tself.data = core::ptr::null_mut();").unwrap(); writeln!(w, "\t\tself.datalen = 0;").unwrap(); writeln!(w, "\t\tret").unwrap(); writeln!(w, "\t}}").unwrap(); writeln!(w, "\t#[allow(unused)] pub(crate) fn as_slice(&self) -> &[{}] {{", inner_type).unwrap(); - writeln!(w, "\t\tunsafe {{ core::slice::from_raw_parts_mut(self.data, self.datalen) }}").unwrap(); + writeln!(w, "\t\tunsafe {{ crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }}").unwrap(); writeln!(w, "\t}}").unwrap(); writeln!(w, "}}").unwrap(); @@ -250,7 +250,7 @@ pub fn write_vec_block(w: &mut W, mangled_container: &str, in writeln!(w, "impl Drop for {} {{", mangled_container).unwrap(); writeln!(w, "\tfn drop(&mut self) {{").unwrap(); writeln!(w, "\t\tif self.datalen == 0 {{ return; }}").unwrap(); - writeln!(w, "\t\tlet _ = unsafe {{ Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }};").unwrap(); + writeln!(w, "\t\tlet _ = unsafe {{ Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }};").unwrap(); writeln!(w, "\t}}").unwrap(); writeln!(w, "}}").unwrap(); if clonable { @@ -258,7 +258,7 @@ pub fn write_vec_block(w: &mut W, mangled_container: &str, in writeln!(w, "\tfn clone(&self) -> Self {{").unwrap(); writeln!(w, "\t\tlet mut res = Vec::new();").unwrap(); writeln!(w, "\t\tif self.datalen == 0 {{ return Self::from(res); }}").unwrap(); - writeln!(w, "\t\tres.extend_from_slice(unsafe {{ core::slice::from_raw_parts_mut(self.data, self.datalen) }});").unwrap(); + writeln!(w, "\t\tres.extend_from_slice(unsafe {{ crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }});").unwrap(); writeln!(w, "\t\tSelf::from(res)").unwrap(); writeln!(w, "\t}}").unwrap(); writeln!(w, "}}").unwrap(); diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index d78289a2..1ac29577 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -108,7 +108,7 @@ fn maybe_convert_trait_impl(w: &mut W, trait_path: &syn::Path } writeln!(w, "}}").unwrap(); }, - "lightning::util::ser::Readable"|"lightning::util::ser::ReadableArgs"|"lightning::util::ser::MaybeReadable" => { + "lightning::util::ser::Readable"|"lightning::util::ser::LengthReadable"|"lightning::util::ser::ReadableArgs"|"lightning::util::ser::MaybeReadable" => { // Create the Result syn::Type let mut res_ty: syn::Type = parse_quote!(Result<#for_ty, lightning::ln::msgs::DecodeError>); @@ -850,7 +850,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, writeln_arg_docs(w, &$field.attrs, "", types, Some(&gen_types), vec![].drain(..), Some(&ref_type)); write!(w, "#[no_mangle]\npub extern \"C\" fn {}_get_{}(this_ptr: &{}) -> ", struct_name, $new_name, struct_name).unwrap(); types.write_c_type(w, &ref_type, Some(&gen_types), true); - write!(w, " {{\n\tlet mut inner_val = &mut this_ptr.get_native_mut_ref().{};\n\t", $real_name).unwrap(); + write!(w, " {{\n\tlet mut inner_val = &mut {}::get_native_mut_ref(this_ptr).{};\n\t", struct_name, $real_name).unwrap(); let local_var = types.write_to_c_conversion_from_ownable_ref_new_var(w, &format_ident!("inner_val"), &ref_type, Some(&gen_types)); if local_var { write!(w, "\n\t").unwrap(); } types.write_to_c_conversion_inline_prefix(w, &ref_type, Some(&gen_types), true); @@ -867,7 +867,7 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, writeln_arg_docs(w, &$field.attrs, "", types, Some(&gen_types), vec![].drain(..), Some(&$field.ty)); writeln!(w, "///\n/// Returns a copy of the field.").unwrap(); write!(w, "#[no_mangle]\npub extern \"C\" fn {}_get_{}(this_ptr: &{}) -> {}", struct_name, $new_name, struct_name, s).unwrap(); - write!(w, " {{\n\tlet mut inner_val = this_ptr.get_native_mut_ref().{}.clone();\n\t", $real_name).unwrap(); + write!(w, " {{\n\tlet mut inner_val = {}::get_native_mut_ref(this_ptr).{}.clone();\n\t", struct_name, $real_name).unwrap(); let local_var = types.write_to_c_conversion_new_var(w, &format_ident!("inner_val"), &$field.ty, Some(&gen_types), true); if local_var { write!(w, "\n\t").unwrap(); } types.write_to_c_conversion_inline_prefix(w, &$field.ty, Some(&gen_types), true); @@ -981,8 +981,6 @@ fn writeln_struct<'a, 'b, W: std::io::Write>(w: &mut W, s: &'a syn::ItemStruct, write!(w, "\t}}").unwrap(); }, syn::Fields::Unnamed(fields) => { - assert!(!s.generics.params.iter() - .any(|gen| if let syn::GenericParam::Lifetime(_) = gen { false } else { true })); writeln!(w, "{} (", types.maybe_resolve_ident(&s.ident).unwrap()).unwrap(); for (idx, field) in fields.unnamed.iter().enumerate() { write!(w, "\t\t").unwrap(); @@ -1395,7 +1393,39 @@ fn writeln_impl(w: &mut W, w_uses: &mut HashSet crate::{resolved_path} {{").unwrap(); + write!(w, "\tlet from_obj = ").unwrap(); + types.write_from_c_conversion_prefix(w, from_ty, Some(&gen_types)); + write!(w, "f").unwrap(); + types.write_from_c_conversion_suffix(w, from_ty, Some(&gen_types)); + write!(w, ";\n\t").unwrap(); + types.write_to_c_conversion_inline_prefix(w, &*i.self_ty, Some(&gen_types), true); + write!(w, "({resolved_path}::from(from_obj))").unwrap(); + types.write_to_c_conversion_inline_suffix(w, &*i.self_ty, Some(&gen_types), true); + writeln!(w, "\n}}").unwrap(); + } else { panic!("wat {:?}", from_ty); } + } } else if path_matches_nongeneric(&trait_path.1, &["Default"]) { writeln!(w, "/// Creates a \"default\" {}. See struct and individual field documentaiton for details on which values are used.", ident).unwrap(); write!(w, "#[must_use]\n#[no_mangle]\npub extern \"C\" fn {}_default() -> {} {{\n", ident, ident).unwrap(); @@ -1454,18 +1484,18 @@ fn writeln_impl(w: &mut W, w_uses: &mut HashSet Self {{").unwrap(); writeln!(w, "\t\tSelf {{").unwrap(); writeln!(w, "\t\t\tinner: if <*mut native{}>::is_null(self.inner) {{ core::ptr::null_mut() }} else {{", ident).unwrap(); - writeln!(w, "\t\t\t\tObjOps::heap_alloc(unsafe {{ &*ObjOps::untweak_ptr(self.inner) }}.clone()) }},").unwrap(); + writeln!(w, "\t\t\t\tObjOps::heap_alloc(Clone::clone(unsafe {{ &*ObjOps::untweak_ptr(self.inner) }})) }},").unwrap(); writeln!(w, "\t\t\tis_owned: true,").unwrap(); writeln!(w, "\t\t}}\n\t}}\n}}").unwrap(); writeln!(w, "#[allow(unused)]").unwrap(); writeln!(w, "/// Used only if an object of this type is returned as a trait impl by a method").unwrap(); writeln!(w, "pub(crate) extern \"C\" fn {}_clone_void(this_ptr: *const c_void) -> *mut c_void {{", ident).unwrap(); - writeln!(w, "\tBox::into_raw(Box::new(unsafe {{ (*(this_ptr as *const native{})).clone() }})) as *mut c_void", ident).unwrap(); + writeln!(w, "\tBox::into_raw(Box::new(Clone::clone(unsafe {{ &*(this_ptr as *const native{}) }}))) as *mut c_void", ident).unwrap(); writeln!(w, "}}").unwrap(); writeln!(w, "#[no_mangle]").unwrap(); writeln!(w, "/// Creates a copy of the {}", ident).unwrap(); writeln!(w, "pub extern \"C\" fn {}_clone(orig: &{}) -> {} {{", ident, ident, ident).unwrap(); - writeln!(w, "\torig.clone()").unwrap(); + writeln!(w, "\tClone::clone(orig)").unwrap(); writeln!(w, "}}").unwrap(); } else if path_matches_nongeneric(&trait_path.1, &["FromStr"]) { let mut err_opt = None; @@ -2556,6 +2586,7 @@ fn main() { // Write a few manually-defined types into the C++ header file write_cpp_wrapper(&mut cpp_header_file, "Str", true, None); + write_cpp_wrapper(&mut cpp_header_file, "ECDSASignature", false, None); // First parse the full crate's ASTs, caching them so that we can hold references to the AST // objects in other datastructures: diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 5ac95570..3e313fa3 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -56,6 +56,14 @@ pub fn single_ident_generic_path_to_ident(p: &syn::Path) -> Option<&syn::Ident> } else { None } } +pub fn path_matches_ignoring_generics(p: &syn::Path, exp: &[&str]) -> bool { + if p.segments.len() != exp.len() { return false; } + for (seg, e) in p.segments.iter().zip(exp.iter()) { + if &format!("{}", seg.ident) != *e { return false; } + } + true +} + pub fn path_matches_nongeneric(p: &syn::Path, exp: &[&str]) -> bool { if p.segments.len() != exp.len() { return false; } for (seg, e) in p.segments.iter().zip(exp.iter()) { @@ -576,6 +584,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, "i32"); Self::insert_primitive(&mut imports, "f64"); Self::insert_primitive(&mut imports, "u64"); Self::insert_primitive(&mut imports, "u32"); @@ -917,6 +926,11 @@ fn initial_clonable_types() -> HashSet { // `write_c_mangled_container_path_intern` (which will add it here too), so we have to manually // add it on startup. res.insert("crate::c_types::derived::CVec_u8Z".to_owned()); + + // write_c_type_intern writes the empty string for the empty tuple. In order to ensure + // COption_NoneZ is marked clonable, we have to support "cloning" "". + res.insert("".to_owned()); + res } @@ -1037,6 +1051,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { match full_path { "bool" => true, "i64" => true, + "i32" => true, "f64" => true, "u64" => true, "u32" => true, @@ -1110,7 +1125,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::Scalar" if !is_ref => Some("crate::c_types::BigEndianScalar"), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"), - "bitcoin::amount::Amount" => Some("u64"), + "bitcoin::Amount"|"bitcoin::amount::Amount" => Some("u64"), + "bitcoin::Weight" => Some("u64"), + "bitcoin::Sequence" => Some("u32"), "bitcoin::script::Script"|"bitcoin::Script" => Some("crate::c_types::u8slice"), "bitcoin::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some("crate::c_types::derived::CVec_u8Z"), @@ -1160,7 +1177,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" if !is_ref => Some("crate::c_types::ThirtyTwoBytes"), - "lightning::io::Read" => Some("crate::c_types::u8slice"), + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => Some("crate::c_types::u8slice"), _ => None, } @@ -1230,7 +1247,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::Scalar" if !is_ref => Some(""), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("::bitcoin::secp256k1::ecdh::SharedSecret::from_bytes("), - "bitcoin::amount::Amount" => Some("::bitcoin::amount::Amount::from_sat("), + "bitcoin::Amount"|"bitcoin::amount::Amount" => Some("::bitcoin::amount::Amount::from_sat("), + "bitcoin::Weight" => Some("::bitcoin::Weight::from_wu("), + "bitcoin::Sequence" => Some("::bitcoin::Sequence("), "bitcoin::script::Script"|"bitcoin::Script" => Some("::bitcoin::script::Script::from_bytes("), "bitcoin::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some("::bitcoin::script::ScriptBuf::from("), @@ -1287,7 +1306,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "lightning::chain::ClaimId" if is_ref=> Some("&::lightning::chain::ClaimId( unsafe { *"), // List of traits we map (possibly during processing of other files): - "lightning::io::Read" => Some("&mut "), + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => Some("&mut "), _ => None, }.map(|s| s.to_owned()) @@ -1349,7 +1368,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::Scalar" => Some(".into_rust()"), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some(".data)"), - "bitcoin::amount::Amount" => Some(")"), + "bitcoin::Amount"|"bitcoin::amount::Amount" => Some(")"), + "bitcoin::Weight" => Some(")"), + "bitcoin::Sequence" => Some(")"), "bitcoin::script::Script"|"bitcoin::Script" => Some(".to_slice())"), "bitcoin::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some(".into_rust())"), @@ -1399,7 +1420,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { if is_ref => Some(" })"), // List of traits we map (possibly during processing of other files): - "lightning::io::Read" => Some(".to_reader()"), + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => Some(".to_slice()"), _ => None, }.map(|s| s.to_owned()) @@ -1481,7 +1502,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::Scalar" if !is_ref => Some("crate::c_types::BigEndianScalar::from_rust(&"), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some("crate::c_types::ThirtyTwoBytes { data: "), - "bitcoin::amount::Amount" => Some(""), + "bitcoin::Amount"|"bitcoin::amount::Amount" => Some(""), + "bitcoin::Weight" => Some(""), + "bitcoin::Sequence" => Some(""), "bitcoin::script::Script"|"bitcoin::Script" => Some("crate::c_types::u8slice::from_slice("), "bitcoin::script::ScriptBuf"|"bitcoin::ScriptBuf" => Some(""), @@ -1530,7 +1553,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" 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("), + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => Some("crate::c_types::u8slice::from_vec(&crate::c_types::reader_to_vec("), _ => None, }.map(|s| s.to_owned()) @@ -1594,7 +1617,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { "bitcoin::secp256k1::Scalar" if !is_ref => Some(")"), "bitcoin::secp256k1::ecdh::SharedSecret" if !is_ref => Some(".secret_bytes() }"), - "bitcoin::amount::Amount" => Some(".to_sat()"), + "bitcoin::Amount"|"bitcoin::amount::Amount" => Some(".to_sat()"), + "bitcoin::Weight" => Some(".to_wu()"), + "bitcoin::Sequence" => Some(".0"), "bitcoin::script::Script"|"bitcoin::Script" => Some(".as_ref())"), "bitcoin::script::ScriptBuf"|"bitcoin::ScriptBuf" if is_ref => Some(".as_bytes().to_vec().into()"), @@ -1640,7 +1665,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { |"lightning::sign::KeyMaterial"|"lightning::chain::ClaimId" if !is_ref => Some(".0 }"), - "lightning::io::Read" => Some("))"), + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => Some("))"), _ => None, }.map(|s| s.to_owned()) @@ -1661,7 +1686,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> { /// TODO: We should never need to use this! fn real_rust_type_mapping<'equiv>(&self, thing: &'equiv str) -> &'equiv str { match thing { - "lightning::io::Read" => "crate::c_types::io::Read", + "lightning::util::ser::LengthLimitedRead"|"lightning::io::Read" => "crate::c_types::io::Read", _ => thing, } } diff --git a/genbindings.sh b/genbindings.sh index 80626d7d..d299e844 100755 --- a/genbindings.sh +++ b/genbindings.sh @@ -137,6 +137,7 @@ static inline const char* check_get_ldk_version() { // Version mismatch, we don't know what we're running! return 0; } + Str_free(bin_ver); return _LDK_HEADER_VER; } static inline const char* check_get_ldk_bindings_version() { @@ -145,6 +146,7 @@ static inline const char* check_get_ldk_bindings_version() { // Version mismatch, we don't know what we're running! return 0; } + Str_free(bin_ver); return _LDK_C_BINDINGS_HEADER_VER; } #endif /* _LDK_HEADER_VER */ @@ -207,7 +209,6 @@ if [ "$2" = "true" ]; then add_crate "lightning-background-processor" "lightning_background_processor" --features=std,lightning/std add_crate "lightning-invoice" "lightning_invoice" --features=std add_crate "lightning-rapid-gossip-sync" "lightning_rapid_gossip_sync" --features=std,lightning/std - add_crate "lightning-liquidity" "lightning_liquidity" --features=std,lightning/std CARGO_BUILD_ARGS="--features=std" else add_crate lightning lightning --features=dnssec @@ -216,7 +217,6 @@ else add_crate "lightning-background-processor" "lightning_background_processor" add_crate "lightning-rapid-gossip-sync" "lightning_rapid_gossip_sync" add_crate "lightning-invoice" "lightning_invoice" - add_crate "lightning-liquidity" "lightning_liquidity" CARGO_BUILD_ARGS="--features=no-std" fi diff --git a/ldk-net/ldk_net.c b/ldk-net/ldk_net.c index fcc0e527..33a6394e 100644 --- a/ldk-net/ldk_net.c +++ b/ldk-net/ldk_net.c @@ -91,10 +91,10 @@ struct Descriptor { static uintptr_t sock_send_data(void* desc, struct LDKu8slice data, bool resume_read) { struct Descriptor *descriptor = (struct Descriptor*)desc; ssize_t write_count = send(descriptor->fd, data.data, data.datalen, MSG_NOSIGNAL); - bool pause_read = false; - if (write_count <= 0) { + bool more_to_write = false; + if (data.datalen > 0 && write_count <= 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { - pause_read = true; + more_to_write = true; write_count = 0; } else { shutdown(descriptor->fd, SHUT_RDWR); @@ -103,23 +103,30 @@ static uintptr_t sock_send_data(void* desc, struct LDKu8slice data, bool resume_ return 0; } } else if (write_count < data.datalen) { - pause_read = true; + more_to_write = true; } - if (pause_read || resume_read) { - int lockres = pthread_mutex_lock(&descriptor->handler->sockets_mutex); - assert(lockres == 0); - for (int i = 0; i < descriptor->handler->sockcount; i++) { - if (descriptor->handler->pollfds[i].fd == descriptor->fd) { - if (pause_read) { - descriptor->handler->pollfds[i].events = POLLOUT; - } else { - descriptor->handler->pollfds[i].events = POLLIN; - } - break; + + int lockres = pthread_mutex_lock(&descriptor->handler->sockets_mutex); + assert(lockres == 0); + bool events_changed = false; + for (int i = 0; i < descriptor->handler->sockcount; i++) { + if (descriptor->handler->pollfds[i].fd == descriptor->fd) { + short events_desired = 0; + if (resume_read) { + events_desired |= POLLIN; + } + if (more_to_write) { + events_desired |= POLLOUT; } + events_changed = descriptor->handler->pollfds[i].events != events_desired; + descriptor->handler->pollfds[i].events = events_desired; + break; } - lockres = pthread_mutex_unlock(&descriptor->handler->sockets_mutex); - assert(lockres == 0); + } + lockres = pthread_mutex_unlock(&descriptor->handler->sockets_mutex); + assert(lockres == 0); + + if (events_changed) { uint8_t dummy = 0; write(descriptor->handler->pipefds[1], &dummy, 1); } @@ -261,20 +268,11 @@ static void *sock_thread_fn(void* arg) { .data = readbuf, .datalen = readlen, }; - LDKCResult_boolPeerHandleErrorZ res = PeerManager_read_event(&handler->ldk_peer_manager, &descriptor, data); - if (res.result_ok) { - if (*res.contents.result) { - lockres = pthread_mutex_lock(&handler->sockets_mutex); - assert(lockres == 0); - assert(handler->pollfds[i].fd == pollfds[i].fd); // Only we change fd order! - handler->pollfds[i].events = POLLOUT; - lockres = pthread_mutex_unlock(&handler->sockets_mutex); - assert(lockres == 0); - } - } else { + LDKCResult_NonePeerHandleErrorZ res = PeerManager_read_event(&handler->ldk_peer_manager, &descriptor, data); + if (!res.result_ok) { close_socks[close_socks_count++] = i; } - CResult_boolPeerHandleErrorZ_free(res); + CResult_NonePeerHandleErrorZ_free(res); } } if (pollfds[i].revents & POLLOUT) { diff --git a/lightning-c-bindings/Cargo.toml b/lightning-c-bindings/Cargo.toml index b96ff164..4d34289d 100644 --- a/lightning-c-bindings/Cargo.toml +++ b/lightning-c-bindings/Cargo.toml @@ -16,20 +16,19 @@ crate-type = ["staticlib" [features] no-std = ["lightning/dnssec"] -std = ["bitcoin/std", "lightning/std", "lightning/dnssec", "lightning-invoice/std", "lightning-background-processor/std", "lightning-rapid-gossip-sync/std", "lightning-liquidity/std"] +std = ["bitcoin/std", "lightning/std", "lightning/dnssec", "lightning-invoice/std", "lightning-background-processor/std", "lightning-rapid-gossip-sync/std"] [dependencies] bitcoin = { version = "0.32", default-features = false } bech32 = { version = "0.9", default-features = false } secp256k1 = { version = "0.29", 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.1-bindings", default-features = false } -lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } -lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } -lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } -lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } -lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } -lightning-liquidity = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.1-bindings", default-features = false } +lightning = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } +lightning-types = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } +lightning-persister = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } +lightning-invoice = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } +lightning-background-processor = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } +lightning-rapid-gossip-sync = { git = "https://github.com/lightningdevkit/rust-lightning", branch = "0.2-bindings", default-features = false } # Always force panic=abort, further options are set in the genbindings.sh build script [profile.dev] diff --git a/lightning-c-bindings/demo.c b/lightning-c-bindings/demo.c index 580d7f57..e793aeef 100644 --- a/lightning-c-bindings/demo.c +++ b/lightning-c-bindings/demo.c @@ -26,10 +26,10 @@ void broadcast_txn(const void *this_arg, LDKCVec_TransactionZ txn) { CVec_TransactionZ_free(txn); } -LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) { +LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKChannelId chan_id, LDKChannelMonitor monitor) { return CResult_ChannelMonitorUpdateStatusNoneZ_ok(ChannelMonitorUpdateStatus_completed()); } -LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKOutPoint funding_txo, const LDKChannelMonitorUpdate *monitor) { +LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKChannelId chan_id, const LDKChannelMonitorUpdate *monitor) { return ChannelMonitorUpdateStatus_completed(); } LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ monitors_pending_monitor_events(const void *this_arg) { @@ -46,14 +46,14 @@ LDKCResult_NoneReplayEventZ never_handle_event(const void *this_arg, const struc return CResult_NoneReplayEventZ_ok(); } -LDKCResult_RouteLightningErrorZ do_find_route(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs) { +LDKCResult_RouteStrZ do_find_route(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs) { LDKStr reason = { .chars = (const unsigned char*)"", .len = 0, .chars_is_owned = false }; - return CResult_RouteLightningErrorZ_err(LightningError_new(reason, ErrorAction_ignore_error())); + return CResult_RouteStrZ_err(reason); } -LDKCResult_RouteLightningErrorZ do_find_route_with_id(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_id) { +LDKCResult_RouteStrZ do_find_route_with_id(const void *this_arg, LDKPublicKey payer, const LDKRouteParameters *route_params, LDKCVec_ChannelDetailsZ *first_hops, const LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_id) { LDKStr reason = { .chars = (const unsigned char*)"", .len = 0, .chars_is_owned = false }; - return CResult_RouteLightningErrorZ_err(LightningError_new(reason, ErrorAction_ignore_error())); + return CResult_RouteStrZ_err(reason); } int main() { @@ -99,11 +99,10 @@ int main() { .this_arg = NULL, .find_path = NULL, .create_blinded_paths = NULL, - .create_compact_blinded_paths = NULL, .free = NULL, }; - LDKKeysManager keys = KeysManager_new(&node_seed, 0, 0); + LDKKeysManager keys = KeysManager_new(&node_seed, 0, 0, true); LDKEntropySource entropy_source = KeysManager_as_EntropySource(&keys); LDKNodeSigner node_signer = KeysManager_as_NodeSigner(&keys); LDKSignerProvider signer_provider = KeysManager_as_SignerProvider(&keys); diff --git a/lightning-c-bindings/demo.cpp b/lightning-c-bindings/demo.cpp index d0431d33..4abdc774 100644 --- a/lightning-c-bindings/demo.cpp +++ b/lightning-c-bindings/demo.cpp @@ -140,7 +140,7 @@ void broadcast_txn(const void *this_arg, LDKCVec_TransactionZ txn) { struct NodeMonitors { std::mutex mut; - std::vector> mons; + std::vector> mons; LDKLogger* logger; void ConnectBlock(const uint8_t (*header)[80], uint32_t height, LDKCVec_C2Tuple_usizeTransactionZZ tx_data, LDKBroadcasterInterface broadcast, LDKFeeEstimator fee_est) { @@ -151,29 +151,26 @@ struct NodeMonitors { } }; -LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKOutPoint funding_txo_arg, LDKChannelMonitor monitor_arg) { +LDKCResult_ChannelMonitorUpdateStatusNoneZ add_channel_monitor(const void *this_arg, LDKChannelId chan_id, LDKChannelMonitor monitor_arg) { // First bind the args to C++ objects so they auto-free + LDK::ChannelId channel_id(std::move(chan_id)); LDK::ChannelMonitor mon(std::move(monitor_arg)); - LDK::OutPoint funding_txo(std::move(funding_txo_arg)); NodeMonitors* arg = (NodeMonitors*) this_arg; std::unique_lock l(arg->mut); - arg->mons.push_back(std::make_pair(std::move(funding_txo), std::move(mon))); + arg->mons.push_back(std::make_pair(std::move(channel_id), std::move(mon))); 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) { - // First bind the args to C++ objects so they auto-free - LDK::OutPoint funding_txo(std::move(funding_txo_arg)); - +LDKChannelMonitorUpdateStatus update_channel_monitor(const void *this_arg, LDKChannelId chan_id, const LDKChannelMonitorUpdate *update) { + LDK::ChannelId channel_id(std::move(chan_id)); NodeMonitors* arg = (NodeMonitors*) this_arg; std::unique_lock l(arg->mut); bool updated = false; for (auto& mon : arg->mons) { - if (OutPoint_get_index(&mon.first) == OutPoint_get_index(&funding_txo) && - !memcmp(OutPoint_get_txid(&mon.first), OutPoint_get_txid(&funding_txo), 32)) { + if (!memcmp(ChannelId_get_a(&mon.first), ChannelId_get_a(&channel_id), 32)) { updated = true; LDKBroadcasterInterface broadcaster = { .broadcast_transactions = broadcast_txn, @@ -201,8 +198,7 @@ LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ monitors_pending_ // 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_OutPointCVec_u8ZZ funding_info = ChannelMonitor_get_funding_txo(&arg->mons[0].second); - LDK::OutPoint outpoint = std::move(funding_info->a); + LDK::OutPoint outpoint = ChannelMonitor_get_funding_txo(&arg->mons[0].second); LDKPublicKey counterparty_node_id = ChannelMonitor_get_counterparty_node_id(&arg->mons[0].second); LDKThirtyTwoBytes channel_id; memset(&channel_id, 0, sizeof(channel_id)); @@ -328,7 +324,7 @@ void sock_read_data_thread(int rdfd, LDKSocketDescriptor *peer_descriptor, LDKPe ssize_t readlen = 0; while ((readlen = read(rdfd, buf, 1024)) > 0) { data.datalen = readlen; - LDK::CResult_boolPeerHandleErrorZ res = PeerManager_read_event(&*pm, peer_descriptor, data); + LDK::CResult_NonePeerHandleErrorZ res = PeerManager_read_event(&*pm, peer_descriptor, data); if (!res->result_ok) { peer_descriptor->disconnect_socket(peer_descriptor->this_arg); return; @@ -541,7 +537,7 @@ uint64_t get_chan_score(const void *this_arg, const LDKCandidateRouteHop *hop, L return 42; } -struct LDKCResult_RouteLightningErrorZ custom_find_route(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs in_flights, LDKThirtyTwoBytes payment_id, LDKThirtyTwoBytes payment_hash) { +struct LDKCResult_RouteStrZ custom_find_route(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKInFlightHtlcs in_flights, LDKThirtyTwoBytes payment_hash, LDKThirtyTwoBytes payment_id) { const LDK::DefaultRouter *router = (LDK::DefaultRouter *)this_arg; assert(first_hops->datalen == 1); assert(ChannelDetails_get_is_usable(&first_hops->data[0])); @@ -618,8 +614,8 @@ int main() { LDKMessageRouter panic_msg_router = { .this_arg = NULL, + .find_path = NULL, // Segfault if we ever try to find a route .create_blinded_paths = NULL, // Segfault if we ever try to find a route - .create_compact_blinded_paths = NULL, // Segfault if we ever try to find a route .free = NULL, }; @@ -633,7 +629,7 @@ int main() { // Instantiate classes for node 1: uint8_t node_seed[32]; memset(&node_seed, 0, 32); - LDK::KeysManager keys1 = KeysManager_new(&node_seed, 0, 0); + LDK::KeysManager keys1 = KeysManager_new(&node_seed, 0, 0, true); LDK::NodeSigner node_signer1 = KeysManager_as_NodeSigner(&keys1); LDK::EntropySource entropy_source1 = KeysManager_as_EntropySource(&keys1); LDK::SignerProvider signer_provider1 = KeysManager_as_SignerProvider(&keys1); @@ -658,22 +654,22 @@ int main() { LDK::CVec_ChannelDetailsZ channels = ChannelManager_list_channels(&cm1); assert(channels->datalen == 0); - LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler1), OnionMessenger_as_OnionMessageHandler(&om1), std::move(custom_msg_handler1)); + LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler1), OnionMessenger_as_OnionMessageHandler(&om1), std::move(custom_msg_handler1), IgnoringMessageHandler_as_SendOnlyMessageHandler(&ignoring_handler1)); random_bytes = entropy_source1.get_secure_random_bytes(); LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), 0xdeadbeef, &random_bytes.data, logger1, std::move(node_signer1)); // Demo getting a channel key and check that its returning real pubkeys: LDKSixteenBytes user_id_1 { .data = {45, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0} }; - LDKThirtyTwoBytes chan_signer_id1 = signer_provider1.generate_channel_keys_id(false, 42, U128_new(user_id_1)); - LDK::EcdsaChannelSigner chan_signer1 = signer_provider1.derive_channel_signer(42, chan_signer_id1); - chan_signer1->ChannelSigner.set_pubkeys(&chan_signer1->ChannelSigner); // Make sure pubkeys is defined - LDKPublicKey payment_point = ChannelPublicKeys_get_payment_point(&chan_signer1->ChannelSigner.pubkeys); + LDKThirtyTwoBytes chan_signer_id1 = signer_provider1.generate_channel_keys_id(42, U128_new(user_id_1)); + LDK::EcdsaChannelSigner chan_signer1 = signer_provider1.derive_channel_signer(chan_signer_id1); + LDK::ChannelPublicKeys chan_keys1 = chan_signer1->BaseEcdsaChannelSigner.ChannelSigner.pubkeys(chan_signer1->BaseEcdsaChannelSigner.ChannelSigner.this_arg); + LDKPublicKey payment_point = ChannelPublicKeys_get_payment_point(&chan_keys1); assert(memcmp(&payment_point, &null_pk, sizeof(null_pk))); // Instantiate classes for node 2: memset(&node_seed, 1, 32); - LDK::KeysManager keys2 = KeysManager_new(&node_seed, 0, 0); + LDK::KeysManager keys2 = KeysManager_new(&node_seed, 0, 0, true); LDK::NodeSigner node_signer2 = KeysManager_as_NodeSigner(&keys2); LDK::EntropySource entropy_source2 = KeysManager_as_EntropySource(&keys2); LDK::SignerProvider signer_provider2 = KeysManager_as_SignerProvider(&keys2); @@ -700,7 +696,7 @@ int main() { LDK::CResult_boolLightningErrorZ ann_res = net_msgs2->handle_channel_announcement(net_msgs2->this_arg, ChannelManager_get_our_node_id(&cm1), chan_ann->contents.result); assert(ann_res->result_ok); - LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), std::move(net_msgs2), OnionMessenger_as_OnionMessageHandler(&om1), std::move(custom_msg_handler2)); + LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), std::move(net_msgs2), OnionMessenger_as_OnionMessageHandler(&om1), std::move(custom_msg_handler2), IgnoringMessageHandler_as_SendOnlyMessageHandler(&ignoring_handler2)); random_bytes = entropy_source2.get_secure_random_bytes(); LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), 0xdeadbeef, &random_bytes.data, logger2, std::move(node_signer2)); @@ -886,17 +882,13 @@ int main() { } std::cout << __FILE__ << ":" << __LINE__ << " - " << "Listed usable channel!" << std::endl; + LDK::Bolt11InvoiceParameters invoice_params = Bolt11InvoiceParameters_default(); LDKCOption_u64Z min_value = { .tag = LDKCOption_u64Z_Some, .some = 5000, }; - LDK::CResult_Bolt11InvoiceSignOrCreationErrorZ invoice = create_invoice_from_channelmanager(&cm2, - min_value, - LDKStr { - .chars = (const uint8_t *)"Invoice Description", - .len = strlen("Invoice Description"), - .chars_is_owned = false - }, 3600, COption_u16Z_none()); + Bolt11InvoiceParameters_set_amount_msats(&invoice_params, min_value); + LDK::CResult_Bolt11InvoiceSignOrCreationErrorZ invoice = ChannelManager_create_bolt11_invoice(&cm2, std::move(invoice_params)); assert(invoice->result_ok); LDKThirtyTwoBytes payment_hash; memcpy(payment_hash.data, Bolt11Invoice_payment_hash(invoice->contents.result), 32); @@ -932,45 +924,39 @@ int main() { std::cout << __FILE__ << ":" << __LINE__ << " - " << "4 monitors updated!" << std::endl; // Check that we received the payment! - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting PendingHTLCsForwardable event..." << std::endl; + std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting PaymentClaimable event!" << std::endl; + + mons_updated = 0; + LDKThirtyTwoBytes payment_preimage; while (true) { + ChannelManager_process_pending_htlc_forwards(&cm2); + PeerManager_process_events(&net2); + EventQueue queue; LDKEventHandler handler = { .this_arg = &queue, .handle_event = handle_event, .free = NULL }; ev2.process_pending_events(handler); - if (queue.events.size() == 1) { - assert(queue.events[0]->tag == LDKEvent_PendingHTLCsForwardable); + if (queue.events.size() != 0) { + assert(queue.events.size() == 1); + assert(queue.events[0]->tag == LDKEvent_PaymentClaimable); + assert(!memcmp(queue.events[0]->payment_claimable.payment_hash.data, payment_hash.data, 32)); + assert(queue.events[0]->payment_claimable.purpose.tag == LDKPaymentPurpose_Bolt11InvoicePayment); + assert(!memcmp(queue.events[0]->payment_claimable.purpose.bolt11_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.bolt11_invoice_payment.payment_preimage.tag == LDKCOption_ThirtyTwoBytesZ_Some); + memcpy(payment_preimage.data, queue.events[0]->payment_claimable.purpose.bolt11_invoice_payment.payment_preimage.some.data, 32); + ChannelManager_claim_funds(&cm2, payment_preimage); + + queue.events.clear(); + ev2.process_pending_events(handler); + assert(queue.events.size() == 1); + assert(queue.events[0]->tag == LDKEvent_PaymentClaimed); + assert(!memcmp(queue.events[0]->payment_claimed.payment_hash.data, payment_hash.data, 32)); + assert(queue.events[0]->payment_claimed.purpose.tag == LDKPaymentPurpose_Bolt11InvoicePayment); break; } std::this_thread::yield(); } - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Received PendingHTLCsForwardable event!" << std::endl; - ChannelManager_process_pending_htlc_forwards(&cm2); - PeerManager_process_events(&net2); - - mons_updated = 0; - LDKThirtyTwoBytes payment_preimage; - { - EventQueue queue; - LDKEventHandler handler = { .this_arg = &queue, .handle_event = handle_event, .free = NULL }; - ev2.process_pending_events(handler); - assert(queue.events.size() == 1); - assert(queue.events[0]->tag == LDKEvent_PaymentClaimable); - assert(!memcmp(queue.events[0]->payment_claimable.payment_hash.data, payment_hash.data, 32)); - assert(queue.events[0]->payment_claimable.purpose.tag == LDKPaymentPurpose_Bolt11InvoicePayment); - assert(!memcmp(queue.events[0]->payment_claimable.purpose.bolt11_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.bolt11_invoice_payment.payment_preimage.tag == LDKCOption_ThirtyTwoBytesZ_Some); - memcpy(payment_preimage.data, queue.events[0]->payment_claimable.purpose.bolt11_invoice_payment.payment_preimage.some.data, 32); - ChannelManager_claim_funds(&cm2, payment_preimage); - - queue.events.clear(); - ev2.process_pending_events(handler); - assert(queue.events.size() == 1); - assert(queue.events[0]->tag == LDKEvent_PaymentClaimed); - assert(!memcmp(queue.events[0]->payment_claimed.payment_hash.data, payment_hash.data, 32)); - assert(queue.events[0]->payment_claimed.purpose.tag == LDKPaymentPurpose_Bolt11InvoicePayment); - } PeerManager_process_events(&net2); // Wait until we've passed through a full set of monitor updates (ie new preimage + CS/RAA messages) { @@ -1007,7 +993,7 @@ int main() { mons_list1->data[0].is_owned = false; // XXX: God this sucks uint8_t node_seed[32]; memset(&node_seed, 0, 32); - LDK::KeysManager keys1 = KeysManager_new(&node_seed, 1, 0); + LDK::KeysManager keys1 = KeysManager_new(&node_seed, 1, 0, true); LDK::NodeSigner node_signer1 = KeysManager_as_NodeSigner(&keys1); LDK::EntropySource entropy_source1 = KeysManager_as_EntropySource(&keys1); LDK::SignerProvider signer_provider1 = KeysManager_as_SignerProvider(&keys1); @@ -1047,7 +1033,7 @@ int main() { mons_list2->data[0] = *& std::get<1>(mons2.mons[0]); // Note that we need a reference, thus need a raw clone here, which *& does. mons_list2->data[0].is_owned = false; // XXX: God this sucks memset(&node_seed, 1, 32); - LDK::KeysManager keys2 = KeysManager_new(&node_seed, 1, 0); + LDK::KeysManager keys2 = KeysManager_new(&node_seed, 1, 0, true); LDK::NodeSigner node_signer2 = KeysManager_as_NodeSigner(&keys2); LDK::EntropySource entropy_source2 = KeysManager_as_EntropySource(&keys2); LDK::SignerProvider signer_provider2 = KeysManager_as_SignerProvider(&keys2); @@ -1104,7 +1090,7 @@ int main() { }, .free = NULL, }; - LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler1), OnionMessenger_as_OnionMessageHandler(&om1), custom_msg_handler1); + LDK::MessageHandler msg_handler1 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm1), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler1), OnionMessenger_as_OnionMessageHandler(&om1), custom_msg_handler1, IgnoringMessageHandler_as_SendOnlyMessageHandler(&ignorer_1)); random_bytes = entropy_source1.get_secure_random_bytes(); LDK::PeerManager net1 = PeerManager_new(std::move(msg_handler1), 0xdeadbeef, &random_bytes.data, logger1, std::move(node_signer1)); @@ -1124,7 +1110,7 @@ int main() { }, .free = NULL, }; - LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler2), OnionMessenger_as_OnionMessageHandler(&om2), custom_msg_handler2); + LDK::MessageHandler msg_handler2 = MessageHandler_new(ChannelManager_as_ChannelMessageHandler(&cm2), P2PGossipSync_as_RoutingMessageHandler(&graph_msg_handler2), OnionMessenger_as_OnionMessageHandler(&om2), custom_msg_handler2, IgnoringMessageHandler_as_SendOnlyMessageHandler(&ignorer_2)); random_bytes = entropy_source1.get_secure_random_bytes(); LDK::PeerManager net2 = PeerManager_new(std::move(msg_handler2), 0xdeadbeef, &random_bytes.data, logger2, std::move(node_signer2)); @@ -1142,48 +1128,25 @@ int main() { std::cout << __FILE__ << ":" << __LINE__ << " - " << "Listed usable channel!" << std::endl; // Send another payment, this time via the retires path - LDK::CResult_Bolt11InvoiceSignOrCreationErrorZ invoice_res2 = create_invoice_from_channelmanager(&cm2, - COption_u64Z_some(10000), - LDKStr { - .chars = (const uint8_t *)"Invoice 2 Description", - .len = strlen("Invoice 2 Description"), - .chars_is_owned = false - }, 3600, COption_u16Z_none()); + + LDK::Bolt11InvoiceParameters invoice_params = Bolt11InvoiceParameters_default(); + Bolt11InvoiceParameters_set_amount_msats(&invoice_params, COption_u64Z_some(10000)); + LDK::CResult_Bolt11InvoiceSignOrCreationErrorZ invoice_res2 = ChannelManager_create_bolt11_invoice(&cm2, std::move(invoice_params)); assert(invoice_res2->result_ok); const LDKBolt11Invoice *invoice2 = invoice_res2->contents.result; - LDK::CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ pay_params = - payment_parameters_from_invoice(invoice2); - LDK::RecipientOnionFields invoice2_recipient(std::move(pay_params->contents.result->b)); - LDK::RouteParameters invoice2_params(std::move(pay_params->contents.result->c)); - assert(pay_params->result_ok); + LDKThirtyTwoBytes payment_id; memset(&payment_id, 0, 32); - LDK::CResult_NoneRetryableSendFailureZ invoice_pay_res = ChannelManager_send_payment( - &cm1, std::move(pay_params->contents.result->a), std::move(invoice2_recipient), - std::move(payment_id), std::move(invoice2_params), Retry_attempts(0) - ); + LDK::CResult_NoneBolt11PaymentErrorZ invoice_pay_res = + ChannelManager_pay_for_bolt11_invoice(&cm1, invoice2, payment_id, COption_u64Z_none(), RouteParametersConfig_default(), Retry_attempts(0)); assert(invoice_pay_res->result_ok); PeerManager_process_events(&net1); - // Check that we received the payment! - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting PendingHTLCsForwardable event..." << std::endl; - while (true) { - EventQueue queue2; - LDKEventHandler handler2 = { .this_arg = &queue2, .handle_event = handle_event, .free = NULL }; - LDK::EventsProvider ev2 = ChannelManager_as_EventsProvider(&cm2); - ev2.process_pending_events(handler2); - if (queue2.events.size() == 1) { - assert(queue2.events[0]->tag == LDKEvent_PendingHTLCsForwardable); - break; - } - std::this_thread::yield(); - } - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Received PendingHTLCsForwardable event!" << std::endl; - ChannelManager_process_pending_htlc_forwards(&cm2); - PeerManager_process_events(&net2); - std::cout << __FILE__ << ":" << __LINE__ << " - " << "Awaiting PaymentClaimable/PaymentClaimed event..." << std::endl; while (true) { + ChannelManager_process_pending_htlc_forwards(&cm2); + PeerManager_process_events(&net2); + EventQueue queue2; LDKEventHandler handler2 = { .this_arg = &queue2, .handle_event = handle_event, .free = NULL }; LDK::EventsProvider ev2 = ChannelManager_as_EventsProvider(&cm2); @@ -1263,11 +1226,4 @@ int main() { assert(peer_2_custom_onion_messages.msgs.size() == 1); assert(peer_2_custom_onion_messages.msgs[0].tlv_type() == 8888); assert(peer_2_custom_messages.msgs.size() != 0); - - // Few extra random tests: - LDKSecretKey sk; - memset(&sk, 42, 32); - LDKThirtyTwoBytes kdiv_params; - memset(&kdiv_params, 43, 32); - LDK::InMemorySigner signer = InMemorySigner_new(sk, sk, sk, sk, sk, random_bytes, 42, kdiv_params, kdiv_params); } diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index dccc05ed..fab14b88 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -24,8 +24,6 @@ struct nativeHumanReadableNameOpaque; typedef struct nativeHumanReadableNameOpaque LDKnativeHumanReadableName; struct nativeOMNameResolverOpaque; typedef struct nativeOMNameResolverOpaque LDKnativeOMNameResolver; -struct nativeLSPS0ClientHandlerOpaque; -typedef struct nativeLSPS0ClientHandlerOpaque LDKnativeLSPS0ClientHandler; struct nativeInvoiceWithExplicitSigningPubkeyBuilderOpaque; typedef struct nativeInvoiceWithExplicitSigningPubkeyBuilderOpaque LDKnativeInvoiceWithExplicitSigningPubkeyBuilder; struct nativeInvoiceWithDerivedSigningPubkeyBuilderOpaque; @@ -42,7 +40,12 @@ struct nativeChannelDerivationParametersOpaque; typedef struct nativeChannelDerivationParametersOpaque LDKnativeChannelDerivationParameters; struct nativeHTLCDescriptorOpaque; typedef struct nativeHTLCDescriptorOpaque LDKnativeHTLCDescriptor; -struct LDKChannelSigner; +struct nativePeerStorageKeyOpaque; +typedef struct nativePeerStorageKeyOpaque LDKnativePeerStorageKey; +struct nativeReceiveAuthKeyOpaque; +typedef struct nativeReceiveAuthKeyOpaque LDKnativeReceiveAuthKey; +struct nativeChangeDestinationSourceSyncWrapperOpaque; +typedef struct nativeChangeDestinationSourceSyncWrapperOpaque LDKnativeChangeDestinationSourceSyncWrapper; struct nativeInMemorySignerOpaque; typedef struct nativeInMemorySignerOpaque LDKnativeInMemorySigner; struct nativeKeysManagerOpaque; @@ -61,6 +64,8 @@ struct nativeInFlightHtlcsOpaque; typedef struct nativeInFlightHtlcsOpaque LDKnativeInFlightHtlcs; struct nativeRouteHopOpaque; typedef struct nativeRouteHopOpaque LDKnativeRouteHop; +struct nativeTrampolineHopOpaque; +typedef struct nativeTrampolineHopOpaque LDKnativeTrampolineHop; struct nativeBlindedTailOpaque; typedef struct nativeBlindedTailOpaque LDKnativeBlindedTail; struct nativePathOpaque; @@ -71,6 +76,8 @@ struct nativeRouteParametersOpaque; typedef struct nativeRouteParametersOpaque LDKnativeRouteParameters; struct nativePaymentParametersOpaque; typedef struct nativePaymentParametersOpaque LDKnativePaymentParameters; +struct nativeRouteParametersConfigOpaque; +typedef struct nativeRouteParametersConfigOpaque LDKnativeRouteParametersConfig; struct nativeFirstHopCandidateOpaque; typedef struct nativeFirstHopCandidateOpaque LDKnativeFirstHopCandidate; struct nativePublicHopCandidateOpaque; @@ -81,10 +88,6 @@ struct nativeBlindedPathCandidateOpaque; typedef struct nativeBlindedPathCandidateOpaque LDKnativeBlindedPathCandidate; struct nativeOneHopBlindedPathCandidateOpaque; typedef struct nativeOneHopBlindedPathCandidateOpaque LDKnativeOneHopBlindedPathCandidate; -struct nativeLSPS0ListProtocolsRequestOpaque; -typedef struct nativeLSPS0ListProtocolsRequestOpaque LDKnativeLSPS0ListProtocolsRequest; -struct nativeLSPS0ListProtocolsResponseOpaque; -typedef struct nativeLSPS0ListProtocolsResponseOpaque LDKnativeLSPS0ListProtocolsResponse; struct nativeUntrustedStringOpaque; typedef struct nativeUntrustedStringOpaque LDKnativeUntrustedString; struct nativePrintableStringOpaque; @@ -101,30 +104,46 @@ struct nativeFixedPenaltyScorerOpaque; typedef struct nativeFixedPenaltyScorerOpaque LDKnativeFixedPenaltyScorer; struct nativeProbabilisticScorerOpaque; typedef struct nativeProbabilisticScorerOpaque LDKnativeProbabilisticScorer; +struct nativeChannelLiquiditiesOpaque; +typedef struct nativeChannelLiquiditiesOpaque LDKnativeChannelLiquidities; struct nativeProbabilisticScoringFeeParametersOpaque; typedef struct nativeProbabilisticScoringFeeParametersOpaque LDKnativeProbabilisticScoringFeeParameters; struct nativeProbabilisticScoringDecayParametersOpaque; typedef struct nativeProbabilisticScoringDecayParametersOpaque LDKnativeProbabilisticScoringDecayParameters; +struct nativeCombinedScorerOpaque; +typedef struct nativeCombinedScorerOpaque LDKnativeCombinedScorer; struct nativeBestBlockOpaque; typedef struct nativeBestBlockOpaque LDKnativeBestBlock; struct nativeWatchedOutputOpaque; typedef struct nativeWatchedOutputOpaque LDKnativeWatchedOutput; -struct nativeLSPS1ClientConfigOpaque; -typedef struct nativeLSPS1ClientConfigOpaque LDKnativeLSPS1ClientConfig; -struct nativeLSPS1ClientHandlerOpaque; -typedef struct nativeLSPS1ClientHandlerOpaque LDKnativeLSPS1ClientHandler; -struct nativeLSPS2ClientConfigOpaque; -typedef struct nativeLSPS2ClientConfigOpaque LDKnativeLSPS2ClientConfig; -struct nativeLSPS2ClientHandlerOpaque; -typedef struct nativeLSPS2ClientHandlerOpaque LDKnativeLSPS2ClientHandler; struct nativeOfferIdOpaque; typedef struct nativeOfferIdOpaque LDKnativeOfferId; struct nativeOfferWithExplicitMetadataBuilderOpaque; typedef struct nativeOfferWithExplicitMetadataBuilderOpaque LDKnativeOfferWithExplicitMetadataBuilder; struct nativeOfferWithDerivedMetadataBuilderOpaque; typedef struct nativeOfferWithDerivedMetadataBuilderOpaque LDKnativeOfferWithDerivedMetadataBuilder; +struct nativeOfferFromHrnOpaque; +typedef struct nativeOfferFromHrnOpaque LDKnativeOfferFromHrn; struct nativeOfferOpaque; typedef struct nativeOfferOpaque LDKnativeOffer; +struct nativeCurrencyCodeOpaque; +typedef struct nativeCurrencyCodeOpaque LDKnativeCurrencyCode; +struct nativeCurrencyCodeErrorOpaque; +typedef struct nativeCurrencyCodeErrorOpaque LDKnativeCurrencyCodeError; +struct nativeAnchorDescriptorOpaque; +typedef struct nativeAnchorDescriptorOpaque LDKnativeAnchorDescriptor; +struct nativeInputOpaque; +typedef struct nativeInputOpaque LDKnativeInput; +struct nativeUtxoOpaque; +typedef struct nativeUtxoOpaque LDKnativeUtxo; +struct nativeCoinSelectionOpaque; +typedef struct nativeCoinSelectionOpaque LDKnativeCoinSelection; +struct nativeInboundHTLCErrOpaque; +typedef struct nativeInboundHTLCErrOpaque LDKnativeInboundHTLCErr; +struct nativeWalletSyncOpaque; +typedef struct nativeWalletSyncOpaque LDKnativeWalletSync; +struct nativeBumpTransactionEventHandlerSyncOpaque; +typedef struct nativeBumpTransactionEventHandlerSyncOpaque LDKnativeBumpTransactionEventHandlerSync; struct nativeNodeIdOpaque; typedef struct nativeNodeIdOpaque LDKnativeNodeId; struct nativeNetworkGraphOpaque; @@ -145,24 +164,12 @@ struct nativeNodeAliasOpaque; typedef struct nativeNodeAliasOpaque LDKnativeNodeAlias; struct nativeNodeInfoOpaque; typedef struct nativeNodeInfoOpaque LDKnativeNodeInfo; -struct nativeInboundHTLCErrOpaque; -typedef struct nativeInboundHTLCErrOpaque LDKnativeInboundHTLCErr; -struct nativeAnchorDescriptorOpaque; -typedef struct nativeAnchorDescriptorOpaque LDKnativeAnchorDescriptor; -struct nativeInputOpaque; -typedef struct nativeInputOpaque LDKnativeInput; -struct nativeUtxoOpaque; -typedef struct nativeUtxoOpaque LDKnativeUtxo; -struct nativeCoinSelectionOpaque; -typedef struct nativeCoinSelectionOpaque LDKnativeCoinSelection; -struct nativeWalletOpaque; -typedef struct nativeWalletOpaque LDKnativeWallet; -struct nativeBumpTransactionEventHandlerOpaque; -typedef struct nativeBumpTransactionEventHandlerOpaque LDKnativeBumpTransactionEventHandler; struct nativeBlindedForwardOpaque; typedef struct nativeBlindedForwardOpaque LDKnativeBlindedForward; struct nativePendingHTLCInfoOpaque; typedef struct nativePendingHTLCInfoOpaque LDKnativePendingHTLCInfo; +struct nativeOptionalOfferPaymentParamsOpaque; +typedef struct nativeOptionalOfferPaymentParamsOpaque LDKnativeOptionalOfferPaymentParams; struct nativeChannelManagerOpaque; typedef struct nativeChannelManagerOpaque LDKnativeChannelManager; struct nativeChainParametersOpaque; @@ -173,6 +180,8 @@ struct nativeBolt11InvoiceParametersOpaque; typedef struct nativeBolt11InvoiceParametersOpaque LDKnativeBolt11InvoiceParameters; struct nativeChannelManagerReadArgsOpaque; typedef struct nativeChannelManagerReadArgsOpaque LDKnativeChannelManagerReadArgs; +struct nativeTaggedHashOpaque; +typedef struct nativeTaggedHashOpaque LDKnativeTaggedHash; struct nativeChannelHandshakeConfigOpaque; typedef struct nativeChannelHandshakeConfigOpaque LDKnativeChannelHandshakeConfig; struct nativeChannelHandshakeLimitsOpaque; @@ -183,16 +192,22 @@ struct nativeChannelConfigUpdateOpaque; typedef struct nativeChannelConfigUpdateOpaque LDKnativeChannelConfigUpdate; struct nativeUserConfigOpaque; typedef struct nativeUserConfigOpaque LDKnativeUserConfig; -struct nativeTaggedHashOpaque; -typedef struct nativeTaggedHashOpaque LDKnativeTaggedHash; -struct nativeLSPS2ServiceConfigOpaque; -typedef struct nativeLSPS2ServiceConfigOpaque LDKnativeLSPS2ServiceConfig; -struct nativeLSPS2ServiceHandlerOpaque; -typedef struct nativeLSPS2ServiceHandlerOpaque LDKnativeLSPS2ServiceHandler; +struct nativeChannelConfigOverridesOpaque; +typedef struct nativeChannelConfigOverridesOpaque LDKnativeChannelConfigOverrides; +struct nativeChannelHandshakeConfigUpdateOpaque; +typedef struct nativeChannelHandshakeConfigUpdateOpaque LDKnativeChannelHandshakeConfigUpdate; +struct nativeDecryptedOurPeerStorageOpaque; +typedef struct nativeDecryptedOurPeerStorageOpaque LDKnativeDecryptedOurPeerStorage; +struct nativeEncryptedOurPeerStorageOpaque; +typedef struct nativeEncryptedOurPeerStorageOpaque LDKnativeEncryptedOurPeerStorage; +struct nativeOffersMessageFlowOpaque; +typedef struct nativeOffersMessageFlowOpaque LDKnativeOffersMessageFlow; struct nativeChannelMonitorUpdateOpaque; typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate; struct nativeHTLCUpdateOpaque; typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate; +struct nativeHolderCommitmentTransactionBalanceOpaque; +typedef struct nativeHolderCommitmentTransactionBalanceOpaque LDKnativeHolderCommitmentTransactionBalance; struct nativeChannelMonitorOpaque; typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor; struct nativeExpandedKeyOpaque; @@ -211,12 +226,8 @@ struct nativePeerManagerOpaque; typedef struct nativePeerManagerOpaque LDKnativePeerManager; struct nativeRapidGossipSyncOpaque; typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync; -struct nativeMonitorUpdatingPersisterOpaque; -typedef struct nativeMonitorUpdatingPersisterOpaque LDKnativeMonitorUpdatingPersister; -struct nativeMonitorNameOpaque; -typedef struct nativeMonitorNameOpaque LDKnativeMonitorName; -struct nativeUpdateNameOpaque; -typedef struct nativeUpdateNameOpaque LDKnativeUpdateName; +struct nativeAsyncReceiveOfferCacheOpaque; +typedef struct nativeAsyncReceiveOfferCacheOpaque LDKnativeAsyncReceiveOfferCache; struct nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderOpaque; typedef struct nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderOpaque LDKnativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder; struct nativeUnsignedInvoiceRequestOpaque; @@ -227,6 +238,12 @@ struct nativeVerifiedInvoiceRequestOpaque; typedef struct nativeVerifiedInvoiceRequestOpaque LDKnativeVerifiedInvoiceRequest; struct nativeInvoiceRequestFieldsOpaque; typedef struct nativeInvoiceRequestFieldsOpaque LDKnativeInvoiceRequestFields; +struct nativeKVStoreSyncWrapperOpaque; +typedef struct nativeKVStoreSyncWrapperOpaque LDKnativeKVStoreSyncWrapper; +struct nativeMonitorUpdatingPersisterOpaque; +typedef struct nativeMonitorUpdatingPersisterOpaque LDKnativeMonitorUpdatingPersister; +struct nativeUpdateNameOpaque; +typedef struct nativeUpdateNameOpaque LDKnativeUpdateName; struct nativeInitOpaque; typedef struct nativeInitOpaque LDKnativeInit; struct nativeErrorMessageOpaque; @@ -289,18 +306,26 @@ struct nativeClosingSignedFeeRangeOpaque; typedef struct nativeClosingSignedFeeRangeOpaque LDKnativeClosingSignedFeeRange; struct nativeClosingSignedOpaque; typedef struct nativeClosingSignedOpaque LDKnativeClosingSigned; +struct nativeClosingCompleteOpaque; +typedef struct nativeClosingCompleteOpaque LDKnativeClosingComplete; +struct nativeClosingSigOpaque; +typedef struct nativeClosingSigOpaque LDKnativeClosingSig; +struct nativeStartBatchOpaque; +typedef struct nativeStartBatchOpaque LDKnativeStartBatch; struct nativeUpdateAddHTLCOpaque; typedef struct nativeUpdateAddHTLCOpaque LDKnativeUpdateAddHTLC; struct nativeOnionMessageOpaque; typedef struct nativeOnionMessageOpaque LDKnativeOnionMessage; struct nativeUpdateFulfillHTLCOpaque; typedef struct nativeUpdateFulfillHTLCOpaque LDKnativeUpdateFulfillHTLC; +struct nativePeerStorageOpaque; +typedef struct nativePeerStorageOpaque LDKnativePeerStorage; +struct nativePeerStorageRetrievalOpaque; +typedef struct nativePeerStorageRetrievalOpaque LDKnativePeerStorageRetrieval; struct nativeUpdateFailHTLCOpaque; typedef struct nativeUpdateFailHTLCOpaque LDKnativeUpdateFailHTLC; struct nativeUpdateFailMalformedHTLCOpaque; typedef struct nativeUpdateFailMalformedHTLCOpaque LDKnativeUpdateFailMalformedHTLC; -struct nativeCommitmentSignedBatchOpaque; -typedef struct nativeCommitmentSignedBatchOpaque LDKnativeCommitmentSignedBatch; struct nativeCommitmentSignedOpaque; typedef struct nativeCommitmentSignedOpaque LDKnativeCommitmentSigned; struct nativeRevokeAndACKOpaque; @@ -309,6 +334,10 @@ struct nativeUpdateFeeOpaque; typedef struct nativeUpdateFeeOpaque LDKnativeUpdateFee; struct nativeChannelReestablishOpaque; typedef struct nativeChannelReestablishOpaque LDKnativeChannelReestablish; +struct nativeNextFundingOpaque; +typedef struct nativeNextFundingOpaque LDKnativeNextFunding; +struct nativeFundingLockedOpaque; +typedef struct nativeFundingLockedOpaque LDKnativeFundingLocked; struct nativeAnnouncementSignaturesOpaque; typedef struct nativeAnnouncementSignaturesOpaque LDKnativeAnnouncementSignatures; struct nativeUnsignedNodeAnnouncementOpaque; @@ -343,32 +372,6 @@ struct nativeOnionPacketOpaque; typedef struct nativeOnionPacketOpaque LDKnativeOnionPacket; struct nativeTrampolineOnionPacketOpaque; typedef struct nativeTrampolineOnionPacketOpaque LDKnativeTrampolineOnionPacket; -struct nativeLSPS1OrderIdOpaque; -typedef struct nativeLSPS1OrderIdOpaque LDKnativeLSPS1OrderId; -struct nativeLSPS1GetInfoRequestOpaque; -typedef struct nativeLSPS1GetInfoRequestOpaque LDKnativeLSPS1GetInfoRequest; -struct nativeLSPS1OptionsOpaque; -typedef struct nativeLSPS1OptionsOpaque LDKnativeLSPS1Options; -struct nativeLSPS1GetInfoResponseOpaque; -typedef struct nativeLSPS1GetInfoResponseOpaque LDKnativeLSPS1GetInfoResponse; -struct nativeLSPS1CreateOrderRequestOpaque; -typedef struct nativeLSPS1CreateOrderRequestOpaque LDKnativeLSPS1CreateOrderRequest; -struct nativeLSPS1OrderParamsOpaque; -typedef struct nativeLSPS1OrderParamsOpaque LDKnativeLSPS1OrderParams; -struct nativeLSPS1CreateOrderResponseOpaque; -typedef struct nativeLSPS1CreateOrderResponseOpaque LDKnativeLSPS1CreateOrderResponse; -struct nativeLSPS1PaymentInfoOpaque; -typedef struct nativeLSPS1PaymentInfoOpaque LDKnativeLSPS1PaymentInfo; -struct nativeLSPS1Bolt11PaymentInfoOpaque; -typedef struct nativeLSPS1Bolt11PaymentInfoOpaque LDKnativeLSPS1Bolt11PaymentInfo; -struct nativeLSPS1OnchainPaymentInfoOpaque; -typedef struct nativeLSPS1OnchainPaymentInfoOpaque LDKnativeLSPS1OnchainPaymentInfo; -struct nativeLSPS1OnchainPaymentOpaque; -typedef struct nativeLSPS1OnchainPaymentOpaque LDKnativeLSPS1OnchainPayment; -struct nativeLSPS1ChannelInfoOpaque; -typedef struct nativeLSPS1ChannelInfoOpaque LDKnativeLSPS1ChannelInfo; -struct nativeLSPS1GetOrderRequestOpaque; -typedef struct nativeLSPS1GetOrderRequestOpaque LDKnativeLSPS1GetOrderRequest; struct nativeRecordOpaque; typedef struct nativeRecordOpaque LDKnativeRecord; struct nativeInboundHTLCDetailsOpaque; @@ -381,22 +384,28 @@ struct nativeChannelCounterpartyOpaque; typedef struct nativeChannelCounterpartyOpaque LDKnativeChannelCounterparty; struct nativeChannelDetailsOpaque; typedef struct nativeChannelDetailsOpaque LDKnativeChannelDetails; +struct nativeNotifierOpaque; +typedef struct nativeNotifierOpaque LDKnativeNotifier; struct nativeFutureOpaque; typedef struct nativeFutureOpaque LDKnativeFuture; struct nativeSleeperOpaque; typedef struct nativeSleeperOpaque LDKnativeSleeper; -struct nativeRawLSPSMessageOpaque; -typedef struct nativeRawLSPSMessageOpaque LDKnativeRawLSPSMessage; -struct nativeLSPSRequestIdOpaque; -typedef struct nativeLSPSRequestIdOpaque LDKnativeLSPSRequestId; -struct nativeLSPSDateTimeOpaque; -typedef struct nativeLSPSDateTimeOpaque LDKnativeLSPSDateTime; -struct nativeLSPSResponseErrorOpaque; -typedef struct nativeLSPSResponseErrorOpaque LDKnativeLSPSResponseError; +struct nativeOfferPathsRequestOpaque; +typedef struct nativeOfferPathsRequestOpaque LDKnativeOfferPathsRequest; +struct nativeOfferPathsOpaque; +typedef struct nativeOfferPathsOpaque LDKnativeOfferPaths; +struct nativeServeStaticInvoiceOpaque; +typedef struct nativeServeStaticInvoiceOpaque LDKnativeServeStaticInvoice; +struct nativeStaticInvoicePersistedOpaque; +typedef struct nativeStaticInvoicePersistedOpaque LDKnativeStaticInvoicePersisted; struct nativeHeldHtlcAvailableOpaque; typedef struct nativeHeldHtlcAvailableOpaque LDKnativeHeldHtlcAvailable; struct nativeReleaseHeldHtlcOpaque; typedef struct nativeReleaseHeldHtlcOpaque LDKnativeReleaseHeldHtlc; +struct nativeStaticInvoiceOpaque; +typedef struct nativeStaticInvoiceOpaque LDKnativeStaticInvoice; +struct nativeUnsignedStaticInvoiceOpaque; +typedef struct nativeUnsignedStaticInvoiceOpaque LDKnativeUnsignedStaticInvoice; struct nativeCounterpartyCommitmentSecretsOpaque; typedef struct nativeCounterpartyCommitmentSecretsOpaque LDKnativeCounterpartyCommitmentSecrets; struct nativeTxCreationKeysOpaque; @@ -427,28 +436,16 @@ struct nativeShutdownScriptOpaque; typedef struct nativeShutdownScriptOpaque LDKnativeShutdownScript; struct nativeInvalidShutdownScriptOpaque; typedef struct nativeInvalidShutdownScriptOpaque LDKnativeInvalidShutdownScript; +struct nativeAnchorChannelReserveContextOpaque; +typedef struct nativeAnchorChannelReserveContextOpaque LDKnativeAnchorChannelReserveContext; struct nativeBolt12ParseErrorOpaque; typedef struct nativeBolt12ParseErrorOpaque LDKnativeBolt12ParseError; -struct nativeLSPS2GetInfoRequestOpaque; -typedef struct nativeLSPS2GetInfoRequestOpaque LDKnativeLSPS2GetInfoRequest; -struct nativeLSPS2RawOpeningFeeParamsOpaque; -typedef struct nativeLSPS2RawOpeningFeeParamsOpaque LDKnativeLSPS2RawOpeningFeeParams; -struct nativeLSPS2OpeningFeeParamsOpaque; -typedef struct nativeLSPS2OpeningFeeParamsOpaque LDKnativeLSPS2OpeningFeeParams; -struct nativeLSPS2GetInfoResponseOpaque; -typedef struct nativeLSPS2GetInfoResponseOpaque LDKnativeLSPS2GetInfoResponse; -struct nativeLSPS2BuyRequestOpaque; -typedef struct nativeLSPS2BuyRequestOpaque LDKnativeLSPS2BuyRequest; -struct nativeLSPS2InterceptScidOpaque; -typedef struct nativeLSPS2InterceptScidOpaque LDKnativeLSPS2InterceptScid; -struct nativeLSPS2BuyResponseOpaque; -typedef struct nativeLSPS2BuyResponseOpaque LDKnativeLSPS2BuyResponse; -struct nativePacketOpaque; -typedef struct nativePacketOpaque LDKnativePacket; struct nativeClaimedHTLCOpaque; typedef struct nativeClaimedHTLCOpaque LDKnativeClaimedHTLC; struct nativeReplayEventOpaque; typedef struct nativeReplayEventOpaque LDKnativeReplayEvent; +struct nativePacketOpaque; +typedef struct nativePacketOpaque LDKnativePacket; struct nativeNonceOpaque; typedef struct nativeNonceOpaque LDKnativeNonce; struct nativeRoutingFeesOpaque; @@ -487,12 +484,10 @@ struct nativeOutPointOpaque; typedef struct nativeOutPointOpaque LDKnativeOutPoint; struct nativeBigSizeOpaque; typedef struct nativeBigSizeOpaque LDKnativeBigSize; +struct nativeCollectionLengthOpaque; +typedef struct nativeCollectionLengthOpaque LDKnativeCollectionLength; struct nativeHostnameOpaque; typedef struct nativeHostnameOpaque LDKnativeHostname; -struct nativeTransactionU16LenLimitedOpaque; -typedef struct nativeTransactionU16LenLimitedOpaque LDKnativeTransactionU16LenLimited; -struct nativeChannelIdOpaque; -typedef struct nativeChannelIdOpaque LDKnativeChannelId; struct nativeBlindedPayInfoOpaque; typedef struct nativeBlindedPayInfoOpaque LDKnativeBlindedPayInfo; struct nativeBlindedPaymentPathOpaque; @@ -501,6 +496,8 @@ struct nativePaymentForwardNodeOpaque; typedef struct nativePaymentForwardNodeOpaque LDKnativePaymentForwardNode; struct nativeForwardTlvsOpaque; typedef struct nativeForwardTlvsOpaque LDKnativeForwardTlvs; +struct nativeTrampolineForwardTlvsOpaque; +typedef struct nativeTrampolineForwardTlvsOpaque LDKnativeTrampolineForwardTlvs; struct nativeReceiveTlvsOpaque; typedef struct nativeReceiveTlvsOpaque LDKnativeReceiveTlvs; struct nativeUnauthenticatedReceiveTlvsOpaque; @@ -511,10 +508,12 @@ struct nativePaymentConstraintsOpaque; typedef struct nativePaymentConstraintsOpaque LDKnativePaymentConstraints; struct nativeBolt12OfferContextOpaque; typedef struct nativeBolt12OfferContextOpaque LDKnativeBolt12OfferContext; +struct nativeAsyncBolt12OfferContextOpaque; +typedef struct nativeAsyncBolt12OfferContextOpaque LDKnativeAsyncBolt12OfferContext; struct nativeBolt12RefundContextOpaque; typedef struct nativeBolt12RefundContextOpaque LDKnativeBolt12RefundContext; -struct nativeUtxoFutureOpaque; -typedef struct nativeUtxoFutureOpaque LDKnativeUtxoFuture; +struct nativeChannelIdOpaque; +typedef struct nativeChannelIdOpaque LDKnativeChannelId; struct nativeOnionMessengerOpaque; typedef struct nativeOnionMessengerOpaque LDKnativeOnionMessenger; struct nativeResponderOpaque; @@ -523,8 +522,14 @@ struct nativeResponseInstructionOpaque; typedef struct nativeResponseInstructionOpaque LDKnativeResponseInstruction; struct nativeDefaultMessageRouterOpaque; typedef struct nativeDefaultMessageRouterOpaque LDKnativeDefaultMessageRouter; +struct nativeNodeIdMessageRouterOpaque; +typedef struct nativeNodeIdMessageRouterOpaque LDKnativeNodeIdMessageRouter; +struct nativeNullMessageRouterOpaque; +typedef struct nativeNullMessageRouterOpaque LDKnativeNullMessageRouter; struct nativeOnionMessagePathOpaque; typedef struct nativeOnionMessagePathOpaque LDKnativeOnionMessagePath; +struct nativeUtxoFutureOpaque; +typedef struct nativeUtxoFutureOpaque LDKnativeUtxoFuture; struct nativeFilesystemStoreOpaque; typedef struct nativeFilesystemStoreOpaque LDKnativeFilesystemStore; struct nativeInitFeaturesOpaque; @@ -549,16 +554,18 @@ struct nativeEmptyNodeIdLookUpOpaque; typedef struct nativeEmptyNodeIdLookUpOpaque LDKnativeEmptyNodeIdLookUp; struct nativeBlindedHopOpaque; typedef struct nativeBlindedHopOpaque LDKnativeBlindedHop; -struct nativeMessageQueueOpaque; -typedef struct nativeMessageQueueOpaque LDKnativeMessageQueue; +struct nativeFundingTxInputOpaque; +typedef struct nativeFundingTxInputOpaque LDKnativeFundingTxInput; +struct nativeAttributionDataOpaque; +typedef struct nativeAttributionDataOpaque LDKnativeAttributionData; struct nativeInvoiceErrorOpaque; typedef struct nativeInvoiceErrorOpaque LDKnativeInvoiceError; struct nativeErroneousFieldOpaque; typedef struct nativeErroneousFieldOpaque LDKnativeErroneousField; struct nativeTrackedSpendableOutputOpaque; typedef struct nativeTrackedSpendableOutputOpaque LDKnativeTrackedSpendableOutput; -struct nativeOutputSweeperOpaque; -typedef struct nativeOutputSweeperOpaque LDKnativeOutputSweeper; +struct nativeOutputSweeperSyncOpaque; +typedef struct nativeOutputSweeperSyncOpaque LDKnativeOutputSweeperSync; struct nativeDelayedPaymentBasepointOpaque; typedef struct nativeDelayedPaymentBasepointOpaque LDKnativeDelayedPaymentBasepoint; struct nativeDelayedPaymentKeyOpaque; @@ -575,8 +582,6 @@ struct nativeLockedChannelMonitorOpaque; typedef struct nativeLockedChannelMonitorOpaque LDKnativeLockedChannelMonitor; struct nativeChainMonitorOpaque; typedef struct nativeChainMonitorOpaque LDKnativeChainMonitor; -struct nativeLSPS0ServiceHandlerOpaque; -typedef struct nativeLSPS0ServiceHandlerOpaque LDKnativeLSPS0ServiceHandler; struct nativeBlindedMessagePathOpaque; typedef struct nativeBlindedMessagePathOpaque LDKnativeBlindedMessagePath; struct nativeMessageForwardNodeOpaque; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 17ef4459..e6415b67 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -44,12 +44,13 @@ typedef enum LDKBalanceSource { typedef enum LDKBlindedFailure { /** * This HTLC is being failed backwards by the introduction node, and thus should be failed with - * [`msgs::UpdateFailHTLC`] and error code `0x8000|0x4000|24`. + * [`msgs::UpdateFailHTLC`] and error code [`LocalHTLCFailureReason::InvalidOnionBlinding`]. */ LDKBlindedFailure_FromIntroductionNode, /** * This HTLC is being failed backwards by a blinded node within the path, and thus should be - * failed with [`msgs::UpdateFailMalformedHTLC`] and error code `0x8000|0x4000|24`. + * failed with [`msgs::UpdateFailMalformedHTLC`] and error code + * [`LocalHTLCFailureReason::InvalidOnionBlinding`]. */ LDKBlindedFailure_FromBlindedNode, /** @@ -92,10 +93,6 @@ typedef enum LDKBolt11SemanticError { * The invoice's features are invalid */ LDKBolt11SemanticError_InvalidFeatures, - /** - * The recovery id doesn't fit the signature/pub key - */ - LDKBolt11SemanticError_InvalidRecoveryId, /** * The invoice's signature is invalid */ @@ -134,6 +131,10 @@ typedef enum LDKBolt12SemanticError { * The amount exceeded the total bitcoin supply or didn't match an expected amount. */ LDKBolt12SemanticError_InvalidAmount, + /** + * The currency code did not contain valid ASCII uppercase letters. + */ + LDKBolt12SemanticError_InvalidCurrencyCode, /** * An amount was provided but was not sufficient in value. */ @@ -294,6 +295,12 @@ typedef enum LDKChannelMonitorUpdateStatus { * * This includes performing any `fsync()` calls required to ensure the update is guaranteed to * be available on restart even if the application crashes. + * + * If you return this variant, you cannot later return [`InProgress`] from the same instance of + * [`Persist`]/[`Watch`] without first restarting. + * + * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress + * [`Persist`]: chainmonitor::Persist */ LDKChannelMonitorUpdateStatus_Completed, /** @@ -321,7 +328,12 @@ typedef enum LDKChannelMonitorUpdateStatus { * 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*. * + * If you return this variant, you cannot later return [`Completed`] from the same instance of + * [`Persist`]/[`Watch`] without first restarting. + * * [`InProgress`]: ChannelMonitorUpdateStatus::InProgress + * [`Completed`]: ChannelMonitorUpdateStatus::Completed + * [`Persist`]: chainmonitor::Persist */ LDKChannelMonitorUpdateStatus_InProgress, /** @@ -387,11 +399,14 @@ typedef enum LDKChannelShutdownState { */ typedef enum LDKConfirmationTarget { /** - * The most aggressive (i.e. highest) feerate estimate available. + * The most aggressive feerate estimate which we think is reasonable. * * This is used to sanity-check our counterparty's feerates and should be as conservative as * possible to ensure that we don't confuse a peer using a very conservative estimator for one - * trying to burn channel balance to dust. + * trying to burn channel balance to dust. To ensure that this is never lower than an honest + * counterparty's feerate estimate you may wish to use a value which is higher than your + * maximum feerate estimate, for example by adding a constant few-hundred or few-thousand + * sats-per-kW. */ LDKConfirmationTarget_MaximumFeeEstimate, /** @@ -592,6 +607,20 @@ typedef enum LDKDirection { LDKDirection_Sentinel, } LDKDirection; +/** + * Bit positions used in [`FundingLocked::retransmit_flags`] for requesting message retransmission. + */ +typedef enum LDKFundingLockedFlags { + /** + * Retransmit `announcement_signatures`. + */ + LDKFundingLockedFlags_AnnouncementSignatures, + /** + * Must be last for serialization purposes + */ + LDKFundingLockedFlags_Sentinel, +} LDKFundingLockedFlags; + /** * Describes the type of HTLC claim as determined by analyzing the witness. */ @@ -702,53 +731,6 @@ typedef enum LDKInboundHTLCStateDetails { LDKInboundHTLCStateDetails_Sentinel, } LDKInboundHTLCStateDetails; -/** - * An object representing the status of an order. - */ -typedef enum LDKLSPS1OrderState { - /** - * The order has been created. - */ - LDKLSPS1OrderState_Created, - /** - * The LSP has opened the channel and published the funding transaction. - */ - LDKLSPS1OrderState_Completed, - /** - * The order failed. - */ - LDKLSPS1OrderState_Failed, - /** - * Must be last for serialization purposes - */ - LDKLSPS1OrderState_Sentinel, -} LDKLSPS1OrderState; - -/** - * The state of a payment. - * - * *Note*: Previously, the spec also knew a `CANCELLED` state for BOLT11 payments, which has since - * been deprecated and `REFUNDED` should be used instead. - */ -typedef enum LDKLSPS1PaymentState { - /** - * A payment is expected. - */ - LDKLSPS1PaymentState_ExpectPayment, - /** - * A sufficient payment has been received. - */ - LDKLSPS1PaymentState_Paid, - /** - * The payment has been refunded. - */ - LDKLSPS1PaymentState_Refunded, - /** - * Must be last for serialization purposes - */ - LDKLSPS1PaymentState_Sentinel, -} LDKLSPS1PaymentState; - /** * An enum representing the available verbosity levels of the logger. */ @@ -813,6 +795,20 @@ typedef enum LDKNetwork { LDKNetwork_Sentinel, } LDKNetwork; +/** + * Bit positions used in [`NextFunding::retransmit_flags`] for requesting message retransmission. + */ +typedef enum LDKNextFundingFlag { + /** + * Retransmit `commitment_signed`. + */ + LDKNextFundingFlag_CommitmentSigned, + /** + * Must be last for serialization purposes + */ + LDKNextFundingFlag_Sentinel, +} LDKNextFundingFlag; + /** * Exposes the state of pending outbound HTLCs. * @@ -892,8 +888,8 @@ typedef enum LDKPaymentFailureReason { */ LDKPaymentFailureReason_RetriesExhausted, /** - * The payment expired while retrying, based on the provided - * [`PaymentParameters::expiry_time`]. + * Either the BOLT 12 invoice was expired by the time we received it or the payment expired while + * retrying based on the provided [`PaymentParameters::expiry_time`]. * * Also used for [`InvoiceRequestExpired`] when downgrading to version prior to 0.0.124. * @@ -980,11 +976,14 @@ typedef enum LDKRecipient { */ typedef enum LDKRetryableSendFailure { /** - * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. + * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired or + * the BOLT 12 invoice paid to via [`ChannelManager::send_payment_for_bolt12_invoice`] was + * expired. * *Note that this error is *not* caused by [`Retry::Timeout`]. * * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice */ LDKRetryableSendFailure_PaymentExpired, /** @@ -2242,6 +2241,16 @@ typedef enum LDKOffersContext_Tag { * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ LDKOffersContext_InvoiceRequest, + /** + * Context used by a [`BlindedMessagePath`] within the [`Offer`] of an async recipient. + * + * This variant is received by the static invoice server when handling an [`InvoiceRequest`] on + * behalf of said async recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + LDKOffersContext_StaticInvoiceRequested, /** * Context used by a [`BlindedMessagePath`] within a [`Refund`] or as a reply path for an * [`InvoiceRequest`]. @@ -2281,6 +2290,41 @@ typedef struct LDKOffersContext_LDKInvoiceRequest_Body { struct LDKNonce nonce; } LDKOffersContext_LDKInvoiceRequest_Body; +typedef struct LDKOffersContext_LDKStaticInvoiceRequested_Body { + /** + * An identifier for the async recipient for whom we as a static invoice server are serving + * [`StaticInvoice`]s. Used paired with the + * [`OffersContext::StaticInvoiceRequested::invoice_slot`] when looking up a corresponding + * [`StaticInvoice`] to return to the payer if the recipient is offline. This id was previously + * provided via [`AsyncPaymentsContext::ServeStaticInvoice::recipient_id`]. + * + * Also useful for rate limiting the number of [`InvoiceRequest`]s we will respond to on + * recipient's behalf. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKCVec_u8Z recipient_id; + /** + * The slot number for a specific [`StaticInvoice`] that the recipient previously + * requested be served on their behalf. Useful when paired with the + * [`OffersContext::StaticInvoiceRequested::recipient_id`] to pull that specific invoice from + * the database when payers send an [`InvoiceRequest`]. This id was previously + * provided via [`AsyncPaymentsContext::ServeStaticInvoice::invoice_slot`]. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + uint16_t invoice_slot; + /** + * The time as duration since the Unix epoch at which this path expires and messages sent over + * it should be ignored. + * + * Useful to timeout async recipients that are no longer supported as clients. + */ + uint64_t path_absolute_expiry; +} LDKOffersContext_LDKStaticInvoiceRequested_Body; + typedef struct LDKOffersContext_LDKOutboundPayment_Body { /** * Payment ID used when creating a [`Refund`] or [`InvoiceRequest`]. @@ -2298,15 +2342,6 @@ typedef struct LDKOffersContext_LDKOutboundPayment_Body { * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ struct LDKNonce nonce; - /** - * Authentication code for the [`PaymentId`], which should be checked when the context is - * used with an [`InvoiceError`]. - * - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKThirtyTwoBytes hmac; } LDKOffersContext_LDKOutboundPayment_Body; typedef struct LDKOffersContext_LDKInboundPayment_Body { @@ -2316,53 +2351,203 @@ typedef struct LDKOffersContext_LDKInboundPayment_Body { * [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash */ struct LDKThirtyTwoBytes payment_hash; - /** - * A nonce used for authenticating that a received [`InvoiceError`] is for a valid - * sent [`Bolt12Invoice`]. - * - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - */ - struct LDKNonce nonce; - /** - * Authentication code for the [`PaymentHash`], which should be checked when the context is - * used to log the received [`InvoiceError`]. - * - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - */ - struct LDKThirtyTwoBytes hmac; } LDKOffersContext_LDKInboundPayment_Body; typedef struct MUST_USE_STRUCT LDKOffersContext { LDKOffersContext_Tag tag; union { LDKOffersContext_LDKInvoiceRequest_Body invoice_request; + LDKOffersContext_LDKStaticInvoiceRequested_Body static_invoice_requested; LDKOffersContext_LDKOutboundPayment_Body outbound_payment; LDKOffersContext_LDKInboundPayment_Body inbound_payment; }; } LDKOffersContext; + + +/** + * An identifier for an [`Offer`] built using [`DerivedMetadata`]. + */ +typedef struct MUST_USE_STRUCT LDKOfferId { + /** + * 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. + */ + LDKnativeOfferId *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; +} LDKOfferId; + /** * Contains data specific to an [`AsyncPaymentsMessage`]. * * [`AsyncPaymentsMessage`]: crate::onion_message::async_payments::AsyncPaymentsMessage */ typedef enum LDKAsyncPaymentsContext_Tag { + /** + * Context used by a [`BlindedMessagePath`] provided out-of-band to an async recipient, where the + * context is provided back to the static invoice server in corresponding [`OfferPathsRequest`]s. + * + * [`OfferPathsRequest`]: crate::onion_message::async_payments::OfferPathsRequest + */ + LDKAsyncPaymentsContext_OfferPathsRequest, + /** + * Context used by a reply path to an [`OfferPathsRequest`], provided back to us as an async + * recipient in corresponding [`OfferPaths`] messages from the static invoice server. + * + * [`OfferPathsRequest`]: crate::onion_message::async_payments::OfferPathsRequest + * [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + */ + LDKAsyncPaymentsContext_OfferPaths, + /** + * Context used by a reply path to an [`OfferPaths`] message, provided back to us as the static + * invoice server in corresponding [`ServeStaticInvoice`] messages. + * + * [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + * [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + */ + LDKAsyncPaymentsContext_ServeStaticInvoice, + /** + * Context used by a reply path to a [`ServeStaticInvoice`] message, provided back to us in + * corresponding [`StaticInvoicePersisted`] messages. + * + * [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + * [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted + */ + LDKAsyncPaymentsContext_StaticInvoicePersisted, /** * Context contained within the reply [`BlindedMessagePath`] we put in outbound * [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`] - * messages. + * messages if we are an always-online sender paying an async recipient. * * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc */ LDKAsyncPaymentsContext_OutboundPayment, + /** + * Context contained within the [`BlindedMessagePath`]s we put in static invoices, provided back + * to us in corresponding [`HeldHtlcAvailable`] messages. + * + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + */ + LDKAsyncPaymentsContext_InboundPayment, + /** + * Context contained within the reply [`BlindedMessagePath`] put in outbound + * [`HeldHtlcAvailable`] messages, provided back to the async sender's always-online counterparty + * in corresponding [`ReleaseHeldHtlc`] messages. + * + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + */ + LDKAsyncPaymentsContext_ReleaseHeldHtlc, /** * Must be last for serialization purposes */ LDKAsyncPaymentsContext_Sentinel, } LDKAsyncPaymentsContext_Tag; +typedef struct LDKAsyncPaymentsContext_LDKOfferPathsRequest_Body { + /** + * An identifier for the async recipient that is requesting blinded paths to include in their + * [`Offer::paths`]. This ID will be surfaced when the async recipient eventually sends a + * corresponding [`ServeStaticInvoice`] message, and can be used to rate limit the recipient. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + * [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + */ + struct LDKCVec_u8Z recipient_id; + /** + * An optional field indicating the time as duration since the Unix epoch at which this path + * expires and messages sent over it should be ignored. + * + * Useful to timeout async recipients that are no longer supported as clients. + */ + struct LDKCOption_u64Z path_absolute_expiry; +} LDKAsyncPaymentsContext_LDKOfferPathsRequest_Body; + +typedef struct LDKAsyncPaymentsContext_LDKOfferPaths_Body { + /** + * The \"slot\" in the static invoice server's database that the invoice corresponding to these + * offer paths should go into, originally set by us in [`OfferPathsRequest::invoice_slot`]. This + * value allows us as the recipient to replace a specific invoice that is stored by the server, + * which is useful for limiting the number of invoices stored by the server while also keeping + * all the invoices persisted with the server fresh. + * + * [`OfferPathsRequest::invoice_slot`]: crate::onion_message::async_payments::OfferPathsRequest::invoice_slot + */ + uint16_t invoice_slot; + /** + * The time as duration since the Unix epoch at which this path expires and messages sent over + * it should be ignored. + * + * This avoids the situation where the [`OfferPaths`] message is very delayed and thus + * outdated. + * + * [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + */ + uint64_t path_absolute_expiry; +} LDKAsyncPaymentsContext_LDKOfferPaths_Body; + +typedef struct LDKAsyncPaymentsContext_LDKServeStaticInvoice_Body { + /** + * An identifier for the async recipient that is requesting that a [`StaticInvoice`] be served + * on their behalf. + * + * Useful when surfaced alongside the below `invoice_slot` when payers send an + * [`InvoiceRequest`], to pull the specific static invoice from the database. + * + * Also useful to rate limit the invoices being persisted on behalf of a particular recipient. + * + * This id will be provided back to us as the static invoice server via + * [`OffersContext::StaticInvoiceRequested::recipient_id`]. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKCVec_u8Z recipient_id; + /** + * The slot number for the specific [`StaticInvoice`] that the recipient is requesting be + * served on their behalf. Useful when surfaced alongside the above `recipient_id` when payers + * send an [`InvoiceRequest`], to pull the specific static invoice from the database. This id + * will be provided back to us as the static invoice server via + * [`OffersContext::StaticInvoiceRequested::invoice_slot`]. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + uint16_t invoice_slot; + /** + * The time as duration since the Unix epoch at which this path expires and messages sent over + * it should be ignored. + * + * Useful to timeout async recipients that are no longer supported as clients. + */ + uint64_t path_absolute_expiry; +} LDKAsyncPaymentsContext_LDKServeStaticInvoice_Body; + +typedef struct LDKAsyncPaymentsContext_LDKStaticInvoicePersisted_Body { + /** + * The id of the offer in the cache corresponding to the [`StaticInvoice`] that has been + * persisted. This invoice is now ready to be provided by the static invoice server in response + * to [`InvoiceRequest`]s, so the corresponding offer can be marked as ready to receive + * payments. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKOfferId offer_id; + /** + * The time as duration since the Unix epoch at which the invoice corresponding to this path + * was created. Useful to know when an invoice needs replacement. + */ + uint64_t invoice_created_at; +} LDKAsyncPaymentsContext_LDKStaticInvoicePersisted_Body; + typedef struct LDKAsyncPaymentsContext_LDKOutboundPayment_Body { /** * ID used when payment to the originating [`Offer`] was initiated. Useful for us to identify @@ -2371,27 +2556,53 @@ typedef struct LDKAsyncPaymentsContext_LDKOutboundPayment_Body { * [`Offer`]: crate::offers::offer::Offer */ struct LDKThirtyTwoBytes payment_id; +} LDKAsyncPaymentsContext_LDKOutboundPayment_Body; + +typedef struct LDKAsyncPaymentsContext_LDKInboundPayment_Body { /** - * A nonce used for authenticating that a [`ReleaseHeldHtlc`] message is valid for a preceding - * [`HeldHtlcAvailable`] message. + * The time as duration since the Unix epoch at which this path expires and messages sent over + * it should be ignored. Without this, anyone with the path corresponding to this context is + * able to trivially ask if we're online forever. + */ + uint64_t path_absolute_expiry; +} LDKAsyncPaymentsContext_LDKInboundPayment_Body; + +typedef struct LDKAsyncPaymentsContext_LDKReleaseHeldHtlc_Body { + /** + * An identifier for the HTLC that should be released by us as the sender's always-online + * channel counterparty to the often-offline recipient. + */ + struct LDKThirtyTwoBytes intercept_id; + /** + * The short channel id alias corresponding to the to-be-released inbound HTLC, to help locate + * the HTLC internally if the [`ReleaseHeldHtlc`] races our node decoding the held HTLC's + * onion. + * + * We use the outbound scid alias because it is stable even if the channel splices, unlike + * regular short channel ids. * * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc - * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable */ - struct LDKNonce nonce; + uint64_t prev_outbound_scid_alias; /** - * Authentication code for the [`PaymentId`]. + * The id of the to-be-released HTLC, to help locate the HTLC internally if the + * [`ReleaseHeldHtlc`] races our node decoding the held HTLC's onion. * - * Prevents the recipient from being able to deanonymize us by creating a blinded path to us - * containing the expected [`PaymentId`]. + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc */ - struct LDKThirtyTwoBytes hmac; -} LDKAsyncPaymentsContext_LDKOutboundPayment_Body; + uint64_t htlc_id; +} LDKAsyncPaymentsContext_LDKReleaseHeldHtlc_Body; typedef struct MUST_USE_STRUCT LDKAsyncPaymentsContext { LDKAsyncPaymentsContext_Tag tag; union { + LDKAsyncPaymentsContext_LDKOfferPathsRequest_Body offer_paths_request; + LDKAsyncPaymentsContext_LDKOfferPaths_Body offer_paths; + LDKAsyncPaymentsContext_LDKServeStaticInvoice_Body serve_static_invoice; + LDKAsyncPaymentsContext_LDKStaticInvoicePersisted_Body static_invoice_persisted; LDKAsyncPaymentsContext_LDKOutboundPayment_Body outbound_payment; + LDKAsyncPaymentsContext_LDKInboundPayment_Body inbound_payment; + LDKAsyncPaymentsContext_LDKReleaseHeldHtlc_Body release_held_htlc; }; } LDKAsyncPaymentsContext; @@ -2499,6 +2710,17 @@ typedef enum LDKMessageSendInstructions_Tag { * Indicates that a message is being sent as a reply to a received message. */ LDKMessageSendInstructions_ForReply, + /** + * Indicates that this onion message did not originate from our node and is being forwarded + * through us from another node on the network to the destination. + * + * We separate out this case because forwarded onion messages are treated differently from + * outbound onion messages initiated by our node. Outbounds are buffered internally, whereas, for + * DoS protection, forwards should never be buffered internally and instead will either be + * dropped or generate an [`Event::OnionMessageIntercepted`] if the next-hop node is + * disconnected. + */ + LDKMessageSendInstructions_ForwardedMessage, /** * Must be last for serialization purposes */ @@ -2542,6 +2764,20 @@ typedef struct LDKMessageSendInstructions_LDKForReply_Body { struct LDKResponseInstruction instructions; } LDKMessageSendInstructions_LDKForReply_Body; +typedef struct LDKMessageSendInstructions_LDKForwardedMessage_Body { + /** + * The destination where we need to send the forwarded onion message. + */ + struct LDKDestination destination; + /** + * The reply path which should be included in the message, that terminates at the original + * sender of this forwarded message. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedMessagePath reply_path; +} LDKMessageSendInstructions_LDKForwardedMessage_Body; + typedef struct MUST_USE_STRUCT LDKMessageSendInstructions { LDKMessageSendInstructions_Tag tag; union { @@ -2549,6 +2785,7 @@ typedef struct MUST_USE_STRUCT LDKMessageSendInstructions { LDKMessageSendInstructions_LDKWithReplyPath_Body with_reply_path; LDKMessageSendInstructions_LDKWithoutReplyPath_Body without_reply_path; LDKMessageSendInstructions_LDKForReply_Body for_reply; + LDKMessageSendInstructions_LDKForwardedMessage_Body forwarded_message; }; } LDKMessageSendInstructions; @@ -2620,11 +2857,14 @@ typedef struct LDKCResult_DNSResolverMessageDecodeErrorZ { /** * A struct containing the two parts of a BIP 353 Human Readable Name - the user and domain parts. * - * The `user` and `domain` parts, together, cannot exceed 232 bytes in length, and both must be + * The `user` and `domain` parts, together, cannot exceed 231 bytes in length, and both must be * non-empty. * - * To protect against [Homograph Attacks], both parts of a Human Readable Name must be plain - * ASCII. + * If you intend to handle non-ASCII `user` or `domain` parts, you must handle [Homograph Attacks] + * and do punycode en-/de-coding yourself. This struct will always handle only plain ASCII `user` + * and `domain` parts. + * + * This struct can also be used for LN-Address recipients. * * [Homograph Attacks]: https://en.wikipedia.org/wiki/IDN_homograph_attack */ @@ -3154,15 +3394,27 @@ typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { }; } LDKCOption_CVec_ThirtyTwoBytesZZ; + + /** - * A 3-byte byte array. + * An ISO 4217 three-letter currency code (e.g., USD). + * + * Currency codes must be exactly 3 ASCII uppercase letters. */ -typedef struct LDKThreeBytes { +typedef struct MUST_USE_STRUCT LDKCurrencyCode { /** - * The three bytes + * 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. */ - uint8_t data[3]; -} LDKThreeBytes; + LDKnativeCurrencyCode *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; +} LDKCurrencyCode; /** * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or @@ -3194,9 +3446,9 @@ typedef struct LDKAmount_LDKCurrency_Body { /** * The currency that the amount is denominated in. */ - struct LDKThreeBytes iso4217_code; + struct LDKCurrencyCode iso4217_code; /** - * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). + * The amount in the currency unit adjusted by the ISO 4217 exponent (e.g., USD cents). */ uint64_t amount; } LDKAmount_LDKCurrency_Body; @@ -3540,16 +3792,18 @@ typedef enum LDKSpendableOutputDescriptor_Tag { * it is an output from an old state which we broadcast (which should never happen). * * To derive the delayed payment key which is used to sign this input, you must pass the - * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the - * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided - * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be - * generated without the secret key using [`DelayedPaymentKey::from_basepoint`] and only the - * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. + * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which + * corresponds to the [`ChannelPublicKeys::delayed_payment_basepoint`] in + * [`ChannelSigner::pubkeys`]) and the provided + * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to + * [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be generated without the + * secret key using [`DelayedPaymentKey::from_basepoint`] and only the + * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in + * [`ChannelSigner::pubkeys`]. * * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is * used in the witness script generation), you must pass the counterparty - * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to - * [`ChannelSigner::provide_channel_parameters`]) and the provided + * [`ChannelPublicKeys::revocation_basepoint`] and the provided * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to * [`RevocationKey`]. * @@ -4075,6 +4329,38 @@ typedef struct LDKCResult_ECDSASignatureNoneZ { bool result_ok; } LDKCResult_ECDSASignatureNoneZ; +/** + * The contents of CResult_StrNoneZ + */ +typedef union LDKCResult_StrNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStr *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_StrNoneZPtr; + +/** + * A CResult_StrNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Str on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_StrNoneZ { + /** + * The contents of this CResult_StrNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StrNoneZPtr contents; + /** + * Whether this CResult_StrNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_StrNoneZ; + /** * The contents of CResult_TransactionNoneZ */ @@ -4107,6 +4393,124 @@ typedef struct LDKCResult_TransactionNoneZ { bool result_ok; } LDKCResult_TransactionNoneZ; +/** + * The contents of CResult_CVec_u8ZNoneZ + */ +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. + */ + struct LDKCVec_u8Z *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_u8ZNoneZPtr; + +/** + * 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_CVec_u8ZNoneZ { + /** + * The contents of this CResult_CVec_u8ZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_u8ZNoneZPtr contents; + /** + * Whether this CResult_CVec_u8ZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_u8ZNoneZ; + + + +/** + * A script pubkey for shutting down a channel as defined by [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + */ +typedef struct MUST_USE_STRUCT LDKShutdownScript { + /** + * 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. + */ + LDKnativeShutdownScript *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; +} LDKShutdownScript; + +/** + * The contents of CResult_ShutdownScriptNoneZ + */ +typedef union LDKCResult_ShutdownScriptNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKShutdownScript *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_ShutdownScriptNoneZPtr; + +/** + * A CResult_ShutdownScriptNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ShutdownScriptNoneZ { + /** + * The contents of this CResult_ShutdownScriptNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ShutdownScriptNoneZPtr contents; + /** + * Whether this CResult_ShutdownScriptNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_ShutdownScriptNoneZ; + +/** + * The contents of CResult_WitnessNoneZ + */ +typedef union LDKCResult_WitnessNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKWitness *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_WitnessNoneZPtr; + +/** + * A CResult_WitnessNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Witness on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_WitnessNoneZ { + /** + * The contents of this CResult_WitnessNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_WitnessNoneZPtr contents; + /** + * Whether this CResult_WitnessNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_WitnessNoneZ; + /** * A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. * This corresponds to std::vector in C++ @@ -4169,2131 +4573,1474 @@ typedef struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { bool result_ok; } LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; +/** + * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CVec_u8ZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKCVec_u8Z *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CVec_u8ZZ; + /** - * This class tracks the per-transaction information needed to build a commitment transaction and will - * actually build it and sign. It is used for holder transactions that we sign only when needed - * and for transactions we sign for the counterparty. - * - * This class can be used inside a signer implementation to generate a signature given the relevant - * secret key. + * A [`CandidateRouteHop::FirstHop`] entry. */ -typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKFirstHopCandidate { /** * 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. */ - LDKnativeCommitmentTransaction *inner; + LDKnativeFirstHopCandidate *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; -} LDKCommitmentTransaction; +} LDKFirstHopCandidate; /** - * Information needed to build and sign a holder's commitment transaction. - * - * The transaction is only signed once we are ready to broadcast. + * A [`CandidateRouteHop::PublicHop`] entry. */ -typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { +typedef struct MUST_USE_STRUCT LDKPublicHopCandidate { /** * 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. */ - LDKnativeHolderCommitmentTransaction *inner; + LDKnativePublicHopCandidate *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; -} LDKHolderCommitmentTransaction; +} LDKPublicHopCandidate; /** - * Information about an HTLC as it appears in a commitment transaction + * A [`CandidateRouteHop::PrivateHop`] entry. */ -typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { +typedef struct MUST_USE_STRUCT LDKPrivateHopCandidate { /** * 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. */ - LDKnativeHTLCOutputInCommitment *inner; + LDKnativePrivateHopCandidate *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; -} LDKHTLCOutputInCommitment; +} LDKPrivateHopCandidate; /** - * This class tracks the per-transaction information needed to build a closing transaction and will - * actually build it and sign. - * - * This class can be used inside a signer implementation to generate a signature given the relevant - * secret key. + * A [`CandidateRouteHop::Blinded`] entry. */ -typedef struct MUST_USE_STRUCT LDKClosingTransaction { +typedef struct MUST_USE_STRUCT LDKBlindedPathCandidate { /** * 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. */ - LDKnativeClosingTransaction *inner; + LDKnativeBlindedPathCandidate *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; -} LDKClosingTransaction; +} LDKBlindedPathCandidate; /** - * The unsigned part of a [`channel_announcement`] message. - * - * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message + * A [`CandidateRouteHop::OneHopBlinded`] entry. */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { +typedef struct MUST_USE_STRUCT LDKOneHopBlindedPathCandidate { /** * 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. */ - LDKnativeUnsignedChannelAnnouncement *inner; + LDKnativeOneHopBlindedPathCandidate *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; -} LDKUnsignedChannelAnnouncement; +} LDKOneHopBlindedPathCandidate; + +/** + * A wrapper around the various hop representations. + * + * Can be used to examine the properties of a hop, + * potentially to decide whether to include it in a route. + */ +typedef enum LDKCandidateRouteHop_Tag { + /** + * A hop from the payer, where the outbound liquidity is known. + */ + LDKCandidateRouteHop_FirstHop, + /** + * A hop found in the [`ReadOnlyNetworkGraph`]. + */ + LDKCandidateRouteHop_PublicHop, + /** + * A private hop communicated by the payee, generally via a BOLT 11 invoice. + * + * Because BOLT 11 route hints can take multiple hops to get to the destination, this may not + * terminate at the payee. + */ + LDKCandidateRouteHop_PrivateHop, + /** + * A blinded path which starts with an introduction point and ultimately terminates with the + * payee. + * + * Because we don't know the payee's identity, [`CandidateRouteHop::target`] will return + * `None` in this state. + * + * Because blinded paths are \"all or nothing\", and we cannot use just one part of a blinded + * path, the full path is treated as a single [`CandidateRouteHop`]. + */ + LDKCandidateRouteHop_Blinded, + /** + * Similar to [`Self::Blinded`], but the path here only has one hop. + * + * While we treat this similarly to [`CandidateRouteHop::Blinded`] in many respects (e.g. + * returning `None` from [`CandidateRouteHop::target`]), in this case we do actually know the + * payee's identity - it's the introduction point! + * + * [`BlindedPayInfo`] provided for 1-hop blinded paths is ignored because it is meant to apply + * to the hops *between* the introduction node and the destination. + * + * This primarily exists to track that we need to included a blinded path at the end of our + * [`Route`], even though it doesn't actually add an additional hop in the payment. + * + * [`BlindedPayInfo`]: crate::blinded_path::payment::BlindedPayInfo + */ + LDKCandidateRouteHop_OneHopBlinded, + /** + * Must be last for serialization purposes + */ + LDKCandidateRouteHop_Sentinel, +} LDKCandidateRouteHop_Tag; + +typedef struct MUST_USE_STRUCT LDKCandidateRouteHop { + LDKCandidateRouteHop_Tag tag; + union { + struct { + struct LDKFirstHopCandidate first_hop; + }; + struct { + struct LDKPublicHopCandidate public_hop; + }; + struct { + struct LDKPrivateHopCandidate private_hop; + }; + struct { + struct LDKBlindedPathCandidate blinded; + }; + struct { + struct LDKOneHopBlindedPathCandidate one_hop_blinded; + }; + }; +} LDKCandidateRouteHop; /** - * One counterparty's public keys which do not change over the life of a channel. + * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`]. */ -typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { +typedef struct MUST_USE_STRUCT LDKChannelUsage { /** * 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. */ - LDKnativeChannelPublicKeys *inner; + LDKnativeChannelUsage *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; -} LDKChannelPublicKeys; +} LDKChannelUsage; /** - * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). - * The fields are organized by holder/counterparty. + * Parameters for configuring [`ProbabilisticScorer`]. * - * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters - * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. + * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel + * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). + * + * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the + * parameters here. */ -typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { +typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters { /** * 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. */ - LDKnativeChannelTransactionParameters *inner; + LDKnativeProbabilisticScoringFeeParameters *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; -} LDKChannelTransactionParameters; +} LDKProbabilisticScoringFeeParameters; /** - * A trait to handle Lightning channel key material without concretizing the channel type or - * the signature mechanism. + * An interface used to score payment channels for path finding. * - * Several methods allow errors to be returned to support async signing. In such cases, the - * signing operation can be replayed by calling [`ChannelManager::signer_unblocked`] once the - * result is ready, at which point the channel operation will resume. Methods which allow for - * async results are explicitly documented as such + * `ScoreLookUp` is used to determine the penalty for a given channel. * - * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * Scoring is in terms of fees willing to be paid in order to avoid routing through a channel. */ -typedef struct LDKChannelSigner { +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; /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + * 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`. * - * This method is *not* asynchronous. This method is expected to always return `Ok` - * immediately after we reconnect to peers, and returning an `Err` may lead to an immediate - * `panic`. This method will be made asynchronous in a future release. + * 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. */ - struct LDKCResult_PublicKeyNoneZ (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + uint64_t (*channel_penalty_msat)(const void *this_arg, const struct LDKCandidateRouteHop *NONNULL_PTR candidate, struct LDKChannelUsage usage, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR score_params); /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. - * - * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. - * - * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * 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. */ - struct LDKCResult__u832NoneZ (*release_commitment_secret)(const void *this_arg, uint64_t idx); + void (*free)(void *this_arg); +} LDKScoreLookUp; + + + +/** + * A path in a [`Route`] to the payment recipient. Must always be at least length one. + * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19. + */ +typedef struct MUST_USE_STRUCT LDKPath { /** - * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. - * - * This is required in order for the signer to make sure that releasing a commitment - * secret won't leave us without a broadcastable holder transaction. - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outbound HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - * - * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately - * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` - * and pause future signing operations until this validation completes. + * 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. */ - struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); + LDKnativePath *inner; /** - * Validate the counterparty's revocation. - * - * This is required in order for the signer to make sure that the state has moved - * forward and it is safe to sign the next counterparty commitment. - * - * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately - * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` - * and pause future signing operations until this validation completes. + * 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. */ - struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); + bool is_owned; +} LDKPath; + +/** + * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt. + */ +typedef struct LDKScoreUpdate { /** - * Returns the holder's channel public keys and basepoints. - * - * This method is *not* asynchronous. Instead, the value must be cached locally. + * 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. */ - struct LDKChannelPublicKeys pubkeys; + void *this_arg; /** - * Fill in the pubkeys field as a reference to it will be given to Rust after this returns - * Note that this takes a pointer to this object, not the this_ptr like other methods do - * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. + * Handles updating channel penalties after failing to route through a channel. */ - void (*set_pubkeys)(const struct LDKChannelSigner*NONNULL_PTR ); + void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); /** - * 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 - * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. - * - * This method is *not* asynchronous. Instead, the value must be cached locally. + * Handles updating channel penalties after successfully routing along a path. */ - struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); + void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); /** - * Set the counterparty static channel data, including basepoints, - * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. - * - * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] - * instance, LDK will call this method exactly once - either immediately after construction - * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding - * information has been generated. - * - * channel_parameters.is_populated() MUST be true. + * Handles updating channel penalties after a probe over the given path failed. + */ + void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); + /** + * Handles updating channel penalties after a probe over the given path succeeded. + */ + void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); + /** + * Scorers may wish to reduce their certainty of channel liquidity information over time. + * Thus, this method is provided to allow scorers to observe the passage of time - the holder + * of this object should call this method regularly (generally via the + * `lightning-background-processor` crate). */ - void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + void (*time_passed)(void *this_arg, uint64_t duration_since_epoch); /** * 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); -} LDKChannelSigner; +} LDKScoreUpdate; /** - * A trait to sign Lightning channel transactions as described in - * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). - * - * Signing services could be implemented on a hardware wallet and should implement signing - * policies in order to be secure. Please refer to the [VLS Policy - * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) - * for an example of such policies. + * A scorer that is accessed under a lock. * - * Like [`ChannelSigner`], many of the methods allow errors to be returned to support async - * signing. In such cases, the signing operation can be replayed by calling - * [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual - * method documentation for which method should be called) once the result is ready, at which - * point the channel operation will resume. + * 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 [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel. * - * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * [`find_route`]: crate::routing::router::find_route */ -typedef struct LDKEcdsaChannelSigner { +typedef struct LDKLockableScore { /** * 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; /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment - * are provided. A validating signer should ensure that an outbound HTLC output is removed - * only when the matching preimage is provided and after the corresponding inbound HTLC has - * been removed for forwarded payments. - * - * Note that all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. - * - * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * Returns read locked scorer. */ - struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); + struct LDKScoreLookUp (*read_lock)(const void *this_arg); /** - * Creates a signature for a holder's commitment transaction. - * - * This will be called - * - with a non-revoked `commitment_tx`. - * - with the latest `commitment_tx` when we initiate a force-close. - * - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * Returns write locked scorer. */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + struct LDKScoreUpdate (*write_lock)(const void *this_arg); /** - * 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. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do - * so). - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * 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. */ - 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]); + void (*free)(void *this_arg); +} LDKLockableScore; + +/** + * Refers to a scorer that is accessible under lock and also writeable to disk + * + * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to + * use the Persister to persist it. + */ +typedef struct LDKWriteableScore { /** - * Create a signature for the given input in a transaction spending a commitment transaction - * HTLC output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * `amount` is the value of the output spent by this input, committed to in the BIP 143 - * signature. - * - * `per_commitment_key` is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script - * (which is committed to in the BIP 143 signatures). - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * 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. */ - 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); + void *this_arg; /** - * 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 may be called for HTLCs in the penultimate commitment transaction if a - * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) - * broadcasts it before receiving the update for the latest commitment transaction. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * Implementation of LockableScore for this object. */ - 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); + struct LDKLockableScore LockableScore; /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. - * - * `per_commitment_point` is the dynamic point corresponding to the channel state - * detected onchain. It has been generated by our counterparty and is used to derive - * channel state keys, which are then included in the witness script and committed to in the - * BIP 143 signature. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * Serialize the object into a byte array */ - 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); + struct LDKCVec_u8Z (*write)(const void *this_arg); /** - * 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. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. - * - * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * 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. */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + void (*free)(void *this_arg); +} LDKWriteableScore; + +/** + * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not + */ +typedef enum LDKCOption_WriteableScoreZ_Tag { /** - * 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`. - * - * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid - * signature and should be retried later. Once the signer is ready to provide a signature after - * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. - * - * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked - * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); + LDKCOption_WriteableScoreZ_Some, /** - * Signs a channel announcement message with our funding key proving it comes from one of the - * channel participants. - * - * Channel announcements also require a signature from each node's network key. Our node - * signature is computed through [`NodeSigner::sign_gossip_message`]. - * - * This method is *not* asynchronous. If an `Err` is returned, the channel will not be - * publicly announced and our counterparty may (though likely will not) close the channel on - * us for violating the protocol. - * - * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message + * When we're in this state, this COption_WriteableScoreZ contains nothing */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + LDKCOption_WriteableScoreZ_None, /** - * Signs the input of a splicing funding transaction with our funding key. - * - * In splicing, the previous funding transaction output is spent as the input of - * the new funding transaction, and is a 2-of-2 multisig. - * - * `input_index`: The index of the input within the new funding transaction `tx`, - * spending the previous funding transaction's output - * - * `input_value`: The value of the previous funding transaction output. - * - * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately - * closed. - */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_splicing_funding_input)(const void *this_arg, struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value); - /** - * Implementation of ChannelSigner for this object. - */ - struct LDKChannelSigner ChannelSigner; - /** - * Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. - * The new EcdsaChannelSigner 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 LDKEcdsaChannelSigner *NONNULL_PTR new_EcdsaChannelSigner); - /** - * 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. + * Must be last for serialization purposes */ - void (*free)(void *this_arg); -} LDKEcdsaChannelSigner; + LDKCOption_WriteableScoreZ_Sentinel, +} LDKCOption_WriteableScoreZ_Tag; + +typedef struct LDKCOption_WriteableScoreZ { + LDKCOption_WriteableScoreZ_Tag tag; + union { + struct { + struct LDKWriteableScore some; + }; + }; +} LDKCOption_WriteableScoreZ; /** - * The contents of CResult_EcdsaChannelSignerDecodeErrorZ + * The contents of CResult_NoneIOErrorZ */ -typedef union LDKCResult_EcdsaChannelSignerDecodeErrorZPtr { +typedef union LDKCResult_NoneIOErrorZPtr { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKEcdsaChannelSigner *result; + void *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_EcdsaChannelSignerDecodeErrorZPtr; + enum LDKIOError *err; +} LDKCResult_NoneIOErrorZPtr; /** - * A CResult_EcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::sign::ecdsa::EcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * 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_EcdsaChannelSignerDecodeErrorZ { +typedef struct LDKCResult_NoneIOErrorZ { /** - * The contents of this CResult_EcdsaChannelSignerDecodeErrorZ, accessible via either + * The contents of this CResult_NoneIOErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_EcdsaChannelSignerDecodeErrorZPtr contents; + union LDKCResult_NoneIOErrorZPtr contents; /** - * Whether this CResult_EcdsaChannelSignerDecodeErrorZ represents a success state. + * Whether this CResult_NoneIOErrorZ represents a success state. */ bool result_ok; -} LDKCResult_EcdsaChannelSignerDecodeErrorZ; +} LDKCResult_NoneIOErrorZ; + + /** - * The contents of CResult_CVec_u8ZNoneZ + * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] + * + * Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and + * [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain + * transactions. + * + * When a channel is spliced, most fields continue to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). See individual fields for details. + * + * [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances + * [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances */ -typedef union LDKCResult_CVec_u8ZNoneZPtr { +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKCVec_u8Z *result; + LDKnativeChannelDetails *inner; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * 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. */ - void *err; -} LDKCResult_CVec_u8ZNoneZPtr; + bool is_owned; +} LDKChannelDetails; /** - * 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`. + * A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_CVec_u8ZNoneZ { +typedef struct LDKCVec_ChannelDetailsZ { /** - * The contents of this CResult_CVec_u8ZNoneZ, 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_CVec_u8ZNoneZPtr contents; + struct LDKChannelDetails *data; /** - * Whether this CResult_CVec_u8ZNoneZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_CVec_u8ZNoneZ; + uintptr_t datalen; +} LDKCVec_ChannelDetailsZ; /** - * A script pubkey for shutting down a channel as defined by [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP, + * it can take multiple paths. Each path is composed of one or more hops through the network. */ -typedef struct MUST_USE_STRUCT LDKShutdownScript { +typedef struct MUST_USE_STRUCT LDKRoute { /** * 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. */ - LDKnativeShutdownScript *inner; + LDKnativeRoute *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; -} LDKShutdownScript; +} LDKRoute; /** - * The contents of CResult_ShutdownScriptNoneZ + * The contents of CResult_RouteStrZ */ -typedef union LDKCResult_ShutdownScriptNoneZPtr { +typedef union LDKCResult_RouteStrZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKShutdownScript *result; + struct LDKRoute *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_ShutdownScriptNoneZPtr; + struct LDKStr *err; +} LDKCResult_RouteStrZPtr; /** - * A CResult_ShutdownScriptNoneZ represents the result of a fallible operation, - * containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure. + * A CResult_RouteStrZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route on success and a crate::c_types::Str on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ShutdownScriptNoneZ { +typedef struct LDKCResult_RouteStrZ { /** - * The contents of this CResult_ShutdownScriptNoneZ, accessible via either + * The contents of this CResult_RouteStrZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ShutdownScriptNoneZPtr contents; + union LDKCResult_RouteStrZPtr contents; /** - * Whether this CResult_ShutdownScriptNoneZ represents a success state. + * Whether this CResult_RouteStrZ represents a success state. */ bool result_ok; -} LDKCResult_ShutdownScriptNoneZ; +} LDKCResult_RouteStrZ; /** - * An enum which can either contain a u16 or not + * The contents of CResult_CVec_BlindedPaymentPathZNoneZ */ -typedef enum LDKCOption_u16Z_Tag { +typedef union LDKCResult_CVec_BlindedPaymentPathZNoneZPtr { /** - * When we're in this state, this COption_u16Z contains a u16 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_u16Z_Some, + struct LDKCVec_BlindedPaymentPathZ *result; /** - * When we're in this state, this COption_u16Z contains nothing + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKCOption_u16Z_None, + void *err; +} LDKCResult_CVec_BlindedPaymentPathZNoneZPtr; + +/** + * A CResult_CVec_BlindedPaymentPathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedPaymentPathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedPaymentPathZNoneZ { /** - * Must be last for serialization purposes + * The contents of this CResult_CVec_BlindedPaymentPathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_u16Z_Sentinel, -} LDKCOption_u16Z_Tag; + union LDKCResult_CVec_BlindedPaymentPathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedPaymentPathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedPaymentPathZNoneZ; + -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 + * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for + * in-use channel liquidity. */ -typedef enum LDKCOption_boolZ_Tag { - /** - * When we're in this state, this COption_boolZ contains a bool - */ - LDKCOption_boolZ_Some, +typedef struct MUST_USE_STRUCT LDKInFlightHtlcs { /** - * When we're in this state, this COption_boolZ contains nothing + * 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. */ - LDKCOption_boolZ_None, + LDKnativeInFlightHtlcs *inner; /** - * Must be last for serialization purposes + * 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_boolZ_Sentinel, -} LDKCOption_boolZ_Tag; - -typedef struct LDKCOption_boolZ { - LDKCOption_boolZ_Tag tag; - union { - struct { - bool some; - }; - }; -} LDKCOption_boolZ; + bool is_owned; +} LDKInFlightHtlcs; /** - * The contents of CResult_WitnessNoneZ + * The contents of CResult_InFlightHtlcsDecodeErrorZ */ -typedef union LDKCResult_WitnessNoneZPtr { +typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKWitness *result; + struct LDKInFlightHtlcs *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_WitnessNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_InFlightHtlcsDecodeErrorZPtr; /** - * A CResult_WitnessNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Witness on success and a () on failure. + * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::InFlightHtlcs 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_WitnessNoneZ { +typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ { /** - * The contents of this CResult_WitnessNoneZ, accessible via either + * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_WitnessNoneZPtr contents; + union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; /** - * Whether this CResult_WitnessNoneZ represents a success state. + * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_WitnessNoneZ; +} LDKCResult_InFlightHtlcsDecodeErrorZ; /** - * A simple implementation of [`EcdsaChannelSigner`] that just keeps the private keys in memory. - * - * This implementation performs no policy checks and is insufficient by itself as - * a secure external signer. + * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel + * that leads to it. */ -typedef struct MUST_USE_STRUCT LDKInMemorySigner { +typedef struct MUST_USE_STRUCT LDKRouteHop { /** * 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. */ - LDKnativeInMemorySigner *inner; + LDKnativeRouteHop *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; -} LDKInMemorySigner; +} LDKRouteHop; /** - * The contents of CResult_InMemorySignerDecodeErrorZ + * The contents of CResult_RouteHopDecodeErrorZ */ -typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { +typedef union LDKCResult_RouteHopDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInMemorySigner *result; + struct LDKRouteHop *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_InMemorySignerDecodeErrorZPtr; +} LDKCResult_RouteHopDecodeErrorZPtr; /** - * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteHop 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_InMemorySignerDecodeErrorZ { +typedef struct LDKCResult_RouteHopDecodeErrorZ { /** - * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either + * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InMemorySignerDecodeErrorZPtr contents; + union LDKCResult_RouteHopDecodeErrorZPtr contents; /** - * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. + * Whether this CResult_RouteHopDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InMemorySignerDecodeErrorZ; +} LDKCResult_RouteHopDecodeErrorZ; /** - * A [`CandidateRouteHop::FirstHop`] entry. + * A Trampoline hop in a route, and additional metadata about it. \"Hop\" is defined as a node. */ -typedef struct MUST_USE_STRUCT LDKFirstHopCandidate { +typedef struct MUST_USE_STRUCT LDKTrampolineHop { /** * 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. */ - LDKnativeFirstHopCandidate *inner; + LDKnativeTrampolineHop *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; -} LDKFirstHopCandidate; +} LDKTrampolineHop; +/** + * The contents of CResult_TrampolineHopDecodeErrorZ + */ +typedef union LDKCResult_TrampolineHopDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTrampolineHop *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_TrampolineHopDecodeErrorZPtr; +/** + * A CResult_TrampolineHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::TrampolineHop 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_TrampolineHopDecodeErrorZ { + /** + * The contents of this CResult_TrampolineHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TrampolineHopDecodeErrorZPtr contents; + /** + * Whether this CResult_TrampolineHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_TrampolineHopDecodeErrorZ; /** - * A [`CandidateRouteHop::PublicHop`] entry. + * A dynamically-allocated array of crate::lightning::routing::router::TrampolineHops of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKPublicHopCandidate { +typedef struct LDKCVec_TrampolineHopZ { /** - * 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. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativePublicHopCandidate *inner; + struct LDKTrampolineHop *data; /** - * 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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKPublicHopCandidate; + uintptr_t datalen; +} LDKCVec_TrampolineHopZ; /** - * A [`CandidateRouteHop::PrivateHop`] entry. + * 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 LDKPrivateHopCandidate { +typedef struct MUST_USE_STRUCT LDKBlindedHop { /** * 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. */ - LDKnativePrivateHopCandidate *inner; + LDKnativeBlindedHop *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; -} LDKPrivateHopCandidate; - - +} LDKBlindedHop; /** - * A [`CandidateRouteHop::Blinded`] entry. + * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKBlindedPathCandidate { +typedef struct LDKCVec_BlindedHopZ { /** - * 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. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKnativeBlindedPathCandidate *inner; + struct LDKBlindedHop *data; /** - * 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. + * The number of elements pointed to by `data`. */ - bool is_owned; -} LDKBlindedPathCandidate; + uintptr_t datalen; +} LDKCVec_BlindedHopZ; /** - * A [`CandidateRouteHop::OneHopBlinded`] entry. + * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in + * their [`Bolt12Invoice`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -typedef struct MUST_USE_STRUCT LDKOneHopBlindedPathCandidate { +typedef struct MUST_USE_STRUCT LDKBlindedTail { /** * 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. */ - LDKnativeOneHopBlindedPathCandidate *inner; + LDKnativeBlindedTail *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; -} LDKOneHopBlindedPathCandidate; +} LDKBlindedTail; /** - * A wrapper around the various hop representations. - * - * Can be used to examine the properties of a hop, - * potentially to decide whether to include it in a route. + * The contents of CResult_BlindedTailDecodeErrorZ */ -typedef enum LDKCandidateRouteHop_Tag { +typedef union LDKCResult_BlindedTailDecodeErrorZPtr { /** - * A hop from the payer, where the outbound liquidity is known. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCandidateRouteHop_FirstHop, + struct LDKBlindedTail *result; /** - * A hop found in the [`ReadOnlyNetworkGraph`]. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCandidateRouteHop_PublicHop, + struct LDKDecodeError *err; +} LDKCResult_BlindedTailDecodeErrorZPtr; + +/** + * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::BlindedTail 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_BlindedTailDecodeErrorZ { /** - * A private hop communicated by the payee, generally via a BOLT 11 invoice. - * - * Because BOLT 11 route hints can take multiple hops to get to the destination, this may not - * terminate at the payee. + * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCandidateRouteHop_PrivateHop, + union LDKCResult_BlindedTailDecodeErrorZPtr contents; /** - * A blinded path which starts with an introduction point and ultimately terminates with the - * payee. - * - * Because we don't know the payee's identity, [`CandidateRouteHop::target`] will return - * `None` in this state. - * - * Because blinded paths are \"all or nothing\", and we cannot use just one part of a blinded - * path, the full path is treated as a single [`CandidateRouteHop`]. + * Whether this CResult_BlindedTailDecodeErrorZ represents a success state. */ - LDKCandidateRouteHop_Blinded, + bool result_ok; +} LDKCResult_BlindedTailDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHopZ { /** - * Similar to [`Self::Blinded`], but the path here only has one hop. - * - * While we treat this similarly to [`CandidateRouteHop::Blinded`] in many respects (e.g. - * returning `None` from [`CandidateRouteHop::target`]), in this case we do actually know the - * payee's identity - it's the introduction point! - * - * [`BlindedPayInfo`] provided for 1-hop blinded paths is ignored because it is meant to apply - * to the hops *between* the introduction node and the destination. - * - * This primarily exists to track that we need to included a blinded path at the end of our - * [`Route`], even though it doesn't actually add an additional hop in the payment. - * - * [`BlindedPayInfo`]: crate::blinded_path::payment::BlindedPayInfo + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCandidateRouteHop_OneHopBlinded, + struct LDKRouteHop *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCandidateRouteHop_Sentinel, -} LDKCandidateRouteHop_Tag; - -typedef struct MUST_USE_STRUCT LDKCandidateRouteHop { - LDKCandidateRouteHop_Tag tag; - union { - struct { - struct LDKFirstHopCandidate first_hop; - }; - struct { - struct LDKPublicHopCandidate public_hop; - }; - struct { - struct LDKPrivateHopCandidate private_hop; - }; - struct { - struct LDKBlindedPathCandidate blinded; - }; - struct { - struct LDKOneHopBlindedPathCandidate one_hop_blinded; - }; - }; -} LDKCandidateRouteHop; + uintptr_t datalen; +} LDKCVec_RouteHopZ; +/** + * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PathZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPath *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PathZ; +/** + * The contents of CResult_RouteDecodeErrorZ + */ +typedef union LDKCResult_RouteDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRoute *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_RouteDecodeErrorZPtr; /** - * Proposed use of a channel passed as a parameter to [`ScoreLookUp::channel_penalty_msat`]. + * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route 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 MUST_USE_STRUCT LDKChannelUsage { +typedef struct LDKCResult_RouteDecodeErrorZ { /** - * 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. + * The contents of this CResult_RouteDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeChannelUsage *inner; + union LDKCResult_RouteDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_RouteDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKChannelUsage; + bool result_ok; +} LDKCResult_RouteDecodeErrorZ; /** - * Parameters for configuring [`ProbabilisticScorer`]. - * - * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel - * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). + * Parameters needed to find a [`Route`]. * - * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the - * parameters here. + * Passed to [`find_route`] and [`build_route_from_hops`]. */ -typedef struct MUST_USE_STRUCT LDKProbabilisticScoringFeeParameters { +typedef struct MUST_USE_STRUCT LDKRouteParameters { /** * 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. */ - LDKnativeProbabilisticScoringFeeParameters *inner; + LDKnativeRouteParameters *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; -} LDKProbabilisticScoringFeeParameters; +} LDKRouteParameters; /** - * 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. + * The contents of CResult_RouteParametersDecodeErrorZ */ -typedef struct LDKScoreLookUp { +typedef union LDKCResult_RouteParametersDecodeErrorZPtr { /** - * 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. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *this_arg; + struct LDKRouteParameters *result; /** - * 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, const struct LDKCandidateRouteHop *NONNULL_PTR candidate, 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. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void (*free)(void *this_arg); -} LDKScoreLookUp; - - + struct LDKDecodeError *err; +} LDKCResult_RouteParametersDecodeErrorZPtr; /** - * A path in a [`Route`] to the payment recipient. Must always be at least length one. - * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19. + * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteParameters 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 MUST_USE_STRUCT LDKPath { +typedef struct LDKCResult_RouteParametersDecodeErrorZ { /** - * 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. + * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativePath *inner; + union LDKCResult_RouteParametersDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_RouteParametersDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKPath; + bool result_ok; +} LDKCResult_RouteParametersDecodeErrorZ; /** - * `ScoreUpdate` is used to update the scorer's internal state after a payment attempt. + * A dynamically-allocated array of u64s of arbitrary size. + * This corresponds to std::vector in C++ */ -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; - /** - * Handles updating channel penalties after failing to route through a channel. - */ - void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); - /** - * Handles updating channel penalties after successfully routing along a path. - */ - void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); - /** - * Handles updating channel penalties after a probe over the given path failed. - */ - void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id, uint64_t duration_since_epoch); - /** - * Handles updating channel penalties after a probe over the given path succeeded. - */ - void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t duration_since_epoch); +typedef struct LDKCVec_u64Z { /** - * Scorers may wish to reduce their certainty of channel liquidity information over time. - * Thus, this method is provided to allow scorers to observe the passage of time - the holder - * of this object should call this method regularly (generally via the - * `lightning-background-processor` crate). + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void (*time_passed)(void *this_arg, uint64_t duration_since_epoch); + uint64_t *data; /** - * 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. + * The number of elements pointed to by `data`. */ - void (*free)(void *this_arg); -} LDKScoreUpdate; + uintptr_t datalen; +} LDKCVec_u64Z; -/** - * A scorer that is accessed under a lock. - * - * 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 [`ScoreLookUp::channel_penalty_msat`] returning a different value for the same channel. - * - * [`find_route`]: crate::routing::router::find_route - */ -typedef struct LDKLockableScore { - /** - * 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 read locked scorer. - */ - 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. - */ - void (*free)(void *this_arg); -} LDKLockableScore; -/** - * Refers to a scorer that is accessible under lock and also writeable to disk - * - * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to - * use the Persister to persist it. - */ -typedef struct LDKWriteableScore { - /** - * 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 LockableScore for this object. - */ - struct LDKLockableScore LockableScore; - /** - * 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); -} LDKWriteableScore; /** - * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not + * Information used to route a payment. */ -typedef enum LDKCOption_WriteableScoreZ_Tag { - /** - * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore - */ - LDKCOption_WriteableScoreZ_Some, +typedef struct MUST_USE_STRUCT LDKPaymentParameters { /** - * When we're in this state, this COption_WriteableScoreZ contains nothing + * 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. */ - LDKCOption_WriteableScoreZ_None, + LDKnativePaymentParameters *inner; /** - * Must be last for serialization purposes + * 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_WriteableScoreZ_Sentinel, -} LDKCOption_WriteableScoreZ_Tag; - -typedef struct LDKCOption_WriteableScoreZ { - LDKCOption_WriteableScoreZ_Tag tag; - union { - struct { - struct LDKWriteableScore some; - }; - }; -} LDKCOption_WriteableScoreZ; + bool is_owned; +} LDKPaymentParameters; /** - * The contents of CResult_NoneIOErrorZ + * The contents of CResult_PaymentParametersDecodeErrorZ */ -typedef union LDKCResult_NoneIOErrorZPtr { +typedef union LDKCResult_PaymentParametersDecodeErrorZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKPaymentParameters *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_NoneIOErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_PaymentParametersDecodeErrorZPtr; /** - * A CResult_NoneIOErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::c_types::IOError on failure. + * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::PaymentParameters 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_NoneIOErrorZ { +typedef struct LDKCResult_PaymentParametersDecodeErrorZ { /** - * The contents of this CResult_NoneIOErrorZ, accessible via either + * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneIOErrorZPtr contents; + union LDKCResult_PaymentParametersDecodeErrorZPtr contents; /** - * Whether this CResult_NoneIOErrorZ represents a success state. + * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneIOErrorZ; +} LDKCResult_PaymentParametersDecodeErrorZ; /** - * Parameters needed to find a [`Route`]. - * - * Passed to [`find_route`] and [`build_route_from_hops`]. + * A struct for configuring parameters for routing the payment. */ -typedef struct MUST_USE_STRUCT LDKRouteParameters { +typedef struct MUST_USE_STRUCT LDKRouteParametersConfig { /** * 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. */ - LDKnativeRouteParameters *inner; + LDKnativeRouteParametersConfig *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; -} LDKRouteParameters; - -/** - * A tuple of 3 elements. See the individual fields for the types contained. - */ -typedef struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - /** - * The element at position 0 - */ - struct LDKThirtyTwoBytes a; - /** - * The element at position 1 - */ - struct LDKRecipientOnionFields b; - /** - * The element at position 2 - */ - struct LDKRouteParameters c; -} LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ; +} LDKRouteParametersConfig; /** - * The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ + * The contents of CResult_RouteParametersConfigDecodeErrorZ */ -typedef union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { +typedef union LDKCResult_RouteParametersConfigDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *result; + struct LDKRouteParametersConfig *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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_RouteParametersConfigDecodeErrorZPtr; /** - * A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure. + * A CResult_RouteParametersConfigDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteParametersConfig 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { +typedef struct LDKCResult_RouteParametersConfigDecodeErrorZ { /** - * The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either + * The contents of this CResult_RouteParametersConfigDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr contents; + union LDKCResult_RouteParametersConfigDecodeErrorZPtr contents; /** - * Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state. + * Whether this CResult_RouteParametersConfigDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ; +} LDKCResult_RouteParametersConfigDecodeErrorZ; /** - * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`] - * - * Balances of a channel are available through [`ChainMonitor::get_claimable_balances`] and - * [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain - * transactions. - * - * [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels - * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels - * [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances - * [`ChannelMonitor::get_claimable_balances`]: crate::chain::channelmonitor::ChannelMonitor::get_claimable_balances + * A list of hops along a payment path terminating with a channel to the recipient. */ -typedef struct MUST_USE_STRUCT LDKChannelDetails { +typedef struct MUST_USE_STRUCT LDKRouteHint { /** * 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. */ - LDKnativeChannelDetails *inner; + LDKnativeRouteHint *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; -} LDKChannelDetails; +} LDKRouteHint; /** - * A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. + * A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_ChannelDetailsZ { +typedef struct LDKCVec_RouteHintZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKChannelDetails *data; + struct LDKRouteHint *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_ChannelDetailsZ; - +} LDKCVec_RouteHintZ; +/** + * The contents of CResult_RouteHintDecodeErrorZ + */ +typedef union LDKCResult_RouteHintDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteHint *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_RouteHintDecodeErrorZPtr; /** - * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP, - * it can take multiple paths. Each path is composed of one or more hops through the network. + * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::routing::RouteHint 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 MUST_USE_STRUCT LDKRoute { +typedef struct LDKCResult_RouteHintDecodeErrorZ { /** - * 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. + * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeRoute *inner; + union LDKCResult_RouteHintDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_RouteHintDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKRoute; + bool result_ok; +} LDKCResult_RouteHintDecodeErrorZ; /** - * An Err type for failure to process messages. + * A channel descriptor for a hop along a payment path. + * + * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are + * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as + * fields not supported in BOLT 11 will be stripped. */ -typedef struct MUST_USE_STRUCT LDKLightningError { +typedef struct MUST_USE_STRUCT LDKRouteHintHop { /** * 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. */ - LDKnativeLightningError *inner; + LDKnativeRouteHintHop *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; -} LDKLightningError; +} LDKRouteHintHop; /** - * The contents of CResult_RouteLightningErrorZ + * The contents of CResult_RouteHintHopDecodeErrorZ */ -typedef union LDKCResult_RouteLightningErrorZPtr { +typedef union LDKCResult_RouteHintHopDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRoute *result; + struct LDKRouteHintHop *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKLightningError *err; -} LDKCResult_RouteLightningErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_RouteHintHopDecodeErrorZPtr; /** - * A CResult_RouteLightningErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. + * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::routing::RouteHintHop 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_RouteLightningErrorZ { +typedef struct LDKCResult_RouteHintHopDecodeErrorZ { /** - * The contents of this CResult_RouteLightningErrorZ, accessible via either + * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RouteLightningErrorZPtr contents; + union LDKCResult_RouteHintHopDecodeErrorZPtr contents; /** - * Whether this CResult_RouteLightningErrorZ represents a success state. + * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RouteLightningErrorZ; - -/** - * The contents of CResult_CVec_BlindedPaymentPathZNoneZ - */ -typedef union LDKCResult_CVec_BlindedPaymentPathZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_BlindedPaymentPathZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_CVec_BlindedPaymentPathZNoneZPtr; +} LDKCResult_RouteHintHopDecodeErrorZ; /** - * A CResult_CVec_BlindedPaymentPathZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_BlindedPaymentPathZ 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::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_CVec_BlindedPaymentPathZNoneZ { +typedef struct LDKCVec_PublicKeyZ { /** - * The contents of this CResult_CVec_BlindedPaymentPathZNoneZ, 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_CVec_BlindedPaymentPathZNoneZPtr contents; + struct LDKPublicKey *data; /** - * Whether this CResult_CVec_BlindedPaymentPathZNoneZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_CVec_BlindedPaymentPathZNoneZ; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; /** - * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for - * in-use channel liquidity. + * [`ScoreLookUp`] implementation that uses a fixed penalty. */ -typedef struct MUST_USE_STRUCT LDKInFlightHtlcs { +typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { /** * 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. */ - LDKnativeInFlightHtlcs *inner; + LDKnativeFixedPenaltyScorer *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; -} LDKInFlightHtlcs; +} LDKFixedPenaltyScorer; /** - * The contents of CResult_InFlightHtlcsDecodeErrorZ + * The contents of CResult_FixedPenaltyScorerDecodeErrorZ */ -typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { +typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInFlightHtlcs *result; + struct LDKFixedPenaltyScorer *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_InFlightHtlcsDecodeErrorZPtr; +} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr; /** - * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::FixedPenaltyScorer 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_InFlightHtlcsDecodeErrorZ { +typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { /** - * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; + union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents; /** - * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InFlightHtlcsDecodeErrorZ; +} LDKCResult_FixedPenaltyScorerDecodeErrorZ; /** - * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel - * that leads to it. + * Container for live and historical liquidity bounds for each channel. */ -typedef struct MUST_USE_STRUCT LDKRouteHop { +typedef struct MUST_USE_STRUCT LDKChannelLiquidities { /** * 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. */ - LDKnativeRouteHop *inner; + LDKnativeChannelLiquidities *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; -} LDKRouteHop; +} LDKChannelLiquidities; /** - * The contents of CResult_RouteHopDecodeErrorZ + * The contents of CResult_ChannelLiquiditiesDecodeErrorZ */ -typedef union LDKCResult_RouteHopDecodeErrorZPtr { +typedef union LDKCResult_ChannelLiquiditiesDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRouteHop *result; + struct LDKChannelLiquidities *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_RouteHopDecodeErrorZPtr; +} LDKCResult_ChannelLiquiditiesDecodeErrorZPtr; /** - * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteHop on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ChannelLiquiditiesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::scoring::ChannelLiquidities 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_RouteHopDecodeErrorZ { +typedef struct LDKCResult_ChannelLiquiditiesDecodeErrorZ { /** - * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelLiquiditiesDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RouteHopDecodeErrorZPtr contents; + union LDKCResult_ChannelLiquiditiesDecodeErrorZPtr contents; /** - * Whether this CResult_RouteHopDecodeErrorZ represents a success state. + * Whether this CResult_ChannelLiquiditiesDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RouteHopDecodeErrorZ; +} LDKCResult_ChannelLiquiditiesDecodeErrorZ; /** - * 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. + * A compressed pubkey which a node uses to sign announcements and decode HTLCs routed through it. + * + * This type stores a simple byte array which is not checked for validity (i.e. that it describes + * a point which lies on the secp256k1 curve), unlike [`PublicKey`], as validity checking would + * otherwise represent a large portion of [`NetworkGraph`] deserialization time (and RGS + * application). */ -typedef struct MUST_USE_STRUCT LDKBlindedHop { +typedef struct MUST_USE_STRUCT LDKNodeId { /** * 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. */ - LDKnativeBlindedHop *inner; + LDKnativeNodeId *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; -} LDKBlindedHop; +} LDKNodeId; /** - * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size. + * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_BlindedHopZ { +typedef struct LDKCVec_NodeIdZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKBlindedHop *data; + struct LDKNodeId *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_BlindedHopZ; - - +} LDKCVec_NodeIdZ; /** - * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in - * their [`Bolt12Invoice`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKBlindedTail { +typedef struct LDKC2Tuple_u64u64Z { /** - * 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. + * The element at position 0 */ - LDKnativeBlindedTail *inner; + uint64_t a; /** - * 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. + * The element at position 1 */ - bool is_owned; -} LDKBlindedTail; + uint64_t b; +} LDKC2Tuple_u64u64Z; /** - * The contents of CResult_BlindedTailDecodeErrorZ + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not */ -typedef union LDKCResult_BlindedTailDecodeErrorZPtr { +typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z */ - struct LDKBlindedTail *result; + LDKCOption_C2Tuple_u64u64ZZ_Some, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing */ - struct LDKDecodeError *err; -} LDKCResult_BlindedTailDecodeErrorZPtr; + LDKCOption_C2Tuple_u64u64ZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_u64u64ZZ_Sentinel, +} LDKCOption_C2Tuple_u64u64ZZ_Tag; + +typedef struct LDKCOption_C2Tuple_u64u64ZZ { + LDKCOption_C2Tuple_u64u64ZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_u64u64Z some; + }; + }; +} LDKCOption_C2Tuple_u64u64ZZ; /** - * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * 32 u16s */ -typedef struct LDKCResult_BlindedTailDecodeErrorZ { - /** - * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_BlindedTailDecodeErrorZPtr contents; +typedef struct LDKThirtyTwoU16s { /** - * Whether this CResult_BlindedTailDecodeErrorZ represents a success state. + * The thirty-two 16-bit integers */ - bool result_ok; -} LDKCResult_BlindedTailDecodeErrorZ; + uint16_t data[32]; +} LDKThirtyTwoU16s; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. - * This corresponds to std::vector in C++ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCVec_RouteHopZ { +typedef struct LDKC2Tuple_Z { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The element at position 0 */ - struct LDKRouteHop *data; + struct LDKThirtyTwoU16s a; /** - * The number of elements pointed to by `data`. + * The element at position 1 */ - uintptr_t datalen; -} LDKCVec_RouteHopZ; + struct LDKThirtyTwoU16s b; +} LDKC2Tuple_Z; /** - * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. - * This corresponds to std::vector in C++ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCVec_PathZ { +typedef struct LDKC2Tuple__u1632_u1632Z { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The element at position 0 */ - struct LDKPath *data; + struct LDKThirtyTwoU16s a; /** - * The number of elements pointed to by `data`. + * The element at position 1 */ - uintptr_t datalen; -} LDKCVec_PathZ; + struct LDKThirtyTwoU16s b; +} LDKC2Tuple__u1632_u1632Z; /** - * The contents of CResult_RouteDecodeErrorZ + * An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not */ -typedef union LDKCResult_RouteDecodeErrorZPtr { +typedef enum LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRoute *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_RouteDecodeErrorZPtr; - -/** - * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route 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_RouteDecodeErrorZ { - /** - * The contents of this CResult_RouteDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteDecodeErrorZ; - -/** - * The contents of CResult_RouteParametersDecodeErrorZ - */ -typedef union LDKCResult_RouteParametersDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRouteParameters *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_RouteParametersDecodeErrorZPtr; - -/** - * A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteParameters 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_RouteParametersDecodeErrorZ { - /** - * The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteParametersDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteParametersDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteParametersDecodeErrorZ; - -/** - * A dynamically-allocated array of u64s of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_u64Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - uint64_t *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_u64Z; - - - -/** - * Information used to route a payment. - */ -typedef struct MUST_USE_STRUCT LDKPaymentParameters { - /** - * 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. - */ - LDKnativePaymentParameters *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; -} LDKPaymentParameters; - -/** - * The contents of CResult_PaymentParametersDecodeErrorZ - */ -typedef union LDKCResult_PaymentParametersDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPaymentParameters *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_PaymentParametersDecodeErrorZPtr; - -/** - * A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::PaymentParameters 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_PaymentParametersDecodeErrorZ { - /** - * The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PaymentParametersDecodeErrorZPtr contents; - /** - * Whether this CResult_PaymentParametersDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PaymentParametersDecodeErrorZ; - - - -/** - * A list of hops along a payment path terminating with a channel to the recipient. - */ -typedef struct MUST_USE_STRUCT LDKRouteHint { - /** - * 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. - */ - LDKnativeRouteHint *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; -} LDKRouteHint; - -/** - * A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_RouteHintZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKRouteHint *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_RouteHintZ; - -/** - * The contents of CResult_RouteHintDecodeErrorZ - */ -typedef union LDKCResult_RouteHintDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRouteHint *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_RouteHintDecodeErrorZPtr; - -/** - * A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::routing::RouteHint 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_RouteHintDecodeErrorZ { - /** - * The contents of this CResult_RouteHintDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteHintDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteHintDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteHintDecodeErrorZ; - - - -/** - * A channel descriptor for a hop along a payment path. - * - * While this generally comes from BOLT 11's `r` field, this struct includes more fields than are - * available in BOLT 11. Thus, encoding and decoding this via `lightning-invoice` is lossy, as - * fields not supported in BOLT 11 will be stripped. - */ -typedef struct MUST_USE_STRUCT LDKRouteHintHop { - /** - * 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. - */ - LDKnativeRouteHintHop *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; -} LDKRouteHintHop; - -/** - * The contents of CResult_RouteHintHopDecodeErrorZ - */ -typedef union LDKCResult_RouteHintHopDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRouteHintHop *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_RouteHintHopDecodeErrorZPtr; - -/** - * A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::routing::RouteHintHop 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_RouteHintHopDecodeErrorZ { - /** - * The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteHintHopDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteHintHopDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteHintHopDecodeErrorZ; - -/** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PublicKeyZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKPublicKey *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; - -/** - * A dynamically-allocated array of u16s of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_u16Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - uint16_t *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_u16Z; - - - -/** - * [`ScoreLookUp`] implementation that uses a fixed penalty. - */ -typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { - /** - * 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. - */ - LDKnativeFixedPenaltyScorer *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; -} LDKFixedPenaltyScorer; - -/** - * The contents of CResult_FixedPenaltyScorerDecodeErrorZ - */ -typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKFixedPenaltyScorer *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_FixedPenaltyScorerDecodeErrorZPtr; - -/** - * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::scoring::FixedPenaltyScorer 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_FixedPenaltyScorerDecodeErrorZ { - /** - * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents; - /** - * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_FixedPenaltyScorerDecodeErrorZ; - - - -/** - * Represents the compressed public key of a node - */ -typedef struct MUST_USE_STRUCT LDKNodeId { - /** - * 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. - */ - LDKnativeNodeId *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; -} LDKNodeId; - -/** - * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_NodeIdZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKNodeId *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_NodeIdZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_u64u64Z { - /** - * The element at position 0 - */ - uint64_t a; - /** - * The element at position 1 - */ - uint64_t b; -} LDKC2Tuple_u64u64Z; - -/** - * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not - */ -typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { - /** - * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z - */ - LDKCOption_C2Tuple_u64u64ZZ_Some, - /** - * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing - */ - LDKCOption_C2Tuple_u64u64ZZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_C2Tuple_u64u64ZZ_Sentinel, -} LDKCOption_C2Tuple_u64u64ZZ_Tag; - -typedef struct LDKCOption_C2Tuple_u64u64ZZ { - LDKCOption_C2Tuple_u64u64ZZ_Tag tag; - union { - struct { - struct LDKC2Tuple_u64u64Z some; - }; - }; -} LDKCOption_C2Tuple_u64u64ZZ; - -/** - * 32 u16s - */ -typedef struct LDKThirtyTwoU16s { - /** - * The thirty-two 16-bit integers - */ - uint16_t data[32]; -} LDKThirtyTwoU16s; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_Z { - /** - * The element at position 0 - */ - struct LDKThirtyTwoU16s a; - /** - * The element at position 1 - */ - struct LDKThirtyTwoU16s b; -} LDKC2Tuple_Z; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple__u1632_u1632Z { - /** - * The element at position 0 - */ - struct LDKThirtyTwoU16s a; - /** - * The element at position 1 - */ - 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 + * When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z */ LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_Some, /** @@ -6376,6 +6123,12 @@ typedef struct LDKLogger { * Logs the [`Record`]. */ void (*log)(const void *this_arg, struct LDKRecord record); + /** + * Called, if set, after this Logger has been cloned into a duplicate object. + * The new Logger 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 LDKLogger *NONNULL_PTR new_Logger); /** * 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. @@ -6677,6 +6430,33 @@ typedef struct MUST_USE_STRUCT LDKUntrustedString { bool is_owned; } LDKUntrustedString; +/** + * 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; + /** * The reason the channel was closed. See individual variants for more details. */ @@ -6689,9 +6469,11 @@ typedef enum LDKClosureReason_Tag { */ LDKClosureReason_CounterpartyForceClosed, /** - * Closure generated from [`ChannelManager::force_close_channel`], called by the user. + * Closure generated from [`ChannelManager::force_close_broadcasting_latest_txn`] or + * [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`], called by the user. * - * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn + * [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn */ LDKClosureReason_HolderForceClosed, /** @@ -6722,7 +6504,8 @@ typedef enum LDKClosureReason_Tag { */ LDKClosureReason_CommitmentTxConfirmed, /** - * The funding transaction failed to confirm in a timely manner on an inbound channel. + * The funding transaction failed to confirm in a timely manner on an inbound channel or the + * counterparty failed to fund the channel in a timely manner. */ LDKClosureReason_FundingTimedOut, /** @@ -6755,6 +6538,14 @@ typedef enum LDKClosureReason_Tag { * The channel has been immediately closed. */ LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, + /** + * We requested a cooperative close of a channel that had not been funded yet. + * The channel has been immediately closed. + * + * Note that events containing this variant will be lost on downgrade to a version of LDK + * prior to 0.2. + */ + LDKClosureReason_LocallyCoopClosedUnfundedChannel, /** * Another channel in the same funding batch closed before the funding transaction * was ready to be broadcast. @@ -6788,7 +6579,7 @@ typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { * a security vulnerability in the terminal emulator or the logging subsystem. * To be safe, use `Display` on `UntrustedString` * - * [`UntrustedString`]: crate::util::string::UntrustedString + * [`UntrustedString`]: crate::types::string::UntrustedString */ struct LDKUntrustedString peer_msg; } LDKClosureReason_LDKCounterpartyForceClosed_Body; @@ -6798,17 +6589,24 @@ typedef struct LDKClosureReason_LDKHolderForceClosed_Body { * Whether or not the latest transaction was broadcasted when the channel was force * closed. * - * Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have - * this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`] - * or force-closed prior to being funded will have this field set to false. + * This will be set to `Some(true)` for any channels closed after their funding + * transaction was (or might have been) broadcasted, and `Some(false)` for any channels + * closed prior to their funding transaction being broadcasted. * * This will be `None` for objects generated or written by LDK 0.0.123 and * earlier. - * - * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn. - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn. */ struct LDKCOption_boolZ broadcasted_latest_txn; + /** + * The error message provided to [`ChannelManager::force_close_broadcasting_latest_txn`] or + * [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]. + * + * This will be the empty string for objects generated or written by LDK 0.1 and earlier. + * + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn + * [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn + */ + struct LDKStr message; } LDKClosureReason_LDKHolderForceClosed_Body; typedef struct LDKClosureReason_LDKProcessingError_Body { @@ -6818,6 +6616,15 @@ typedef struct LDKClosureReason_LDKProcessingError_Body { struct LDKStr err; } LDKClosureReason_LDKProcessingError_Body; +typedef struct LDKClosureReason_LDKHTLCsTimedOut_Body { + /** + * The payment hash of an HTLC that timed out. + * + * Will be `None` for any event serialized by LDK prior to 0.2. + */ + struct LDKCOption_ThirtyTwoBytesZ payment_hash; +} LDKClosureReason_LDKHTLCsTimedOut_Body; + typedef struct LDKClosureReason_LDKPeerFeerateTooLow_Body { /** * The feerate on our channel set by our peer. @@ -6837,6 +6644,7 @@ typedef struct MUST_USE_STRUCT LDKClosureReason { LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; LDKClosureReason_LDKHolderForceClosed_Body holder_force_closed; LDKClosureReason_LDKProcessingError_Body processing_error; + LDKClosureReason_LDKHTLCsTimedOut_Body htl_cs_timed_out; LDKClosureReason_LDKPeerFeerateTooLow_Body peer_feerate_too_low; }; } LDKClosureReason; @@ -6886,6 +6694,11 @@ typedef enum LDKMonitorEvent_Tag { * channel. */ LDKMonitorEvent_HolderForceClosed, + /** + * Indicates that we've detected a commitment transaction (either holder's or counterparty's) + * be included in a block and should consider the channel closed. + */ + LDKMonitorEvent_CommitmentTxConfirmed, /** * Indicates a [`ChannelMonitor`] update has completed. See * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. @@ -7002,262 +6815,14 @@ typedef struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { } LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; /** - * An enum which can either contain a crate::c_types::Str or not + * The contents of CResult_OfferIdDecodeErrorZ */ -typedef enum LDKCOption_StrZ_Tag { +typedef union LDKCResult_OfferIdDecodeErrorZPtr { /** - * When we're in this state, this COption_StrZ contains a crate::c_types::Str + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_StrZ_Some, - /** - * When we're in this state, this COption_StrZ contains nothing - */ - LDKCOption_StrZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_StrZ_Sentinel, -} LDKCOption_StrZ_Tag; - -typedef struct LDKCOption_StrZ { - LDKCOption_StrZ_Tag tag; - union { - struct { - struct LDKStr some; - }; - }; -} LDKCOption_StrZ; - - - -/** - * A JSON-RPC request's `id`. - * - * Please refer to the [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification#request_object) for - * more information. - */ -typedef struct MUST_USE_STRUCT LDKLSPSRequestId { - /** - * 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. - */ - LDKnativeLSPSRequestId *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; -} LDKLSPSRequestId; - -/** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) - */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_InvalidRoute, - /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] - * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a - * monitor update is awaiting async resolution. Once it resolves the attempted action should - * complete automatically. - * - * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel - * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel - * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress - */ - LDKAPIError_MonitorUpdateInProgress, - /** - * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible - * with the channel counterparty as negotiated in [`InitFeatures`]. - * - * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open - * a channel or cooperatively close one with this peer (and will have to force-close instead). - * - * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey - * [`InitFeatures`]: crate::types::features::InitFeatures - */ - LDKAPIError_IncompatibleShutdownScript, - /** - * Must be last for serialization purposes - */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKAPIMisuseError_Body; - -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - /** - * A human-readable error message - */ - struct LDKStr err; - /** - * The feerate which was too high. - */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKInvalidRoute_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKInvalidRoute_Body; - -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { - /** - * The incompatible shutdown script. - */ - struct LDKShutdownScript script; -} LDKAPIError_LDKIncompatibleShutdownScript_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKInvalidRoute_Body invalid_route; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; - }; -} LDKAPIError; - -/** - * The contents of CResult_LSPSRequestIdAPIErrorZ - */ -typedef union LDKCResult_LSPSRequestIdAPIErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKLSPSRequestId *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult_LSPSRequestIdAPIErrorZPtr; - -/** - * A CResult_LSPSRequestIdAPIErrorZ represents the result of a fallible operation, - * containing a crate::lightning_liquidity::lsps0::ser::LSPSRequestId 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_LSPSRequestIdAPIErrorZ { - /** - * The contents of this CResult_LSPSRequestIdAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_LSPSRequestIdAPIErrorZPtr contents; - /** - * Whether this CResult_LSPSRequestIdAPIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_LSPSRequestIdAPIErrorZ; - - - -/** - * Fees and parameters for a JIT Channel including the promise. - * - * The promise is an HMAC calculated using a secret known to the LSP and the rest of the fields as input. - * It exists so the LSP can verify the authenticity of a client provided LSPS2OpeningFeeParams by recalculating - * the promise using the secret. Once verified they can be confident it was not modified by the client. - */ -typedef struct MUST_USE_STRUCT LDKLSPS2OpeningFeeParams { - /** - * 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. - */ - LDKnativeLSPS2OpeningFeeParams *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; -} LDKLSPS2OpeningFeeParams; - -/** - * A dynamically-allocated array of crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParamss of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_LSPS2OpeningFeeParamsZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKLSPS2OpeningFeeParams *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_LSPS2OpeningFeeParamsZ; - - - -/** - * An identifier for an [`Offer`] built using [`DerivedMetadata`]. - */ -typedef struct MUST_USE_STRUCT LDKOfferId { - /** - * 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. - */ - LDKnativeOfferId *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; -} LDKOfferId; - -/** - * The contents of CResult_OfferIdDecodeErrorZ - */ -typedef union LDKCResult_OfferIdDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKOfferId *result; + struct LDKOfferId *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. @@ -7437,6 +7002,63 @@ typedef struct LDKCResult_OfferDecodeErrorZ { bool result_ok; } LDKCResult_OfferDecodeErrorZ; + + +/** + * An error indicating that a currency code is invalid. + * + * A valid currency code must follow the ISO 4217 standard: + * - Exactly 3 characters in length. + * - Consist only of uppercase ASCII letters (A–Z). + */ +typedef struct MUST_USE_STRUCT LDKCurrencyCodeError { + /** + * 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. + */ + LDKnativeCurrencyCodeError *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; +} LDKCurrencyCodeError; + +/** + * The contents of CResult_CurrencyCodeCurrencyCodeErrorZ + */ +typedef union LDKCResult_CurrencyCodeCurrencyCodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCurrencyCode *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKCurrencyCodeError *err; +} LDKCResult_CurrencyCodeCurrencyCodeErrorZPtr; + +/** + * A CResult_CurrencyCodeCurrencyCodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::CurrencyCode on success and a crate::lightning::offers::offer::CurrencyCodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ { + /** + * The contents of this CResult_CurrencyCodeCurrencyCodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CurrencyCodeCurrencyCodeErrorZPtr contents; + /** + * Whether this CResult_CurrencyCodeCurrencyCodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CurrencyCodeCurrencyCodeErrorZ; + /** * The contents of CResult_OfferBolt12ParseErrorZ */ @@ -7470,258 +7092,637 @@ typedef struct LDKCResult_OfferBolt12ParseErrorZ { bool result_ok; } LDKCResult_OfferBolt12ParseErrorZ; + + /** - * The contents of CResult_NodeIdDecodeErrorZ + * Information about an HTLC as it appears in a commitment transaction */ -typedef union LDKCResult_NodeIdDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKHTLCOutputInCommitment { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKNodeId *result; + LDKnativeHTLCOutputInCommitment *inner; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * 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. */ - struct LDKDecodeError *err; -} LDKCResult_NodeIdDecodeErrorZPtr; + bool is_owned; +} LDKHTLCOutputInCommitment; /** - * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_NodeIdDecodeErrorZ { +typedef struct LDKCVec_HTLCOutputInCommitmentZ { /** - * The contents of this CResult_NodeIdDecodeErrorZ, 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_NodeIdDecodeErrorZPtr contents; + struct LDKHTLCOutputInCommitment *data; /** - * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_NodeIdDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_HTLCOutputInCommitmentZ; /** - * The contents of CResult_PublicKeySecp256k1ErrorZ + * A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_PublicKeySecp256k1ErrorZPtr { +typedef struct LDKCVec_HTLCDescriptorZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKPublicKey *result; + struct LDKHTLCDescriptor *data; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The number of elements pointed to by `data`. */ - enum LDKSecp256k1Error *err; -} LDKCResult_PublicKeySecp256k1ErrorZPtr; + uintptr_t datalen; +} LDKCVec_HTLCDescriptorZ; + + /** - * 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`. + * An unspent transaction output that is available to spend resulting from a successful + * [`CoinSelection`] attempt. */ -typedef struct LDKCResult_PublicKeySecp256k1ErrorZ { +typedef struct MUST_USE_STRUCT LDKUtxo { /** - * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * 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. */ - union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; + LDKnativeUtxo *inner; /** - * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. + * 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 result_ok; -} LDKCResult_PublicKeySecp256k1ErrorZ; + bool is_owned; +} LDKUtxo; /** - * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion - * return packet by a node along the route. See [BOLT #4] for details. - * - * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md + * The contents of CResult_UtxoDecodeErrorZ */ -typedef enum LDKNetworkUpdate_Tag { - /** - * An error indicating that a channel failed to route a payment, which should be applied via - * [`NetworkGraph::channel_failed_permanent`] if permanent. - */ - LDKNetworkUpdate_ChannelFailure, +typedef union LDKCResult_UtxoDecodeErrorZPtr { /** - * An error indicating that a node failed to route a payment, which should be applied via - * [`NetworkGraph::node_failed_permanent`] if permanent. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKNetworkUpdate_NodeFailure, + struct LDKUtxo *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. */ - LDKNetworkUpdate_Sentinel, -} LDKNetworkUpdate_Tag; + struct LDKDecodeError *err; +} LDKCResult_UtxoDecodeErrorZPtr; -typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { +/** + * A CResult_UtxoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::bump_transaction::Utxo 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_UtxoDecodeErrorZ { /** - * The short channel id of the closed channel. + * The contents of this CResult_UtxoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t short_channel_id; + union LDKCResult_UtxoDecodeErrorZPtr contents; /** - * Whether the channel should be permanently removed or temporarily disabled until a new - * `channel_update` message is received. + * Whether this CResult_UtxoDecodeErrorZ represents a success state. */ - bool is_permanent; -} LDKNetworkUpdate_LDKChannelFailure_Body; + bool result_ok; +} LDKCResult_UtxoDecodeErrorZ; -typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { +/** + * A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_UtxoZ { /** - * The node id of the failed node. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKPublicKey node_id; + struct LDKUtxo *data; /** - * Whether the node should be permanently removed from consideration or can be restored - * when a new `channel_update` message is received. + * The number of elements pointed to by `data`. */ - bool is_permanent; -} LDKNetworkUpdate_LDKNodeFailure_Body; - -typedef struct MUST_USE_STRUCT LDKNetworkUpdate { - LDKNetworkUpdate_Tag tag; - union { - LDKNetworkUpdate_LDKChannelFailure_Body channel_failure; - LDKNetworkUpdate_LDKNodeFailure_Body node_failure; - }; -} LDKNetworkUpdate; + uintptr_t datalen; +} LDKCVec_UtxoZ; /** - * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not + * An enum which can either contain a crate::c_types::TxOut or not */ -typedef enum LDKCOption_NetworkUpdateZ_Tag { +typedef enum LDKCOption_TxOutZ_Tag { /** - * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate + * When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut */ - LDKCOption_NetworkUpdateZ_Some, + LDKCOption_TxOutZ_Some, /** - * When we're in this state, this COption_NetworkUpdateZ contains nothing + * When we're in this state, this COption_TxOutZ contains nothing */ - LDKCOption_NetworkUpdateZ_None, + LDKCOption_TxOutZ_None, /** * Must be last for serialization purposes */ - LDKCOption_NetworkUpdateZ_Sentinel, -} LDKCOption_NetworkUpdateZ_Tag; + LDKCOption_TxOutZ_Sentinel, +} LDKCOption_TxOutZ_Tag; -typedef struct LDKCOption_NetworkUpdateZ { - LDKCOption_NetworkUpdateZ_Tag tag; +typedef struct LDKCOption_TxOutZ { + LDKCOption_TxOutZ_Tag tag; union { struct { - struct LDKNetworkUpdate some; + struct LDKTxOut some; }; }; -} LDKCOption_NetworkUpdateZ; +} LDKCOption_TxOutZ; /** - * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ + * The contents of CResult_u64ShortChannelIdErrorZ */ -typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { +typedef union LDKCResult_u64ShortChannelIdErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_NetworkUpdateZ *result; + uint64_t *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_COption_NetworkUpdateZDecodeErrorZPtr; + enum LDKShortChannelIdError *err; +} LDKCResult_u64ShortChannelIdErrorZPtr; /** - * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, + * containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { +typedef struct LDKCResult_u64ShortChannelIdErrorZ { /** - * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either + * The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; + union LDKCResult_u64ShortChannelIdErrorZPtr contents; /** - * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + * Whether this CResult_u64ShortChannelIdErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; +} LDKCResult_u64ShortChannelIdErrorZ; + -/** - * The contents of CResult_TxOutUtxoLookupErrorZ - */ -typedef union LDKCResult_TxOutUtxoLookupErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxOut *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKUtxoLookupError *err; -} LDKCResult_TxOutUtxoLookupErrorZPtr; /** - * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation, - * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it + * should go next. */ -typedef struct LDKCResult_TxOutUtxoLookupErrorZ { +typedef struct MUST_USE_STRUCT LDKPendingHTLCInfo { /** - * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * 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. */ - union LDKCResult_TxOutUtxoLookupErrorZPtr contents; + LDKnativePendingHTLCInfo *inner; /** - * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state. + * 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 result_ok; -} LDKCResult_TxOutUtxoLookupErrorZ; + bool is_owned; +} LDKPendingHTLCInfo; /** - * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async. - * - * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info. + * Invalid inbound onion payment. */ -typedef struct MUST_USE_STRUCT LDKUtxoFuture { +typedef struct MUST_USE_STRUCT LDKInboundHTLCErr { /** * 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. */ - LDKnativeUtxoFuture *inner; + LDKnativeInboundHTLCErr *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; -} LDKUtxoFuture; +} LDKInboundHTLCErr; /** - * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously, - * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async` - * variant. + * The contents of CResult_PendingHTLCInfoInboundHTLCErrZ */ -typedef enum LDKUtxoResult_Tag { +typedef union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr { /** - * A result which was resolved synchronously. It either includes a [`TxOut`] for the output - * requested or a [`UtxoLookupError`]. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKUtxoResult_Sync, + struct LDKPendingHTLCInfo *result; /** - * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of - * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes. - * - * Note that in order to avoid runaway memory usage, the number of parallel checks is limited, + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKInboundHTLCErr *err; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr; + +/** + * A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ { + /** + * The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr contents; + /** + * Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. + */ + bool result_ok; +} LDKCResult_PendingHTLCInfoInboundHTLCErrZ; + +/** + * The contents of CResult_CVec_UtxoZNoneZ + */ +typedef union LDKCResult_CVec_UtxoZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_UtxoZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_UtxoZNoneZPtr; + +/** + * A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_UtxoZNoneZ { + /** + * The contents of this CResult_CVec_UtxoZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_UtxoZNoneZPtr contents; + /** + * Whether this CResult_CVec_UtxoZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_UtxoZNoneZ; + + + +/** + * An input that must be included in a transaction when performing coin selection through + * [`CoinSelectionSource::select_confirmed_utxos`]. It is guaranteed to be a SegWit input, so it + * must have an empty [`TxIn::script_sig`] when spent. + */ +typedef struct MUST_USE_STRUCT LDKInput { + /** + * 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. + */ + LDKnativeInput *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; +} LDKInput; + +/** + * A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_InputZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKInput *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_InputZ; + + + +/** + * The result of a successful coin selection attempt for a transaction requiring additional UTXOs + * to cover its fees. + */ +typedef struct MUST_USE_STRUCT LDKCoinSelection { + /** + * 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. + */ + LDKnativeCoinSelection *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; +} LDKCoinSelection; + +/** + * The contents of CResult_CoinSelectionNoneZ + */ +typedef union LDKCResult_CoinSelectionNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCoinSelection *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CoinSelectionNoneZPtr; + +/** + * A CResult_CoinSelectionNoneZ represents the result of a fallible operation, + * containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CoinSelectionNoneZ { + /** + * The contents of this CResult_CoinSelectionNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CoinSelectionNoneZPtr contents; + /** + * Whether this CResult_CoinSelectionNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CoinSelectionNoneZ; + +/** + * The contents of CResult_NodeIdDecodeErrorZ + */ +typedef union LDKCResult_NodeIdDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNodeId *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_NodeIdDecodeErrorZPtr; + +/** + * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeId 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_NodeIdDecodeErrorZ { + /** + * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NodeIdDecodeErrorZPtr contents; + /** + * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NodeIdDecodeErrorZ; + +/** + * The contents of CResult_PublicKeySecp256k1ErrorZ + */ +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. + */ + struct LDKPublicKey *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeySecp256k1ErrorZPtr; + +/** + * 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_PublicKeySecp256k1ErrorZ { + /** + * The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PublicKeySecp256k1ErrorZPtr contents; + /** + * Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PublicKeySecp256k1ErrorZ; + +/** + * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion + * return packet by a node along the route. See [BOLT #4] for details. + * + * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md + */ +typedef enum LDKNetworkUpdate_Tag { + /** + * An error indicating that a channel failed to route a payment, which should be applied via + * [`NetworkGraph::channel_failed_permanent`] if permanent. + */ + LDKNetworkUpdate_ChannelFailure, + /** + * An error indicating that a node failed to route a payment, which should be applied via + * [`NetworkGraph::node_failed_permanent`] if permanent. + */ + LDKNetworkUpdate_NodeFailure, + /** + * Must be last for serialization purposes + */ + LDKNetworkUpdate_Sentinel, +} LDKNetworkUpdate_Tag; + +typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { + /** + * The short channel id of the closed channel. + */ + uint64_t short_channel_id; + /** + * Whether the channel should be permanently removed or temporarily disabled until a new + * `channel_update` message is received. + */ + bool is_permanent; +} LDKNetworkUpdate_LDKChannelFailure_Body; + +typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { + /** + * The node id of the failed node. + */ + struct LDKPublicKey node_id; + /** + * Whether the node should be permanently removed from consideration or can be restored + * when a new `channel_update` message is received. + */ + bool is_permanent; +} LDKNetworkUpdate_LDKNodeFailure_Body; + +typedef struct MUST_USE_STRUCT LDKNetworkUpdate { + LDKNetworkUpdate_Tag tag; + union { + LDKNetworkUpdate_LDKChannelFailure_Body channel_failure; + LDKNetworkUpdate_LDKNodeFailure_Body node_failure; + }; +} LDKNetworkUpdate; + +/** + * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not + */ +typedef enum LDKCOption_NetworkUpdateZ_Tag { + /** + * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate + */ + LDKCOption_NetworkUpdateZ_Some, + /** + * When we're in this state, this COption_NetworkUpdateZ contains nothing + */ + LDKCOption_NetworkUpdateZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NetworkUpdateZ_Sentinel, +} LDKCOption_NetworkUpdateZ_Tag; + +typedef struct LDKCOption_NetworkUpdateZ { + LDKCOption_NetworkUpdateZ_Tag tag; + union { + struct { + struct LDKNetworkUpdate some; + }; + }; +} LDKCOption_NetworkUpdateZ; + +/** + * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ + */ +typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_NetworkUpdateZ *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_COption_NetworkUpdateZDecodeErrorZPtr; + +/** + * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_NetworkUpdateZ 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_COption_NetworkUpdateZDecodeErrorZ { + /** + * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; + +/** + * The contents of CResult_TxOutUtxoLookupErrorZ + */ +typedef union LDKCResult_TxOutUtxoLookupErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTxOut *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKUtxoLookupError *err; +} LDKCResult_TxOutUtxoLookupErrorZPtr; + +/** + * A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation, + * containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_TxOutUtxoLookupErrorZ { + /** + * The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TxOutUtxoLookupErrorZPtr contents; + /** + * Whether this CResult_TxOutUtxoLookupErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_TxOutUtxoLookupErrorZ; + + + +/** + * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async. + * + * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info. + */ +typedef struct MUST_USE_STRUCT LDKUtxoFuture { + /** + * 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. + */ + LDKnativeUtxoFuture *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; +} LDKUtxoFuture; + +/** + * The result of a [`UtxoLookup::get_utxo`] call. A call may resolve either synchronously, + * returning the `Sync` variant, or asynchronously, returning an [`UtxoFuture`] in the `Async` + * variant. + */ +typedef enum LDKUtxoResult_Tag { + /** + * A result which was resolved synchronously. It either includes a [`TxOut`] for the output + * requested or a [`UtxoLookupError`]. + */ + LDKUtxoResult_Sync, + /** + * A result which will be resolved asynchronously. It includes a [`UtxoFuture`], a `clone` of + * which you must keep locally and call [`UtxoFuture::resolve`] on once the lookup completes. + * + * Note that in order to avoid runaway memory usage, the number of parallel checks is limited, * but only fairly loosely. Because a pending checks block all message processing, leaving * checks pending for an extended time may cause DoS of other functions. It is recommended you * keep a tight timeout on lookups, on the order of a few seconds. @@ -7796,6 +7797,26 @@ typedef struct LDKCOption_UtxoLookupZ { }; } LDKCOption_UtxoLookupZ; + + +/** + * An Err type for failure to process messages. + */ +typedef struct MUST_USE_STRUCT LDKLightningError { + /** + * 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. + */ + LDKnativeLightningError *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; +} LDKLightningError; + /** * The contents of CResult_NoneLightningErrorZ */ @@ -8491,6 +8512,50 @@ typedef struct MUST_USE_STRUCT LDKClosingSigned { +/** + * A [`closing_complete`] message to be sent to or received from a peer. + * + * [`closing_complete`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig + */ +typedef struct MUST_USE_STRUCT LDKClosingComplete { + /** + * 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. + */ + LDKnativeClosingComplete *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; +} LDKClosingComplete; + + + +/** + * A [`closing_sig`] message to be sent to or received from a peer. + * + * [`closing_sig`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig + */ +typedef struct MUST_USE_STRUCT LDKClosingSig { + /** + * 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. + */ + LDKnativeClosingSig *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; +} LDKClosingSig; + + + /** * A [`shutdown`] message to be sent to or received from a peer. * @@ -8798,10 +8863,70 @@ typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter { bool is_owned; } LDKGossipTimestampFilter; + + +/** + * A [`peer_storage`] message that can be sent to or received from a peer. + * + * This message is used to distribute backup data to peers. + * If data is lost or corrupted, users can retrieve it through [`PeerStorageRetrieval`] + * to recover critical information, such as channel states, for fund recovery. + * + * [`peer_storage`] is used to send our own encrypted backup data to a peer. + * + * [`peer_storage`]: https://github.com/lightning/bolts/pull/1110 + */ +typedef struct MUST_USE_STRUCT LDKPeerStorage { + /** + * 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. + */ + LDKnativePeerStorage *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; +} LDKPeerStorage; + + + /** - * An event generated by ChannelManager which indicates a message should be sent to a peer (or - * broadcast to most peers). - * These events are handled by PeerManager::process_events if you are using a PeerManager. + * A [`peer_storage_retrieval`] message that can be sent to or received from a peer. + * + * This message is sent to peers for whom we store backup data. + * If we receive this message, it indicates that the peer had stored our backup data. + * This data can be used for fund recovery in case of data loss. + * + * [`peer_storage_retrieval`] is used to send the most recent backup of the peer. + * + * [`peer_storage_retrieval`]: https://github.com/lightning/bolts/pull/1110 + */ +typedef struct MUST_USE_STRUCT LDKPeerStorageRetrieval { + /** + * 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. + */ + LDKnativePeerStorageRetrieval *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; +} LDKPeerStorageRetrieval; + +/** + * An event generated by a [`BaseMessageHandler`] which indicates a message should be sent to a + * peer (or broadcast to most peers). + * + * These events are handled by [`PeerManager::process_events`] if you are using a [`PeerManager`]. + * + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`PeerManager`]: crate::ln::peer_handler::PeerManager */ typedef enum LDKMessageSendEvent_Tag { /** @@ -8905,6 +9030,14 @@ typedef enum LDKMessageSendEvent_Tag { * Used to indicate that a closing_signed message should be sent to the peer with the given node_id. */ LDKMessageSendEvent_SendClosingSigned, + /** + * Used to indicate that a `closing_complete` message should be sent to the peer with the given `node_id`. + */ + LDKMessageSendEvent_SendClosingComplete, + /** + * Used to indicate that a `closing_sig` message should be sent to the peer with the given `node_id`. + */ + LDKMessageSendEvent_SendClosingSig, /** * Used to indicate that a shutdown message should be sent to the peer with the given node_id. */ @@ -8968,6 +9101,17 @@ typedef enum LDKMessageSendEvent_Tag { * enable receiving gossip messages from the peer. */ LDKMessageSendEvent_SendGossipTimestampFilter, + /** + * Sends a channel partner Peer Storage of our backup which they should store. + * This should be sent on each new connection to the channel partner or whenever we want + * them to update the backup that they store. + */ + LDKMessageSendEvent_SendPeerStorage, + /** + * Sends a channel partner their own peer storage which we store and update when they send + * a [`PeerStorage`]. + */ + LDKMessageSendEvent_SendPeerStorageRetrieval, /** * Must be last for serialization purposes */ @@ -9210,6 +9354,10 @@ typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body { * The node_id of the node which should receive these message(s) */ struct LDKPublicKey node_id; + /** + * The channel_id associated with all the update messages. + */ + struct LDKChannelId channel_id; /** * The update messages which should be sent. ALL messages in the struct should be sent! */ @@ -9238,6 +9386,28 @@ typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body { struct LDKClosingSigned msg; } LDKMessageSendEvent_LDKSendClosingSigned_Body; +typedef struct LDKMessageSendEvent_LDKSendClosingComplete_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKClosingComplete msg; +} LDKMessageSendEvent_LDKSendClosingComplete_Body; + +typedef struct LDKMessageSendEvent_LDKSendClosingSig_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; + /** + * The message which should be sent. + */ + struct LDKClosingSig msg; +} LDKMessageSendEvent_LDKSendClosingSig_Body; + typedef struct LDKMessageSendEvent_LDKSendShutdown_Body { /** * The node_id of the node which should receive this message @@ -9368,6 +9538,28 @@ typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body { struct LDKGossipTimestampFilter msg; } LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body; +typedef struct LDKMessageSendEvent_LDKSendPeerStorage_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The peer_storage which should be sent. + */ + struct LDKPeerStorage msg; +} LDKMessageSendEvent_LDKSendPeerStorage_Body; + +typedef struct LDKMessageSendEvent_LDKSendPeerStorageRetrieval_Body { + /** + * The node_id of this message recipient + */ + struct LDKPublicKey node_id; + /** + * The peer_storage_retrieval which should be sent. + */ + struct LDKPeerStorageRetrieval msg; +} LDKMessageSendEvent_LDKSendPeerStorageRetrieval_Body; + typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_Tag tag; union { @@ -9395,6 +9587,8 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs; LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack; LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed; + LDKMessageSendEvent_LDKSendClosingComplete_Body send_closing_complete; + LDKMessageSendEvent_LDKSendClosingSig_Body send_closing_sig; LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown; LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish; LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement; @@ -9407,11 +9601,13 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query; LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range; LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter; + LDKMessageSendEvent_LDKSendPeerStorage_Body send_peer_storage; + LDKMessageSendEvent_LDKSendPeerStorageRetrieval_Body send_peer_storage_retrieval; }; } LDKMessageSendEvent; /** - * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::msgs::MessageSendEvents of arbitrary size. * This corresponds to std::vector in C++ */ typedef struct LDKCVec_MessageSendEventZ { @@ -10030,353 +10226,49 @@ typedef struct LDKCOption_CVec_SocketAddressZZ { }; } LDKCOption_CVec_SocketAddressZZ; -/** - * The contents of CResult_u64ShortChannelIdErrorZ - */ -typedef union LDKCResult_u64ShortChannelIdErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - uint64_t *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKShortChannelIdError *err; -} LDKCResult_u64ShortChannelIdErrorZPtr; - -/** - * A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, - * containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_u64ShortChannelIdErrorZ { - /** - * The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_u64ShortChannelIdErrorZPtr contents; - /** - * Whether this CResult_u64ShortChannelIdErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_u64ShortChannelIdErrorZ; - - - -/** - * Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it - * should go next. - */ -typedef struct MUST_USE_STRUCT LDKPendingHTLCInfo { - /** - * 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. - */ - LDKnativePendingHTLCInfo *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; -} LDKPendingHTLCInfo; - - - -/** - * Invalid inbound onion payment. - */ -typedef struct MUST_USE_STRUCT LDKInboundHTLCErr { - /** - * 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. - */ - LDKnativeInboundHTLCErr *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; -} LDKInboundHTLCErr; - -/** - * The contents of CResult_PendingHTLCInfoInboundHTLCErrZ - */ -typedef union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPendingHTLCInfo *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKInboundHTLCErr *err; -} LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr; - -/** - * A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ { - /** - * The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PendingHTLCInfoInboundHTLCErrZPtr contents; - /** - * Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. - */ - bool result_ok; -} LDKCResult_PendingHTLCInfoInboundHTLCErrZ; - -/** - * A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_HTLCOutputInCommitmentZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKHTLCOutputInCommitment *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_HTLCOutputInCommitmentZ; - -/** - * A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_HTLCDescriptorZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKHTLCDescriptor *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_HTLCDescriptorZ; - /** - * An unspent transaction output that is available to spend resulting from a successful - * [`CoinSelection`] attempt. - */ -typedef struct MUST_USE_STRUCT LDKUtxo { - /** - * 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. - */ - LDKnativeUtxo *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; -} LDKUtxo; - -/** - * A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_UtxoZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKUtxo *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_UtxoZ; - -/** - * An enum which can either contain a crate::c_types::TxOut or not - */ -typedef enum LDKCOption_TxOutZ_Tag { - /** - * When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut - */ - LDKCOption_TxOutZ_Some, - /** - * When we're in this state, this COption_TxOutZ contains nothing - */ - LDKCOption_TxOutZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_TxOutZ_Sentinel, -} LDKCOption_TxOutZ_Tag; - -typedef struct LDKCOption_TxOutZ { - LDKCOption_TxOutZ_Tag tag; - union { - struct { - struct LDKTxOut some; - }; - }; -} LDKCOption_TxOutZ; - - - -/** - * An input that must be included in a transaction when performing coin selection through - * [`CoinSelectionSource::select_confirmed_utxos`]. It is guaranteed to be a SegWit input, so it - * must have an empty [`TxIn::script_sig`] when spent. - */ -typedef struct MUST_USE_STRUCT LDKInput { - /** - * 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. - */ - LDKnativeInput *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; -} LDKInput; - -/** - * A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_InputZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKInput *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_InputZ; - - - -/** - * The result of a successful coin selection attempt for a transaction requiring additional UTXOs - * to cover its fees. + * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer */ -typedef struct MUST_USE_STRUCT LDKCoinSelection { +typedef struct MUST_USE_STRUCT LDKBolt12OfferContext { /** * 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. */ - LDKnativeCoinSelection *inner; + LDKnativeBolt12OfferContext *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; -} LDKCoinSelection; - -/** - * The contents of CResult_CoinSelectionNoneZ - */ -typedef union LDKCResult_CoinSelectionNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCoinSelection *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_CoinSelectionNoneZPtr; - -/** - * A CResult_CoinSelectionNoneZ represents the result of a fallible operation, - * containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CoinSelectionNoneZ { - /** - * The contents of this CResult_CoinSelectionNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CoinSelectionNoneZPtr contents; - /** - * Whether this CResult_CoinSelectionNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_CoinSelectionNoneZ; - -/** - * The contents of CResult_CVec_UtxoZNoneZ - */ -typedef union LDKCResult_CVec_UtxoZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_UtxoZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_CVec_UtxoZNoneZPtr; - -/** - * A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_UtxoZNoneZ { - /** - * The contents of this CResult_CVec_UtxoZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_UtxoZNoneZPtr contents; - /** - * Whether this CResult_CVec_UtxoZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_UtxoZNoneZ; +} LDKBolt12OfferContext; /** - * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`]. + * The context of a payment made for a static invoice requested from a BOLT 12 [`Offer`]. * * [`Offer`]: crate::offers::offer::Offer */ -typedef struct MUST_USE_STRUCT LDKBolt12OfferContext { +typedef struct MUST_USE_STRUCT LDKAsyncBolt12OfferContext { /** * 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. */ - LDKnativeBolt12OfferContext *inner; + LDKnativeAsyncBolt12OfferContext *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; -} LDKBolt12OfferContext; +} LDKAsyncBolt12OfferContext; @@ -10413,6 +10305,12 @@ typedef enum LDKPaymentContext_Tag { * [`Offer`]: crate::offers::offer::Offer */ LDKPaymentContext_Bolt12Offer, + /** + * The payment was made for a static invoice requested from a BOLT 12 [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + */ + LDKPaymentContext_AsyncBolt12Offer, /** * The payment was made for an invoice sent for a BOLT 12 [`Refund`]. * @@ -10431,6 +10329,9 @@ typedef struct MUST_USE_STRUCT LDKPaymentContext { struct { struct LDKBolt12OfferContext bolt12_offer; }; + struct { + struct LDKAsyncBolt12OfferContext async_bolt12_offer; + }; struct { struct LDKBolt12RefundContext bolt12_refund; }; @@ -10464,6 +10365,33 @@ typedef struct LDKCOption_PaymentContextZ { }; } LDKCOption_PaymentContextZ; +/** + * An enum which can either contain a crate::c_types::Str or not + */ +typedef enum LDKCOption_StrZ_Tag { + /** + * When we're in this state, this COption_StrZ contains a crate::c_types::Str + */ + LDKCOption_StrZ_Some, + /** + * When we're in this state, this COption_StrZ contains nothing + */ + LDKCOption_StrZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_StrZ_Sentinel, +} LDKCOption_StrZ_Tag; + +typedef struct LDKCOption_StrZ { + LDKCOption_StrZ_Tag tag; + union { + struct { + struct LDKStr some; + }; + }; +} LDKCOption_StrZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -10505,6 +10433,111 @@ typedef struct LDKCOption_C2Tuple_u64u16ZZ { }; } LDKCOption_C2Tuple_u64u16ZZ; +/** + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) + */ +typedef enum LDKAPIError_Tag { + /** + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. + */ + LDKAPIError_APIMisuseError, + /** + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. + */ + LDKAPIError_FeeRateTooHigh, + /** + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). + */ + LDKAPIError_InvalidRoute, + /** + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] + * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a + * monitor update is awaiting async resolution. Once it resolves the attempted action should + * complete automatically. + * + * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel + * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress + */ + LDKAPIError_MonitorUpdateInProgress, + /** + * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * with the channel counterparty as negotiated in [`InitFeatures`]. + * + * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open + * a channel or cooperatively close one with this peer (and will have to force-close instead). + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey + * [`InitFeatures`]: crate::types::features::InitFeatures + */ + LDKAPIError_IncompatibleShutdownScript, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + /** + * A human-readable error message + */ + struct LDKStr err; + /** + * The feerate which was too high. + */ + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKInvalidRoute_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKInvalidRoute_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + /** + * The incompatible shutdown script. + */ + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKInvalidRoute_Body invalid_route; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + }; +} LDKAPIError; + /** * The contents of CResult_ChannelIdAPIErrorZ */ @@ -10719,6 +10752,71 @@ typedef struct LDKCResult_NoneRetryableSendFailureZ { bool result_ok; } LDKCResult_NoneRetryableSendFailureZ; +/** + * An error when attempting to pay a [`Bolt11Invoice`]. + * + * [`Bolt11Invoice`]: lightning_invoice::Bolt11Invoice + */ +typedef enum LDKBolt11PaymentError_Tag { + /** + * Incorrect amount was provided to [`ChannelManager::pay_for_bolt11_invoice`]. + * This happens when the user-provided amount is less than an amount specified in the [`Bolt11Invoice`]. + * + * [`Bolt11Invoice`]: lightning_invoice::Bolt11Invoice + * [`ChannelManager::pay_for_bolt11_invoice`]: crate::ln::channelmanager::ChannelManager::pay_for_bolt11_invoice + */ + LDKBolt11PaymentError_InvalidAmount, + /** + * The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. + */ + LDKBolt11PaymentError_SendingFailed, + /** + * Must be last for serialization purposes + */ + LDKBolt11PaymentError_Sentinel, +} LDKBolt11PaymentError_Tag; + +typedef struct MUST_USE_STRUCT LDKBolt11PaymentError { + LDKBolt11PaymentError_Tag tag; + union { + struct { + enum LDKRetryableSendFailure sending_failed; + }; + }; +} LDKBolt11PaymentError; + +/** + * The contents of CResult_NoneBolt11PaymentErrorZ + */ +typedef union LDKCResult_NoneBolt11PaymentErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKBolt11PaymentError *err; +} LDKCResult_NoneBolt11PaymentErrorZPtr; + +/** + * A CResult_NoneBolt11PaymentErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::outbound_payment::Bolt11PaymentError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneBolt11PaymentErrorZ { + /** + * The contents of this CResult_NoneBolt11PaymentErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneBolt11PaymentErrorZPtr contents; + /** + * Whether this CResult_NoneBolt11PaymentErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneBolt11PaymentErrorZ; + /** * An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not */ @@ -10766,6 +10864,16 @@ typedef enum LDKBolt12PaymentError_Tag { * The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. */ LDKBolt12PaymentError_SendingFailed, + /** + * Failed to create a blinded path back to ourselves. + * + * We attempted to initiate payment to a [`StaticInvoice`] but failed to create a reply path for + * our [`HeldHtlcAvailable`] message. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + */ + LDKBolt12PaymentError_BlindedPathCreationFailed, /** * Must be last for serialization purposes */ @@ -11165,6 +11273,33 @@ typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ { bool result_ok; } LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; +/** + * 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; + /** @@ -11222,6 +11357,38 @@ typedef struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { bool result_ok; } LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ; +/** + * The contents of CResult_OfferNoneZ + */ +typedef union LDKCResult_OfferNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOffer *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_OfferNoneZPtr; + +/** + * A CResult_OfferNoneZ represents the result of a fallible operation, + * containing a crate::lightning::offers::offer::Offer on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OfferNoneZ { + /** + * The contents of this CResult_OfferNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferNoneZPtr contents; + /** + * Whether this CResult_OfferNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferNoneZ; + /** * A dynamically-allocated array of crate::lightning::onion_message::messenger::Destinations of arbitrary size. * This corresponds to std::vector in C++ @@ -11303,6 +11470,76 @@ typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ { bool result_ok; } LDKCResult_ThirtyTwoBytesAPIErrorZ; +/** + * The contents of CResult_CVec_BlindedMessagePathZNoneZ + */ +typedef union LDKCResult_CVec_BlindedMessagePathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_BlindedMessagePathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_BlindedMessagePathZNoneZPtr; + +/** + * A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedMessagePathZNoneZ { + /** + * The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_BlindedMessagePathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedMessagePathZNoneZ; + + + +/** + * A [`commitment_signed`] message to be sent to or received from a peer. + * + * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed + */ +typedef struct MUST_USE_STRUCT LDKCommitmentSigned { + /** + * 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. + */ + LDKnativeCommitmentSigned *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; +} LDKCommitmentSigned; + +/** + * A dynamically-allocated array of crate::lightning::ln::msgs::CommitmentSigneds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CommitmentSignedZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKCommitmentSigned *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CommitmentSignedZ; + /** @@ -11331,6 +11568,35 @@ typedef struct MUST_USE_STRUCT LDKInvoiceRequest { +/** + * A `StaticInvoice` is a reusable payment request corresponding to an [`Offer`]. + * + * A static invoice may be sent in response to an [`InvoiceRequest`] and includes all the + * information needed to pay the recipient. However, unlike [`Bolt12Invoice`]s, static invoices do + * not provide proof-of-payment. Therefore, [`Bolt12Invoice`]s should be preferred when the + * recipient is online to provide one. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +typedef struct MUST_USE_STRUCT LDKStaticInvoice { + /** + * 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. + */ + LDKnativeStaticInvoice *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; +} LDKStaticInvoice; + + + /** * An error in response to an [`InvoiceRequest`] or an [`Bolt12Invoice`]. * @@ -11370,6 +11636,10 @@ typedef enum LDKOffersMessage_Tag { * [`Refund`]: crate::offers::refund::Refund */ LDKOffersMessage_Invoice, + /** + * A [`StaticInvoice`] sent in response to an [`InvoiceRequest`]. + */ + LDKOffersMessage_StaticInvoice, /** * An error from handling an [`OffersMessage`]. */ @@ -11389,6 +11659,9 @@ typedef struct MUST_USE_STRUCT LDKOffersMessage { struct { struct LDKBolt12Invoice invoice; }; + struct { + struct LDKStaticInvoice static_invoice; + }; struct { struct LDKInvoiceError invoice_error; }; @@ -11468,6 +11741,134 @@ typedef struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { +/** + * [`BlindedMessagePath`]s to be included in an async recipient's [`Offer::paths`], sent by a + * static invoice server in response to an [`OfferPathsRequest`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +typedef struct MUST_USE_STRUCT LDKOfferPaths { + /** + * 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. + */ + LDKnativeOfferPaths *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; +} LDKOfferPaths; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OfferPathsResponseInstructionZ { + /** + * The element at position 0 + */ + struct LDKOfferPaths a; + /** + * The element at position 1 + */ + struct LDKResponseInstruction b; +} LDKC2Tuple_OfferPathsResponseInstructionZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ or not + */ +typedef enum LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_OfferPathsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ + */ + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_OfferPathsResponseInstructionZZ contains nothing + */ + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_Tag; + +typedef struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ { + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_OfferPathsResponseInstructionZ some; + }; + }; +} LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ; + + + +/** + * A request from an async recipient to a static invoice server that a [`StaticInvoice`] be + * provided in response to [`InvoiceRequest`]s from payers. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +typedef struct MUST_USE_STRUCT LDKServeStaticInvoice { + /** + * 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. + */ + LDKnativeServeStaticInvoice *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; +} LDKServeStaticInvoice; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ { + /** + * The element at position 0 + */ + struct LDKServeStaticInvoice a; + /** + * The element at position 1 + */ + struct LDKResponseInstruction b; +} LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ or not + */ +typedef enum LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ + */ + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ contains nothing + */ + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_Tag; + +typedef struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ some; + }; + }; +} LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ; + + + /** * Releases the HTLC corresponding to an inbound [`HeldHtlcAvailable`] message. */ @@ -11529,6 +11930,54 @@ typedef struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +/** + * A request from an async recipient for [`BlindedMessagePath`]s from a static invoice server. + * These paths will be used in the async recipient's [`Offer::paths`], so payers can request + * [`StaticInvoice`]s from the static invoice server. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ +typedef struct MUST_USE_STRUCT LDKOfferPathsRequest { + /** + * 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. + */ + LDKnativeOfferPathsRequest *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; +} LDKOfferPathsRequest; + + + +/** + * Confirmation from a static invoice server that a [`StaticInvoice`] was persisted and the + * corresponding [`Offer`] is ready to be used to receive async payments. Sent to an async + * recipient in response to a [`ServeStaticInvoice`] message. + * + * [`Offer`]: crate::offers::offer::Offer + */ +typedef struct MUST_USE_STRUCT LDKStaticInvoicePersisted { + /** + * 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. + */ + LDKnativeStaticInvoicePersisted *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; +} LDKStaticInvoicePersisted; + + + /** * An HTLC destined for the recipient of this message is being held upstream. The reply path * accompanying this onion message should be used to send a [`ReleaseHeldHtlc`] response, which @@ -11555,6 +12004,33 @@ typedef struct MUST_USE_STRUCT LDKHeldHtlcAvailable { * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ typedef enum LDKAsyncPaymentsMessage_Tag { + /** + * A request from an async recipient for [`BlindedMessagePath`]s, sent to a static invoice + * server. + */ + LDKAsyncPaymentsMessage_OfferPathsRequest, + /** + * [`BlindedMessagePath`]s to be included in an async recipient's [`Offer::paths`], sent by a + * static invoice server in response to an [`OfferPathsRequest`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths + */ + LDKAsyncPaymentsMessage_OfferPaths, + /** + * A request from an async recipient to a static invoice server that a [`StaticInvoice`] be + * provided in response to [`InvoiceRequest`]s from payers. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + LDKAsyncPaymentsMessage_ServeStaticInvoice, + /** + * Confirmation from a static invoice server that a [`StaticInvoice`] was persisted and the + * corresponding [`Offer`] is ready to be used to receive async payments. Sent to an async + * recipient in response to a [`ServeStaticInvoice`] message. + * + * [`Offer`]: crate::offers::offer::Offer + */ + LDKAsyncPaymentsMessage_StaticInvoicePersisted, /** * An HTLC is being held upstream for the often-offline recipient, to be released via * [`ReleaseHeldHtlc`]. @@ -11573,6 +12049,18 @@ typedef enum LDKAsyncPaymentsMessage_Tag { typedef struct MUST_USE_STRUCT LDKAsyncPaymentsMessage { LDKAsyncPaymentsMessage_Tag tag; union { + struct { + struct LDKOfferPathsRequest offer_paths_request; + }; + struct { + struct LDKOfferPaths offer_paths; + }; + struct { + struct LDKServeStaticInvoice serve_static_invoice; + }; + struct { + struct LDKStaticInvoicePersisted static_invoice_persisted; + }; struct { struct LDKHeldHtlcAvailable held_htlc_available; }; @@ -11742,6 +12230,26 @@ typedef struct MUST_USE_STRUCT LDKOnionPacket { +/** + * BOLT 4 onion packet including hop data for the next peer. + */ +typedef struct MUST_USE_STRUCT LDKTrampolineOnionPacket { + /** + * 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. + */ + LDKnativeTrampolineOnionPacket *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; +} LDKTrampolineOnionPacket; + + + /** * Information communicated in the onion to the recipient for multi-part tracking and proof that * the payment is associated with an invoice. @@ -11769,6 +12277,10 @@ typedef enum LDKPendingHTLCRouting_Tag { * An HTLC which should be forwarded on to another node. */ LDKPendingHTLCRouting_Forward, + /** + * An HTLC which should be forwarded on to another Trampoline node. + */ + LDKPendingHTLCRouting_TrampolineForward, /** * The onion indicates that this is a payment for an invoice (supposedly) generated by us. * @@ -11812,8 +12324,42 @@ typedef struct LDKPendingHTLCRouting_LDKForward_Body { * The absolute CLTV of the inbound HTLC */ struct LDKCOption_u32Z incoming_cltv_expiry; + /** + * Whether this HTLC should be held by our node until we receive a corresponding + * [`ReleaseHeldHtlc`] onion message. + */ + enum LDKCOption_NoneZ hold_htlc; } LDKPendingHTLCRouting_LDKForward_Body; +typedef struct LDKPendingHTLCRouting_LDKTrampolineForward_Body { + /** + * The onion shared secret we build with the sender (or the preceding Trampoline node) used + * to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. + */ + struct LDKThirtyTwoBytes incoming_shared_secret; + /** + * The onion which should be included in the forwarded HTLC, telling the next hop what to + * do with the HTLC. + */ + struct LDKTrampolineOnionPacket onion_packet; + /** + * The node ID of the Trampoline node which we need to route this HTLC to. + */ + struct LDKPublicKey node_id; + /** + * Set if this HTLC is being forwarded within a blinded path. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedForward blinded; + /** + * The absolute CLTV of the inbound HTLC + */ + uint32_t incoming_cltv_expiry; +} LDKPendingHTLCRouting_LDKTrampolineForward_Body; + typedef struct LDKPendingHTLCRouting_LDKReceive_Body { /** * Information about the amount the sender intended to pay and (potential) proof that this @@ -11907,15 +12453,29 @@ typedef struct LDKPendingHTLCRouting_LDKReceiveKeysend_Body { /** * Set if we are receiving a keysend to a blinded path, meaning we created the * [`PaymentSecret`] and should verify it using our - * [`NodeSigner::get_inbound_payment_key`]. + * [`NodeSigner::get_expanded_key`]. */ bool has_recipient_created_payment_secret; + /** + * The [`InvoiceRequest`] associated with the [`Offer`] corresponding to this payment. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKInvoiceRequest invoice_request; + /** + * The context of the payment included by the recipient in a blinded path, or `None` if a + * blinded path was not used. + * + * Used in part to determine the [`events::PaymentPurpose`]. + */ + struct LDKCOption_PaymentContextZ payment_context; } LDKPendingHTLCRouting_LDKReceiveKeysend_Body; typedef struct MUST_USE_STRUCT LDKPendingHTLCRouting { LDKPendingHTLCRouting_Tag tag; union { LDKPendingHTLCRouting_LDKForward_Body forward; + LDKPendingHTLCRouting_LDKTrampolineForward_Body trampoline_forward; LDKPendingHTLCRouting_LDKReceive_Body receive; LDKPendingHTLCRouting_LDKReceiveKeysend_Body receive_keysend; }; @@ -12023,691 +12583,1278 @@ typedef struct LDKCResult_BlindedFailureDecodeErrorZ { /** - * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates - * on-chain transactions to ensure no loss of funds occurs. - * - * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date - * information and are actively monitoring the chain. + * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction). + * The fields are organized by holder/counterparty. * - * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the - * returned block hash and the the current chain and then reconnecting blocks to get to the - * best chain) upon deserializing the object! + * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters + * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKChannelMonitor { +typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { /** * 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. */ - LDKnativeChannelMonitor *inner; + LDKnativeChannelTransactionParameters *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; -} LDKChannelMonitor; - -/** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChannelMonitorZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKChannelMonitor *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_ChannelMonitorZ; +} LDKChannelTransactionParameters; /** - * An update generated by the underlying channel itself which contains some new information the - * [`ChannelMonitor`] should be made aware of. + * This class tracks the per-transaction information needed to build a commitment transaction and will + * actually build it and sign. It is used for holder transactions that we sign only when needed + * and for transactions we sign for the counterparty. * - * Because this represents only a small number of updates to the underlying state, it is generally - * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction - * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment - * transaction), a single update may reach upwards of 1 MiB in serialized size. + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct MUST_USE_STRUCT LDKCommitmentTransaction { /** * 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. */ - LDKnativeChannelMonitorUpdate *inner; + LDKnativeCommitmentTransaction *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; -} LDKChannelMonitorUpdate; - -/** - * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as - * blocks are connected and disconnected. - * - * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated 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. - * - * See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements. - */ -typedef struct LDKWatch { - /** - * 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; - /** - * Watches a channel identified by `funding_txo` using `monitor`. - * - * Implementations are responsible for watching the chain for the funding transaction along - * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. - * - * 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 - */ - 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 [`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. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); - /** - * Returns any monitor events since the last call. Subsequent calls must only return new - * events. - * - * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no - * further events may be returned here until the [`ChannelMonitor`] has been fully persisted - * to disk. - * - * For details on asynchronous [`ChannelMonitor`] updating and returning - * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`]. - */ - struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(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); -} LDKWatch; - -/** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_TransactionZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKTransaction *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_TransactionZ; - -/** - * An interface to send a transaction to the Bitcoin network. - */ -typedef struct LDKBroadcasterInterface { - /** - * 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; - /** - * Sends a list of transactions out to (hopefully) be mined. - * This only needs to handle the actual broadcasting of transactions, LDK will automatically - * rebroadcast transactions that haven't made it into a block. - * - * In some cases LDK may attempt to broadcast a transaction which double-spends another - * and this isn't a bug and can be safely ignored. - * - * If more than one transaction is given, these transactions should be considered to be a - * package and broadcast together. Some of the transactions may or may not depend on each other, - * be sure to manage both cases correctly. - * - * Bitcoin transaction packages are defined in BIP 331 and here: - * - */ - void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs); - /** - * 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); -} LDKBroadcasterInterface; - -/** - * A trait that describes a source of entropy. - */ -typedef struct LDKEntropySource { - /** - * 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; - /** - * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a - * different value each time it is called. - */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(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); -} LDKEntropySource; +} LDKCommitmentTransaction; /** - * A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_inbound_payment_key`]. + * Information needed to build and sign a holder's commitment transaction. * - * [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key + * The transaction is only signed once we are ready to broadcast. */ -typedef struct MUST_USE_STRUCT LDKExpandedKey { +typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransaction { /** * 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. */ - LDKnativeExpandedKey *inner; + LDKnativeHolderCommitmentTransaction *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; -} LDKExpandedKey; +} LDKHolderCommitmentTransaction; /** - * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, - * but without the signature information. - * Decoding and encoding should not lead to information loss but may lead to different hashes. + * This class tracks the per-transaction information needed to build a closing transaction and will + * actually build it and sign. * - * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. */ -typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { +typedef struct MUST_USE_STRUCT LDKClosingTransaction { /** * 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. */ - LDKnativeRawBolt11Invoice *inner; + LDKnativeClosingTransaction *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; -} LDKRawBolt11Invoice; +} LDKClosingTransaction; /** - * The unsigned part of a [`channel_update`] message. + * The unsigned part of a [`channel_announcement`] message. * - * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { +typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { /** * 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. */ - LDKnativeUnsignedChannelUpdate *inner; + LDKnativeUnsignedChannelAnnouncement *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; -} LDKUnsignedChannelUpdate; +} LDKUnsignedChannelAnnouncement; /** - * The unsigned part of a [`node_announcement`] message. - * - * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message + * One counterparty's public keys which do not change over the life of a channel. */ -typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { +typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { /** * 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. */ - LDKnativeUnsignedNodeAnnouncement *inner; + LDKnativeChannelPublicKeys *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; -} LDKUnsignedNodeAnnouncement; - -/** - * Represents the set of gossip messages that require a signature from a node's identity key. - */ -typedef enum LDKUnsignedGossipMessage_Tag { - /** - * An unsigned channel announcement. - */ - LDKUnsignedGossipMessage_ChannelAnnouncement, - /** - * An unsigned channel update. - */ - LDKUnsignedGossipMessage_ChannelUpdate, - /** - * An unsigned node announcement. - */ - LDKUnsignedGossipMessage_NodeAnnouncement, - /** - * Must be last for serialization purposes - */ - LDKUnsignedGossipMessage_Sentinel, -} LDKUnsignedGossipMessage_Tag; - -typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage { - LDKUnsignedGossipMessage_Tag tag; - union { - struct { - struct LDKUnsignedChannelAnnouncement channel_announcement; - }; - struct { - struct LDKUnsignedChannelUpdate channel_update; - }; - struct { - struct LDKUnsignedNodeAnnouncement node_announcement; - }; - }; -} LDKUnsignedGossipMessage; +} LDKChannelPublicKeys; /** - * A trait that can handle cryptographic operations at the scope level of a node. + * A trait to handle Lightning channel key material without concretizing the channel type or + * the signature mechanism. + * + * Several methods allow errors to be returned to support async signing. In such cases, the + * signing operation can be replayed by calling [`ChannelManager::signer_unblocked`] once the + * result is ready, at which point the channel operation will resume. Methods which allow for + * async results are explicitly documented as such + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ -typedef struct LDKNodeSigner { +typedef struct LDKChannelSigner { /** * 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; /** - * Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. - * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. + * Gets the per-commitment point for a specific commitment number * - * This method must return the same value each time it is called. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. * - * [phantom node payments]: PhantomKeysManager + * This method is *not* asynchronous. This method is expected to always return `Ok` + * immediately after we reconnect to peers, and returning an `Err` may lead to an immediate + * `panic`. This method will be made asynchronous in a future release. */ - struct LDKExpandedKey (*get_inbound_payment_key)(const void *this_arg); + struct LDKCResult_PublicKeyNoneZ (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** - * Get node id based on the provided [`Recipient`]. + * Gets the commitment secret for a specific commitment number as part of the revocation process * - * This method must return the same value each time it is called with a given [`Recipient`] - * parameter. + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. * - * Errors if the [`Recipient`] variant is not supported by the implementation. + * May be called more than once for the same index. + * + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ - struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); + struct LDKCResult__u832NoneZ (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** - * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if - * one is provided. Note that this tweak can be applied to `other_key` instead of our node - * secret, though this is less efficient. + * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. * - * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error - * should be resolved to allow LDK to resume forwarding HTLCs. + * This is required in order for the signer to make sure that releasing a commitment + * secret won't leave us without a broadcastable holder transaction. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. * - * Errors if the [`Recipient`] variant is not supported by the implementation. + * The preimages of outbound HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. */ - struct LDKCResult_ThirtyTwoBytesNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak); + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** - * Sign an invoice. - * - * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of - * this trait to parse the invoice and make sure they're signing what they expect, rather than - * blindly signing the hash. + * Validate the counterparty's revocation. * - * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32. + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. * - * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. + */ + struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); + /** + * Returns the holder channel public keys and basepoints. This should only be called once + * during channel creation and as such implementations are allowed undefined behavior if + * called more than once. * - * Errors if the [`Recipient`] variant is not supported by the implementation. + * This method is *not* asynchronous. Instead, the value must be computed locally or in + * advance and cached. */ - struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKRawBolt11Invoice *NONNULL_PTR invoice, enum LDKRecipient recipient); + struct LDKChannelPublicKeys (*pubkeys)(const void *this_arg); /** - * Signs the [`TaggedHash`] of a BOLT 12 invoice. + * Returns a new funding pubkey (i.e. our public which is used in a 2-of-2 with the + * counterparty's key to to lock the funds on-chain) for a spliced channel. * - * 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`]. + * `splice_parent_funding_txid` can be used to compute a tweak with which to rotate the base + * key (which will then be available later in signing operations via + * [`ChannelTransactionParameters::splice_parent_funding_txid`]). * - * [`TaggedHash`]: crate::offers::merkle::TaggedHash + * This method is *not* asynchronous. Instead, the value must be cached locally. */ - struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice); + struct LDKPublicKey (*new_funding_pubkey)(const void *this_arg, struct LDKThirtyTwoBytes splice_parent_funding_txid); /** - * Sign a gossip message. + * 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 + * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. * - * 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. + * This method is *not* asynchronous. Instead, the value must be cached locally. */ - struct LDKCResult_ECDSASignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); + struct LDKThirtyTwoBytes (*channel_keys_id)(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); -} LDKNodeSigner; +} LDKChannelSigner; /** - * A trait that can return signer instances for individual channels. + * A trait to sign Lightning channel transactions as described in + * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). + * + * Signing services could be implemented on a hardware wallet and should implement signing + * policies in order to be secure. Please refer to the [VLS Policy + * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) + * for an example of such policies. + * + * Like [`ChannelSigner`], many of the methods allow errors to be returned to support async + * signing. In such cases, the signing operation can be replayed by calling + * [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual + * method documentation for which method should be called) once the result is ready, at which + * point the channel operation will resume. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ -typedef struct LDKSignerProvider { +typedef struct LDKBaseEcdsaChannelSigner { /** * 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; /** - * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::EcdsaSigner`] through - * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow - * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated - * `channel_keys_id`. + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * - * This method must return a different value each time it is called. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outbound and inbound HTLCs that were fulfilled since the last commitment + * are provided. A validating signer should ensure that an outbound HTLC output is removed + * only when the matching preimage is provided and after the corresponding inbound HTLC has + * been removed for forwarded payments. + * + * Note that all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ - struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id); + struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** - * Derives the private key material backing a `Signer`. + * Creates a signature for a holder's commitment transaction. * - * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through - * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be - * re-derived from its `channel_keys_id`, which can be obtained through its trait method - * [`ChannelSigner::channel_keys_id`]. + * This will be called + * - with a non-revoked `commitment_tx`. + * - with the latest `commitment_tx` when we initiate a force-close. + * + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do + * so). + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * `amount` is the value of the output spent by this input, committed to in the BIP 143 + * signature. + * + * `per_commitment_key` is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script + * (which is committed to in the BIP 143 signatures). + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - struct LDKEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); + struct LDKCResult_ECDSASignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** - * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. - * This is only called during deserialization of other objects which contain - * [`EcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. + * 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`]. * - * This method is slowly being phased out -- it will only be called when reading objects - * written by LDK versions prior to 0.0.113. + * Note that this may be called for HTLCs in the penultimate commitment transaction if a + * [`ChannelMonitor`] [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * broadcasts it before receiving the update for the latest commitment transaction. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * - * [`Signer`]: Self::EcdsaSigner + * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - struct LDKCResult_EcdsaChannelSignerDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + 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); /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. * - * If this function returns an error, this will result in a channel failing to open. + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. * - * 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. `channel_keys_id` may be - * used to derive a unique value for each channel. + * `witness_script` is either an offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * `amount` is value of the output spent by this input, committed to in the BIP 143 signature. + * + * `per_commitment_point` is the dynamic point corresponding to the channel state + * detected onchain. It has been generated by our counterparty and is used to derive + * channel state keys, which are then included in the witness script and committed to in the + * BIP 143 signature. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id); + struct LDKCResult_ECDSASignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** - * Get a script pubkey which we will send funds to when closing a channel. + * Create a signature for a (proposed) closing transaction. * - * If this function returns an error, this will result in a channel failing to open or close. - * In the event of a failure when the counterparty is initiating a close, this can result in a - * channel force close. + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. * - * 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. + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ - struct LDKCResult_ShutdownScriptNoneZ (*get_shutdown_scriptpubkey)(const void *this_arg); + struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + /** + * Computes the signature for a commitment transaction's keyed anchor output used as an + * input within `anchor_tx`, which spends the commitment transaction, at index `input`. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. + * + * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_keyed_anchor_input)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. + * + * Channel announcements also require a signature from each node's network key. Our node + * signature is computed through [`NodeSigner::sign_gossip_message`]. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will not be + * publicly announced and our counterparty may (though likely will not) close the channel on + * us for violating the protocol. + * + * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + /** + * Signs the shared input of a splice transaction with our funding key. + * + * In splicing, the previous funding transaction output is spent as the input of + * the new funding transaction, and is a 2-of-2 multisig. + * + * `channel_parameters`: The [`ChannelTransactionParameters`] for the channel's current funding + * transaction that is being spent in the splice transaction to sign. A new set of + * [`ChannelTransactionParameters`] will become available for the new funding transaction. + * + * `input_index`: The index of the input within the new funding transaction `tx`, + * spending the previous funding transaction's output + */ + struct LDKECDSASignature (*sign_splice_shared_input)(const void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction tx, uintptr_t input_index); + /** + * Implementation of ChannelSigner for this object. + */ + struct LDKChannelSigner ChannelSigner; /** * 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); -} LDKSignerProvider; +} LDKBaseEcdsaChannelSigner; /** - * A trait which should be implemented to provide feerate information on a number of time - * horizons. + * A trait to sign Lightning channel transactions as described in + * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). * - * If access to a local mempool is not feasible, feerate estimates should be fetched from a set of - * third-parties hosting them. Note that this enables them to affect the propagation of your - * pre-signed transactions at any time and therefore endangers the safety of channels funds. It - * should be considered carefully as a deployment. + * Signing services could be implemented on a hardware wallet and should implement signing + * policies in order to be secure. Please refer to the [VLS Policy + * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) + * for an example of such policies. * - * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're - * called from inside the library in response to chain events, P2P events, or timer events). + * Like [`ChannelSigner`], many of the methods allow errors to be returned to support async + * signing. In such cases, the signing operation can be replayed by calling + * [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual + * method documentation for which method should be called) once the result is ready, at which + * point the channel operation will resume. * - * LDK may generate a substantial number of fee-estimation calls in some cases. You should - * pre-calculate and cache the fee estimate results to ensure you don't substantially slow HTLC - * handling. + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ -typedef struct LDKFeeEstimator { +typedef struct LDKEcdsaChannelSigner { /** * 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; /** - * Gets estimated satoshis of fee required per 1000 Weight-Units. - * - * LDK will wrap this method and ensure that the value returned is no smaller than 253 - * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte). - * - * The following unit conversions can be used to convert to sats/KW: - * * satoshis-per-byte * 250 - * * satoshis-per-kbyte / 4 + * Implementation of BaseEcdsaChannelSigner for this object. */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + struct LDKBaseEcdsaChannelSigner BaseEcdsaChannelSigner; + /** + * Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. + * The new EcdsaChannelSigner 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 LDKEcdsaChannelSigner *NONNULL_PTR new_EcdsaChannelSigner); /** * 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); -} LDKFeeEstimator; +} LDKEcdsaChannelSigner; /** - * 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. + * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates + * on-chain transactions to ensure no loss of funds occurs. * - * Can only be constructed by calling [`UnauthenticatedReceiveTlvs::authenticate`]. + * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date + * information and are actively monitoring the chain. + * + * Like the [`ChannelManager`], deserialization is implemented for `(BlockHash, ChannelMonitor)`, + * providing you with the last block hash which was connected before shutting down. You must begin + * syncing the chain from that point, disconnecting and connecting blocks as required to get to + * the best chain on startup. Note that all [`ChannelMonitor`]s passed to a [`ChainMonitor`] must + * by synced as of the same block, so syncing must happen prior to [`ChainMonitor`] + * initialization. + * + * For those loading potentially-ancient [`ChannelMonitor`]s, deserialization is also implemented + * for `Option<(BlockHash, ChannelMonitor)>`. LDK can no longer deserialize a [`ChannelMonitor`] + * that was first created in LDK prior to 0.0.110 and last updated prior to LDK 0.0.119. In such + * cases, the `Option<(..)>` deserialization option may return `Ok(None)` rather than failing to + * deserialize, allowing you to differentiate between the two cases. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -typedef struct MUST_USE_STRUCT LDKReceiveTlvs { +typedef struct MUST_USE_STRUCT LDKChannelMonitor { /** * 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; + LDKnativeChannelMonitor *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; +} LDKChannelMonitor; /** - * A trait defining behavior for routing a payment. + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKRouter { - /** - * 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; - /** - * Finds a [`Route`] for a payment between the given `payer` and a payee. - * - * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] - * and [`RouteParameters::final_value_msat`], respectively. - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); - /** - * Finds a [`Route`] for a payment between the given `payer` and a payee. - * - * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] - * and [`RouteParameters::final_value_msat`], respectively. - * - * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific - * payment. - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); +typedef struct LDKCVec_ChannelMonitorZ { /** - * Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` - * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are - * given in `tlvs`. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCResult_CVec_BlindedPaymentPathZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats); + struct LDKChannelMonitor *data; /** - * 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. + * The number of elements pointed to by `data`. */ - void (*free)(void *this_arg); -} LDKRouter; + uintptr_t datalen; +} LDKCVec_ChannelMonitorZ; /** - * A path for sending an [`OnionMessage`]. + * An update generated by the underlying channel itself which contains some new information the + * [`ChannelMonitor`] should be made aware of. + * + * Because this represents only a small number of updates to the underlying state, it is generally + * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction + * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment + * transaction), a single update may reach upwards of 1 MiB in serialized size. */ -typedef struct MUST_USE_STRUCT LDKOnionMessagePath { +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { /** * 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. */ - LDKnativeOnionMessagePath *inner; + LDKnativeChannelMonitorUpdate *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; -} LDKOnionMessagePath; +} LDKChannelMonitorUpdate; /** - * The contents of CResult_OnionMessagePathNoneZ + * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as + * blocks are connected and disconnected. + * + * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are + * responsible for maintaining a set of monitors such that they can be updated 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. + * + * See method documentation and [`ChannelMonitorUpdateStatus`] for specific requirements. */ -typedef union LDKCResult_OnionMessagePathNoneZPtr { +typedef struct LDKWatch { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKOnionMessagePath *result; + void *this_arg; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Watches a channel identified by `channel_id` using `monitor`. + * + * Implementations are responsible for watching the chain for the funding transaction along + * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means + * calling [`block_connected`] and [`blocks_disconnected`] on the monitor. + * + * A return of `Err(())` indicates that the channel should immediately be force-closed without + * broadcasting the funding transaction. + * + * If the given `channel_id` 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 + * [`blocks_disconnected`]: channelmonitor::ChannelMonitor::blocks_disconnected */ - void *err; -} LDKCResult_OnionMessagePathNoneZPtr; - -/** - * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_OnionMessagePathNoneZ { + struct LDKCResult_ChannelMonitorUpdateStatusNoneZ (*watch_channel)(const void *this_arg, struct LDKChannelId channel_id, struct LDKChannelMonitor monitor); /** - * The contents of this CResult_OnionMessagePathNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Updates a channel identified by `channel_id` by applying `update` to its monitor. + * + * 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. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - union LDKCResult_OnionMessagePathNoneZPtr contents; + enum LDKChannelMonitorUpdateStatus (*update_channel)(const void *this_arg, struct LDKChannelId channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** - * Whether this CResult_OnionMessagePathNoneZ represents a success state. + * Returns any monitor events since the last call. Subsequent calls must only return new + * events. + * + * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no + * further events may be returned here until the [`ChannelMonitor`] has been fully persisted + * to disk. + * + * For details on asynchronous [`ChannelMonitor`] updating and returning + * [`MonitorEvent::Completed`] here, see [`ChannelMonitorUpdateStatus::InProgress`]. */ - bool result_ok; -} LDKCResult_OnionMessagePathNoneZ; + struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(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); +} LDKWatch; /** - * The contents of CResult_CVec_BlindedMessagePathZNoneZ + * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_CVec_BlindedMessagePathZNoneZPtr { +typedef struct LDKCVec_TransactionZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCVec_BlindedMessagePathZ *result; + struct LDKTransaction *data; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * The number of elements pointed to by `data`. */ - void *err; -} LDKCResult_CVec_BlindedMessagePathZNoneZPtr; + uintptr_t datalen; +} LDKCVec_TransactionZ; /** - * A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An interface to send a transaction to the Bitcoin network. */ -typedef struct LDKCResult_CVec_BlindedMessagePathZNoneZ { +typedef struct LDKBroadcasterInterface { /** - * The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * 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. */ - union LDKCResult_CVec_BlindedMessagePathZNoneZPtr contents; + void *this_arg; /** - * Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_BlindedMessagePathZNoneZ; + * Sends a list of transactions out to (hopefully) be mined. + * This only needs to handle the actual broadcasting of transactions, LDK will automatically + * rebroadcast transactions that haven't made it into a block. + * + * In some cases LDK may attempt to broadcast a transaction which double-spends another + * and this isn't a bug and can be safely ignored. + * + * If more than one transaction is given, these transactions MUST be a + * single child and its parents and be broadcast together as a package + * (see the [`submitpackage`](https://bitcoincore.org/en/doc/30.0.0/rpc/rawtransactions/submitpackage) + * Bitcoin Core RPC). + * + * Implementations MUST NOT assume any topological order on the transactions. + * + * Bitcoin transaction packages are defined in BIP 331 and here: + * + */ + void (*broadcast_transactions)(const void *this_arg, struct LDKCVec_TransactionZ txs); + /** + * Called, if set, after this BroadcasterInterface has been cloned into a duplicate object. + * The new BroadcasterInterface 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 LDKBroadcasterInterface *NONNULL_PTR new_BroadcasterInterface); + /** + * 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); +} LDKBroadcasterInterface; + +/** + * A trait that describes a source of entropy. + */ +typedef struct LDKEntropySource { + /** + * 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; + /** + * Gets a unique, cryptographically-secure, random 32-byte value. This method must return a + * different value each time it is called. + */ + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(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); +} LDKEntropySource; + + + +/** + * A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_expanded_key`]. + * + * [`NodeSigner::get_expanded_key`]: crate::sign::NodeSigner::get_expanded_key + */ +typedef struct MUST_USE_STRUCT LDKExpandedKey { + /** + * 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. + */ + LDKnativeExpandedKey *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; +} LDKExpandedKey; + + + +/** + * Represents the secret key material used for encrypting Peer Storage. + */ +typedef struct MUST_USE_STRUCT LDKPeerStorageKey { + /** + * 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. + */ + LDKnativePeerStorageKey *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; +} LDKPeerStorageKey; + + + +/** + * A secret key used to authenticate message contexts in received [`BlindedMessagePath`]s. + * + * This key ensures that a node only accepts incoming messages delivered through + * blinded paths that it constructed itself. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + */ +typedef struct MUST_USE_STRUCT LDKReceiveAuthKey { + /** + * 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. + */ + LDKnativeReceiveAuthKey *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; +} LDKReceiveAuthKey; + + + +/** + * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, + * but without the signature information. + * Decoding and encoding should not lead to information loss but may lead to different hashes. + * + * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. + */ +typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { + /** + * 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. + */ + LDKnativeRawBolt11Invoice *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; +} LDKRawBolt11Invoice; + + + +/** + * The unsigned part of a [`channel_update`] message. + * + * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message + */ +typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate { + /** + * 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. + */ + LDKnativeUnsignedChannelUpdate *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; +} LDKUnsignedChannelUpdate; + + + +/** + * The unsigned part of a [`node_announcement`] message. + * + * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message + */ +typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement { + /** + * 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. + */ + LDKnativeUnsignedNodeAnnouncement *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; +} LDKUnsignedNodeAnnouncement; + +/** + * Represents the set of gossip messages that require a signature from a node's identity key. + */ +typedef enum LDKUnsignedGossipMessage_Tag { + /** + * An unsigned channel announcement. + */ + LDKUnsignedGossipMessage_ChannelAnnouncement, + /** + * An unsigned channel update. + */ + LDKUnsignedGossipMessage_ChannelUpdate, + /** + * An unsigned node announcement. + */ + LDKUnsignedGossipMessage_NodeAnnouncement, + /** + * Must be last for serialization purposes + */ + LDKUnsignedGossipMessage_Sentinel, +} LDKUnsignedGossipMessage_Tag; + +typedef struct MUST_USE_STRUCT LDKUnsignedGossipMessage { + LDKUnsignedGossipMessage_Tag tag; + union { + struct { + struct LDKUnsignedChannelAnnouncement channel_announcement; + }; + struct { + struct LDKUnsignedChannelUpdate channel_update; + }; + struct { + struct LDKUnsignedNodeAnnouncement node_announcement; + }; + }; +} LDKUnsignedGossipMessage; + +/** + * A trait that can handle cryptographic operations at the scope level of a node. + */ +typedef struct LDKNodeSigner { + /** + * 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; + /** + * Get the [`ExpandedKey`] which provides cryptographic material for various Lightning Network operations. + * + * This key set is used for: + * - Encrypting and decrypting inbound payment metadata + * - Authenticating payment hashes (both LDK-provided and user-provided) + * - Supporting BOLT 12 Offers functionality (key derivation and authentication) + * - Authenticating spontaneous payments' metadata + * + * This method must return the same value each time it is called. + * + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. This is because LDK avoids storing inbound payment data. Instead, this key + * is used to construct a payment secret which is received in the payment onion and used to + * reconstruct the payment preimage. Therefore, for a payment to be receivable by multiple + * nodes, they must share the same key. + * + * [phantom node payments]: PhantomKeysManager + */ + struct LDKExpandedKey (*get_expanded_key)(const void *this_arg); + /** + * Defines a method to derive a 32-byte encryption key for peer storage. + * + * Implementations of this method must derive a secure encryption key. + * The key is used to encrypt or decrypt backups of our state stored with our peers. + * + * Thus, if you wish to rely on recovery using this method, you should use a key which + * can be re-derived from data which would be available after state loss (eg the wallet seed). + */ + struct LDKPeerStorageKey (*get_peer_storage_key)(const void *this_arg); + /** + * Returns the [`ReceiveAuthKey`] used to authenticate incoming [`BlindedMessagePath`] contexts. + * + * This key is used as additional associated data (AAD) during MAC verification of the + * [`MessageContext`] at the final hop of a blinded path. It ensures that only paths + * constructed by this node will be accepted, preventing unauthorized parties from forging + * valid-looking messages. + * + * Implementers must ensure that this key remains secret and consistent across invocations. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`MessageContext`]: crate::blinded_path::message::MessageContext + */ + struct LDKReceiveAuthKey (*get_receive_auth_key)(const void *this_arg); + /** + * Get node id based on the provided [`Recipient`]. + * + * This method must return the same value each time it is called with a given [`Recipient`] + * parameter. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); + /** + * Gets the ECDH shared secret of our node secret and `other_key`, multiplying by `tweak` if + * one is provided. Note that this tweak can be applied to `other_key` instead of our node + * secret, though this is less efficient. + * + * Note that if this fails while attempting to forward an HTLC, LDK will panic. The error + * should be resolved to allow LDK to resume forwarding HTLCs. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + struct LDKCResult_ThirtyTwoBytesNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_BigEndianScalarZ tweak); + /** + * Sign an invoice. + * + * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of + * this trait to parse the invoice and make sure they're signing what they expect, rather than + * blindly signing the hash. + * + * The `hrp_bytes` are ASCII bytes, while the `invoice_data` is base32. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * + * Errors if the [`Recipient`] variant is not supported by the implementation. + */ + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKRawBolt11Invoice *NONNULL_PTR invoice, enum LDKRecipient recipient); + /** + * Signs the [`TaggedHash`] of a BOLT 12 invoice. + * + * 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. + * + * 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. + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_gossip_message)(const void *this_arg, struct LDKUnsignedGossipMessage msg); + /** + * Sign an arbitrary message with the node's secret key. + * + * Creates a digital signature of a message given the node's secret. The message is prefixed + * with \"Lightning Signed Message:\" before signing. See [this description of the format](https://web.archive.org/web/20191010011846/https://twitter.com/rusty_twit/status/1182102005914800128) + * for more details. + * + * A receiver knowing the node's id and the message can be sure that the signature was generated by the caller. + * An `Err` can be returned to signal that the signer is unavailable / cannot produce a valid + * signature. + */ + struct LDKCResult_StrNoneZ (*sign_message)(const void *this_arg, struct LDKu8slice 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. + */ + void (*free)(void *this_arg); +} LDKNodeSigner; + +/** + * A trait that can return signer instances for individual channels. + */ +typedef struct LDKSignerProvider { + /** + * 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; + /** + * Generates a unique `channel_keys_id` that can be used to obtain a [`Self::EcdsaSigner`] through + * [`SignerProvider::derive_channel_signer`]. The `user_channel_id` is provided to allow + * implementations of [`SignerProvider`] to maintain a mapping between itself and the generated + * `channel_keys_id`. + * + * This method must return a different value each time it is called. + */ + struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, struct LDKU128 user_channel_id); + /** + * Derives the private key material backing a `Signer`. + * + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`ChannelSigner::channel_keys_id`]. + */ + struct LDKEcdsaChannelSigner (*derive_channel_signer)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id); + /** + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * If this function returns an error, this will result in a channel failing to open. + * + * 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. `channel_keys_id` may be + * used to derive a unique value for each channel. + */ + struct LDKCResult_CVec_u8ZNoneZ (*get_destination_script)(const void *this_arg, struct LDKThirtyTwoBytes channel_keys_id); + /** + * 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. + * In the event of a failure when the counterparty is initiating a close, this can result in a + * channel force close. + * + * 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_ShutdownScriptNoneZ (*get_shutdown_scriptpubkey)(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); +} LDKSignerProvider; + +/** + * A trait which should be implemented to provide feerate information on a number of time + * horizons. + * + * If access to a local mempool is not feasible, feerate estimates should be fetched from a set of + * third-parties hosting them. Note that this enables them to affect the propagation of your + * pre-signed transactions at any time and therefore endangers the safety of channels funds. It + * should be considered carefully as a deployment. + * + * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're + * called from inside the library in response to chain events, P2P events, or timer events). + * + * LDK may generate a substantial number of fee-estimation calls in some cases. You should + * pre-calculate and cache the fee estimate results to ensure you don't substantially slow HTLC + * handling. + */ +typedef struct LDKFeeEstimator { + /** + * 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; + /** + * Gets estimated satoshis of fee required per 1000 Weight-Units. + * + * LDK will wrap this method and ensure that the value returned is no smaller than 253 + * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte). + * + * The following unit conversions can be used to convert to sats/KW: + * * satoshis-per-byte * 250 + * * satoshis-per-kbyte / 4 + */ + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + /** + * 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); +} LDKFeeEstimator; + + + +/** + * 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. + * + * Can only be constructed by calling [`UnauthenticatedReceiveTlvs::authenticate`]. + */ +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; + +/** + * A trait defining behavior for routing a payment. + */ +typedef struct LDKRouter { + /** + * 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; + /** + * Finds a [`Route`] for a payment between the given `payer` and a payee. + * + * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] + * and [`RouteParameters::final_value_msat`], respectively. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteStrZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); + /** + * Finds a [`Route`] for a payment between the given `payer` and a payee. + * + * The `payee` and the payment's value are given in [`RouteParameters::payment_params`] + * and [`RouteParameters::final_value_msat`], respectively. + * + * Includes a [`PaymentHash`] and a [`PaymentId`] to be able to correlate the request with a specific + * payment. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteStrZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` + * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are + * given in `tlvs`. + */ + struct LDKCResult_CVec_BlindedPaymentPathZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, struct LDKCOption_u64Z amount_msats); + /** + * 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); +} LDKRouter; + + + +/** + * A path for sending an [`OnionMessage`]. + */ +typedef struct MUST_USE_STRUCT LDKOnionMessagePath { + /** + * 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. + */ + LDKnativeOnionMessagePath *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; +} LDKOnionMessagePath; + +/** + * The contents of CResult_OnionMessagePathNoneZ + */ +typedef union LDKCResult_OnionMessagePathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionMessagePath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_OnionMessagePathNoneZPtr; + +/** + * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionMessagePathNoneZ { + /** + * The contents of this CResult_OnionMessagePathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionMessagePathNoneZPtr contents; + /** + * Whether this CResult_OnionMessagePathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionMessagePathNoneZ; /** * An intermediate node, and possibly a short channel id leading to the next node. + * + * Note: + * [`MessageForwardNode`] must represent a node that supports [`supports_onion_messages`] + * in order to be included in valid blinded paths for onion messaging. + * + * [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages */ typedef struct MUST_USE_STRUCT LDKMessageForwardNode { /** @@ -12757,23 +13904,7 @@ typedef struct LDKMessageRouter { * Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to * be direct peers with the `recipient`. */ - struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers); - /** - * Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are - * assumed to be direct peers with the `recipient`. - * - * Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, - * which is beneficial when a QR code is used to transport the data. The SCID is passed using - * a [`MessageForwardNode`] but may be `None` for graceful degradation. - * - * Implementations using additional intermediate nodes are responsible for using a - * [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations - * should call [`BlindedMessagePath::use_compact_introduction_node`]. - * - * The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], - * ignoring the short channel ids. - */ - struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_compact_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); + struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); /** * 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. @@ -12803,7 +13934,7 @@ typedef struct LDKMessageRouter { * * Additionally, it implements the following traits: * - [`ChannelMessageHandler`] to handle off-chain channel activity from peers - * - [`MessageSendEventsProvider`] to similarly send such messages to peers + * - [`BaseMessageHandler`] to handle peer dis/connection and send messages to peers * - [`OffersMessageHandler`] for BOLT 12 message handling and sending * - [`EventsProvider`] to generate user-actionable [`Event`]s * - [`chain::Listen`] and [`chain::Confirm`] for notification of on-chain activity @@ -12873,17 +14004,17 @@ typedef struct LDKMessageRouter { * network: Network::Bitcoin, * best_block, * }; - * let default_config = UserConfig::default(); + * let config = UserConfig::default(); * let channel_manager = ChannelManager::new( * fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, - * entropy_source, node_signer, signer_provider, default_config, params, current_timestamp, + * entropy_source, node_signer, signer_provider, config.clone(), params, current_timestamp, * ); * * // Restart from deserialized data * let mut channel_monitors = read_channel_monitors(); * let args = ChannelManagerReadArgs::new( * entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, - * router, message_router, logger, default_config, channel_monitors.iter().collect(), + * router, message_router, logger, config, channel_monitors.iter().collect(), * ); * let (block_hash, channel_manager) = * <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; @@ -12893,7 +14024,7 @@ typedef struct LDKMessageRouter { * * // Move the monitors to the ChannelManager's chain::Watch parameter * for monitor in channel_monitors { - * chain_monitor.watch_channel(monitor.get_funding_txo().0, monitor); + * chain_monitor.watch_channel(monitor.channel_id(), monitor); * } * # Ok(()) * # } @@ -12904,14 +14035,14 @@ typedef struct LDKMessageRouter { * The following is required for [`ChannelManager`] to function properly: * - Handle messages from peers using its [`ChannelMessageHandler`] implementation (typically * called by [`PeerManager::read_event`] when processing network I/O) - * - Send messages to peers obtained via its [`MessageSendEventsProvider`] implementation - * (typically initiated when [`PeerManager::process_events`] is called) + * - Process peer connections and send messages to peers obtained via its [`BaseMessageHandler`] + * implementation (typically initiated when [`PeerManager::process_events`] is called) * - Feed on-chain activity using either its [`chain::Listen`] or [`chain::Confirm`] implementation * as documented by those traits * - Perform any periodic channel and payment checks by calling [`timer_tick_occurred`] roughly * every minute * - Persist to disk whenever [`get_and_clear_needs_persistence`] returns `true` using a - * [`Persister`] such as a [`KVStore`] implementation + * [`KVStoreSync`] implementation * - Handle [`Event`]s obtained via its [`EventsProvider`] implementation * * The [`Future`] returned by [`get_event_or_persistence_needed_future`] is useful in determining @@ -13032,7 +14163,7 @@ typedef struct LDKMessageRouter { * match event { * Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, .. } => { * if !is_trusted(counterparty_node_id) { - * match channel_manager.force_close_without_broadcasting_txn( + * match channel_manager.force_close_broadcasting_latest_txn( * &temporary_channel_id, &counterparty_node_id, error_message.to_string() * ) { * Ok(()) => println!(\"Rejecting channel {}\", temporary_channel_id), @@ -13043,7 +14174,7 @@ typedef struct LDKMessageRouter { * * let user_channel_id = 43; * match channel_manager.accept_inbound_channel( - * &temporary_channel_id, &counterparty_node_id, user_channel_id + * &temporary_channel_id, &counterparty_node_id, user_channel_id, None * ) { * Ok(()) => println!(\"Accepting channel {}\", temporary_channel_id), * Err(e) => println!(\"Error accepting channel {}: {:?}\", temporary_channel_id, e), @@ -13173,26 +14304,24 @@ typedef struct LDKMessageRouter { * # } * ``` * - * For paying an invoice, see the [`bolt11_payment`] module with convenience functions for use with - * [`send_payment`]. - * * ``` + * # use bitcoin::hashes::Hash; * # use lightning::events::{Event, EventsProvider}; * # use lightning::types::payment::PaymentHash; * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; - * # use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; - * # use lightning::routing::router::RouteParameters; + * # use lightning::ln::outbound_payment::Retry; + * # use lightning::routing::router::RouteParametersConfig; + * # use lightning_invoice::Bolt11Invoice; * # * # fn example( - * # channel_manager: T, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields, - * # route_params: RouteParameters, retry: Retry + * # channel_manager: T, invoice: &Bolt11Invoice, route_params_config: RouteParametersConfig, + * # retry: Retry * # ) { * # let channel_manager = channel_manager.get_cm(); - * // let (payment_hash, recipient_onion, route_params) = - * // payment::payment_parameters_from_invoice(&invoice); - * let payment_id = PaymentId([42; 32]); - * match channel_manager.send_payment( - * payment_hash, recipient_onion, payment_id, route_params, retry + * # let payment_id = PaymentId([42; 32]); + * # let payment_hash = PaymentHash((*invoice.payment_hash()).to_byte_array()); + * match channel_manager.pay_for_bolt11_invoice( + * invoice, payment_id, None, route_params_config, retry * ) { * Ok(()) => println!(\"Sending payment with hash {}\", payment_hash), * Err(e) => println!(\"Failed sending payment with hash {}: {:?}\", payment_hash, e), @@ -13238,12 +14367,12 @@ typedef struct LDKMessageRouter { * # use lightning::events::{Event, EventsProvider, PaymentPurpose}; * # use lightning::ln::channelmanager::AChannelManager; * # use lightning::offers::parse::Bolt12SemanticError; + * # use lightning::routing::router::RouteParametersConfig; * # * # fn example(channel_manager: T) -> Result<(), Bolt12SemanticError> { * # let channel_manager = channel_manager.get_cm(); - * # let absolute_expiry = None; * let offer = channel_manager - * .create_offer_builder(absolute_expiry)? + * .create_offer_builder()? * # ; * # // Needed for compiling for c_bindings * # let builder: lightning::offers::offer::OfferBuilder<_, _> = offer.into(); @@ -13284,17 +14413,15 @@ typedef struct LDKMessageRouter { * ``` * # use lightning::events::{Event, EventsProvider}; * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; - * # use lightning::ln::outbound_payment::Retry; * # use lightning::offers::offer::Offer; * # * # fn example( - * # channel_manager: T, offer: &Offer, quantity: Option, amount_msats: Option, - * # payer_note: Option, retry: Retry, max_total_routing_fee_msat: Option + * # channel_manager: T, offer: &Offer, amount_msats: Option, * # ) { * # let channel_manager = channel_manager.get_cm(); * let payment_id = PaymentId([42; 32]); * match channel_manager.pay_for_offer( - * offer, quantity, amount_msats, payer_note, payment_id, retry, max_total_routing_fee_msat + * offer, amount_msats, payment_id, Default::default(), * ) { * Ok(()) => println!(\"Requesting invoice for offer\"), * Err(e) => println!(\"Unable to request invoice for offer: {:?}\", e), @@ -13343,16 +14470,17 @@ typedef struct LDKMessageRouter { * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; * # use lightning::ln::outbound_payment::Retry; * # use lightning::offers::parse::Bolt12SemanticError; + * # use lightning::routing::router::RouteParametersConfig; * # * # fn example( * # channel_manager: T, amount_msats: u64, absolute_expiry: Duration, retry: Retry, - * # max_total_routing_fee_msat: Option + * # route_params_config: RouteParametersConfig * # ) -> Result<(), Bolt12SemanticError> { * # let channel_manager = channel_manager.get_cm(); * let payment_id = PaymentId([42; 32]); * let refund = channel_manager * .create_refund_builder( - * amount_msats, absolute_expiry, payment_id, retry, max_total_routing_fee_msat + * amount_msats, absolute_expiry, payment_id, retry, route_params_config * )? * # ; * # // Needed for compiling for c_bindings @@ -13495,12 +14623,11 @@ typedef struct LDKMessageRouter { * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events * [`timer_tick_occurred`]: Self::timer_tick_occurred * [`get_and_clear_needs_persistence`]: Self::get_and_clear_needs_persistence - * [`Persister`]: crate::util::persist::Persister - * [`KVStore`]: crate::util::persist::KVStore + * [`KVStoreSync`]: crate::util::persist::KVStoreSync * [`get_event_or_persistence_needed_future`]: Self::get_event_or_persistence_needed_future * [`lightning-block-sync`]: https://docs.rs/lightning_block_sync/latest/lightning_block_sync * [`lightning-transaction-sync`]: https://docs.rs/lightning_transaction_sync/latest/lightning_transaction_sync - * [`lightning-background-processor`]: https://docs.rs/lightning_background_processor/lightning_background_processor + * [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor * [`list_channels`]: Self::list_channels * [`list_usable_channels`]: Self::list_usable_channels * [`create_channel`]: Self::create_channel @@ -13514,7 +14641,6 @@ typedef struct LDKMessageRouter { * [`create_bolt11_invoice`]: Self::create_bolt11_invoice * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash - * [`bolt11_payment`]: crate::ln::bolt11_payment * [`claim_funds`]: Self::claim_funds * [`send_payment`]: Self::send_payment * [`offers`]: crate::offers @@ -13523,7 +14649,7 @@ typedef struct LDKMessageRouter { * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest * [`create_refund_builder`]: Self::create_refund_builder * [`request_refund_payment`]: Self::request_refund_payment - * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected + * [`peer_disconnected`]: msgs::BaseMessageHandler::peer_disconnected * [`funding_created`]: msgs::FundingCreated * [`funding_transaction_generated`]: Self::funding_transaction_generated * [`BlockHash`]: bitcoin::hash_types::BlockHash @@ -13593,6 +14719,38 @@ typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { bool result_ok; } LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; +/** + * The contents of CResult_NoneSecp256k1ErrorZ + */ +typedef union LDKCResult_NoneSecp256k1ErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKSecp256k1Error *err; +} LDKCResult_NoneSecp256k1ErrorZPtr; + +/** + * A CResult_NoneSecp256k1ErrorZ represents the result of a fallible operation, + * containing a () 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_NoneSecp256k1ErrorZ { + /** + * The contents of this CResult_NoneSecp256k1ErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneSecp256k1ErrorZPtr contents; + /** + * Whether this CResult_NoneSecp256k1ErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneSecp256k1ErrorZ; + /** * Options for how to set the max dust exposure allowed on a channel. See * [`ChannelConfig::max_dust_htlc_exposure`] for details. @@ -13631,12 +14789,19 @@ typedef enum LDKMaxDustHTLCExposure_Tag { * on HTLC outputs means your channel may be subject to more dust exposure in the event of * increases in fee rate. * + * Note that because zero-commitment-fee anchor channels do not allow for feerate updates (and + * thus never experience dust exposure changes due to feerate shifts, resulting in no + * force-closes due to dust exposure limits), such channels will calculate their maximum + * dust exposure using a constant feerate of 250 sat/KW when using this variant. + * See [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`] to enable such channels. + * * # Backwards Compatibility * This variant only became available in LDK 0.0.116, so if you downgrade to a prior version * by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat. * * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate + * [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`]: ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments */ LDKMaxDustHTLCExposure_FeeRateMultiplier, /** @@ -13771,6 +14936,33 @@ typedef struct LDKCOption_MaxDustHTLCExposureZ { }; } LDKCOption_MaxDustHTLCExposureZ; +/** + * An enum which can either contain a u8 or not + */ +typedef enum LDKCOption_u8Z_Tag { + /** + * When we're in this state, this COption_u8Z contains a u8 + */ + LDKCOption_u8Z_Some, + /** + * When we're in this state, this COption_u8Z contains nothing + */ + LDKCOption_u8Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u8Z_Sentinel, +} LDKCOption_u8Z_Tag; + +typedef struct LDKCOption_u8Z { + LDKCOption_u8Z_Tag tag; + union { + struct { + uint8_t some; + }; + }; +} LDKCOption_u8Z; + /** * An enum which can either contain a crate::lightning::util::errors::APIError or not */ @@ -13834,41 +15026,484 @@ typedef struct LDKCResult_COption_APIErrorZDecodeErrorZ { /** - * Fees and parameters for a JIT Channel without the promise. + * [`EncryptedOurPeerStorage`] represents encrypted state of the corresponding [`DecryptedOurPeerStorage`]. * - * The promise will be calculated automatically for the LSP and this type converted - * into an [`LSPS2OpeningFeeParams`] for transit over the wire. + * # Key Methods + * - [`EncryptedOurPeerStorage::new`]: Returns [`EncryptedOurPeerStorage`] with the given encrypted cipher. + * - [`EncryptedOurPeerStorage::decrypt`]: Returns [`DecryptedOurPeerStorage`] created from decrypting the cipher. + * - [`EncryptedOurPeerStorage::into_vec`]: Returns the cipher in [`Vec`] format. + */ +typedef struct MUST_USE_STRUCT LDKEncryptedOurPeerStorage { + /** + * 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. + */ + LDKnativeEncryptedOurPeerStorage *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; +} LDKEncryptedOurPeerStorage; + +/** + * The contents of CResult_EncryptedOurPeerStorageNoneZ + */ +typedef union LDKCResult_EncryptedOurPeerStorageNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKEncryptedOurPeerStorage *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_EncryptedOurPeerStorageNoneZPtr; + +/** + * A CResult_EncryptedOurPeerStorageNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_EncryptedOurPeerStorageNoneZ { + /** + * The contents of this CResult_EncryptedOurPeerStorageNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_EncryptedOurPeerStorageNoneZPtr contents; + /** + * Whether this CResult_EncryptedOurPeerStorageNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_EncryptedOurPeerStorageNoneZ; + + + +/** + * [`DecryptedOurPeerStorage`] is used to store serialised channel information that allows for the creation of a + * `peer_storage` backup. + * + * This structure is designed to serialize channel data for backup and supports encryption + * using `ChaCha20Poly1305RFC` for transmission. + * + * # Key Methods + * - [`DecryptedOurPeerStorage::new`]: Returns [`DecryptedOurPeerStorage`] with the given data. + * - [`DecryptedOurPeerStorage::encrypt`]: Returns [`EncryptedOurPeerStorage`] created from encrypting the provided data. + * - [`DecryptedOurPeerStorage::into_vec`]: Returns the data in [`Vec`] format. + * + * ## Example + * ``` + * use lightning::ln::our_peer_storage::DecryptedOurPeerStorage; + * use lightning::sign::{KeysManager, NodeSigner}; + * let seed = [1u8; 32]; + * let keys_mgr = KeysManager::new(&seed, 42, 42, true); + * let key = keys_mgr.get_peer_storage_key(); + * let decrypted_ops = DecryptedOurPeerStorage::new(vec![1, 2, 3]); + * let our_peer_storage = decrypted_ops.encrypt(&key, &[0u8; 32]); + * let decrypted_data = our_peer_storage.decrypt(&key).unwrap(); + * assert_eq!(decrypted_data.into_vec(), vec![1, 2, 3]); + * ``` */ -typedef struct MUST_USE_STRUCT LDKLSPS2RawOpeningFeeParams { +typedef struct MUST_USE_STRUCT LDKDecryptedOurPeerStorage { /** * 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. */ - LDKnativeLSPS2RawOpeningFeeParams *inner; + LDKnativeDecryptedOurPeerStorage *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; -} LDKLSPS2RawOpeningFeeParams; +} LDKDecryptedOurPeerStorage; + +/** + * The contents of CResult_DecryptedOurPeerStorageNoneZ + */ +typedef union LDKCResult_DecryptedOurPeerStorageNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDecryptedOurPeerStorage *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_DecryptedOurPeerStorageNoneZPtr; + +/** + * A CResult_DecryptedOurPeerStorageNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_DecryptedOurPeerStorageNoneZ { + /** + * The contents of this CResult_DecryptedOurPeerStorageNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DecryptedOurPeerStorageNoneZPtr contents; + /** + * Whether this CResult_DecryptedOurPeerStorageNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_DecryptedOurPeerStorageNoneZ; + + + +/** + * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] 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; + +/** + * Instructions for how to respond to an `InvoiceRequest`. + */ +typedef enum LDKInvreqResponseInstructions_Tag { + /** + * We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to + * the invoice request since it is now verified. + */ + LDKInvreqResponseInstructions_SendInvoice, + /** + * We are a static invoice server and should respond to this invoice request by retrieving the + * [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_slot` and calling + * [`OffersMessageFlow::enqueue_static_invoice`]. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + */ + LDKInvreqResponseInstructions_SendStaticInvoice, + /** + * Must be last for serialization purposes + */ + LDKInvreqResponseInstructions_Sentinel, +} LDKInvreqResponseInstructions_Tag; + +typedef struct LDKInvreqResponseInstructions_LDKSendStaticInvoice_Body { + /** + * An identifier for the async recipient for whom we are serving [`StaticInvoice`]s. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + */ + struct LDKCVec_u8Z recipient_id; + /** + * The slot number for the specific invoice being requested by the payer. + */ + uint16_t invoice_slot; + /** + * The invoice request that should be forwarded to the async recipient in case the + * recipient is online to respond. Should be forwarded by calling + * [`OffersMessageFlow::enqueue_invoice_request_to_forward`]. + */ + struct LDKInvoiceRequest invoice_request; +} LDKInvreqResponseInstructions_LDKSendStaticInvoice_Body; + +typedef struct MUST_USE_STRUCT LDKInvreqResponseInstructions { + LDKInvreqResponseInstructions_Tag tag; + union { + struct { + struct LDKVerifiedInvoiceRequest send_invoice; + }; + LDKInvreqResponseInstructions_LDKSendStaticInvoice_Body send_static_invoice; + }; +} LDKInvreqResponseInstructions; + +/** + * The contents of CResult_InvreqResponseInstructionsNoneZ + */ +typedef union LDKCResult_InvreqResponseInstructionsNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvreqResponseInstructions *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_InvreqResponseInstructionsNoneZPtr; + +/** + * A CResult_InvreqResponseInstructionsNoneZ represents the result of a fallible operation, + * containing a crate::lightning::offers::flow::InvreqResponseInstructions on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvreqResponseInstructionsNoneZ { + /** + * The contents of this CResult_InvreqResponseInstructionsNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvreqResponseInstructionsNoneZPtr contents; + /** + * Whether this CResult_InvreqResponseInstructionsNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvreqResponseInstructionsNoneZ; + +/** + * An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not + */ +typedef enum LDKCOption_MessageContextZ_Tag { + /** + * When we're in this state, this COption_MessageContextZ contains a crate::lightning::blinded_path::message::MessageContext + */ + LDKCOption_MessageContextZ_Some, + /** + * When we're in this state, this COption_MessageContextZ contains nothing + */ + LDKCOption_MessageContextZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_MessageContextZ_Sentinel, +} LDKCOption_MessageContextZ_Tag; + +typedef struct LDKCOption_MessageContextZ { + LDKCOption_MessageContextZ_Tag tag; + union { + struct { + struct LDKMessageContext some; + }; + }; +} LDKCOption_MessageContextZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ { + /** + * The element at position 0 + */ + struct LDKOffersMessage a; + /** + * The element at position 1 + */ + struct LDKCOption_MessageContextZ b; +} LDKC2Tuple_OffersMessageCOption_MessageContextZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OfferboolZ { + /** + * The element at position 0 + */ + struct LDKOffer a; + /** + * The element at position 1 + */ + bool b; +} LDKC2Tuple_OfferboolZ; + +/** + * The contents of CResult_C2Tuple_OfferboolZNoneZ + */ +typedef union LDKCResult_C2Tuple_OfferboolZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_OfferboolZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_OfferboolZNoneZPtr; + +/** + * A CResult_C2Tuple_OfferboolZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_OfferboolZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_OfferboolZNoneZ { + /** + * The contents of this CResult_C2Tuple_OfferboolZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_OfferboolZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_OfferboolZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_OfferboolZNoneZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OfferPathsMessageContextZ { + /** + * The element at position 0 + */ + struct LDKOfferPaths a; + /** + * The element at position 1 + */ + struct LDKMessageContext b; +} LDKC2Tuple_OfferPathsMessageContextZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ or not + */ +typedef enum LDKCOption_C2Tuple_OfferPathsMessageContextZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_OfferPathsMessageContextZZ contains a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ + */ + LDKCOption_C2Tuple_OfferPathsMessageContextZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_OfferPathsMessageContextZZ contains nothing + */ + LDKCOption_C2Tuple_OfferPathsMessageContextZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_OfferPathsMessageContextZZ_Sentinel, +} LDKCOption_C2Tuple_OfferPathsMessageContextZZ_Tag; + +typedef struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ { + LDKCOption_C2Tuple_OfferPathsMessageContextZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_OfferPathsMessageContextZ some; + }; + }; +} LDKCOption_C2Tuple_OfferPathsMessageContextZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ { + /** + * The element at position 0 + */ + struct LDKServeStaticInvoice a; + /** + * The element at position 1 + */ + struct LDKMessageContext b; +} LDKC2Tuple_ServeStaticInvoiceMessageContextZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ or not + */ +typedef enum LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_ServeStaticInvoiceMessageContextZZ contains a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ + */ + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_ServeStaticInvoiceMessageContextZZ contains nothing + */ + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_Sentinel, +} LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_Tag; + +typedef struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ some; + }; + }; +} LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_CVec_u8Zu16Z { + /** + * The element at position 0 + */ + struct LDKCVec_u8Z a; + /** + * The element at position 1 + */ + uint16_t b; +} LDKC2Tuple_CVec_u8Zu16Z; + +/** + * The contents of CResult_C2Tuple_CVec_u8Zu16ZNoneZ + */ +typedef union LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_CVec_u8Zu16Z *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZPtr; + +/** + * A CResult_C2Tuple_CVec_u8Zu16ZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_CVec_u8Zu16Z on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ { + /** + * The contents of this CResult_C2Tuple_CVec_u8Zu16ZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_CVec_u8Zu16ZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_OutPointCVec_u8ZZ { + /** + * The element at position 0 + */ + struct LDKOutPoint a; + /** + * The element at position 1 + */ + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointCVec_u8ZZ; /** - * A dynamically-allocated array of crate::lightning_liquidity::lsps2::msgs::LSPS2RawOpeningFeeParamss of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_u8ZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_LSPS2RawOpeningFeeParamsZ { +typedef struct LDKCVec_C2Tuple_OutPointCVec_u8ZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKLSPS2RawOpeningFeeParams *data; + struct LDKC2Tuple_OutPointCVec_u8ZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_LSPS2RawOpeningFeeParamsZ; +} LDKCVec_C2Tuple_OutPointCVec_u8ZZZ; /** * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ @@ -13996,19 +15631,41 @@ typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { bool result_ok; } LDKCResult_HTLCUpdateDecodeErrorZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The claimable balance of a holder commitment transaction that has yet to be broadcast. */ -typedef struct LDKC2Tuple_OutPointCVec_u8ZZ { +typedef struct MUST_USE_STRUCT LDKHolderCommitmentTransactionBalance { /** - * The element at position 0 + * 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. */ - struct LDKOutPoint a; + LDKnativeHolderCommitmentTransactionBalance *inner; /** - * The element at position 1 + * 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. */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointCVec_u8ZZ; + bool is_owned; +} LDKHolderCommitmentTransactionBalance; + +/** + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::HolderCommitmentTransactionBalances of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_HolderCommitmentTransactionBalanceZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKHolderCommitmentTransactionBalance *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_HolderCommitmentTransactionBalanceZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -14225,8 +15882,7 @@ typedef struct LDKC2Tuple_boolboolZ { typedef enum LDKBalance_Tag { /** * The channel is not yet closed (or the commitment or closing transaction has not yet - * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - * force-closed now. + * appeared in a block). */ LDKBalance_ClaimableOnChannelClose, /** @@ -14272,19 +15928,32 @@ typedef enum LDKBalance_Tag { typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * A list of balance candidates based on the latest set of valid holder commitment + * transactions that can hit the chain. Typically, a channel only has one valid holder + * commitment transaction that spends the current funding output. As soon as a channel is + * spliced, an alternative holder commitment transaction exists spending the new funding + * output. More alternative holder commitment transactions can exist as the splice remains + * pending and RBF attempts are made. + * + * The candidates are sorted by the order in which the holder commitment transactions were + * negotiated. When only one candidate exists, the channel does not have a splice pending. + * When multiple candidates exist, the last one reflects the balance of the + * latest splice/RBF attempt, while the first reflects the balance prior to the splice + * occurring. + * + * Entries remain in this vec until the pending splice has reached [`ANTI_REORG_DELAY`] + * confirmations, at which point any conflicts will be removed. Once a splice confirms + * [`Self::ClaimableOnChannelClose::confirmed_balance_candidate_index`] will point to the + * confirmed entry, even if it has fewer than [`ANTI_REORG_DELAY`] confirmations. */ - uint64_t amount_satoshis; + struct LDKCVec_HolderCommitmentTransactionBalanceZ balance_candidates; /** - * The transaction fee we pay for the closing commitment transaction. This amount is not - * included in the [`Balance::ClaimableOnChannelClose::amount_satoshis`] value. - * - * Note that if this channel is inbound (and thus our counterparty pays the commitment - * transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK - * 0.0.124, the channel is always treated as outbound (and thus this value is never zero). + * The index within [`Balance::ClaimableOnChannelClose::balance_candidates`] for the + * balance according to the current onchain state of the channel. This can be helpful when + * wanting to determine the claimable amount when the holder commitment transaction for the + * current funding transaction is broadcast and/or confirms. */ - uint64_t transaction_fee_satoshis; + uintptr_t confirmed_balance_candidate_index; /** * The amount of millisatoshis which has been burned to fees from HTLCs which are outbound * from us and are related to a payment which was sent by us. This is the sum of the @@ -14311,7 +15980,7 @@ typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { * to us and for which we know the preimage. This is the sum of the millisatoshis part of * all HTLCs which would be represented by [`Balance::ContentiousClaimable`] on channel * close, but whose current value is included in - * [`Balance::ClaimableOnChannelClose::amount_satoshis`], as well as any dust HTLCs which + * [`HolderCommitmentTransactionBalance::amount_satoshis`], as well as any dust HTLCs which * would otherwise be represented the same. * * This amount (rounded up to a whole satoshi value) will not be included in the counterparty's @@ -14939,39 +16608,6 @@ typedef struct LDKCResult_NonePeerHandleErrorZ { bool result_ok; } LDKCResult_NonePeerHandleErrorZ; -/** - * The contents of CResult_boolPeerHandleErrorZ - */ -typedef union LDKCResult_boolPeerHandleErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - bool *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKPeerHandleError *err; -} LDKCResult_boolPeerHandleErrorZPtr; - -/** - * 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`. - */ -typedef struct LDKCResult_boolPeerHandleErrorZ { - /** - * The contents of this CResult_boolPeerHandleErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_boolPeerHandleErrorZPtr contents; - /** - * Whether this CResult_boolPeerHandleErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_boolPeerHandleErrorZ; - /** * All-encompassing standard error type that processing can return */ @@ -15037,6 +16673,366 @@ typedef struct LDKCResult_u32GraphSyncErrorZ { bool result_ok; } LDKCResult_u32GraphSyncErrorZ; + + +/** + * If we are an often-offline recipient, we'll want to interactively build offers and static + * invoices with an always-online node that will serve those static invoices to payers on our + * behalf when we are offline. + * + * This struct is used to cache those interactively built offers, and should be passed into + * [`OffersMessageFlow`] on startup as well as persisted whenever an offer or invoice is updated. + * + * ## Lifecycle of a cached offer + * + * 1. On initial startup, recipients will request offer paths from the static invoice server + * 2. Once a set of offer paths is received, recipients will build an offer and corresponding + * static invoice, cache the offer as pending, and send the invoice to the server for + * persistence + * 3. Once the invoice is confirmed as persisted by the server, the recipient will mark the + * corresponding offer as ready to receive payments + * 4. If the offer is later returned to the user, it will be kept cached and its invoice will be + * kept up-to-date until the offer expires + * 5. If the offer does not get returned to the user within a certain timeframe, it will be + * replaced with a new one using fresh offer paths requested from the static invoice server + * + * ## Staying in sync with the Static Invoice Server + * + * * Pending offers: for a given cached offer where a corresponding invoice is not yet confirmed as + * persisted by the static invoice server, we will retry persisting an invoice for that offer until + * it succeeds, once per timer tick + * * Confirmed offers that have not yet been returned to the user: we will periodically replace an + * unused confirmed offer with a new one, to try to always have a fresh offer available. We wait + * several hours in between replacements to ensure the new offer replacement doesn't conflict with + * the old one + * * Confirmed offers that have been returned to the user: we will send the server a fresh invoice + * corresponding to each used offer once per timer tick until the offer expires + * + * [`OffersMessageFlow`]: crate::offers::flow::OffersMessageFlow + */ +typedef struct MUST_USE_STRUCT LDKAsyncReceiveOfferCache { + /** + * 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. + */ + LDKnativeAsyncReceiveOfferCache *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; +} LDKAsyncReceiveOfferCache; + +/** + * The contents of CResult_AsyncReceiveOfferCacheDecodeErrorZ + */ +typedef union LDKCResult_AsyncReceiveOfferCacheDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKAsyncReceiveOfferCache *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_AsyncReceiveOfferCacheDecodeErrorZPtr; + +/** + * A CResult_AsyncReceiveOfferCacheDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache 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_AsyncReceiveOfferCacheDecodeErrorZ { + /** + * The contents of this CResult_AsyncReceiveOfferCacheDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_AsyncReceiveOfferCacheDecodeErrorZPtr contents; + /** + * Whether this CResult_AsyncReceiveOfferCacheDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ; + +/** + * The contents of CResult_InvoiceRequestBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequest *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestBolt12SemanticErrorZ; + + + +/** + * Builds a [`Bolt12Invoice`] from either: + * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or + * - a [`Refund`] for the \"offer for money\" flow. + * + * See [module-level documentation] for usage. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Refund`]: crate::offers::refund::Refund + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKInvoiceWithExplicitSigningPubkeyBuilder { + /** + * 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. + */ + LDKnativeInvoiceWithExplicitSigningPubkeyBuilder *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; +} LDKInvoiceWithExplicitSigningPubkeyBuilder; + +/** + * The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceWithExplicitSigningPubkeyBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; + +/** + * 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; + + + +/** + * Builds a [`Bolt12Invoice`] from either: + * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or + * - a [`Refund`] for the \"offer for money\" flow. + * + * See [module-level documentation] for usage. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Refund`]: crate::offers::refund::Refund + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKInvoiceWithDerivedSigningPubkeyBuilder { + /** + * 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. + */ + LDKnativeInvoiceWithDerivedSigningPubkeyBuilder *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; +} LDKInvoiceWithDerivedSigningPubkeyBuilder; + +/** + * The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ + */ +typedef union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceWithDerivedSigningPubkeyBuilder *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr; + +/** + * A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + /** + * The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; + +/** + * The contents of CResult_InvoiceRequestDecodeErrorZ + */ +typedef union LDKCResult_InvoiceRequestDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequest *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_InvoiceRequestDecodeErrorZPtr; + +/** + * A CResult_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequest 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_InvoiceRequestDecodeErrorZ { + /** + * The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestDecodeErrorZ; + + + +/** + * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`]. + * + * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFields { + /** + * 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. + */ + LDKnativeInvoiceRequestFields *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; +} LDKInvoiceRequestFields; + +/** + * The contents of CResult_InvoiceRequestFieldsDecodeErrorZ + */ +typedef union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequestFields *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_InvoiceRequestFieldsDecodeErrorZPtr; + +/** + * A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequestFields 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_InvoiceRequestFieldsDecodeErrorZ { + /** + * The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestFieldsDecodeErrorZ; + /** * The contents of CResult_CVec_u8ZIOErrorZ */ @@ -15268,89 +17264,35 @@ typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { bool result_ok; } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; - - -/** - * A struct representing a name for a channel monitor. - * - * `MonitorName` is primarily used within the [`MonitorUpdatingPersister`] - * in functions that store or retrieve channel monitor snapshots. - * It provides a consistent way to generate a unique key for channel - * monitors based on their funding outpoints. - * - * While users of the Lightning Dev Kit library generally won't need - * to interact with [`MonitorName`] directly, it can be useful for: - * - Custom persistence implementations - * - Debugging or logging channel monitor operations - * - Extending the functionality of the `MonitorUpdatingPersister` - * # Examples - * - * ``` - * use std::str::FromStr; - * - * use bitcoin::Txid; - * - * use lightning::util::persist::MonitorName; - * use lightning::chain::transaction::OutPoint; - * - * let outpoint = OutPoint { - *\t txid: Txid::from_str(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap(), - *\t index: 1, - * }; - * let monitor_name = MonitorName::from(outpoint); - * assert_eq!(monitor_name.as_str(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); - * - * // Using MonitorName to generate a storage key - * let storage_key = format!(\"channel_monitors/{}\", monitor_name.as_str()); - * ``` - */ -typedef struct MUST_USE_STRUCT LDKMonitorName { - /** - * 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. - */ - LDKnativeMonitorName *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; -} LDKMonitorName; - /** - * The contents of CResult_MonitorNameIOErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_MonitorNameIOErrorZPtr { +typedef struct LDKC2Tuple_ChannelIdu64Z { /** - * 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 LDKMonitorName *result; + struct LDKChannelId a; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The element at position 1 */ - enum LDKIOError *err; -} LDKCResult_MonitorNameIOErrorZPtr; + uint64_t b; +} LDKC2Tuple_ChannelIdu64Z; /** - * A CResult_MonitorNameIOErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::persist::MonitorName on success and a crate::c_types::IOError 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_ChannelIdu64Zs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_MonitorNameIOErrorZ { +typedef struct LDKCVec_C2Tuple_ChannelIdu64ZZ { /** - * The contents of this CResult_MonitorNameIOErrorZ, 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_MonitorNameIOErrorZPtr contents; + struct LDKC2Tuple_ChannelIdu64Z *data; /** - * Whether this CResult_MonitorNameIOErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_MonitorNameIOErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_ChannelIdu64ZZ; @@ -15438,301 +17380,31 @@ typedef struct LDKCResult_UpdateNameIOErrorZ { } LDKCResult_UpdateNameIOErrorZ; /** - * The contents of CResult_InvoiceRequestBolt12SemanticErrorZ - */ -typedef union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoiceRequest *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKBolt12SemanticError *err; -} LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr; - -/** - * A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ { - /** - * The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceRequestBolt12SemanticErrorZPtr contents; - /** - * Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceRequestBolt12SemanticErrorZ; - - - -/** - * Builds a [`Bolt12Invoice`] from either: - * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or - * - a [`Refund`] for the \"offer for money\" flow. - * - * See [module-level documentation] for usage. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Refund`]: crate::offers::refund::Refund - * [module-level documentation]: self - */ -typedef struct MUST_USE_STRUCT LDKInvoiceWithExplicitSigningPubkeyBuilder { - /** - * 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. - */ - LDKnativeInvoiceWithExplicitSigningPubkeyBuilder *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; -} LDKInvoiceWithExplicitSigningPubkeyBuilder; - -/** - * The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ - */ -typedef union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoiceWithExplicitSigningPubkeyBuilder *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKBolt12SemanticError *err; -} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr; - -/** - * A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - /** - * The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; - /** - * Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; - - - -/** - * An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify_using_metadata`] or - * [`InvoiceRequest::verify_using_recipient_data`] 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; - - - -/** - * Builds a [`Bolt12Invoice`] from either: - * - an [`InvoiceRequest`] for the \"offer to be paid\" flow or - * - a [`Refund`] for the \"offer for money\" flow. - * - * See [module-level documentation] for usage. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Refund`]: crate::offers::refund::Refund - * [module-level documentation]: self - */ -typedef struct MUST_USE_STRUCT LDKInvoiceWithDerivedSigningPubkeyBuilder { - /** - * 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. - */ - LDKnativeInvoiceWithDerivedSigningPubkeyBuilder *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; -} LDKInvoiceWithDerivedSigningPubkeyBuilder; - -/** - * The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ - */ -typedef union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoiceWithDerivedSigningPubkeyBuilder *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKBolt12SemanticError *err; -} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr; - -/** - * A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - /** - * The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; - /** - * Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; - -/** - * The contents of CResult_InvoiceRequestDecodeErrorZ - */ -typedef union LDKCResult_InvoiceRequestDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoiceRequest *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_InvoiceRequestDecodeErrorZPtr; - -/** - * A CResult_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::InvoiceRequest 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_InvoiceRequestDecodeErrorZ { - /** - * The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceRequestDecodeErrorZPtr contents; - /** - * Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceRequestDecodeErrorZ; - - - -/** - * Fields sent in an [`InvoiceRequest`] message to include in [`PaymentContext::Bolt12Offer`]. - * - * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer + * An enum which can either contain a crate::c_types::Transaction or not */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestFields { +typedef enum LDKCOption_TransactionZ_Tag { /** - * 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. - */ - LDKnativeInvoiceRequestFields *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. + * When we're in this state, this COption_TransactionZ contains a crate::c_types::Transaction */ - bool is_owned; -} LDKInvoiceRequestFields; - -/** - * The contents of CResult_InvoiceRequestFieldsDecodeErrorZ - */ -typedef union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr { + LDKCOption_TransactionZ_Some, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * When we're in this state, this COption_TransactionZ contains nothing */ - struct LDKInvoiceRequestFields *result; + LDKCOption_TransactionZ_None, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Must be last for serialization purposes */ - struct LDKDecodeError *err; -} LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr; + LDKCOption_TransactionZ_Sentinel, +} LDKCOption_TransactionZ_Tag; -/** - * A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::InvoiceRequestFields 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_InvoiceRequestFieldsDecodeErrorZ { - /** - * The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceRequestFieldsDecodeErrorZPtr contents; - /** - * Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceRequestFieldsDecodeErrorZ; +typedef struct LDKCOption_TransactionZ { + LDKCOption_TransactionZ_Tag tag; + union { + struct { + struct LDKTransaction some; + }; + }; +} LDKCOption_TransactionZ; /** * A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. @@ -15804,6 +17476,36 @@ typedef struct LDKCOption_i64Z { }; } LDKCOption_i64Z; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64BlindedMessagePathZ { + /** + * The element at position 0 + */ + uint64_t a; + /** + * The element at position 1 + */ + struct LDKBlindedMessagePath b; +} LDKC2Tuple_u64BlindedMessagePathZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64BlindedMessagePathZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_u64BlindedMessagePathZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_u64BlindedMessagePathZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_u64BlindedMessagePathZZ; + /** * The contents of CResult_SocketAddressDecodeErrorZ */ @@ -16022,6 +17724,39 @@ typedef struct LDKCVec_UpdateFailMalformedHTLCZ { uintptr_t datalen; } LDKCVec_UpdateFailMalformedHTLCZ; +/** + * The contents of CResult_TrampolineOnionPacketDecodeErrorZ + */ +typedef union LDKCResult_TrampolineOnionPacketDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTrampolineOnionPacket *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_TrampolineOnionPacketDecodeErrorZPtr; + +/** + * A CResult_TrampolineOnionPacketDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::TrampolineOnionPacket 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_TrampolineOnionPacketDecodeErrorZ { + /** + * The contents of this CResult_TrampolineOnionPacketDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TrampolineOnionPacketDecodeErrorZPtr contents; + /** + * Whether this CResult_TrampolineOnionPacketDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_TrampolineOnionPacketDecodeErrorZ; + /** * The contents of CResult_AcceptChannelDecodeErrorZ */ @@ -16583,169 +18318,267 @@ typedef struct LDKCResult_ChannelReestablishDecodeErrorZ { bool result_ok; } LDKCResult_ChannelReestablishDecodeErrorZ; + + /** - * The contents of CResult_ClosingSignedDecodeErrorZ + * Information exchanged during channel reestablishment about the next funding from interactive + * transaction construction. */ -typedef union LDKCResult_ClosingSignedDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKNextFunding { + /** + * 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. + */ + LDKnativeNextFunding *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; +} LDKNextFunding; + +/** + * The contents of CResult_NextFundingDecodeErrorZ + */ +typedef union LDKCResult_NextFundingDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClosingSigned *result; + struct LDKNextFunding *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_ClosingSignedDecodeErrorZPtr; +} LDKCResult_NextFundingDecodeErrorZPtr; /** - * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NextFundingDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::NextFunding 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_ClosingSignedDecodeErrorZ { +typedef struct LDKCResult_NextFundingDecodeErrorZ { /** - * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either + * The contents of this CResult_NextFundingDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ClosingSignedDecodeErrorZPtr contents; + union LDKCResult_NextFundingDecodeErrorZPtr contents; /** - * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. + * Whether this CResult_NextFundingDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ClosingSignedDecodeErrorZ; +} LDKCResult_NextFundingDecodeErrorZ; /** - * The minimum and maximum fees which the sender is willing to place on the closing transaction. - * - * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing - * to use. + * Information exchanged during channel reestablishment about the last funding locked. */ -typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange { +typedef struct MUST_USE_STRUCT LDKFundingLocked { /** * 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. */ - LDKnativeClosingSignedFeeRange *inner; + LDKnativeFundingLocked *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; -} LDKClosingSignedFeeRange; +} LDKFundingLocked; /** - * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ + * The contents of CResult_FundingLockedDecodeErrorZ */ -typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr { +typedef union LDKCResult_FundingLockedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKClosingSignedFeeRange *result; + struct LDKFundingLocked *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_ClosingSignedFeeRangeDecodeErrorZPtr; +} LDKCResult_FundingLockedDecodeErrorZPtr; /** - * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::FundingLocked 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_ClosingSignedFeeRangeDecodeErrorZ { +typedef struct LDKCResult_FundingLockedDecodeErrorZ { /** - * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either + * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents; + union LDKCResult_FundingLockedDecodeErrorZPtr contents; /** - * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + * Whether this CResult_FundingLockedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ClosingSignedFeeRangeDecodeErrorZ; +} LDKCResult_FundingLockedDecodeErrorZ; +/** + * The contents of CResult_ClosingSignedDecodeErrorZ + */ +typedef union LDKCResult_ClosingSignedDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKClosingSigned *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_ClosingSignedDecodeErrorZPtr; +/** + * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ { + /** + * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClosingSignedDecodeErrorZPtr contents; + /** + * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClosingSignedDecodeErrorZ; /** - * Optional batch parameters for `commitment_signed` message. + * The contents of CResult_ClosingCompleteDecodeErrorZ */ -typedef struct MUST_USE_STRUCT LDKCommitmentSignedBatch { +typedef union LDKCResult_ClosingCompleteDecodeErrorZPtr { /** - * 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. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKnativeCommitmentSignedBatch *inner; + struct LDKClosingComplete *result; /** - * 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. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - bool is_owned; -} LDKCommitmentSignedBatch; + struct LDKDecodeError *err; +} LDKCResult_ClosingCompleteDecodeErrorZPtr; /** - * The contents of CResult_CommitmentSignedBatchDecodeErrorZ + * A CResult_ClosingCompleteDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingComplete 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 union LDKCResult_CommitmentSignedBatchDecodeErrorZPtr { +typedef struct LDKCResult_ClosingCompleteDecodeErrorZ { + /** + * The contents of this CResult_ClosingCompleteDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClosingCompleteDecodeErrorZPtr contents; + /** + * Whether this CResult_ClosingCompleteDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClosingCompleteDecodeErrorZ; + +/** + * The contents of CResult_ClosingSigDecodeErrorZ + */ +typedef union LDKCResult_ClosingSigDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCommitmentSignedBatch *result; + struct LDKClosingSig *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_CommitmentSignedBatchDecodeErrorZPtr; +} LDKCResult_ClosingSigDecodeErrorZPtr; /** - * A CResult_CommitmentSignedBatchDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::CommitmentSignedBatch on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ClosingSigDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingSig 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_CommitmentSignedBatchDecodeErrorZ { +typedef struct LDKCResult_ClosingSigDecodeErrorZ { /** - * The contents of this CResult_CommitmentSignedBatchDecodeErrorZ, accessible via either + * The contents of this CResult_ClosingSigDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CommitmentSignedBatchDecodeErrorZPtr contents; + union LDKCResult_ClosingSigDecodeErrorZPtr contents; /** - * Whether this CResult_CommitmentSignedBatchDecodeErrorZ represents a success state. + * Whether this CResult_ClosingSigDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CommitmentSignedBatchDecodeErrorZ; +} LDKCResult_ClosingSigDecodeErrorZ; /** - * A [`commitment_signed`] message to be sent to or received from a peer. + * The minimum and maximum fees which the sender is willing to place on the closing transaction. * - * [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed + * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing + * to use. */ -typedef struct MUST_USE_STRUCT LDKCommitmentSigned { +typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange { /** * 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. */ - LDKnativeCommitmentSigned *inner; + LDKnativeClosingSignedFeeRange *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; -} LDKCommitmentSigned; +} LDKClosingSignedFeeRange; + +/** + * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ + */ +typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKClosingSignedFeeRange *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_ClosingSignedFeeRangeDecodeErrorZPtr; + +/** + * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange 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_ClosingSignedFeeRangeDecodeErrorZ { + /** + * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents; + /** + * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ClosingSignedFeeRangeDecodeErrorZ; /** * The contents of CResult_CommitmentSignedDecodeErrorZ @@ -17220,6 +19053,128 @@ typedef struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ { bool result_ok; } LDKCResult_UpdateFulfillHTLCDecodeErrorZ; +/** + * The contents of CResult_PeerStorageDecodeErrorZ + */ +typedef union LDKCResult_PeerStorageDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPeerStorage *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_PeerStorageDecodeErrorZPtr; + +/** + * A CResult_PeerStorageDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::PeerStorage 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_PeerStorageDecodeErrorZ { + /** + * The contents of this CResult_PeerStorageDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PeerStorageDecodeErrorZPtr contents; + /** + * Whether this CResult_PeerStorageDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PeerStorageDecodeErrorZ; + +/** + * The contents of CResult_PeerStorageRetrievalDecodeErrorZ + */ +typedef union LDKCResult_PeerStorageRetrievalDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPeerStorageRetrieval *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_PeerStorageRetrievalDecodeErrorZPtr; + +/** + * A CResult_PeerStorageRetrievalDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::PeerStorageRetrieval 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_PeerStorageRetrievalDecodeErrorZ { + /** + * The contents of this CResult_PeerStorageRetrievalDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PeerStorageRetrievalDecodeErrorZPtr contents; + /** + * Whether this CResult_PeerStorageRetrievalDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PeerStorageRetrievalDecodeErrorZ; + + + +/** + * A [`start_batch`] message to be sent to group together multiple channel messages as a single + * logical message. + * + * [`start_batch`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#batching-channel-messages + */ +typedef struct MUST_USE_STRUCT LDKStartBatch { + /** + * 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. + */ + LDKnativeStartBatch *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; +} LDKStartBatch; + +/** + * The contents of CResult_StartBatchDecodeErrorZ + */ +typedef union LDKCResult_StartBatchDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStartBatch *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_StartBatchDecodeErrorZPtr; + +/** + * A CResult_StartBatchDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::StartBatch 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_StartBatchDecodeErrorZ { + /** + * The contents of this CResult_StartBatchDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StartBatchDecodeErrorZPtr contents; + /** + * Whether this CResult_StartBatchDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StartBatchDecodeErrorZ; + /** * The contents of CResult_OnionPacketDecodeErrorZ */ @@ -17289,8 +19244,9 @@ typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ { /** - * An onion message to be sent to or received from a peer. + * An [`onion message`] to be sent to or received from a peer. * + * [`onion message`]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md#onion-messages */ typedef struct MUST_USE_STRUCT LDKOnionMessage { /** @@ -18431,110 +20387,137 @@ typedef struct LDKCVec_FutureZ { uintptr_t datalen; } LDKCVec_FutureZ; - +/** + * The contents of CResult_OfferPathsRequestDecodeErrorZ + */ +typedef union LDKCResult_OfferPathsRequestDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOfferPathsRequest *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_OfferPathsRequestDecodeErrorZPtr; /** - * Lightning message type used by LSPS protocols. + * A CResult_OfferPathsRequestDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::OfferPathsRequest 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 MUST_USE_STRUCT LDKRawLSPSMessage { +typedef struct LDKCResult_OfferPathsRequestDecodeErrorZ { /** - * 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. + * The contents of this CResult_OfferPathsRequestDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeRawLSPSMessage *inner; + union LDKCResult_OfferPathsRequestDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_OfferPathsRequestDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKRawLSPSMessage; + bool result_ok; +} LDKCResult_OfferPathsRequestDecodeErrorZ; /** - * The contents of CResult_RawLSPSMessageDecodeErrorZ + * The contents of CResult_OfferPathsDecodeErrorZ */ -typedef union LDKCResult_RawLSPSMessageDecodeErrorZPtr { +typedef union LDKCResult_OfferPathsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRawLSPSMessage *result; + struct LDKOfferPaths *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_RawLSPSMessageDecodeErrorZPtr; +} LDKCResult_OfferPathsDecodeErrorZPtr; /** - * A CResult_RawLSPSMessageDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_liquidity::lsps0::ser::RawLSPSMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_OfferPathsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::OfferPaths 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_RawLSPSMessageDecodeErrorZ { +typedef struct LDKCResult_OfferPathsDecodeErrorZ { /** - * The contents of this CResult_RawLSPSMessageDecodeErrorZ, accessible via either + * The contents of this CResult_OfferPathsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RawLSPSMessageDecodeErrorZPtr contents; + union LDKCResult_OfferPathsDecodeErrorZPtr contents; /** - * Whether this CResult_RawLSPSMessageDecodeErrorZ represents a success state. + * Whether this CResult_OfferPathsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RawLSPSMessageDecodeErrorZ; - +} LDKCResult_OfferPathsDecodeErrorZ; +/** + * The contents of CResult_ServeStaticInvoiceDecodeErrorZ + */ +typedef union LDKCResult_ServeStaticInvoiceDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKServeStaticInvoice *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_ServeStaticInvoiceDecodeErrorZPtr; /** - * An object representing datetimes as described in bLIP-50 / LSPS0. + * A CResult_ServeStaticInvoiceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::ServeStaticInvoice 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 MUST_USE_STRUCT LDKLSPSDateTime { +typedef struct LDKCResult_ServeStaticInvoiceDecodeErrorZ { /** - * 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. + * The contents of this CResult_ServeStaticInvoiceDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeLSPSDateTime *inner; + union LDKCResult_ServeStaticInvoiceDecodeErrorZPtr contents; /** - * 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. + * Whether this CResult_ServeStaticInvoiceDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKLSPSDateTime; + bool result_ok; +} LDKCResult_ServeStaticInvoiceDecodeErrorZ; /** - * The contents of CResult_LSPSDateTimeNoneZ + * The contents of CResult_StaticInvoicePersistedDecodeErrorZ */ -typedef union LDKCResult_LSPSDateTimeNoneZPtr { +typedef union LDKCResult_StaticInvoicePersistedDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKLSPSDateTime *result; + struct LDKStaticInvoicePersisted *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_LSPSDateTimeNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_StaticInvoicePersistedDecodeErrorZPtr; /** - * A CResult_LSPSDateTimeNoneZ represents the result of a fallible operation, - * containing a crate::lightning_liquidity::lsps0::ser::LSPSDateTime on success and a () on failure. + * A CResult_StaticInvoicePersistedDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::async_payments::StaticInvoicePersisted 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_LSPSDateTimeNoneZ { +typedef struct LDKCResult_StaticInvoicePersistedDecodeErrorZ { /** - * The contents of this CResult_LSPSDateTimeNoneZ, accessible via either + * The contents of this CResult_StaticInvoicePersistedDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_LSPSDateTimeNoneZPtr contents; + union LDKCResult_StaticInvoicePersistedDecodeErrorZPtr contents; /** - * Whether this CResult_LSPSDateTimeNoneZ represents a success state. + * Whether this CResult_StaticInvoicePersistedDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_LSPSDateTimeNoneZ; +} LDKCResult_StaticInvoicePersistedDecodeErrorZ; /** * The contents of CResult_HeldHtlcAvailableDecodeErrorZ @@ -18635,6 +20618,99 @@ typedef struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ { bool result_ok; } LDKCResult_AsyncPaymentsMessageDecodeErrorZ; +/** + * Error when signing messages. + */ +typedef enum LDKSignError_Tag { + /** + * User-defined error when signing the message. + */ + LDKSignError_Signing, + /** + * Error when verifying the produced signature using the given pubkey. + */ + LDKSignError_Verification, + /** + * Must be last for serialization purposes + */ + LDKSignError_Sentinel, +} LDKSignError_Tag; + +typedef struct MUST_USE_STRUCT LDKSignError { + LDKSignError_Tag tag; + union { + struct { + enum LDKSecp256k1Error verification; + }; + }; +} LDKSignError; + +/** + * The contents of CResult_StaticInvoiceSignErrorZ + */ +typedef union LDKCResult_StaticInvoiceSignErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStaticInvoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKSignError *err; +} LDKCResult_StaticInvoiceSignErrorZPtr; + +/** + * A CResult_StaticInvoiceSignErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::static_invoice::StaticInvoice on success and a crate::lightning::offers::merkle::SignError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_StaticInvoiceSignErrorZ { + /** + * The contents of this CResult_StaticInvoiceSignErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StaticInvoiceSignErrorZPtr contents; + /** + * Whether this CResult_StaticInvoiceSignErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StaticInvoiceSignErrorZ; + +/** + * The contents of CResult_StaticInvoiceDecodeErrorZ + */ +typedef union LDKCResult_StaticInvoiceDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStaticInvoice *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_StaticInvoiceDecodeErrorZPtr; + +/** + * A CResult_StaticInvoiceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::static_invoice::StaticInvoice 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_StaticInvoiceDecodeErrorZ { + /** + * The contents of this CResult_StaticInvoiceDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StaticInvoiceDecodeErrorZPtr contents; + /** + * Whether this CResult_StaticInvoiceDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StaticInvoiceDecodeErrorZ; + /** * The contents of CResult_OffersMessageDecodeErrorZ */ @@ -19345,38 +21421,6 @@ typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { bool result_ok; } LDKCResult_ShutdownScriptInvalidShutdownScriptZ; -/** - * The contents of CResult_u64NoneZ - */ -typedef union LDKCResult_u64NoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - uint64_t *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_u64NoneZPtr; - -/** - * A CResult_u64NoneZ represents the result of a fallible operation, - * containing a u64 on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_u64NoneZ { - /** - * The contents of this CResult_u64NoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_u64NoneZPtr contents; - /** - * Whether this CResult_u64NoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_u64NoneZ; - /** * `FundingInfo` holds information about a channel's funding transaction. * @@ -19837,27 +21881,32 @@ typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { } LDKCResult_COption_ClosureReasonZDecodeErrorZ; /** - * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. + * The type of HTLC handling performed in [`Event::HTLCHandlingFailed`]. */ -typedef enum LDKHTLCDestination_Tag { +typedef enum LDKHTLCHandlingFailureType_Tag { /** * We tried forwarding to a channel but failed to do so. An example of such an instance is when * there is insufficient capacity in our outbound channel. */ - LDKHTLCDestination_NextHopChannel, + LDKHTLCHandlingFailureType_Forward, /** * Scenario where we are unsure of the next node to forward the HTLC to. + * + * Deprecated: will only be used in versions before LDK v0.2.0. Downgrades will result in + * this type being represented as [`Self::InvalidForward`]. */ - LDKHTLCDestination_UnknownNextHop, + LDKHTLCHandlingFailureType_UnknownNextHop, /** * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate * intercept HTLC. + * + * In LDK v0.2.0 and greater, this variant replaces [`Self::UnknownNextHop`]. */ - LDKHTLCDestination_InvalidForward, + LDKHTLCHandlingFailureType_InvalidForward, /** * We couldn't decode the incoming onion to obtain the forwarding details. */ - LDKHTLCDestination_InvalidOnion, + LDKHTLCHandlingFailureType_InvalidOnion, /** * Failure scenario where an HTLC may have been forwarded to be intended for us, * but is invalid for some reason, so we reject it. @@ -19870,14 +21919,14 @@ typedef enum LDKHTLCDestination_Tag { * * A probing attack where an intermediary node is trying to detect if we are the ultimate * recipient for a payment. */ - LDKHTLCDestination_FailedPayment, + LDKHTLCHandlingFailureType_Receive, /** * Must be last for serialization purposes */ - LDKHTLCDestination_Sentinel, -} LDKHTLCDestination_Tag; + LDKHTLCHandlingFailureType_Sentinel, +} LDKHTLCHandlingFailureType_Tag; -typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { +typedef struct LDKHTLCHandlingFailureType_LDKForward_Body { /** * The `node_id` of the next node. For backwards compatibility, this field is * marked as optional, versions prior to 0.0.110 may not always be able to provide @@ -19890,98 +21939,422 @@ typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { * The outgoing `channel_id` between us and the next node. */ struct LDKChannelId channel_id; -} LDKHTLCDestination_LDKNextHopChannel_Body; +} LDKHTLCHandlingFailureType_LDKForward_Body; -typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { +typedef struct LDKHTLCHandlingFailureType_LDKUnknownNextHop_Body { /** * Short channel id we are requesting to forward an HTLC to. */ uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKUnknownNextHop_Body; +} LDKHTLCHandlingFailureType_LDKUnknownNextHop_Body; -typedef struct LDKHTLCDestination_LDKInvalidForward_Body { +typedef struct LDKHTLCHandlingFailureType_LDKInvalidForward_Body { /** * Short channel id we are requesting to forward an HTLC to. */ uint64_t requested_forward_scid; -} LDKHTLCDestination_LDKInvalidForward_Body; +} LDKHTLCHandlingFailureType_LDKInvalidForward_Body; -typedef struct LDKHTLCDestination_LDKFailedPayment_Body { +typedef struct LDKHTLCHandlingFailureType_LDKReceive_Body { /** * The payment hash of the payment we attempted to process. */ struct LDKThirtyTwoBytes payment_hash; -} LDKHTLCDestination_LDKFailedPayment_Body; +} LDKHTLCHandlingFailureType_LDKReceive_Body; -typedef struct MUST_USE_STRUCT LDKHTLCDestination { - LDKHTLCDestination_Tag tag; +typedef struct MUST_USE_STRUCT LDKHTLCHandlingFailureType { + LDKHTLCHandlingFailureType_Tag tag; union { - LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; - LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; - LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; - LDKHTLCDestination_LDKFailedPayment_Body failed_payment; + LDKHTLCHandlingFailureType_LDKForward_Body forward; + LDKHTLCHandlingFailureType_LDKUnknownNextHop_Body unknown_next_hop; + LDKHTLCHandlingFailureType_LDKInvalidForward_Body invalid_forward; + LDKHTLCHandlingFailureType_LDKReceive_Body receive; }; -} LDKHTLCDestination; +} LDKHTLCHandlingFailureType; /** - * An enum which can either contain a crate::lightning::events::HTLCDestination or not + * An enum which can either contain a crate::lightning::events::HTLCHandlingFailureType or not */ -typedef enum LDKCOption_HTLCDestinationZ_Tag { +typedef enum LDKCOption_HTLCHandlingFailureTypeZ_Tag { /** - * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination + * When we're in this state, this COption_HTLCHandlingFailureTypeZ contains a crate::lightning::events::HTLCHandlingFailureType */ - LDKCOption_HTLCDestinationZ_Some, + LDKCOption_HTLCHandlingFailureTypeZ_Some, /** - * When we're in this state, this COption_HTLCDestinationZ contains nothing + * When we're in this state, this COption_HTLCHandlingFailureTypeZ contains nothing */ - LDKCOption_HTLCDestinationZ_None, + LDKCOption_HTLCHandlingFailureTypeZ_None, /** * Must be last for serialization purposes */ - LDKCOption_HTLCDestinationZ_Sentinel, -} LDKCOption_HTLCDestinationZ_Tag; + LDKCOption_HTLCHandlingFailureTypeZ_Sentinel, +} LDKCOption_HTLCHandlingFailureTypeZ_Tag; -typedef struct LDKCOption_HTLCDestinationZ { - LDKCOption_HTLCDestinationZ_Tag tag; +typedef struct LDKCOption_HTLCHandlingFailureTypeZ { + LDKCOption_HTLCHandlingFailureTypeZ_Tag tag; union { struct { - struct LDKHTLCDestination some; + struct LDKHTLCHandlingFailureType some; }; }; -} LDKCOption_HTLCDestinationZ; +} LDKCOption_HTLCHandlingFailureTypeZ; + +/** + * The contents of CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ + */ +typedef union LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_HTLCHandlingFailureTypeZ *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_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr; + +/** + * A CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_HTLCHandlingFailureTypeZ 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_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + /** + * The contents of this CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ; + +/** + * The reason that a HTLC was failed by the local node. These errors either represent direct, + * human-readable mappings of BOLT04 error codes or provide additional information that would + * otherwise be erased by the BOLT04 error code. + * + * For example: + * [`Self::FeeInsufficient`] is a direct representation of its underlying BOLT04 error code. + * [`Self::PrivateChannelForward`] provides additional information that is not provided by its + * BOLT04 error code. + */ +typedef enum LDKLocalHTLCFailureReason_Tag { + /** + * There has been a temporary processing failure on the node which may resolve on retry. + */ + LDKLocalHTLCFailureReason_TemporaryNodeFailure, + /** + * These has been a permanent processing failure on the node which will not resolve on retry. + */ + LDKLocalHTLCFailureReason_PermanentNodeFailure, + /** + * The HTLC does not implement a feature that is required by our node. + * + * The sender may have outdated gossip, or a bug in its implementation. + */ + LDKLocalHTLCFailureReason_RequiredNodeFeature, + /** + * The onion version specified by the HTLC packet is unknown to our node. + */ + LDKLocalHTLCFailureReason_InvalidOnionVersion, + /** + * The integrity of the HTLC packet cannot be verified because it has an invalid HMAC. + */ + LDKLocalHTLCFailureReason_InvalidOnionHMAC, + /** + * The onion packet has an invalid ephemeral key, so the HTLC cannot be processed. + */ + LDKLocalHTLCFailureReason_InvalidOnionKey, + /** + * A temporary forwarding error has occurred which may resolve on retry. + */ + LDKLocalHTLCFailureReason_TemporaryChannelFailure, + /** + * A permanent forwarding error has occurred which will not resolve on retry. + */ + LDKLocalHTLCFailureReason_PermanentChannelFailure, + /** + * The HTLC does not implement a feature that is required by our channel for processing. + */ + LDKLocalHTLCFailureReason_RequiredChannelFeature, + /** + * The HTLC's target outgoing channel that is not known to our node. + */ + LDKLocalHTLCFailureReason_UnknownNextPeer, + /** + * The HTLC amount is below our advertised htlc_minimum_msat. + * + * The sender may have outdated gossip, or a bug in its implementation. + */ + LDKLocalHTLCFailureReason_AmountBelowMinimum, + /** + * The HTLC does not pay sufficient fees. + * + * The sender may have outdated gossip, or a bug in its implementation. + */ + LDKLocalHTLCFailureReason_FeeInsufficient, + /** + * The HTLC does not meet the cltv_expiry_delta advertised by our node, set by + * [`ChannelConfig::cltv_expiry_delta`]. + * + * The sender may have outdated gossip, or a bug in its implementation. + * + * [`ChannelConfig::cltv_expiry_delta`]: crate::util::config::ChannelConfig::cltv_expiry_delta + */ + LDKLocalHTLCFailureReason_IncorrectCLTVExpiry, + /** + * The HTLC expires too close to the current block height to be safely processed. + */ + LDKLocalHTLCFailureReason_CLTVExpiryTooSoon, + /** + * A payment was made to our node that either had incorrect payment information, or was + * unknown to us. + */ + LDKLocalHTLCFailureReason_IncorrectPaymentDetails, + /** + * The HTLC's expiry is less than the expiry height specified by the sender. + * + * The forwarding node has either tampered with this value, or the sending node has an + * old best block height. + */ + LDKLocalHTLCFailureReason_FinalIncorrectCLTVExpiry, + /** + * The HTLC's amount is less than the amount specified by the sender. + * + * The forwarding node has tampered with this value, or has a bug in its implementation. + */ + LDKLocalHTLCFailureReason_FinalIncorrectHTLCAmount, + /** + * The channel has been marked as disabled because the channel peer is offline. + */ + LDKLocalHTLCFailureReason_ChannelDisabled, + /** + * The HTLC expires too far in the future, so it is rejected to avoid the worst-case outcome + * of funds being held for extended periods of time. + * + */ + LDKLocalHTLCFailureReason_CLTVExpiryTooFar, + /** + * The HTLC payload contained in the onion packet could not be understood by our node. + */ + LDKLocalHTLCFailureReason_InvalidOnionPayload, + /** + * The total amount for a multi-part payment did not arrive in time, so the HTLCs partially + * paying the amount were canceled. + */ + LDKLocalHTLCFailureReason_MPPTimeout, + /** + * Our node was selected as part of a blinded path, but the packet we received was not + * properly constructed, or had incorrect values for the blinded path. + * + * This may happen if the forwarding node tamperd with the HTLC or the sender or recipient + * implementations have a bug. + */ + LDKLocalHTLCFailureReason_InvalidOnionBlinding, + /** + * UnknownFailureCode represents BOLT04 failure codes that we are not familiar with. We will + * encounter this if: + * - A peer sends us a new failure code that LDK has not yet been upgraded to understand. + * - We read a deprecated failure code from disk that LDK no longer uses. + * + * See + * for latest defined error codes. + */ + LDKLocalHTLCFailureReason_UnknownFailureCode, + /** + * A HTLC forward was failed back rather than forwarded on the proposed outgoing channel + * because its expiry is too close to the current block height to leave time to safely claim + * it on chain if the channel force closes. + */ + LDKLocalHTLCFailureReason_ForwardExpiryBuffer, + /** + * The HTLC was failed because it has invalid trampoline forwarding information. + */ + LDKLocalHTLCFailureReason_InvalidTrampolineForward, + /** + * A HTLC receive was failed back rather than claimed because its expiry is too close to + * the current block height to leave time to safely claim it on chain if the channel force + * closes. + */ + LDKLocalHTLCFailureReason_PaymentClaimBuffer, + /** + * The HTLC was failed because accepting it would push our commitment's total amount of dust + * HTLCs over the limit that we allow to be burned to miner fees if the channel closed while + * they are unresolved. + */ + LDKLocalHTLCFailureReason_DustLimitHolder, + /** + * The HTLC was failed because accepting it would push our counterparty's total amount of + * dust (small) HTLCs over the limit that we allow to be burned to miner fees if the channel + * closes while they are unresolved. + */ + LDKLocalHTLCFailureReason_DustLimitCounterparty, + /** + * The HTLC was failed because it would drop the remote party's channel balance such that it + * cannot cover the fees it is required to pay at various fee rates. This buffer is maintained + * so that channels can always maintain reasonable fee rates. + */ + LDKLocalHTLCFailureReason_FeeSpikeBuffer, + /** + * The HTLC that requested to be forwarded over a private channel was rejected to prevent + * revealing the existence of the channel. + */ + LDKLocalHTLCFailureReason_PrivateChannelForward, + /** + * The HTLC was failed because it made a request to forward over the real channel ID of a + * channel that implements `option_scid_alias` which is a privacy feature to prevent the + * real channel ID from being known. + */ + LDKLocalHTLCFailureReason_RealSCIDForward, + /** + * The HTLC was rejected because our channel has not yet reached sufficient depth to be used. + */ + LDKLocalHTLCFailureReason_ChannelNotReady, + /** + * A keysend payment with a preimage that did not match the HTLC has was rejected. + */ + LDKLocalHTLCFailureReason_InvalidKeysendPreimage, + /** + * The HTLC was failed because it had an invalid trampoline payload. + */ + LDKLocalHTLCFailureReason_InvalidTrampolinePayload, + /** + * A payment was rejected because it did not include the correct payment secret from an + * invoice. + */ + LDKLocalHTLCFailureReason_PaymentSecretRequired, + /** + * The HTLC was failed because its expiry is too close to the current block height, and we + * expect that it will immediately be failed back by our downstream peer. + */ + LDKLocalHTLCFailureReason_OutgoingCLTVTooSoon, + /** + * The HTLC was failed because it was pending on a channel which is now in the process of + * being closed. + */ + LDKLocalHTLCFailureReason_ChannelClosed, + /** + * The HTLC was failed back because its expiry height was reached and funds were timed out + * on chain. + */ + LDKLocalHTLCFailureReason_OnChainTimeout, + /** + * The HTLC was failed because zero amount HTLCs are not allowed. + */ + LDKLocalHTLCFailureReason_ZeroAmount, + /** + * The HTLC was failed because its amount is less than the smallest HTLC that the channel + * can currently accept. + * + * This may occur because the HTLC is smaller than the counterparty's advertised minimum + * accepted HTLC size, or if we have reached our maximum total dust HTLC exposure. + */ + LDKLocalHTLCFailureReason_HTLCMinimum, + /** + * The HTLC was failed because its amount is more than then largest HTLC that the channel + * can currently accept. + * + * This may occur because the outbound channel has insufficient liquidity to forward the HTLC, + * we have reached the counterparty's in-flight limits, or the HTLC exceeds our advertised + * maximum accepted HTLC size. + */ + LDKLocalHTLCFailureReason_HTLCMaximum, + /** + * The HTLC was failed because our remote peer is offline. + */ + LDKLocalHTLCFailureReason_PeerOffline, + /** + * The HTLC was failed because the channel balance was overdrawn. + */ + LDKLocalHTLCFailureReason_ChannelBalanceOverdrawn, + /** + * Must be last for serialization purposes + */ + LDKLocalHTLCFailureReason_Sentinel, +} LDKLocalHTLCFailureReason_Tag; + +typedef struct LDKLocalHTLCFailureReason_LDKUnknownFailureCode_Body { + /** + * The bolt 04 failure code. + */ + uint16_t code; +} LDKLocalHTLCFailureReason_LDKUnknownFailureCode_Body; + +typedef struct MUST_USE_STRUCT LDKLocalHTLCFailureReason { + LDKLocalHTLCFailureReason_Tag tag; + union { + LDKLocalHTLCFailureReason_LDKUnknownFailureCode_Body unknown_failure_code; + }; +} LDKLocalHTLCFailureReason; + +/** + * The reason for HTLC failures in [`Event::HTLCHandlingFailed`]. + */ +typedef enum LDKHTLCHandlingFailureReason_Tag { + /** + * The forwarded HTLC was failed back by the downstream node with an encrypted error reason. + */ + LDKHTLCHandlingFailureReason_Downstream, + /** + * The HTLC was failed locally by our node. + */ + LDKHTLCHandlingFailureReason_Local, + /** + * Must be last for serialization purposes + */ + LDKHTLCHandlingFailureReason_Sentinel, +} LDKHTLCHandlingFailureReason_Tag; + +typedef struct LDKHTLCHandlingFailureReason_LDKLocal_Body { + /** + * The reason that our node chose to fail the HTLC. + */ + struct LDKLocalHTLCFailureReason reason; +} LDKHTLCHandlingFailureReason_LDKLocal_Body; + +typedef struct MUST_USE_STRUCT LDKHTLCHandlingFailureReason { + LDKHTLCHandlingFailureReason_Tag tag; + union { + LDKHTLCHandlingFailureReason_LDKLocal_Body local; + }; +} LDKHTLCHandlingFailureReason; /** - * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + * The contents of CResult_HTLCHandlingFailureReasonDecodeErrorZ */ -typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { +typedef union LDKCResult_HTLCHandlingFailureReasonDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_HTLCDestinationZ *result; + struct LDKHTLCHandlingFailureReason *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_COption_HTLCDestinationZDecodeErrorZPtr; +} LDKCResult_HTLCHandlingFailureReasonDecodeErrorZPtr; /** - * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_HTLCHandlingFailureReasonDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::HTLCHandlingFailureReason 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_COption_HTLCDestinationZDecodeErrorZ { +typedef struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ { /** - * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either + * The contents of this CResult_HTLCHandlingFailureReasonDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; + union LDKCResult_HTLCHandlingFailureReasonDecodeErrorZPtr contents; /** - * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + * Whether this CResult_HTLCHandlingFailureReasonDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; +} LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ; /** * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not @@ -20070,6 +22443,36 @@ typedef struct LDKCOption_U128Z { }; } LDKCOption_U128Z; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_ChannelIdCOption_U128ZZ { + /** + * The element at position 0 + */ + struct LDKChannelId a; + /** + * The element at position 1 + */ + struct LDKCOption_U128Z b; +} LDKC2Tuple_ChannelIdCOption_U128ZZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdCOption_U128ZZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_ChannelIdCOption_U128ZZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ; + /** * A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. * This corresponds to std::vector in C++ @@ -20086,6 +22489,151 @@ typedef struct LDKCVec_ClaimedHTLCZ { uintptr_t datalen; } LDKCVec_ClaimedHTLCZ; +/** + * The BOLT 12 invoice that was paid, surfaced in [`Event::PaymentSent::bolt12_invoice`]. + */ +typedef enum LDKPaidBolt12Invoice_Tag { + /** + * The BOLT 12 invoice specified by the BOLT 12 specification, + * allowing the user to perform proof of payment. + */ + LDKPaidBolt12Invoice_Bolt12Invoice, + /** + * The Static invoice, used in the async payment specification update proposal, + * where the user cannot perform proof of payment. + */ + LDKPaidBolt12Invoice_StaticInvoice, + /** + * Must be last for serialization purposes + */ + LDKPaidBolt12Invoice_Sentinel, +} LDKPaidBolt12Invoice_Tag; + +typedef struct MUST_USE_STRUCT LDKPaidBolt12Invoice { + LDKPaidBolt12Invoice_Tag tag; + union { + struct { + struct LDKBolt12Invoice bolt12_invoice; + }; + struct { + struct LDKStaticInvoice static_invoice; + }; + }; +} LDKPaidBolt12Invoice; + +/** + * An enum which can either contain a crate::lightning::events::PaidBolt12Invoice or not + */ +typedef enum LDKCOption_PaidBolt12InvoiceZ_Tag { + /** + * When we're in this state, this COption_PaidBolt12InvoiceZ contains a crate::lightning::events::PaidBolt12Invoice + */ + LDKCOption_PaidBolt12InvoiceZ_Some, + /** + * When we're in this state, this COption_PaidBolt12InvoiceZ contains nothing + */ + LDKCOption_PaidBolt12InvoiceZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_PaidBolt12InvoiceZ_Sentinel, +} LDKCOption_PaidBolt12InvoiceZ_Tag; + +typedef struct LDKCOption_PaidBolt12InvoiceZ { + LDKCOption_PaidBolt12InvoiceZ_Tag tag; + union { + struct { + struct LDKPaidBolt12Invoice some; + }; + }; +} LDKCOption_PaidBolt12InvoiceZ; + +/** + * A dynamically-allocated array of u32s of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_u32Z { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + uint32_t *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_u32Z; + +/** + * An enum which can either contain a crate::lightning::chain::transaction::OutPoint or not + */ +typedef enum LDKCOption_OutPointZ_Tag { + /** + * When we're in this state, this COption_OutPointZ contains a crate::lightning::chain::transaction::OutPoint + */ + LDKCOption_OutPointZ_Some, + /** + * When we're in this state, this COption_OutPointZ contains nothing + */ + LDKCOption_OutPointZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_OutPointZ_Sentinel, +} LDKCOption_OutPointZ_Tag; + +typedef struct LDKCOption_OutPointZ { + LDKCOption_OutPointZ_Tag tag; + union { + struct { + struct LDKOutPoint some; + }; + }; +} LDKCOption_OutPointZ; + +/** + * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_OutPointZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKOutPoint *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_OutPointZ; + +/** + * An enum which can either contain a crate::lightning::events::HTLCHandlingFailureReason or not + */ +typedef enum LDKCOption_HTLCHandlingFailureReasonZ_Tag { + /** + * When we're in this state, this COption_HTLCHandlingFailureReasonZ contains a crate::lightning::events::HTLCHandlingFailureReason + */ + LDKCOption_HTLCHandlingFailureReasonZ_Some, + /** + * When we're in this state, this COption_HTLCHandlingFailureReasonZ contains nothing + */ + LDKCOption_HTLCHandlingFailureReasonZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_HTLCHandlingFailureReasonZ_Sentinel, +} LDKCOption_HTLCHandlingFailureReasonZ_Tag; + +typedef struct LDKCOption_HTLCHandlingFailureReasonZ { + LDKCOption_HTLCHandlingFailureReasonZ_Tag tag; + union { + struct { + struct LDKHTLCHandlingFailureReason some; + }; + }; +} LDKCOption_HTLCHandlingFailureReasonZ; + /** @@ -20224,14 +22772,25 @@ typedef enum LDKBumpTransactionEvent_Tag { * and child anchor transactions), possibly resulting in a loss of funds. Once the transaction * is constructed, it must be fully signed for and broadcast by the consumer of the event * along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be - * broadcast first, as the child anchor transaction depends on it. + * broadcast first, as the child anchor transaction depends on it. It is also possible that the + * feerate of the commitment transaction is already sufficient, in which case the child anchor + * transaction is not needed and only the commitment transaction should be broadcast. + * + * In zero-fee commitment channels, the commitment transaction and the anchor transaction + * form a 1-parent-1-child package that conforms to BIP 431 (known as TRUC transactions). + * The anchor transaction must be version 3, and its size must be no more than 1000 vB. + * The anchor transaction is usually needed to bump the fee of the commitment transaction + * as the commitment transaction is not explicitly assigned any fees. In those cases the + * anchor transaction must be broadcast together with the commitment transaction as a + * `child-with-parents` package (usually using the Bitcoin Core `submitpackage` RPC). * * The consumer should be able to sign for any of the additional inputs included within the - * child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be - * re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature - * can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be - * provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the - * full witness required to spend. + * child anchor transaction. To sign its keyed-anchor input, an [`EcdsaChannelSigner`] should + * be re-derived through [`SignerProvider::derive_channel_signer`]. The anchor input signature + * can be computed with [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`], which can then + * be provided to [`build_keyed_anchor_input_witness`] along with the `funding_pubkey` to + * obtain the full witness required to spend. Note that no signature or witness data is + * required to spend the keyless anchor used in zero-fee commitment channels. * * It is possible to receive more than one instance of this event if a valid child anchor * transaction is never broadcast or is but not with a sufficient fee to be mined. Care should @@ -20251,24 +22810,35 @@ typedef enum LDKBumpTransactionEvent_Tag { * be not urgent. * * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner - * [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input - * [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness + * [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_keyed_anchor_input + * [`build_keyed_anchor_input_witness`]: crate::ln::chan_utils::build_keyed_anchor_input_witness */ LDKBumpTransactionEvent_ChannelClose, /** * Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a - * holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the - * zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC - * transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached - * for a timely confirmation within the chain. These additional inputs and/or outputs must be - * appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the - * target feerate decreases the confirmation odds of the transaction, possibly resulting in a - * loss of funds. Once the transaction meets the target feerate, it must be signed for and - * broadcast by the consumer of the event. + * holder commitment transaction and its HTLC(s) need to be resolved on-chain. In all such + * channels, the pre-signed HTLC transactions have a zero fee, thus requiring additional + * inputs and/or outputs to be attached for a timely confirmation within the chain. These + * additional inputs and/or outputs must be appended to the resulting HTLC transaction to + * meet the target feerate. Failure to meet the target feerate decreases the confirmation + * odds of the transaction, possibly resulting in a loss of funds. Once the transaction + * meets the target feerate, it must be signed for and broadcast by the consumer of the + * event. + * + * In zero-fee commitment channels, you must set the version of the HTLC claim transaction + * to version 3 as the counterparty's signature commits to the version of + * the transaction. You must also make sure that this claim transaction does not grow + * bigger than 10,000 vB, the maximum vsize of any TRUC transaction as specified in + * BIP 431. It is possible for [`htlc_descriptors`] to be long enough such + * that claiming all the HTLCs therein in a single transaction would exceed this limit. + * In this case, you must claim all the HTLCs in [`htlc_descriptors`] using multiple + * transactions. Finally, note that while HTLCs in zero-fee commitment channels no + * longer have the 1 CSV lock, LDK will still emit this event only after the commitment + * transaction has 1 confirmation. * * The consumer should be able to sign for any of the non-HTLC inputs added to the resulting * HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived - * through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be + * through [`SignerProvider::derive_channel_signer`]. Each HTLC input's signature can be * computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be * provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required * to spend. @@ -20285,6 +22855,7 @@ typedef enum LDKBumpTransactionEvent_Tag { * * [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner * [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction + * [`htlc_descriptors`]: `BumpTransactionEvent::HTLCResolution::htlc_descriptors` */ LDKBumpTransactionEvent_HTLCResolution, /** @@ -20597,17 +23168,6 @@ typedef enum LDKEvent_Tag { * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ProbeFailed, - /** - * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at - * a time in the future. - * - * # Failure Behavior and Persistence - * This event will eventually be replayed after failures-to-handle (i.e., the event handler - * returning `Err(ReplayEvent ())`) and will be regenerated after restarts. - * - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - */ - LDKEvent_PendingHTLCsForwardable, /** * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if * you've encoded an intercept scid in the receiver's invoice route hints using @@ -20668,10 +23228,13 @@ typedef enum LDKEvent_Tag { */ LDKEvent_ChannelPending, /** - * Used to indicate that a channel with the given `channel_id` is ready to - * be used. This event is emitted either when the funding transaction has been confirmed - * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel - * establishment. + * Used to indicate that a channel with the given `channel_id` is ready to be used. This event + * is emitted when + * - the initial funding transaction has been confirmed on-chain to an acceptable depth + * according to both parties (i.e., `channel_ready` messages were exchanged), + * - a splice funding transaction has been confirmed on-chain to an acceptable depth according + * to both parties (i.e., `splice_locked` messages were exchanged), or, + * - in case of a 0conf channel, when both parties have confirmed the channel establishment. * * # Failure Behavior and Persistence * This event will eventually be replayed after failures-to-handle (i.e., the event handler @@ -20694,10 +23257,42 @@ typedef enum LDKEvent_Tag { * returning `Err(ReplayEvent ())`) and will be persisted across restarts. */ LDKEvent_ChannelClosed, + /** + * Used to indicate that a splice for the given `channel_id` has been negotiated and its + * funding transaction has been broadcast. + * + * The splice is then considered pending until both parties have seen enough confirmations to + * consider the funding locked. Once this occurs, an [`Event::ChannelReady`] will be emitted. + * + * Any UTXOs spent by the splice cannot be reused except by an RBF attempt for the same channel. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + */ + LDKEvent_SplicePending, + /** + * Used to indicate that a splice for the given `channel_id` has failed. + * + * This event may be emitted if a splice fails after it has been initiated but prior to signing + * any negotiated funding transaction. + * + * Any UTXOs contributed to be spent by the funding transaction may be reused and will be + * given in `contributed_inputs`. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + */ + LDKEvent_SpliceFailed, /** * Used to indicate to the user that they can abandon the funding transaction and recycle the * inputs for another purpose. * + * When splicing, users can expect to receive an event for each negotiated splice transaction + * that did not become locked. The negotiated splice transaction that became locked can be + * obtained via [`Event::ChannelReady::funding_txo`]. + * * This event is not guaranteed to be generated for channels that are closed due to a restart. * * # Failure Behavior and Persistence @@ -20710,8 +23305,8 @@ typedef enum LDKEvent_Tag { * * To accept the request (and in the case of a dual-funded channel, not contribute funds), * 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. + * To reject the request, call [`ChannelManager::force_close_broadcasting_latest_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. @@ -20721,7 +23316,8 @@ typedef enum LDKEvent_Tag { * returning `Err(ReplayEvent ())`) and won't be persisted across restarts. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * [`ChannelClosed`]: Event::ChannelClosed + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ LDKEvent_OpenChannelRequest, @@ -20729,16 +23325,6 @@ typedef enum LDKEvent_Tag { * Indicates that the HTLC was accepted, but could not be processed when or after attempting to * forward it. * - * Some scenarios where this event may be sent include: - * * Insufficient capacity in the outbound channel - * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes - * * When an unknown SCID is requested for forwarding a payment. - * * Expected MPP amount has already been reached - * * The HTLC has timed out - * - * This event, however, does not get generated if an HTLC fails to meet the forwarding - * requirements (i.e. insufficient fees paid, or a CLTV that is too soon). - * * # Failure Behavior and Persistence * This event will eventually be replayed after failures-to-handle (i.e., the event handler * returning `Err(ReplayEvent ())`) and will be persisted across restarts. @@ -20748,8 +23334,10 @@ typedef enum LDKEvent_Tag { * Indicates that a transaction originating from LDK needs to have its fee bumped. This event * requires confirmed external funds to be readily available to spend. * - * LDK does not currently generate this event unless the - * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true. + * LDK does not currently generate this event unless either the + * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] or the + * [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`] config flags are set to + * true. * It is limited to the scope of channels with anchor outputs. * * # Failure Behavior and Persistence @@ -20757,6 +23345,7 @@ typedef enum LDKEvent_Tag { * returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts. * * [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx + * [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments */ LDKEvent_BumpTransaction, /** @@ -20765,6 +23354,12 @@ typedef enum LDKEvent_Tag { * `OnionMessenger` was initialized with * [`OnionMessenger::new_with_offline_peer_interception`], see its docs. * + * The offline peer should be awoken if possible on receipt of this event, such as via the LSPS5 + * protocol. + * + * Once they connect, you should handle the generated [`Event::OnionMessagePeerConnected`] and + * provide the stored message. + * * # Failure Behavior and Persistence * This event will eventually be replayed after failures-to-handle (i.e., the event handler * returning `Err(ReplayEvent ())`), but won't be persisted across restarts. @@ -20773,19 +23368,78 @@ typedef enum LDKEvent_Tag { */ LDKEvent_OnionMessageIntercepted, /** - * Indicates that an onion message supporting peer has come online and it may - * be time to forward any onion messages that were previously intercepted for - * them. This event will only be generated if the `OnionMessenger` was - * initialized with + * Indicates that an onion message supporting peer has come online and any messages previously + * stored for them (from [`Event::OnionMessageIntercepted`]s) should be forwarded to them by + * calling [`OnionMessenger::forward_onion_message`]. + * + * This event will only be generated if the `OnionMessenger` was initialized with * [`OnionMessenger::new_with_offline_peer_interception`], see its docs. * * # Failure Behavior and Persistence * This event will eventually be replayed after failures-to-handle (i.e., the event handler * returning `Err(ReplayEvent ())`), but won't be persisted across restarts. * + * [`OnionMessenger::forward_onion_message`]: crate::onion_message::messenger::OnionMessenger::forward_onion_message * [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception */ LDKEvent_OnionMessagePeerConnected, + /** + * As a static invoice server, we received a [`StaticInvoice`] from an async recipient that wants + * us to serve the invoice to payers on their behalf when they are offline. This event will only + * be generated if we previously created paths using + * [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with + * them via [`ChannelManager::set_paths_to_static_invoice_server`]. + * + * [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + * [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server + */ + LDKEvent_PersistStaticInvoice, + /** + * As a static invoice server, we received an [`InvoiceRequest`] on behalf of an often-offline + * recipient for whom we are serving [`StaticInvoice`]s. + * + * This event will only be generated if we previously created paths using + * [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with + * them via [`ChannelManager::set_paths_to_static_invoice_server`]. + * + * If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that + * matches the below `recipient_id` and `invoice_slot`, that invoice should be retrieved now + * and forwarded to the payer via [`ChannelManager::respond_to_static_invoice_request`]. + * The invoice request path previously persisted from [`Event::PersistStaticInvoice`] should + * also be provided in [`ChannelManager::respond_to_static_invoice_request`]. + * + * [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + * [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + */ + LDKEvent_StaticInvoiceRequested, + /** + * Indicates that a channel funding transaction constructed interactively is ready to be + * signed. This event will only be triggered if at least one input was contributed. + * + * The transaction contains all inputs and outputs provided by both parties including the + * channel's funding output and a change output if applicable. + * + * No part of the transaction should be changed before signing as the content of the transaction + * has already been negotiated with the counterparty. + * + * Each signature MUST use the `SIGHASH_ALL` flag to avoid invalidation of the initial commitment and + * hence possible loss of funds. + * + * After signing, call [`ChannelManager::funding_transaction_signed`] with the (partially) signed + * funding transaction. + * + * Generated in [`ChannelManager`] message handling. + * + * # Failure Behavior and Persistence + * This event will eventually be replayed after failures-to-handle (i.e., the event handler + * returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + */ + LDKEvent_FundingTransactionReadyForSigning, /** * Must be last for serialization purposes */ @@ -20909,15 +23563,11 @@ typedef struct LDKEvent_LDKPaymentClaimable_Body { */ struct LDKPaymentPurpose purpose; /** - * The `channel_id` indicating over which channel we received the payment. + * The `(channel_id, user_channel_id)` pairs over which the payment was received. * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKChannelId via_channel_id; - /** - * The `user_channel_id` indicating over which channel we received the payment. + * This will be an incomplete vector for MPP payment events created/serialized using LDK version 0.1.0 and prior. */ - struct LDKCOption_U128Z via_user_channel_id; + struct LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ receiving_channel_ids; /** * The block height at which this payment will be failed back and will no longer be * eligible for claiming. @@ -21004,7 +23654,9 @@ typedef struct LDKEvent_LDKConnectionNeeded_Body { */ struct LDKPublicKey node_id; /** - * Sockets for connecting to the node. + * Sockets for connecting to the node, if available. We don't require these addresses to be + * present in case the node id corresponds to a known peer that is offline and can be awoken, + * such as via the LSPS5 protocol. */ struct LDKCVec_SocketAddressZ addresses; } LDKEvent_LDKConnectionNeeded_Body; @@ -21055,10 +23707,20 @@ typedef struct LDKEvent_LDKPaymentSent_Body { * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ struct LDKThirtyTwoBytes payment_hash; + /** + * The total amount that was paid, across all paths. + * + * Note that, like [`Route::get_total_amount`], this does *not* include the paid fees. + * + * This is only `None` for payments initiated on LDK versions prior to 0.2. + * + * [`Route::get_total_amount`]: crate::routing::router::Route::get_total_amount + */ + struct LDKCOption_u64Z amount_msat; /** * The total fee which was spent at intermediate hops in this payment, across all paths. * - * Note that, like [`Route::get_total_fees`] this does *not* include any potential + * Note that, like [`Route::get_total_fees`], this does *not* include any potential * overpayment to the recipient node. * * If the recipient or an intermediate node misbehaves and gives us free money, this may @@ -21069,6 +23731,20 @@ typedef struct LDKEvent_LDKPaymentSent_Body { * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees */ struct LDKCOption_u64Z fee_paid_msat; + /** + * The BOLT 12 invoice that was paid. `None` if the payment was a non BOLT 12 payment. + * + * The BOLT 12 invoice is useful for proof of payment because it contains the + * payment hash. A third party can verify that the payment was made by + * showing the invoice and confirming that the payment hash matches + * the hash of the payment preimage. + * + * However, the [`PaidBolt12Invoice`] can also be of type [`StaticInvoice`], which + * is a special [`Bolt12Invoice`] where proof of payment is not possible. + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + */ + struct LDKCOption_PaidBolt12InvoiceZ bolt12_invoice; } LDKEvent_LDKPaymentSent_Body; typedef struct LDKEvent_LDKPaymentFailed_Body { @@ -21115,6 +23791,25 @@ typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. */ struct LDKPath path; + /** + * The time that each hop indicated it held the HTLC. + * + * The unit in which the hold times are expressed are 100's of milliseconds. So a hop + * reporting 2 is a hold time that corresponds to between 200 and 299 milliseconds. + * + * We expect that at each hop the actual hold time will be strictly greater than the hold + * time of the following hops, as a node along the path shouldn't have completed the HTLC + * until the next node has completed it. Note that because hold times are in 100's of ms, + * hold times as reported are likely to often be equal across hops. + * + * If our peer didn't provide attribution data or the HTLC resolved on chain, the list + * will be empty. + * + * Each entry will correspond with one entry in [`Path::hops`], or, thereafter, the + * [`BlindedTail::trampoline_hops`] in [`Path::blinded_tail`]. Because not all nodes + * support hold times, the list may be shorter than the number of hops in the path. + */ + struct LDKCVec_u32Z hold_times; } LDKEvent_LDKPaymentPathSuccessful_Body; typedef struct LDKEvent_LDKPaymentPathFailed_Body { @@ -21161,6 +23856,25 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { * retried. May be `None` for older [`Event`] serializations. */ struct LDKCOption_u64Z short_channel_id; + /** + * The time that each hop indicated it held the HTLC. + * + * The unit in which the hold times are expressed are 100's of milliseconds. So a hop + * reporting 2 is a hold time that corresponds to between 200 and 299 milliseconds. + * + * We expect that at each hop the actual hold time will be strictly greater than the hold + * time of the following hops, as a node along the path shouldn't have completed the HTLC + * until the next node has completed it. Note that because hold times are in 100's of ms, + * hold times as reported are likely to often be equal across hops. + * + * If our peer didn't provide attribution data or the HTLC resolved on chain, the list + * will be empty. + * + * Each entry will correspond with one entry in [`Path::hops`], or, thereafter, the + * [`BlindedTail::trampoline_hops`] in [`Path::blinded_tail`]. Because not all nodes + * support hold times, the list may be shorter than the number of hops in the path. + */ + struct LDKCVec_u32Z hold_times; } LDKEvent_LDKPaymentPathFailed_Body; typedef struct LDKEvent_LDKProbeSuccessful_Body { @@ -21209,16 +23923,6 @@ typedef struct LDKEvent_LDKProbeFailed_Body { struct LDKCOption_u64Z short_channel_id; } LDKEvent_LDKProbeFailed_Body; -typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { - /** - * The minimum amount of time that should be waited prior to calling - * process_pending_htlc_forwards. To increase the effort required to correlate payments, - * you should wait a random amount of time in roughly the range (now + time_forwardable, - * now + 5*time_forwardable). - */ - uint64_t time_forwardable; -} LDKEvent_LDKPendingHTLCsForwardable_Body; - typedef struct LDKEvent_LDKHTLCIntercepted_Body { /** * An id to help LDK identify which HTLC is being forwarded or failed. @@ -21400,6 +24104,12 @@ typedef struct LDKEvent_LDKChannelPending_Body { * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKChannelTypeFeatures channel_type; + /** + * The witness script that is used to lock the channel's funding output to commitment transactions. + * + * This field will be `None` for objects serialized with LDK versions prior to 0.2.0. + */ + struct LDKCOption_CVec_u8ZZ funding_redeem_script; } LDKEvent_LDKChannelPending_Body; typedef struct LDKEvent_LDKChannelReady_Body { @@ -21422,6 +24132,13 @@ typedef struct LDKEvent_LDKChannelReady_Body { * The `node_id` of the channel counterparty. */ struct LDKPublicKey counterparty_node_id; + /** + * The outpoint of the channel's funding transaction. + * + * Will be `None` if the channel's funding transaction reached an acceptable depth prior to + * version 0.2. + */ + struct LDKCOption_OutPointZ funding_txo; /** * The features that this channel will operate with. */ @@ -21488,6 +24205,81 @@ typedef struct LDKEvent_LDKChannelClosed_Body { struct LDKCOption_u64Z last_local_balance_msat; } LDKEvent_LDKChannelClosed_Body; +typedef struct LDKEvent_LDKSplicePending_Body { + /** + * The `channel_id` of the channel that has a pending splice funding transaction. + */ + struct LDKChannelId channel_id; + /** + * 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. + * + * [`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; + /** + * The `node_id` of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The outpoint of the channel's splice funding transaction. + */ + struct LDKOutPoint new_funding_txo; + /** + * The features that this channel will operate with. Currently, these will be the same + * features that the channel was opened with, but in the future splices may change them. + */ + struct LDKChannelTypeFeatures channel_type; + /** + * The witness script that is used to lock the channel's funding output to commitment transactions. + */ + struct LDKCVec_u8Z new_funding_redeem_script; +} LDKEvent_LDKSplicePending_Body; + +typedef struct LDKEvent_LDKSpliceFailed_Body { + /** + * The `channel_id` of the channel for which the splice failed. + */ + struct LDKChannelId channel_id; + /** + * 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. + * + * [`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; + /** + * The `node_id` of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The outpoint of the channel's splice funding transaction, if one was created. + */ + struct LDKCOption_OutPointZ abandoned_funding_txo; + /** + * The features that this channel will operate with, if available. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKChannelTypeFeatures channel_type; + /** + * UTXOs spent as inputs contributed to the splice transaction. + */ + struct LDKCVec_OutPointZ contributed_inputs; + /** + * Outputs contributed to the splice transaction. + */ + struct LDKCVec_TxOutZ contributed_outputs; +} LDKEvent_LDKSpliceFailed_Body; + typedef struct LDKEvent_LDKDiscardFunding_Body { /** * The channel_id of the channel which has been closed. @@ -21505,10 +24297,10 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * * When responding to the request, the `temporary_channel_id` should be passed * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, - * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. + * or through [`ChannelManager::force_close_broadcasting_latest_txn`] to reject. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn */ struct LDKChannelId temporary_channel_id; /** @@ -21516,11 +24308,11 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * * When responding to the request, the `counterparty_node_id` should be passed * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to - * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the - * request. + * accept the request, or through [`ChannelManager::force_close_broadcasting_latest_txn`] + * to reject the request. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn */ struct LDKPublicKey counterparty_node_id; /** @@ -21567,9 +24359,15 @@ typedef struct LDKEvent_LDKHTLCHandlingFailed_Body { */ struct LDKChannelId prev_channel_id; /** - * Destination of the HTLC that failed to be processed. + * The type of HTLC handling that failed. + */ + struct LDKHTLCHandlingFailureType failure_type; + /** + * The reason that the HTLC failed. + * + * This field will be `None` only for objects serialized prior to LDK 0.2.0. */ - struct LDKHTLCDestination failed_next_destination; + struct LDKCOption_HTLCHandlingFailureReasonZ failure_reason; } LDKEvent_LDKHTLCHandlingFailed_Body; typedef struct LDKEvent_LDKOnionMessageIntercepted_Body { @@ -21591,6 +24389,121 @@ typedef struct LDKEvent_LDKOnionMessagePeerConnected_Body { struct LDKPublicKey peer_node_id; } LDKEvent_LDKOnionMessagePeerConnected_Body; +typedef struct LDKEvent_LDKPersistStaticInvoice_Body { + /** + * The invoice that should be persisted and later provided to payers when handling a future + * [`Event::StaticInvoiceRequested`]. + */ + struct LDKStaticInvoice invoice; + /** + * The path to where invoice requests will be forwarded. If we receive an invoice + * request, we'll forward it to the async recipient over this path in case the + * recipient is online to provide a new invoice. This path should be persisted and + * later provided to [`ChannelManager::respond_to_static_invoice_request`]. + * + * This path's [`BlindedMessagePath::introduction_node`] MUST be set to our node or one of our + * peers. This is because, for DoS protection, invoice requests forwarded over this path are + * treated by our node like any other onion message forward and will not generate + * [`Event::ConnectionNeeded`] if the first hop in the path is not our peer. + * + * If the next-hop peer in the path is offline, if configured to do so we will generate an + * [`Event::OnionMessageIntercepted`] for the invoice request. + * + * [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + */ + struct LDKBlindedMessagePath invoice_request_path; + /** + * Useful for the recipient to replace a specific invoice stored by us as the static invoice + * server. + * + * When this invoice and its metadata are persisted, this slot number should be included so if + * we receive another [`Event::PersistStaticInvoice`] containing the same slot number we can + * swap the existing invoice out for the new one. + */ + uint16_t invoice_slot; + /** + * An identifier for the recipient, originally provided to + * [`ChannelManager::blinded_paths_for_async_recipient`]. + * + * When an [`Event::StaticInvoiceRequested`] comes in for the invoice, this id will be surfaced + * and can be used alongside the `invoice_slot` to retrieve the invoice from the database. + * + *[`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + */ + struct LDKCVec_u8Z recipient_id; + /** + * Once the [`StaticInvoice`] and `invoice_slot` are persisted, + * [`ChannelManager::static_invoice_persisted`] should be called with this responder to confirm + * to the recipient that their [`Offer`] is ready to be used for async payments. + * + * [`ChannelManager::static_invoice_persisted`]: crate::ln::channelmanager::ChannelManager::static_invoice_persisted + * [`Offer`]: crate::offers::offer::Offer + */ + struct LDKResponder invoice_persisted_path; +} LDKEvent_LDKPersistStaticInvoice_Body; + +typedef struct LDKEvent_LDKStaticInvoiceRequested_Body { + /** + * An identifier for the recipient previously surfaced in + * [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_slot` to + * retrieve the [`StaticInvoice`] requested by the payer. + */ + struct LDKCVec_u8Z recipient_id; + /** + * The slot number for the invoice being requested, previously surfaced in + * [`Event::PersistStaticInvoice::invoice_slot`]. Useful when paired with the `recipient_id` to + * retrieve the [`StaticInvoice`] requested by the payer. + */ + uint16_t invoice_slot; + /** + * The path over which the [`StaticInvoice`] will be sent to the payer, which should be + * provided to [`ChannelManager::respond_to_static_invoice_request`] along with the invoice. + * + * [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + */ + struct LDKResponder reply_path; + /** + * The invoice request that will be forwarded to the async recipient to give the + * recipient a chance to provide an invoice in case it is online. It should be + * provided to [`ChannelManager::respond_to_static_invoice_request`]. + * + * [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + */ + struct LDKInvoiceRequest invoice_request; +} LDKEvent_LDKStaticInvoiceRequested_Body; + +typedef struct LDKEvent_LDKFundingTransactionReadyForSigning_Body { + /** + * The `channel_id` of the channel which you'll need to pass back into + * [`ChannelManager::funding_transaction_signed`]. + * + * [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + */ + struct LDKChannelId channel_id; + /** + * The counterparty's `node_id`, which you'll need to pass back into + * [`ChannelManager::funding_transaction_signed`]. + * + * [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + */ + struct LDKPublicKey counterparty_node_id; + /** + * The `user_channel_id` value passed in for outbound channels, or for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for inbound channels. + * + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; + /** + * The unsigned transaction to be signed and passed back to + * [`ChannelManager::funding_transaction_signed`]. + * + * [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + */ + struct LDKTransaction unsigned_transaction; +} LDKEvent_LDKFundingTransactionReadyForSigning_Body; + typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { @@ -21606,13 +24519,14 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; LDKEvent_LDKProbeSuccessful_Body probe_successful; LDKEvent_LDKProbeFailed_Body probe_failed; - LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted; LDKEvent_LDKSpendableOutputs_Body spendable_outputs; LDKEvent_LDKPaymentForwarded_Body payment_forwarded; LDKEvent_LDKChannelPending_Body channel_pending; LDKEvent_LDKChannelReady_Body channel_ready; LDKEvent_LDKChannelClosed_Body channel_closed; + LDKEvent_LDKSplicePending_Body splice_pending; + LDKEvent_LDKSpliceFailed_Body splice_failed; LDKEvent_LDKDiscardFunding_Body discard_funding; LDKEvent_LDKOpenChannelRequest_Body open_channel_request; LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed; @@ -21621,6 +24535,9 @@ typedef struct MUST_USE_STRUCT LDKEvent { }; LDKEvent_LDKOnionMessageIntercepted_Body onion_message_intercepted; LDKEvent_LDKOnionMessagePeerConnected_Body onion_message_peer_connected; + LDKEvent_LDKPersistStaticInvoice_Body persist_static_invoice; + LDKEvent_LDKStaticInvoiceRequested_Body static_invoice_requested; + LDKEvent_LDKFundingTransactionReadyForSigning_Body funding_transaction_ready_for_signing; }; } LDKEvent; @@ -21684,6 +24601,92 @@ typedef struct LDKCResult_COption_EventZDecodeErrorZ { bool result_ok; } LDKCResult_COption_EventZDecodeErrorZ; +/** + * The contents of CResult_PaidBolt12InvoiceDecodeErrorZ + */ +typedef union LDKCResult_PaidBolt12InvoiceDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPaidBolt12Invoice *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_PaidBolt12InvoiceDecodeErrorZPtr; + +/** + * A CResult_PaidBolt12InvoiceDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::events::PaidBolt12Invoice 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_PaidBolt12InvoiceDecodeErrorZ { + /** + * The contents of this CResult_PaidBolt12InvoiceDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaidBolt12InvoiceDecodeErrorZPtr contents; + /** + * Whether this CResult_PaidBolt12InvoiceDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaidBolt12InvoiceDecodeErrorZ; + + + +/** + * 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; + +/** + * The contents of CResult_PacketDecodeErrorZ + */ +typedef union LDKCResult_PacketDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPacket *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_PacketDecodeErrorZPtr; + +/** + * A CResult_PacketDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::packet::Packet 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_PacketDecodeErrorZ { + /** + * The contents of this CResult_PacketDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PacketDecodeErrorZPtr contents; + /** + * Whether this CResult_PacketDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PacketDecodeErrorZ; + /** * The contents of CResult_NonceDecodeErrorZ */ @@ -22344,6 +25347,67 @@ typedef struct LDKCResult_BigSizeDecodeErrorZ { bool result_ok; } LDKCResult_BigSizeDecodeErrorZ; + + +/** + * The lightning protocol uses u16s for lengths in most cases. As our serialization framework + * primarily targets that, we must as well. However, because we may serialize objects that have + * more than 65K entries, we need to be able to store larger values. Thus, we define a variable + * length integer here that is backwards-compatible for values < 0xffff. We treat 0xffff as + * \"read eight more bytes\". + * + * To ensure we only have one valid encoding per value, we add 0xffff to values written as eight + * bytes. Thus, 0xfffe is serialized as 0xfffe, whereas 0xffff is serialized as + * 0xffff0000000000000000 (i.e. read-eight-bytes then zero). + */ +typedef struct MUST_USE_STRUCT LDKCollectionLength { + /** + * 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. + */ + LDKnativeCollectionLength *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; +} LDKCollectionLength; + +/** + * The contents of CResult_CollectionLengthDecodeErrorZ + */ +typedef union LDKCResult_CollectionLengthDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCollectionLength *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_CollectionLengthDecodeErrorZPtr; + +/** + * A CResult_CollectionLengthDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::ser::CollectionLength 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_CollectionLengthDecodeErrorZ { + /** + * The contents of this CResult_CollectionLengthDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CollectionLengthDecodeErrorZPtr contents; + /** + * Whether this CResult_CollectionLengthDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CollectionLengthDecodeErrorZ; + /** * The contents of CResult_UntrustedStringDecodeErrorZ */ @@ -22413,90 +25477,365 @@ typedef struct LDKCResult_HostnameDecodeErrorZ { /** - * A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`] - * if the `Transaction`'s consensus-serialized length is <= u16::MAX. - * - * Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`. + * Information needed to route a payment across a [`BlindedPaymentPath`]. */ -typedef struct MUST_USE_STRUCT LDKTransactionU16LenLimited { +typedef struct MUST_USE_STRUCT LDKBlindedPayInfo { /** * 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. */ - LDKnativeTransactionU16LenLimited *inner; + LDKnativeBlindedPayInfo *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; -} LDKTransactionU16LenLimited; +} LDKBlindedPayInfo; + +/** + * The contents of CResult_BlindedPayInfoDecodeErrorZ + */ +typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedPayInfo *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_BlindedPayInfoDecodeErrorZPtr; + +/** + * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::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`. + */ +typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ { + /** + * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPayInfoDecodeErrorZ; /** - * The contents of CResult_TransactionU16LenLimitedNoneZ + * The contents of CResult_BlindedPaymentPathNoneZ */ -typedef union LDKCResult_TransactionU16LenLimitedNoneZPtr { +typedef union LDKCResult_BlindedPaymentPathNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTransactionU16LenLimited *result; + struct LDKBlindedPaymentPath *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_TransactionU16LenLimitedNoneZPtr; +} LDKCResult_BlindedPaymentPathNoneZPtr; + +/** + * A CResult_BlindedPaymentPathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::BlindedPaymentPath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedPaymentPathNoneZ { + /** + * The contents of this CResult_BlindedPaymentPathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPaymentPathNoneZPtr contents; + /** + * Whether this CResult_BlindedPaymentPathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPaymentPathNoneZ; + + + +/** + * An intermediate node, its outbound channel, and relay parameters. + */ +typedef struct MUST_USE_STRUCT LDKPaymentForwardNode { + /** + * 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. + */ + LDKnativePaymentForwardNode *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; +} LDKPaymentForwardNode; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::payment::PaymentForwardNodes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PaymentForwardNodeZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPaymentForwardNode *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PaymentForwardNodeZ; + + + +/** + * 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; + +/** + * The contents of CResult_PaymentContextDecodeErrorZ + */ +typedef union LDKCResult_PaymentContextDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKPaymentContext *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_PaymentContextDecodeErrorZPtr; + +/** + * A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::PaymentContext 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_PaymentContextDecodeErrorZ { + /** + * The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PaymentContextDecodeErrorZPtr contents; + /** + * Whether this CResult_PaymentContextDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentContextDecodeErrorZ; + +/** + * The contents of CResult_Bolt12OfferContextDecodeErrorZ + */ +typedef union LDKCResult_Bolt12OfferContextDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt12OfferContext *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_Bolt12OfferContextDecodeErrorZPtr; + +/** + * A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::Bolt12OfferContext 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_Bolt12OfferContextDecodeErrorZ { + /** + * The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt12OfferContextDecodeErrorZPtr contents; + /** + * Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt12OfferContextDecodeErrorZ; + +/** + * The contents of CResult_AsyncBolt12OfferContextDecodeErrorZ + */ +typedef union LDKCResult_AsyncBolt12OfferContextDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKAsyncBolt12OfferContext *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_AsyncBolt12OfferContextDecodeErrorZPtr; /** - * A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation, - * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure. + * A CResult_AsyncBolt12OfferContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::AsyncBolt12OfferContext 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_TransactionU16LenLimitedNoneZ { +typedef struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ { /** - * The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either + * The contents of this CResult_AsyncBolt12OfferContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TransactionU16LenLimitedNoneZPtr contents; + union LDKCResult_AsyncBolt12OfferContextDecodeErrorZPtr contents; /** - * Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state. + * Whether this CResult_AsyncBolt12OfferContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TransactionU16LenLimitedNoneZ; +} LDKCResult_AsyncBolt12OfferContextDecodeErrorZ; /** - * The contents of CResult_TransactionU16LenLimitedDecodeErrorZ + * The contents of CResult_Bolt12RefundContextDecodeErrorZ */ -typedef union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr { +typedef union LDKCResult_Bolt12RefundContextDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTransactionU16LenLimited *result; + struct LDKBolt12RefundContext *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_TransactionU16LenLimitedDecodeErrorZPtr; +} LDKCResult_Bolt12RefundContextDecodeErrorZPtr; /** - * A CResult_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::payment::Bolt12RefundContext 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_TransactionU16LenLimitedDecodeErrorZ { +typedef struct LDKCResult_Bolt12RefundContextDecodeErrorZ { /** - * The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either + * The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TransactionU16LenLimitedDecodeErrorZPtr contents; + union LDKCResult_Bolt12RefundContextDecodeErrorZPtr contents; /** - * Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state. + * Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TransactionU16LenLimitedDecodeErrorZ; +} LDKCResult_Bolt12RefundContextDecodeErrorZ; /** * The contents of CResult_ChannelIdDecodeErrorZ @@ -22896,523 +26235,166 @@ typedef struct LDKC2Tuple__u832u16Z { uint16_t b; } LDKC2Tuple__u832u16Z; - - -/** - * Information needed to route a payment across a [`BlindedPaymentPath`]. - */ -typedef struct MUST_USE_STRUCT LDKBlindedPayInfo { - /** - * 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. - */ - LDKnativeBlindedPayInfo *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; -} LDKBlindedPayInfo; - /** - * The contents of CResult_BlindedPayInfoDecodeErrorZ + * The contents of CResult_ResponderDecodeErrorZ */ -typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr { +typedef union LDKCResult_ResponderDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedPayInfo *result; + struct LDKResponder *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_BlindedPayInfoDecodeErrorZPtr; +} LDKCResult_ResponderDecodeErrorZPtr; /** - * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ResponderDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::Responder 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_BlindedPayInfoDecodeErrorZ { +typedef struct LDKCResult_ResponderDecodeErrorZ { /** - * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either + * The contents of this CResult_ResponderDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents; + union LDKCResult_ResponderDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. + * Whether this CResult_ResponderDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedPayInfoDecodeErrorZ; +} LDKCResult_ResponderDecodeErrorZ; /** - * The contents of CResult_BlindedPaymentPathNoneZ + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_BlindedPaymentPathNoneZPtr { +typedef struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { /** - * 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 LDKBlindedPaymentPath *result; + struct LDKPublicKey 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_BlindedPaymentPathNoneZPtr; + struct LDKOnionMessage b; + /** + * The element at position 2 + */ + struct LDKCVec_SocketAddressZ c; +} LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ; /** - * A CResult_BlindedPaymentPathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::BlindedPaymentPath on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Errors that may occur when [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message */ -typedef struct LDKCResult_BlindedPaymentPathNoneZ { +typedef enum LDKSendError_Tag { /** - * The contents of this CResult_BlindedPaymentPathNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Errored computing onion message packet keys. */ - union LDKCResult_BlindedPaymentPathNoneZPtr contents; + LDKSendError_Secp256k1, /** - * Whether this CResult_BlindedPaymentPathNoneZ represents a success state. + * Because implementations such as Eclair will drop onion messages where the message packet + * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size. */ - bool result_ok; -} LDKCResult_BlindedPaymentPathNoneZ; - - - -/** - * An intermediate node, its outbound channel, and relay parameters. - */ -typedef struct MUST_USE_STRUCT LDKPaymentForwardNode { + LDKSendError_TooBigPacket, /** - * 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. + * The provided [`Destination`] was an invalid [`BlindedMessagePath`] due to not having any + * blinded hops. */ - LDKnativePaymentForwardNode *inner; + LDKSendError_TooFewBlindedHops, /** - * 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. + * The first hop is not a peer and doesn't have a known [`SocketAddress`]. */ - bool is_owned; -} LDKPaymentForwardNode; - -/** - * A dynamically-allocated array of crate::lightning::blinded_path::payment::PaymentForwardNodes of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PaymentForwardNodeZ { + LDKSendError_InvalidFirstHop, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Indicates that a path could not be found by the [`MessageRouter`]. + * + * This occurs when either: + * - No path from the sender to the destination was found to send the onion message + * - No reply path to the sender could be created when responding to an onion message */ - struct LDKPaymentForwardNode *data; + LDKSendError_PathNotFound, /** - * The number of elements pointed to by `data`. + * Onion message contents must have a TLV type >= 64. */ - uintptr_t datalen; -} LDKCVec_PaymentForwardNodeZ; - - - -/** - * Parameters for relaying over a given [`BlindedHop`]. - * - * [`BlindedHop`]: crate::blinded_path::BlindedHop - */ -typedef struct MUST_USE_STRUCT LDKPaymentRelay { + LDKSendError_InvalidMessage, /** - * 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. + * Our next-hop peer's buffer was full or our total outbound buffer was full. */ - LDKnativePaymentRelay *inner; + LDKSendError_BufferFull, /** - * 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. + * Failed to retrieve our node id from the provided [`NodeSigner`]. + * + * [`NodeSigner`]: crate::sign::NodeSigner */ - bool is_owned; -} LDKPaymentRelay; + LDKSendError_GetNodeIdFailed, + /** + * The provided [`Destination`] has a blinded path with an unresolved introduction node. An + * attempt to resolve it in the [`MessageRouter`] when finding an [`OnionMessagePath`] likely + * failed. + */ + LDKSendError_UnresolvedIntroductionNode, + /** + * We attempted to send to a blinded path where we are the introduction node, and failed to + * advance the blinded path to make the second hop the new introduction node. Either + * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the + * new blinding point, or we were attempting to send to ourselves. + */ + LDKSendError_BlindedPathAdvanceFailed, + /** + * Must be last for serialization purposes + */ + LDKSendError_Sentinel, +} LDKSendError_Tag; + +typedef struct MUST_USE_STRUCT LDKSendError { + LDKSendError_Tag tag; + union { + struct { + enum LDKSecp256k1Error secp256k1; + }; + struct { + struct LDKPublicKey invalid_first_hop; + }; + }; +} LDKSendError; /** - * The contents of CResult_PaymentRelayDecodeErrorZ + * The contents of CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ */ -typedef union LDKCResult_PaymentRelayDecodeErrorZPtr { +typedef union LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPaymentRelay *result; + struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ *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; + struct LDKSendError *err; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr; /** - * 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; - -/** - * The contents of CResult_PaymentContextDecodeErrorZ - */ -typedef union LDKCResult_PaymentContextDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPaymentContext *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_PaymentContextDecodeErrorZPtr; - -/** - * A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::PaymentContext 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_PaymentContextDecodeErrorZ { - /** - * The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PaymentContextDecodeErrorZPtr contents; - /** - * Whether this CResult_PaymentContextDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PaymentContextDecodeErrorZ; - -/** - * The contents of CResult_Bolt12OfferContextDecodeErrorZ - */ -typedef union LDKCResult_Bolt12OfferContextDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBolt12OfferContext *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_Bolt12OfferContextDecodeErrorZPtr; - -/** - * A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::Bolt12OfferContext 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_Bolt12OfferContextDecodeErrorZ { - /** - * The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_Bolt12OfferContextDecodeErrorZPtr contents; - /** - * Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_Bolt12OfferContextDecodeErrorZ; - -/** - * The contents of CResult_Bolt12RefundContextDecodeErrorZ - */ -typedef union LDKCResult_Bolt12RefundContextDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBolt12RefundContext *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_Bolt12RefundContextDecodeErrorZPtr; - -/** - * A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::Bolt12RefundContext 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_Bolt12RefundContextDecodeErrorZ { - /** - * The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_Bolt12RefundContextDecodeErrorZPtr contents; - /** - * Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_Bolt12RefundContextDecodeErrorZ; - -/** - * The contents of CResult_ResponderDecodeErrorZ - */ -typedef union LDKCResult_ResponderDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKResponder *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_ResponderDecodeErrorZPtr; - -/** - * A CResult_ResponderDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::messenger::Responder 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_ResponderDecodeErrorZ { - /** - * The contents of this CResult_ResponderDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ResponderDecodeErrorZPtr contents; - /** - * Whether this CResult_ResponderDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ResponderDecodeErrorZ; - -/** - * An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not - */ -typedef enum LDKCOption_MessageContextZ_Tag { - /** - * When we're in this state, this COption_MessageContextZ contains a crate::lightning::blinded_path::message::MessageContext - */ - LDKCOption_MessageContextZ_Some, - /** - * When we're in this state, this COption_MessageContextZ contains nothing - */ - LDKCOption_MessageContextZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_MessageContextZ_Sentinel, -} LDKCOption_MessageContextZ_Tag; - -typedef struct LDKCOption_MessageContextZ { - LDKCOption_MessageContextZ_Tag tag; - union { - struct { - struct LDKMessageContext some; - }; - }; -} LDKCOption_MessageContextZ; - -/** - * A tuple of 3 elements. See the individual fields for the types contained. - */ -typedef struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { - /** - * The element at position 0 - */ - struct LDKPublicKey a; - /** - * The element at position 1 - */ - struct LDKOnionMessage b; - /** - * The element at position 2 - */ - struct LDKCOption_CVec_SocketAddressZZ c; -} LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ; - -/** - * Errors that may occur when [sending an onion message]. - * - * [sending an onion message]: OnionMessenger::send_onion_message - */ -typedef enum LDKSendError_Tag { - /** - * Errored computing onion message packet keys. - */ - LDKSendError_Secp256k1, - /** - * Because implementations such as Eclair will drop onion messages where the message packet - * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size. - */ - LDKSendError_TooBigPacket, - /** - * The provided [`Destination`] was an invalid [`BlindedMessagePath`] due to not having any - * blinded hops. - */ - LDKSendError_TooFewBlindedHops, - /** - * The first hop is not a peer and doesn't have a known [`SocketAddress`]. - */ - LDKSendError_InvalidFirstHop, - /** - * Indicates that a path could not be found by the [`MessageRouter`]. - * - * This occurs when either: - * - No path from the sender to the destination was found to send the onion message - * - No reply path to the sender could be created when responding to an onion message - */ - LDKSendError_PathNotFound, - /** - * Onion message contents must have a TLV type >= 64. - */ - LDKSendError_InvalidMessage, - /** - * Our next-hop peer's buffer was full or our total outbound buffer was full. - */ - LDKSendError_BufferFull, - /** - * Failed to retrieve our node id from the provided [`NodeSigner`]. - * - * [`NodeSigner`]: crate::sign::NodeSigner - */ - LDKSendError_GetNodeIdFailed, - /** - * The provided [`Destination`] has a blinded path with an unresolved introduction node. An - * attempt to resolve it in the [`MessageRouter`] when finding an [`OnionMessagePath`] likely - * failed. - */ - LDKSendError_UnresolvedIntroductionNode, - /** - * We attempted to send to a blinded path where we are the introduction node, and failed to - * advance the blinded path to make the second hop the new introduction node. Either - * [`NodeSigner::ecdh`] failed, we failed to tweak the current blinding point to get the - * new blinding point, or we were attempting to send to ourselves. - */ - LDKSendError_BlindedPathAdvanceFailed, - /** - * Must be last for serialization purposes - */ - LDKSendError_Sentinel, -} LDKSendError_Tag; - -typedef struct MUST_USE_STRUCT LDKSendError { - LDKSendError_Tag tag; - union { - struct { - enum LDKSecp256k1Error secp256k1; - }; - struct { - struct LDKPublicKey invalid_first_hop; - }; - }; -} LDKSendError; - -/** - * The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ - */ -typedef union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *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_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr; - -/** - * A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure. + * A CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ 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_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { +typedef struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { /** - * The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either + * The contents of this CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr contents; + union LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr contents; /** - * Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state. + * Whether this CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ; +} LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ; /** * The next hop to forward an onion message along its path. @@ -23447,57 +26429,30 @@ typedef struct MUST_USE_STRUCT LDKNextMessageHop { } LDKNextMessageHop; /** - * The contents of an [`OnionMessage`] as read from the wire. - * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * A processed incoming onion message, containing either a Forward (another onion message) + * or a Receive payload with decrypted contents. */ -typedef enum LDKParsedOnionMessageContents_Tag { - /** - * A message related to BOLT 12 Offers. - */ - LDKParsedOnionMessageContents_Offers, +typedef enum LDKPeeledOnion_Tag { /** - * A message requesting or providing a DNSSEC proof + * Forwarded onion, with the next node id and a new onion */ - LDKParsedOnionMessageContents_DNSResolver, + LDKPeeledOnion_Forward, /** - * A custom onion message specified by the user. + * Received offers onion message, with decrypted contents, context, and reply path */ - LDKParsedOnionMessageContents_Custom, + LDKPeeledOnion_Offers, /** - * Must be last for serialization purposes + * Received async payments onion message, with decrypted contents, context, and reply path */ - LDKParsedOnionMessageContents_Sentinel, -} LDKParsedOnionMessageContents_Tag; - -typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents { - LDKParsedOnionMessageContents_Tag tag; - union { - struct { - struct LDKOffersMessage offers; - }; - struct { - struct LDKDNSResolverMessage dns_resolver; - }; - struct { - struct LDKOnionMessageContents custom; - }; - }; -} LDKParsedOnionMessageContents; - -/** - * A processed incoming onion message, containing either a Forward (another onion message) - * or a Receive payload with decrypted contents. - */ -typedef enum LDKPeeledOnion_Tag { + LDKPeeledOnion_AsyncPayments, /** - * Forwarded onion, with the next node id and a new onion + * Received DNS resolver onion message, with decrypted contents, context, and reply path */ - LDKPeeledOnion_Forward, + LDKPeeledOnion_DNSResolver, /** - * Received onion message, with decrypted contents, context, and reply path + * Received custom onion message, with decrypted contents, context, and reply path */ - LDKPeeledOnion_Receive, + LDKPeeledOnion_Custom, /** * Must be last for serialization purposes */ @@ -23509,21 +26464,58 @@ typedef struct LDKPeeledOnion_LDKForward_Body { struct LDKOnionMessage _1; } LDKPeeledOnion_LDKForward_Body; -typedef struct LDKPeeledOnion_LDKReceive_Body { - struct LDKParsedOnionMessageContents _0; - struct LDKCOption_MessageContextZ _1; +typedef struct LDKPeeledOnion_LDKOffers_Body { + struct LDKOffersMessage _0; + struct LDKCOption_OffersContextZ _1; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedMessagePath _2; +} LDKPeeledOnion_LDKOffers_Body; + +typedef struct LDKPeeledOnion_LDKAsyncPayments_Body { + struct LDKAsyncPaymentsMessage _0; + struct LDKAsyncPaymentsContext _1; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedMessagePath _2; +} LDKPeeledOnion_LDKAsyncPayments_Body; + +typedef struct LDKPeeledOnion_LDKDNSResolver_Body { + struct LDKDNSResolverMessage _0; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKDNSResolverContext _1; + /** + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBlindedMessagePath _2; +} LDKPeeledOnion_LDKDNSResolver_Body; + +typedef struct LDKPeeledOnion_LDKCustom_Body { + struct LDKOnionMessageContents _0; + struct LDKCOption_CVec_u8ZZ _1; /** * * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKBlindedMessagePath _2; -} LDKPeeledOnion_LDKReceive_Body; +} LDKPeeledOnion_LDKCustom_Body; typedef struct MUST_USE_STRUCT LDKPeeledOnion { LDKPeeledOnion_Tag tag; union { LDKPeeledOnion_LDKForward_Body forward; - LDKPeeledOnion_LDKReceive_Body receive; + LDKPeeledOnion_LDKOffers_Body offers; + LDKPeeledOnion_LDKAsyncPayments_Body async_payments; + LDKPeeledOnion_LDKDNSResolver_Body dns_resolver; + LDKPeeledOnion_LDKCustom_Body custom; }; } LDKPeeledOnion; @@ -23704,132 +26696,376 @@ typedef struct LDKCVec_PhantomRouteHintsZ { uintptr_t datalen; } LDKCVec_PhantomRouteHintsZ; + + /** - * The contents of CResult_InvoiceErrorDecodeErrorZ + * An input to contribute to a channel's funding transaction either when using the v2 channel + * establishment protocol or when splicing. */ -typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKFundingTxInput { + /** + * 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. + */ + LDKnativeFundingTxInput *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; +} LDKFundingTxInput; + +/** + * A dynamically-allocated array of crate::lightning::ln::funding::FundingTxInputs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_FundingTxInputZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKFundingTxInput *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_FundingTxInputZ; + +/** + * The contents of CResult_FundingTxInputDecodeErrorZ + */ +typedef union LDKCResult_FundingTxInputDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoiceError *result; + struct LDKFundingTxInput *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_InvoiceErrorDecodeErrorZPtr; +} LDKCResult_FundingTxInputDecodeErrorZPtr; /** - * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_error::InvoiceError on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_FundingTxInputDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::funding::FundingTxInput 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_InvoiceErrorDecodeErrorZ { +typedef struct LDKCResult_FundingTxInputDecodeErrorZ { /** - * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either + * The contents of this CResult_FundingTxInputDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceErrorDecodeErrorZPtr contents; + union LDKCResult_FundingTxInputDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state. + * Whether this CResult_FundingTxInputDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceErrorDecodeErrorZ; - +} LDKCResult_FundingTxInputDecodeErrorZ; +/** + * The contents of CResult_FundingTxInputNoneZ + */ +typedef union LDKCResult_FundingTxInputNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKFundingTxInput *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_FundingTxInputNoneZPtr; /** - * The state of a spendable output currently tracked by an [`OutputSweeper`]. + * A CResult_FundingTxInputNoneZ represents the result of a fallible operation, + * containing a crate::lightning::ln::funding::FundingTxInput on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKTrackedSpendableOutput { +typedef struct LDKCResult_FundingTxInputNoneZ { /** - * 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. + * The contents of this CResult_FundingTxInputNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeTrackedSpendableOutput *inner; + union LDKCResult_FundingTxInputNoneZPtr contents; /** - * 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. + * Whether this CResult_FundingTxInputNoneZ represents a success state. */ - bool is_owned; -} LDKTrackedSpendableOutput; + bool result_ok; +} LDKCResult_FundingTxInputNoneZ; /** - * The contents of CResult_TrackedSpendableOutputDecodeErrorZ + * The contents of CResult_LocalHTLCFailureReasonDecodeErrorZ */ -typedef union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr { +typedef union LDKCResult_LocalHTLCFailureReasonDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTrackedSpendableOutput *result; + struct LDKLocalHTLCFailureReason *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_TrackedSpendableOutputDecodeErrorZPtr; +} LDKCResult_LocalHTLCFailureReasonDecodeErrorZPtr; /** - * A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::sweep::TrackedSpendableOutput on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_LocalHTLCFailureReasonDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::onion_utils::LocalHTLCFailureReason 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_TrackedSpendableOutputDecodeErrorZ { +typedef struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ { /** - * The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either + * The contents of this CResult_LocalHTLCFailureReasonDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr contents; + union LDKCResult_LocalHTLCFailureReasonDecodeErrorZPtr contents; /** - * Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state. + * Whether this CResult_LocalHTLCFailureReasonDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TrackedSpendableOutputDecodeErrorZ; +} LDKCResult_LocalHTLCFailureReasonDecodeErrorZ; /** - * The current status of the output spend. + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef enum LDKOutputSpendStatus_Tag { - /** - * The output is tracked but an initial spending transaction hasn't been generated and - * broadcasted yet. - */ - LDKOutputSpendStatus_PendingInitialBroadcast, +typedef struct LDKC3Tuple_OnionPacketu64u32Z { /** - * A transaction spending the output has been broadcasted but is pending its first confirmation on-chain. + * The element at position 0 */ - LDKOutputSpendStatus_PendingFirstConfirmation, + struct LDKOnionPacket a; /** - * A transaction spending the output has been confirmed on-chain but will be tracked until it - * reaches at least [`PRUNE_DELAY_BLOCKS`] confirmations to ensure [`Event::SpendableOutputs`] - * stemming from lingering [`ChannelMonitor`]s can safely be replayed. - * - * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * The element at position 1 */ - LDKOutputSpendStatus_PendingThresholdConfirmations, + uint64_t b; /** - * Must be last for serialization purposes + * The element at position 2 */ - LDKOutputSpendStatus_Sentinel, -} LDKOutputSpendStatus_Tag; + uint32_t c; +} LDKC3Tuple_OnionPacketu64u32Z; -typedef struct LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body { +/** + * The contents of CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ + */ +typedef union LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { /** - * The height at which we will first generate and broadcast a spending transaction. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_u32Z delayed_until_height; -} LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body; - -typedef struct LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body { + struct LDKC3Tuple_OnionPacketu64u32Z *result; /** - * The hash of the chain tip when we first broadcast a transaction spending this output. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKThirtyTwoBytes first_broadcast_hash; + struct LDKAPIError *err; +} LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr; + +/** + * A CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C3Tuple_OnionPacketu64u32Z 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_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + /** + * The contents of this CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr contents; + /** + * Whether this CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ; + + + +/** + * Attribution data allows the sender of an HTLC to identify which hop failed an HTLC robustly, + * preventing earlier hops from corrupting the HTLC failure information (or at least allowing the + * sender to identify the earliest hop which corrupted HTLC failure information). + * + * Additionally, it allows a sender to identify how long each hop along a path held an HTLC, with + * 100ms granularity. + */ +typedef struct MUST_USE_STRUCT LDKAttributionData { + /** + * 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. + */ + LDKnativeAttributionData *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; +} LDKAttributionData; + +/** + * The contents of CResult_AttributionDataDecodeErrorZ + */ +typedef union LDKCResult_AttributionDataDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKAttributionData *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_AttributionDataDecodeErrorZPtr; + +/** + * A CResult_AttributionDataDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::onion_utils::AttributionData 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_AttributionDataDecodeErrorZ { + /** + * The contents of this CResult_AttributionDataDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_AttributionDataDecodeErrorZPtr contents; + /** + * Whether this CResult_AttributionDataDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_AttributionDataDecodeErrorZ; + +/** + * The contents of CResult_InvoiceErrorDecodeErrorZ + */ +typedef union LDKCResult_InvoiceErrorDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceError *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_InvoiceErrorDecodeErrorZPtr; + +/** + * A CResult_InvoiceErrorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_error::InvoiceError 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_InvoiceErrorDecodeErrorZ { + /** + * The contents of this CResult_InvoiceErrorDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceErrorDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceErrorDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceErrorDecodeErrorZ; + + + +/** + * The state of a spendable output currently tracked by an [`OutputSweeper`]. + */ +typedef struct MUST_USE_STRUCT LDKTrackedSpendableOutput { + /** + * 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. + */ + LDKnativeTrackedSpendableOutput *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; +} LDKTrackedSpendableOutput; + +/** + * The contents of CResult_TrackedSpendableOutputDecodeErrorZ + */ +typedef union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKTrackedSpendableOutput *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_TrackedSpendableOutputDecodeErrorZPtr; + +/** + * A CResult_TrackedSpendableOutputDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::sweep::TrackedSpendableOutput 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_TrackedSpendableOutputDecodeErrorZ { + /** + * The contents of this CResult_TrackedSpendableOutputDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_TrackedSpendableOutputDecodeErrorZPtr contents; + /** + * Whether this CResult_TrackedSpendableOutputDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_TrackedSpendableOutputDecodeErrorZ; + +/** + * The current status of the output spend. + */ +typedef enum LDKOutputSpendStatus_Tag { + /** + * The output is tracked but an initial spending transaction hasn't been generated and + * broadcasted yet. + */ + LDKOutputSpendStatus_PendingInitialBroadcast, + /** + * A transaction spending the output has been broadcasted but is pending its first confirmation on-chain. + */ + LDKOutputSpendStatus_PendingFirstConfirmation, + /** + * A transaction spending the output has been confirmed on-chain but will be tracked until it + * reaches at least [`PRUNE_DELAY_BLOCKS`] confirmations to ensure [`Event::SpendableOutputs`] + * stemming from lingering [`ChannelMonitor`]s can safely be replayed. + * + * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + */ + LDKOutputSpendStatus_PendingThresholdConfirmations, + /** + * Must be last for serialization purposes + */ + LDKOutputSpendStatus_Sentinel, +} LDKOutputSpendStatus_Tag; + +typedef struct LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body { + /** + * The height at which we will first generate and broadcast a spending transaction. + */ + struct LDKCOption_u32Z delayed_until_height; +} LDKOutputSpendStatus_LDKPendingInitialBroadcast_Body; + +typedef struct LDKOutputSpendStatus_LDKPendingFirstConfirmation_Body { + /** + * The hash of the chain tip when we first broadcast a transaction spending this output. + */ + struct LDKThirtyTwoBytes first_broadcast_hash; /** * The best height when we last broadcast a transaction spending this output. */ @@ -24039,10 +27275,9 @@ typedef struct LDKCVec_TrackedSpendableOutputZ { } LDKCVec_TrackedSpendableOutputZ; /** - * A helper trait that describes an on-chain wallet capable of returning a (change) destination - * script. + * A synchronous helper trait that describes an on-chain wallet capable of returning a (change) destination script. */ -typedef struct LDKChangeDestinationSource { +typedef struct LDKChangeDestinationSourceSync { /** * 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. @@ -24061,7 +27296,7 @@ typedef struct LDKChangeDestinationSource { * 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); -} LDKChangeDestinationSource; +} LDKChangeDestinationSourceSync; /** * Provides an interface that allows storage and retrieval of persisted values that are associated @@ -24085,8 +27320,10 @@ typedef struct LDKChangeDestinationSource { * **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`. + * + * For an asynchronous version of this trait, see [`KVStore`]. */ -typedef struct LDKKVStore { +typedef struct LDKKVStoreSync { /** * 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. @@ -24105,23 +27342,27 @@ typedef struct LDKKVStore { /** * Persists the given data under the given `key`. * - * Will create the given `primary_namespace` and `secondary_namespace` if not already present - * in the store. + * 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); + struct LDKCResult_NoneIOErrorZ (*write)(const void *this_arg, struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKCVec_u8Z 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. + * [`KVStoreSync::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. * + * All removal operations must complete in a consistent total order with [`Self::write`]s + * to the same key. Whether a removal operation is `lazy` or not, [`Self::write`] operations + * to the same key which occur before a removal completes must cancel/overwrite the pending + * removal. + * * 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. @@ -24135,12 +27376,18 @@ typedef struct LDKKVStore { * 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); + /** + * Called, if set, after this KVStoreSync has been cloned into a duplicate object. + * The new KVStoreSync 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 LDKKVStoreSync *NONNULL_PTR new_KVStoreSync); /** * 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; +} LDKKVStoreSync; /** * A trait that describes a wallet capable of creating a spending [`Transaction`] from a set of @@ -24178,10 +27425,11 @@ typedef struct LDKOutputSpender { /** * A utility that keeps track of [`SpendableOutputDescriptor`]s, persists them in a given - * [`KVStore`] and regularly retries sweeping them based on a callback given to the constructor + * [`KVStoreSync`] and regularly retries sweeping them based on a callback given to the constructor * methods. * - * Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s received via [`Event::SpendableOutputs`]. + * Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s + * received via [`Event::SpendableOutputs`]. * * This needs to be notified of chain state changes either via its [`Listen`] or [`Confirm`] * implementation and hence has to be connected with the utilized chain data sources. @@ -24190,60 +27438,29 @@ typedef struct LDKOutputSpender { * required to give their chain data sources (i.e., [`Filter`] implementation) to the respective * constructor. * + * For an asynchronous version of this struct, see [`OutputSweeper`]. + * * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs */ -typedef struct MUST_USE_STRUCT LDKOutputSweeper { +typedef struct MUST_USE_STRUCT LDKOutputSweeperSync { /** * 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. */ - LDKnativeOutputSweeper *inner; + LDKnativeOutputSweeperSync *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; -} LDKOutputSweeper; - -/** - * The contents of CResult_OutputSweeperDecodeErrorZ - */ -typedef union LDKCResult_OutputSweeperDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKOutputSweeper *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_OutputSweeperDecodeErrorZPtr; - -/** - * A CResult_OutputSweeperDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::sweep::OutputSweeper 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_OutputSweeperDecodeErrorZ { - /** - * The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_OutputSweeperDecodeErrorZPtr contents; - /** - * Whether this CResult_OutputSweeperDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_OutputSweeperDecodeErrorZ; +} LDKOutputSweeperSync; /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_BestBlockOutputSweeperZ { +typedef struct LDKC2Tuple_BestBlockOutputSweeperSyncZ { /** * The element at position 0 */ @@ -24251,41 +27468,41 @@ typedef struct LDKC2Tuple_BestBlockOutputSweeperZ { /** * The element at position 1 */ - struct LDKOutputSweeper b; -} LDKC2Tuple_BestBlockOutputSweeperZ; + struct LDKOutputSweeperSync b; +} LDKC2Tuple_BestBlockOutputSweeperSyncZ; /** - * The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ + * The contents of CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BestBlockOutputSweeperZ *result; + struct LDKC2Tuple_BestBlockOutputSweeperSyncZ *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_BestBlockOutputSweeperZDecodeErrorZPtr; +} LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr; /** - * A CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperSyncZ 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_BestBlockOutputSweeperZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ; +} LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ; @@ -24695,62 +27912,32 @@ typedef struct LDKCResult_LockedChannelMonitorNoneZ { /** * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC2Tuple_OutPointChannelIdZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; - /** - * The element at position 1 - */ - struct LDKChannelId b; -} LDKC2Tuple_OutPointChannelIdZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_OutPointChannelIdZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_OutPointChannelIdZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_OutPointChannelIdZZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_OutPointCVec_u64ZZ { +typedef struct LDKC2Tuple_ChannelIdCVec_u64ZZ { /** * The element at position 0 */ - struct LDKOutPoint a; + struct LDKChannelId a; /** * The element at position 1 */ struct LDKCVec_u64Z b; -} LDKC2Tuple_OutPointCVec_u64ZZ; +} LDKC2Tuple_ChannelIdCVec_u64ZZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_u64ZZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdCVec_u64ZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ { +typedef struct LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_OutPointCVec_u64ZZ *data; + struct LDKC2Tuple_ChannelIdCVec_u64ZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_OutPointCVec_u64ZZZ; +} LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ; /** * The contents of CResult_BlindedMessagePathDecodeErrorZ @@ -24785,38 +27972,6 @@ typedef struct LDKCResult_BlindedMessagePathDecodeErrorZ { bool result_ok; } LDKCResult_BlindedMessagePathDecodeErrorZ; -/** - * The contents of CResult_BlindedMessagePathNoneZ - */ -typedef union LDKCResult_BlindedMessagePathNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBlindedMessagePath *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_BlindedMessagePathNoneZPtr; - -/** - * A CResult_BlindedMessagePathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::message::BlindedMessagePath on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_BlindedMessagePathNoneZ { - /** - * The contents of this CResult_BlindedMessagePathNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_BlindedMessagePathNoneZPtr contents; - /** - * Whether this CResult_BlindedMessagePathNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_BlindedMessagePathNoneZ; - /** * The contents of CResult_MessageContextDecodeErrorZ */ @@ -24949,170 +28104,97 @@ typedef struct LDKCResult_DNSResolverContextDecodeErrorZ { bool result_ok; } LDKCResult_DNSResolverContextDecodeErrorZ; -/** - * Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`] - * data migration. - */ -typedef struct LDKMigratableKVStore { - /** - * 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 *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. - * - * This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] - * implementation. - * - * Must exhaustively return all entries known to the store to ensure no data is missed, but - * may return the items in arbitrary order. - */ - struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ (*list_all_keys)(const void *this_arg); - /** - * Implementation of KVStore for this object. - */ - struct LDKKVStore KVStore; - /** - * 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); -} LDKMigratableKVStore; + /** - * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Parameters defining the context around the anchor channel reserve requirement calculation. */ -typedef struct LDKPersister { - /** - * 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 the given ['ChannelManager'] to disk, returning an error if persistence failed. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - struct LDKCResult_NoneIOErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); +typedef struct MUST_USE_STRUCT LDKAnchorChannelReserveContext { /** - * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. - */ - 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. + * 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. */ - struct LDKCResult_NoneIOErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); + LDKnativeAnchorChannelReserveContext *inner; /** - * 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. + * 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. */ - void (*free)(void *this_arg); -} LDKPersister; - - + bool is_owned; +} LDKAnchorChannelReserveContext; /** - * 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` + * A struct representing a name for a channel monitor. * - * Full channel monitors would be stored at a single key: + * `MonitorName` is primarily used within the [`MonitorUpdatingPersister`] + * in functions that store or retrieve [`ChannelMonitor`] snapshots. + * It provides a consistent way to generate a unique key for channel + * monitors based on the channel's funding [`OutPoint`] for v1 channels or + * [`ChannelId`] for v2 channels. Use [`ChannelMonitor::persistence_key`] to + * obtain the correct `MonitorName`. * - * `[CHANNEL_MONITOR_PERSISTENCE_PRIMARY_NAMESPACE]/deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * While users of the Lightning Dev Kit library generally won't need + * to interact with [`MonitorName`] directly, it can be useful for: + * - Custom persistence implementations + * - Debugging or logging channel monitor operations + * - Extending the functionality of the `MonitorUpdatingPersister` * - * Updates would be stored as follows (with `/` delimiting primary_namespace/secondary_namespace/key): + * # Examples * - * ```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`]. + * use std::str::FromStr; * - * ## EXTREMELY IMPORTANT + * use bitcoin::Txid; + * use bitcoin::hashes::hex::FromHex; * - * 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`]. + * use lightning::util::persist::MonitorName; + * use lightning::chain::transaction::OutPoint; + * use lightning::ln::types::ChannelId; * - * # Pruning stale channel updates + * // v1 channel + * let outpoint = OutPoint { + *\t txid: Txid::from_str(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap(), + *\t index: 1, + * }; + * let monitor_name = MonitorName::V1Channel(outpoint); + * assert_eq!(&monitor_name.to_string(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); * - * Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`. - * Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates` - * 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`. + * // v2 channel + * let channel_id = ChannelId(<[u8; 32]>::from_hex(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap()); + * let monitor_name = MonitorName::V2Channel(channel_id); + * assert_eq!(&monitor_name.to_string(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\"); * - * 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. + * // Using MonitorName to generate a storage key + * let storage_key = format!(\"channel_monitors/{}\", monitor_name); + * ``` */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdatingPersister { +typedef enum LDKMonitorName_Tag { /** - * 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. + * The outpoint of the channel's funding transaction. */ - LDKnativeMonitorUpdatingPersister *inner; + LDKMonitorName_V1Channel, /** - * 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. + * The id of the channel produced by [`ChannelId::v2_from_revocation_basepoints`]. */ - bool is_owned; -} LDKMonitorUpdatingPersister; + LDKMonitorName_V2Channel, + /** + * Must be last for serialization purposes + */ + LDKMonitorName_Sentinel, +} LDKMonitorName_Tag; + +typedef struct MUST_USE_STRUCT LDKMonitorName { + LDKMonitorName_Tag tag; + union { + struct { + struct LDKOutPoint v1_channel; + }; + struct { + struct LDKChannelId v2_channel; + }; + }; +} LDKMonitorName; /** * `Persist` defines behavior for persisting channel monitors: this could mean @@ -25179,11 +28261,13 @@ typedef struct LDKPersist { 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. + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup, + * with the `monitor_name` returned by [`ChannelMonitor::persistence_key`]. * - * 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 data can be stored any way you want, so long as `monitor_name` is used to maintain a + * correct mapping with the stored channel data (i.e., calls to `update_persisted_channel` with + * the same `monitor_name` must be applied to or overwrite this data). Note that you **must** + * persist every new monitor to disk. * * The [`ChannelMonitor::get_latest_update_id`] uniquely links this call to [`ChainMonitor::channel_monitor_updated`]. * For [`Persist::persist_new_channel`], it is only necessary to call [`ChainMonitor::channel_monitor_updated`] @@ -25195,7 +28279,7 @@ typedef struct LDKPersist { * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [`Writeable::write`]: crate::util::ser::Writeable::write */ - enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint, const struct LDKChannelMonitor *NONNULL_PTR monitor); + enum LDKChannelMonitorUpdateStatus (*persist_new_channel)(const void *this_arg, struct LDKMonitorName monitor_name, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given * update. @@ -25237,7 +28321,7 @@ typedef struct LDKPersist { * * Note that monitor_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_funding_outpoint, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor); + enum LDKChannelMonitorUpdateStatus (*update_persisted_channel)(const void *this_arg, struct LDKMonitorName monitor_name, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** * Prevents the channel monitor from being loaded on startup. * @@ -25251,7 +28335,16 @@ typedef struct LDKPersist { * restart, this method must in that case be idempotent, ensuring it can handle scenarios where * the monitor already exists in the archive. */ - void (*archive_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint); + void (*archive_persisted_channel)(const void *this_arg, struct LDKMonitorName monitor_name); + /** + * Fetches the set of [`ChannelMonitorUpdate`]s, previously persisted with + * [`Self::update_persisted_channel`], which have completed. + * + * Returning an update here is equivalent to calling + * [`ChainMonitor::channel_monitor_updated`]. Because of this, this method is defaulted and + * hidden in the docs. + */ + struct LDKCVec_C2Tuple_ChannelIdu64ZZ (*get_and_clear_completed_updates)(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. @@ -25259,6 +28352,244 @@ typedef struct LDKPersist { void (*free)(void *this_arg); } LDKPersist; + + +/** + * An implementation of [`chain::Watch`] for monitoring channels. + * + * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by + * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally + * or used independently to monitor channels remotely. See the [module-level documentation] for + * details. + * + * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from + * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, + * detecting substantial mempool feerate changes between blocks, and ensuring reliability if + * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an + * environment with spotty connections, like on mobile. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [module-level documentation]: crate::chain::chainmonitor + * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims + */ +typedef struct MUST_USE_STRUCT LDKChainMonitor { + /** + * 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. + */ + LDKnativeChainMonitor *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; +} LDKChainMonitor; + + + +/** + * A wrapper around a [`KVStoreSync`] that implements the [`KVStore`] trait. It is not necessary to use this type + * directly. + */ +typedef struct MUST_USE_STRUCT LDKKVStoreSyncWrapper { + /** + * 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. + */ + LDKnativeKVStoreSyncWrapper *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; +} LDKKVStoreSyncWrapper; + +/** + * Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`] + * data migration. + */ +typedef struct LDKMigratableKVStore { + /** + * 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 *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. + * + * This is useful for migrating data from [`KVStoreSync`] implementation to [`KVStoreSync`] + * implementation. + * + * Must exhaustively return all entries known to the store to ensure no data is missed, but + * may return the items in arbitrary order. + */ + struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ (*list_all_keys)(const void *this_arg); + /** + * Implementation of KVStoreSync for this object. + */ + struct LDKKVStoreSync KVStoreSync; + /** + * Called, if set, after this MigratableKVStore has been cloned into a duplicate object. + * The new MigratableKVStore 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 LDKMigratableKVStore *NONNULL_PTR new_MigratableKVStore); + /** + * 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); +} LDKMigratableKVStore; + + + +/** + * Implements [`Persist`] in a way that writes and reads both [`ChannelMonitor`]s and + * [`ChannelMonitorUpdate`]s. + * + * # Overview + * + * The main benefit this provides over the [`KVStoreSync`]'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 [`KVStoreSync`]'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`] (e.g., `[SOME-64-CHAR-HEX-STRING]_1`) for v1 + * channels or a [`ChannelId`] (e.g., `[SOME-64-CHAR-HEX-STRING]`) for v2 channels. + * + * 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 or channel id 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 [`KVStoreSync::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 the consolidation threshold is reached according to `maximum_pending_updates`. + * Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates` + * are deleted. + * The `lazy` flag is used on the [`KVStoreSync::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; + +/** + * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a + * future block height is reached. + */ +typedef enum LDKSpendingDelay_Tag { + /** + * A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks` + * is reached. + */ + LDKSpendingDelay_Relative, + /** + * An absolute delay indicating we shouldn't spend the output before `height` is reached. + */ + LDKSpendingDelay_Absolute, + /** + * Must be last for serialization purposes + */ + LDKSpendingDelay_Sentinel, +} LDKSpendingDelay_Tag; + +typedef struct LDKSpendingDelay_LDKRelative_Body { + /** + * The number of blocks until we'll generate and broadcast the spending transaction. + */ + uint32_t num_blocks; +} LDKSpendingDelay_LDKRelative_Body; + +typedef struct LDKSpendingDelay_LDKAbsolute_Body { + /** + * The height at which we'll generate and broadcast the spending transaction. + */ + uint32_t height; +} LDKSpendingDelay_LDKAbsolute_Body; + +typedef struct MUST_USE_STRUCT LDKSpendingDelay { + LDKSpendingDelay_Tag tag; + union { + LDKSpendingDelay_LDKRelative_Body relative; + LDKSpendingDelay_LDKAbsolute_Body absolute; + }; +} LDKSpendingDelay; + /** * The `Listen` trait is used to notify when blocks have been connected or disconnected from the * chain. @@ -25271,6 +28602,24 @@ typedef struct LDKPersist { * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the * entire header chain and only blocks with matching transaction data using BIP 157 filters or * other similar filtering. + * + * # Requirements + * + * Each block must be connected in chain order with one call to either + * [`Listen::block_connected`] or [`Listen::filtered_block_connected`]. If a call to the + * [`Filter`] interface was made during block processing and further transaction(s) from the same + * block now match the filter, a second call to [`Listen::filtered_block_connected`] should be + * made immediately for the same block (prior to any other calls to the [`Listen`] interface). + * + * In case of a reorg, you must call [`Listen::blocks_disconnected`] once with information on the + * \"fork point\" block, i.e. the highest block that is in both forks. You may call + * [`Listen::blocks_disconnected`] multiple times as you walk the chain backwards, but each must + * include a fork point block that is before the last. + * + * # Object Birthday + * + * Note that most implementations take a [`BestBlock`] on construction and blocks only need to be + * applied starting from that point. */ typedef struct LDKListen { /** @@ -25288,9 +28637,14 @@ typedef struct LDKListen { */ void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height); /** - * Notifies the listener that a block was removed at the given height. + * Notifies the listener that one or more blocks were removed in anticipation of a reorg. + * + * The provided [`BestBlock`] is the new best block after disconnecting blocks in the reorg + * but before connecting new ones (i.e. the \"fork point\" block). For backwards compatibility, + * you may instead walk the chain backwards, calling `blocks_disconnected` for each block + * that is disconnected in a reorg. */ - void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); + void (*blocks_disconnected)(const void *this_arg, struct LDKBestBlock fork_point_block); /** * 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. @@ -25408,47 +28762,31 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; + + /** - * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a - * future block height is reached. + * Used to signal to one of many waiters that the condition they're waiting on has happened. + * + * This is usually used by LDK objects such as [`ChannelManager`] or [`PeerManager`] to signal to + * the background processor that it should wake up and process pending events. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`PeerManager`]: crate::ln::peer_handler::PeerManager */ -typedef enum LDKSpendingDelay_Tag { - /** - * A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks` - * is reached. - */ - LDKSpendingDelay_Relative, - /** - * An absolute delay indicating we shouldn't spend the output before `height` is reached. - */ - LDKSpendingDelay_Absolute, - /** - * Must be last for serialization purposes - */ - LDKSpendingDelay_Sentinel, -} LDKSpendingDelay_Tag; - -typedef struct LDKSpendingDelay_LDKRelative_Body { +typedef struct MUST_USE_STRUCT LDKNotifier { /** - * The number of blocks until we'll generate and broadcast the spending transaction. + * 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. */ - uint32_t num_blocks; -} LDKSpendingDelay_LDKRelative_Body; - -typedef struct LDKSpendingDelay_LDKAbsolute_Body { + LDKnativeNotifier *inner; /** - * The height at which we'll generate and broadcast the spending transaction. + * 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. */ - uint32_t height; -} LDKSpendingDelay_LDKAbsolute_Body; - -typedef struct MUST_USE_STRUCT LDKSpendingDelay { - LDKSpendingDelay_Tag tag; - union { - LDKSpendingDelay_LDKRelative_Body relative; - LDKSpendingDelay_LDKAbsolute_Body absolute; - }; -} LDKSpendingDelay; + bool is_owned; +} LDKNotifier; /** * A callback which is called when a [`Future`] completes. @@ -25595,318 +28933,215 @@ typedef struct MUST_USE_STRUCT LDKUserConfig { /** - * An implementation of [`chain::Watch`] for monitoring channels. - * - * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by - * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally - * or used independently to monitor channels remotely. See the [module-level documentation] for - * details. - * - * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from - * a force-closed channel. This is crucial in preventing certain classes of pinning attacks, - * detecting substantial mempool feerate changes between blocks, and ensuring reliability if - * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an - * environment with spotty connections, like on mobile. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [module-level documentation]: crate::chain::chainmonitor - * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims + * Config structure for overriding channel parameters. */ -typedef struct MUST_USE_STRUCT LDKChainMonitor { +typedef struct MUST_USE_STRUCT LDKChannelConfigOverrides { /** * 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. */ - LDKnativeChainMonitor *inner; + LDKnativeChannelConfigOverrides *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; -} LDKChainMonitor; +} LDKChannelConfigOverrides; + + /** - * A trait implemented for objects handling events from [`EventsProvider`]. - * - * An async variation also exists for implementations of [`EventsProvider`] that support async - * event handling. The async event handler should satisfy the generic bounds: `F: - * core::future::Future>, H: Fn(Event) -> F`. + * Config structure for overriding channel handshake parameters. */ -typedef struct LDKEventHandler { +typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfigUpdate { /** - * 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; - /** - * Handles the given [`Event`]. - * - * See [`EventsProvider`] for details that must be considered when implementing this method. + * 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. */ - struct LDKCResult_NoneReplayEventZ (*handle_event)(const void *this_arg, struct LDKEvent event); + LDKnativeChannelHandshakeConfigUpdate *inner; /** - * 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. + * 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. */ - void (*free)(void *this_arg); -} LDKEventHandler; + bool is_owned; +} LDKChannelHandshakeConfigUpdate; /** - * A trait indicating an object may generate events. - * - * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. - * - * Implementations of this trait may also feature an async version of event handling, as shown with - * [`ChannelManager::process_pending_events_async`] and - * [`ChainMonitor::process_pending_events_async`]. - * - * # Requirements - * - * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending - * event since the last invocation. - * - * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s - * and replay any unhandled events on startup. An [`Event`] is considered handled when - * [`process_pending_events`] returns `Ok(())`, thus handlers MUST fully handle [`Event`]s and - * persist any relevant changes to disk *before* returning `Ok(())`. In case of an error (e.g., - * persistence failure) implementors should return `Err(ReplayEvent())`, signalling to the - * [`EventsProvider`] to replay unhandled events on the next invocation (generally immediately). - * Note that some events might not be replayed, please refer to the documentation for - * the individual [`Event`] variants for more detail. - * - * Further, because an application may crash between an [`Event`] being handled and the - * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in - * effect, [`Event`]s may be replayed. - * - * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to - * consult the provider's documentation on the implication of processing events and how a handler - * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and - * [`ChainMonitor::process_pending_events`]). - * - * (C-not implementable) As there is likely no reason for a user to implement this trait on their - * own type(s). - * - * [`process_pending_events`]: Self::process_pending_events - * [`handle_event`]: EventHandler::handle_event - * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events - * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events - * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async - * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async + * The unblinded node in a blinded path. */ -typedef struct LDKEventsProvider { +typedef enum LDKIntroductionNode_Tag { /** - * 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. + * The node id of the introduction node. */ - void *this_arg; + LDKIntroductionNode_NodeId, /** - * Processes any events generated since the last call using the given event handler. - * - * See the trait-level documentation for requirements. + * The short channel id of the channel leading to the introduction node. The [`Direction`] + * identifies which side of the channel is the introduction node. */ - void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); + LDKIntroductionNode_DirectedShortChannelId, /** - * 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. + * Must be last for serialization purposes */ - void (*free)(void *this_arg); -} LDKEventsProvider; + LDKIntroductionNode_Sentinel, +} LDKIntroductionNode_Tag; + +typedef struct LDKIntroductionNode_LDKDirectedShortChannelId_Body { + enum LDKDirection _0; + uint64_t _1; +} LDKIntroductionNode_LDKDirectedShortChannelId_Body; + +typedef struct MUST_USE_STRUCT LDKIntroductionNode { + LDKIntroductionNode_Tag tag; + union { + struct { + struct LDKPublicKey node_id; + }; + LDKIntroductionNode_LDKDirectedShortChannelId_Body directed_short_channel_id; + }; +} LDKIntroductionNode; /** - * A trait defining behavior for creating and verifing the HMAC for authenticating a given data. + * An interface for looking up the node id of a channel counterparty for the purpose of forwarding + * an [`OnionMessage`]. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage */ -typedef struct LDKVerification { +typedef struct LDKNodeIdLookUp { /** * 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; /** - * Constructs an HMAC to include in [`OffersContext`] for the data along with the given - * [`Nonce`]. - */ - struct LDKThirtyTwoBytes (*hmac_for_offer_payment)(const void *this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); - /** - * Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`]. + * Returns the node id of the forwarding node's channel counterparty with `short_channel_id`. + * + * Here, the forwarding node is referring to the node of the [`OnionMessenger`] parameterized + * by the [`NodeIdLookUp`] and the counterparty to one of that node's peers. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_NoneNoneZ (*verify_for_offer_payment)(const void *this_arg, struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + struct LDKPublicKey (*next_node_id)(const void *this_arg, uint64_t short_channel_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); -} LDKVerification; +} LDKNodeIdLookUp; /** - * An unauthenticated [`ReceiveTlvs`]. + * A [`NodeIdLookUp`] that always returns `None`. */ -typedef struct MUST_USE_STRUCT LDKUnauthenticatedReceiveTlvs { +typedef struct MUST_USE_STRUCT LDKEmptyNodeIdLookUp { /** * 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. */ - LDKnativeUnauthenticatedReceiveTlvs *inner; + LDKnativeEmptyNodeIdLookUp *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; -} LDKUnauthenticatedReceiveTlvs; +} LDKEmptyNodeIdLookUp; + + /** - * 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 . + * A read-only view of [`NetworkGraph`]. */ -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, +typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { /** - * 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. + * 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. */ - LDKFailureCode_InvalidOnionPayload, + LDKnativeReadOnlyNetworkGraph *inner; /** - * Must be last for serialization purposes + * 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. */ - LDKFailureCode_Sentinel, -} LDKFailureCode_Tag; - -typedef struct MUST_USE_STRUCT LDKFailureCode { - LDKFailureCode_Tag tag; - union { - struct { - struct LDKCOption_C2Tuple_u64u16ZZ invalid_onion_payload; - }; - }; -} LDKFailureCode; + bool is_owned; +} LDKReadOnlyNetworkGraph; /** - * Chain-related parameters used to construct a new `ChannelManager`. - * - * Typically, the block-specific parameters are derived from the best block hash for the network, - * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters - * are not needed when deserializing a previously constructed `ChannelManager`. + * Data to construct a [`BlindedHop`] for forwarding a payment. */ -typedef struct MUST_USE_STRUCT LDKChainParameters { +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. */ - LDKnativeChainParameters *inner; + 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; -} LDKChainParameters; +} LDKForwardTlvs; /** - * Parameters used with [`create_bolt11_invoice`]. - * - * [`create_bolt11_invoice`]: ChannelManager::create_bolt11_invoice + * Data to construct a [`BlindedHop`] for forwarding a Trampoline payment. */ -typedef struct MUST_USE_STRUCT LDKBolt11InvoiceParameters { +typedef struct MUST_USE_STRUCT LDKTrampolineForwardTlvs { /** * 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. */ - LDKnativeBolt11InvoiceParameters *inner; + LDKnativeTrampolineForwardTlvs *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; -} LDKBolt11InvoiceParameters; +} LDKTrampolineForwardTlvs; /** - * SHA-256 hash + * An unauthenticated [`ReceiveTlvs`]. */ -typedef struct MUST_USE_STRUCT LDKSha256 { +typedef struct MUST_USE_STRUCT LDKUnauthenticatedReceiveTlvs { /** * 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. */ - LDKnativeSha256 *inner; + LDKnativeUnauthenticatedReceiveTlvs *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; -} LDKSha256; - -/** - * Represents the description of an invoice which has to be either a directly included string or - * a hash of a description provided out of band. - */ -typedef enum LDKBolt11InvoiceDescription_Tag { - /** - * Description of what the invoice is for - */ - LDKBolt11InvoiceDescription_Direct, - /** - * Hash of the description of what the invoice is for - */ - LDKBolt11InvoiceDescription_Hash, - /** - * Must be last for serialization purposes - */ - LDKBolt11InvoiceDescription_Sentinel, -} LDKBolt11InvoiceDescription_Tag; - -typedef struct MUST_USE_STRUCT LDKBolt11InvoiceDescription { - LDKBolt11InvoiceDescription_Tag tag; - union { - struct { - struct LDKDescription direct; - }; - struct { - struct LDKSha256 hash; - }; - }; -} LDKBolt11InvoiceDescription; +} LDKUnauthenticatedReceiveTlvs; /** - * A trait indicating an object may generate message send events + * A trait to describe an object which handles when peers connect + disconnect and generates + * outbound messages. + * + * It acts as a supertrait for all the P2P message handlers and can contribute to the + * [`InitFeatures`] which we send to peers or decide to refuse connection to peers. */ -typedef struct LDKMessageSendEventsProvider { +typedef struct LDKBaseMessageHandler { /** * 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. @@ -25917,159 +29152,10 @@ typedef struct LDKMessageSendEventsProvider { * in the process. */ struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(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); -} LDKMessageSendEventsProvider; - -/** - * A trait to describe an object which can receive channel messages. - * - * Messages MAY be called in parallel when they originate from different `their_node_ids`, however - * they MUST NOT be called in parallel when the two calls have the same `their_node_id`. - */ -typedef struct LDKChannelMessageHandler { - /** - * 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; - /** - * Handle an incoming `open_channel` message from the given peer. - */ - void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); - /** - * Handle an incoming `open_channel2` message from the given peer. - */ - void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); - /** - * Handle an incoming `accept_channel` message from the given peer. - */ - void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); - /** - * Handle an incoming `accept_channel2` message from the given peer. - */ - void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg); - /** - * Handle an incoming `funding_created` message from the given peer. - */ - void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); - /** - * Handle an incoming `funding_signed` message from the given peer. - */ - void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); - /** - * Handle an incoming `channel_ready` message from the given peer. - */ - void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); - /** - * Handle an incoming `shutdown` message from the given peer. - */ - void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); - /** - * Handle an incoming `closing_signed` message from the given peer. - */ - void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); - /** - * Handle an incoming `stfu` message from the given peer. - */ - void (*handle_stfu)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg); - /** - * Handle an incoming `tx_add_input message` from the given peer. - */ - void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg); - /** - * Handle an incoming `tx_add_output` message from the given peer. - */ - void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg); - /** - * Handle an incoming `tx_remove_input` message from the given peer. - */ - void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg); - /** - * Handle an incoming `tx_remove_output` message from the given peer. - */ - void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg); - /** - * Handle an incoming `tx_complete message` from the given peer. - */ - void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg); - /** - * Handle an incoming `tx_signatures` message from the given peer. - */ - void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg); - /** - * Handle an incoming `tx_init_rbf` message from the given peer. - */ - void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg); - /** - * Handle an incoming `tx_ack_rbf` message from the given peer. - */ - void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg); - /** - * Handle an incoming `tx_abort message` from the given peer. - */ - void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg); - /** - * Handle an incoming `update_add_htlc` message from the given peer. - */ - void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); - /** - * Handle an incoming `update_fulfill_htlc` message from the given peer. - */ - void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); - /** - * Handle an incoming `update_fail_htlc` message from the given peer. - */ - void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); - /** - * Handle an incoming `update_fail_malformed_htlc` message from the given peer. - */ - void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); - /** - * Handle an incoming `commitment_signed` message from the given peer. - */ - void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); - /** - * Handle an incoming `revoke_and_ack` message from the given peer. - */ - void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); - /** - * Handle an incoming `update_fee` message from the given peer. - */ - void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); - /** - * Handle an incoming `announcement_signatures` message from the given peer. - */ - void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); /** * Indicates a connection to the peer failed/an existing connection was lost. */ void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - * - * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); - /** - * Handle an incoming `channel_reestablish` message from the given peer. - */ - void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg); - /** - * Handle an incoming `channel_update` message from the given peer. - */ - void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); - /** - * Handle an incoming `error` message from the given peer. - */ - void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); /** * Gets the node feature flags which this handler itself supports. All available handlers are * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] @@ -26085,15075 +29171,17163 @@ typedef struct LDKChannelMessageHandler { */ struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); /** - * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. + * Handle a peer (re)connecting. * - * If it's `None`, then no particular network chain hash compatibility will be enforced when - * connecting to peers. - */ - struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); - /** - * Indicates that a message was received from any peer for any handler. - * Called before the message is passed to the appropriate handler. - * Useful for indicating that a network connection is active. + * May return an `Err(())` to indicate that we should immediately disconnect from the peer + * (e.g. because the features they support are not sufficient to communicate with us). * - * Note: Since this function is called frequently, it should be as - * efficient as possible for its intended purpose. - */ - void (*message_received)(const void *this_arg); - /** - * Implementation of MessageSendEventsProvider for this object. + * Note, of course, that other message handlers may wish to communicate with the peer, which + * disconnecting them will prevent. + * + * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. */ - struct LDKMessageSendEventsProvider MessageSendEventsProvider; + struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); /** * 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); -} LDKChannelMessageHandler; +} LDKBaseMessageHandler; /** - * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. + * A handler which can only be used to send messages. * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * This is implemented by [`ChainMonitor`]. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -typedef struct LDKOffersMessageHandler { +typedef struct LDKSendOnlyMessageHandler { /** * 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; /** - * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, - * or replying with an error. - * - * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. - * - * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger - * - * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); - /** - * Releases any [`OffersMessage`]s that need to be sent. - * - * Typically, this is used for messages initiating a payment flow rather than in response to - * another message. The latter should use the return value of [`Self::handle_message`]. + * Implementation of BaseMessageHandler for this object. */ - struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); + struct LDKBaseMessageHandler BaseMessageHandler; /** * 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); -} LDKOffersMessageHandler; +} LDKSendOnlyMessageHandler; /** - * A handler for an [`OnionMessage`] containing an async payments message as its payload. + * A trait implemented for objects handling events from [`EventsProvider`]. * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * An async variation also exists for implementations of [`EventsProvider`] that support async + * event handling. The async event handler should satisfy the generic bounds: `F: + * core::future::Future>, H: Fn(Event) -> F`. */ -typedef struct LDKAsyncPaymentsMessageHandler { +typedef struct LDKEventHandler { /** * 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; /** - * Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release - * the held funds. - * - * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ (*handle_held_htlc_available)(const void *this_arg, struct LDKHeldHtlcAvailable message, struct LDKResponder responder); - /** - * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC - * should be released to the corresponding payee. - */ - void (*handle_release_held_htlc)(const void *this_arg, struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context); - /** - * Release any [`AsyncPaymentsMessage`]s that need to be sent. + * Handles the given [`Event`]. * - * Typically, this is used for messages initiating an async payment flow rather than in response - * to another message. + * See [`EventsProvider`] for details that must be considered when implementing this method. */ - struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); + struct LDKCResult_NoneReplayEventZ (*handle_event)(const void *this_arg, struct LDKEvent event); /** * 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); -} LDKAsyncPaymentsMessageHandler; +} LDKEventHandler; /** - * A handler for an [`OnionMessage`] containing a DNS(SEC) query or a DNSSEC proof + * A trait indicating an object may generate events. * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. + * + * Implementations of this trait may also feature an async version of event handling, as shown with + * [`ChannelManager::process_pending_events_async`] and + * [`ChainMonitor::process_pending_events_async`]. + * + * # Requirements + * + * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending + * event since the last invocation. + * + * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s + * and replay any unhandled events on startup. An [`Event`] is considered handled when + * [`process_pending_events`] returns `Ok(())`, thus handlers MUST fully handle [`Event`]s and + * persist any relevant changes to disk *before* returning `Ok(())`. In case of an error (e.g., + * persistence failure) implementors should return `Err(ReplayEvent())`, signalling to the + * [`EventsProvider`] to replay unhandled events on the next invocation (generally immediately). + * Note that some events might not be replayed, please refer to the documentation for + * the individual [`Event`] variants for more detail. + * + * Further, because an application may crash between an [`Event`] being handled and the + * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in + * effect, [`Event`]s may be replayed. + * + * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to + * consult the provider's documentation on the implication of processing events and how a handler + * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and + * [`ChainMonitor::process_pending_events`]). + * + * (C-not implementable) As there is likely no reason for a user to implement this trait on their + * own type(s). + * + * [`process_pending_events`]: Self::process_pending_events + * [`handle_event`]: EventHandler::handle_event + * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events + * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async + * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async */ -typedef struct LDKDNSResolverMessageHandler { +typedef struct LDKEventsProvider { /** * 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; /** - * Handle a [`DNSSECQuery`] message. - * - * If we provide DNS resolution services to third parties, we should respond with a - * [`DNSSECProof`] message. - * - * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ (*handle_dnssec_query)(const void *this_arg, struct LDKDNSSECQuery message, struct LDKResponder responder); - /** - * Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). + * Processes any events generated since the last call using the given event handler. * - * With this, we should be able to validate the DNS record we requested. - */ - void (*handle_dnssec_proof)(const void *this_arg, struct LDKDNSSECProof message, struct LDKDNSResolverContext context); - /** - * Gets the node feature flags which this handler itself supports. Useful for setting the - * `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response - * to [`DNSSECQuery`] messages. - */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); - /** - * Release any [`DNSResolverMessage`]s that need to be sent. + * See the trait-level documentation for requirements. */ - struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); + void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); /** * 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); -} LDKDNSResolverMessageHandler; +} LDKEventsProvider; /** - * An interface for looking up the node id of a channel counterparty for the purpose of forwarding - * an [`OnionMessage`]. + * An alternative to [`CoinSelectionSourceSync`] that can be implemented and used along + * [`WalletSync`] to provide a default implementation to [`CoinSelectionSourceSync`]. * - * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * For an asynchronous version of this trait, see [`WalletSource`]. */ -typedef struct LDKNodeIdLookUp { +typedef struct LDKWalletSourceSync { /** * 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 node id of the forwarding node's channel counterparty with `short_channel_id`. - * - * Here, the forwarding node is referring to the node of the [`OnionMessenger`] parameterized - * by the [`NodeIdLookUp`] and the counterparty to one of that node's peers. + * Returns all UTXOs, with at least 1 confirmation each, that are available to spend. + */ + struct LDKCResult_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg); + /** + * Returns a script to use for change above dust resulting from a successful coin selection + * attempt. + */ + 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 + * [`WalletSource::list_confirmed_utxos`]). * - * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`TxIn::script_sig`]: bitcoin::TxIn::script_sig + * [`TxIn::witness`]: bitcoin::TxIn::witness */ - struct LDKPublicKey (*next_node_id)(const void *this_arg, uint64_t short_channel_id); + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); /** * 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); -} LDKNodeIdLookUp; +} LDKWalletSourceSync; /** - * Arguments for the creation of a ChannelManager that are not deserialized. - * - * At a high-level, the process for deserializing a ChannelManager and resuming normal operation - * is: - * 1) Deserialize all stored [`ChannelMonitor`]s. - * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling: - * `<(BlockHash, ChannelManager)>::read(reader, args)` - * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored - * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted. - * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the - * same way you would handle a [`chain::Filter`] call using - * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. - * 4) Disconnect/connect blocks on your [`ChannelMonitor`]s to get them in sync with the chain. - * 5) Disconnect/connect blocks on the [`ChannelManager`] to get it in sync with the chain. - * 6) Optionally re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. - * This is important if you have replayed a nontrivial number of blocks in step (4), allowing - * you to avoid having to replay the same blocks if you shut down quickly after startup. It is - * otherwise not required. - * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you - * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in - * the next step. - * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a - * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. - * - * Note that the ordering of #4-7 is not of importance, however all four must occur before you - * call any other methods on the newly-deserialized [`ChannelManager`]. - * - * Note that because some channels may be closed during deserialization, it is critical that you - * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to - * you. If you deserialize an old ChannelManager (during which force-closure transactions may be - * broadcast), and then later deserialize a newer version of the same ChannelManager (which will - * not force-close the same channels but consider them live), you may end up revoking a state for - * which you've already broadcasted the transaction. + * A wrapper over [`WalletSourceSync`] that implements [`CoinSelectionSourceSync`] by preferring + * UTXOs that would avoid conflicting double spends. If not enough UTXOs are available to do so, + * conflicting double spends may happen. * - * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor + * For an asynchronous version of this wrapper, see [`Wallet`]. */ -typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { +typedef struct MUST_USE_STRUCT LDKWalletSync { /** * 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. */ - LDKnativeChannelManagerReadArgs *inner; + LDKnativeWalletSync *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; -} LDKChannelManagerReadArgs; +} LDKWalletSync; + +/** + * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can + * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, + * which most wallets should be able to satisfy. Otherwise, consider implementing + * [`WalletSourceSync`], which can provide a default implementation of this trait when used with + * [`WalletSync`]. + * + * For an asynchronous version of this trait, see [`CoinSelectionSource`]. + */ +typedef struct LDKCoinSelectionSourceSync { + /** + * 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; + /** + * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are + * available to spend. Implementations are free to pick their coin selection algorithm of + * choice, as long as the following requirements are met: + * + * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction + * throughout coin selection, but must not be returned as part of the result. + * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction + * throughout coin selection. In some cases, like when funding an anchor transaction, this + * set is empty. Implementations should ensure they handle this correctly on their end, + * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be + * provided, in which case a zero-value empty OP_RETURN output can be used instead. + * 3. Enough inputs must be selected/contributed for the resulting transaction (including the + * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. + * 4. The final transaction must have a weight smaller than `max_tx_weight`; if this + * constraint can't be met, return an `Err`. In the case of counterparty-signed HTLC + * transactions, we will remove a chunk of HTLCs and try your algorithm again. As for + * anchor transactions, we will try your coin selection again with the same input-output + * set when you call [`ChannelMonitor::rebroadcast_pending_claims`], as anchor transactions + * cannot be downsized. + * + * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of + * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require + * providing the full input weight. Failing to do so may lead to underestimating fee bumps and + * delaying block inclusion. + * + * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they + * can be re-used within new fee-bumped iterations of the original claiming transaction, + * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a + * transaction associated with it, and all of the available UTXOs have already been assigned to + * other claims, implementations must be willing to double spend their UTXOs. The choice of + * which UTXOs to double spend is left to the implementation, but it must strive to keep the + * set of other claims being double spent to a minimum. + * + * [`ChannelMonitor::rebroadcast_pending_claims`]: crate::chain::channelmonitor::ChannelMonitor::rebroadcast_pending_claims + */ + struct LDKCResult_CoinSelectionNoneZ (*select_confirmed_utxos)(const void *this_arg, struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight, uint64_t max_tx_weight); + /** + * Signs and provides the full witness for all inputs within the transaction known to the + * trait (i.e., any provided via [`CoinSelectionSourceSync::select_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. + */ + struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); + /** + * 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); +} LDKCoinSelectionSourceSync; /** - * Contains fields that are both common to [`open_channel`] and [`open_channel2`] messages. + * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a + * [`CoinSelectionSourceSync`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or + * Replace-By-Fee (RBF). * - * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message - * [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message + * For an asynchronous version of this handler, see [`BumpTransactionEventHandler`]. + * + * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction */ -typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields { +typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandlerSync { /** * 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. */ - LDKnativeCommonOpenChannelFields *inner; + LDKnativeBumpTransactionEventHandlerSync *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; -} LDKCommonOpenChannelFields; +} LDKBumpTransactionEventHandlerSync; + +/** + * 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; /** - * Contains fields that are both common to [`accept_channel`] and [`accept_channel2`] messages. + * Static channel fields used to build transactions given per-commitment fields, organized by + * broadcaster/countersignatory. * - * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message - * [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message + * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the + * as_holder_broadcastable and as_counterparty_broadcastable functions. */ -typedef struct MUST_USE_STRUCT LDKCommonAcceptChannelFields { +typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { /** * 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. */ - LDKnativeCommonAcceptChannelFields *inner; + LDKnativeDirectedChannelTransactionParameters *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; -} LDKCommonAcceptChannelFields; +} LDKDirectedChannelTransactionParameters; + +/** + * A trait defining behavior for creating and verifing the HMAC for authenticating a given data. + */ +typedef struct LDKVerification { + /** + * 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; + /** + * Constructs an HMAC to include in [`OffersContext`] for the data along with the given + * [`Nonce`]. + */ + struct LDKThirtyTwoBytes (*hmac_for_offer_payment)(const void *this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + /** + * Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`]. + */ + struct LDKCResult_NoneNoneZ (*verify_for_offer_payment)(const void *this_arg, struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + /** + * 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); +} LDKVerification; /** - * Packet of hop data for next peer + * Optional arguments to [`ChannelManager::pay_for_offer`] + *and [`ChannelManager::pay_for_offer_from_human_readable_name`] + * . + * + * These fields will often not need to be set, and the provided [`Self::default`] can be used. */ -typedef struct MUST_USE_STRUCT LDKPacket { +typedef struct MUST_USE_STRUCT LDKOptionalOfferPaymentParams { /** * 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; + LDKnativeOptionalOfferPaymentParams *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; +} LDKOptionalOfferPaymentParams; /** - * A trait to describe an object which can receive routing messages. - * - * # Implementor DoS Warnings + * 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 messages enabled with the `gossip_queries` feature there are potential DoS vectors when - * handling inbound queries. Implementors using an on-disk network graph should be aware of - * repeated disk I/O for queries accessing different parts of the network graph. + * For more info on failure codes, see . */ -typedef struct LDKRoutingMessageHandler { +typedef enum LDKFailureCode_Tag { /** - * 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. + * 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. */ - void *this_arg; + LDKFailureCode_TemporaryNodeFailure, /** - * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, - * `false` or returning an `Err` otherwise. + * 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 `their_node_id` is `None`, the message was generated by our own local node. + * 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; + + + +/** + * Chain-related parameters used to construct a new `ChannelManager`. + * + * Typically, the block-specific parameters are derived from the best block hash for the network, + * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters + * are not needed when deserializing a previously constructed `ChannelManager`. + */ +typedef struct MUST_USE_STRUCT LDKChainParameters { + /** + * 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. + */ + LDKnativeChainParameters *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; +} LDKChainParameters; + +/** + * The components of a splice's funding transaction that are contributed by one party. + */ +typedef enum LDKSpliceContribution_Tag { + /** + * When funds are added to a channel. + */ + LDKSpliceContribution_SpliceIn, + /** + * When funds are removed from a channel. + */ + LDKSpliceContribution_SpliceOut, + /** + * Must be last for serialization purposes + */ + LDKSpliceContribution_Sentinel, +} LDKSpliceContribution_Tag; + +typedef struct LDKSpliceContribution_LDKSpliceIn_Body { + /** + * The amount to contribute to the splice. + */ + uint64_t value; + /** + * The inputs included in the splice's funding transaction to meet the contributed amount + * plus fees. Any excess amount will be sent to a change output. + */ + struct LDKCVec_FundingTxInputZ inputs; + /** + * An optional change output script. This will be used if needed or, when not set, + * generated using [`SignerProvider::get_destination_script`]. * - * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`SignerProvider::get_destination_script`]: crate::sign::SignerProvider::get_destination_script */ - struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + struct LDKCOption_CVec_u8ZZ change_script; +} LDKSpliceContribution_LDKSpliceIn_Body; + +typedef struct LDKSpliceContribution_LDKSpliceOut_Body { /** - * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` - * or returning an `Err` otherwise. + * The outputs to include in the splice's funding transaction. The total value of all + * outputs plus fees will be the amount that is removed. + */ + struct LDKCVec_TxOutZ outputs; +} LDKSpliceContribution_LDKSpliceOut_Body; + +typedef struct MUST_USE_STRUCT LDKSpliceContribution { + LDKSpliceContribution_Tag tag; + union { + LDKSpliceContribution_LDKSpliceIn_Body splice_in; + LDKSpliceContribution_LDKSpliceOut_Body splice_out; + }; +} LDKSpliceContribution; + + + +/** + * Parameters used with [`create_bolt11_invoice`]. + * + * [`create_bolt11_invoice`]: ChannelManager::create_bolt11_invoice + */ +typedef struct MUST_USE_STRUCT LDKBolt11InvoiceParameters { + /** + * 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. + */ + LDKnativeBolt11InvoiceParameters *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; +} LDKBolt11InvoiceParameters; + + + +/** + * SHA-256 hash + */ +typedef struct MUST_USE_STRUCT LDKSha256 { + /** + * 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. + */ + LDKnativeSha256 *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; +} LDKSha256; + +/** + * Represents the description of an invoice which has to be either a directly included string or + * a hash of a description provided out of band. + */ +typedef enum LDKBolt11InvoiceDescription_Tag { + /** + * Description of what the invoice is for + */ + LDKBolt11InvoiceDescription_Direct, + /** + * Hash of the description of what the invoice is for + */ + LDKBolt11InvoiceDescription_Hash, + /** + * Must be last for serialization purposes + */ + LDKBolt11InvoiceDescription_Sentinel, +} LDKBolt11InvoiceDescription_Tag; + +typedef struct MUST_USE_STRUCT LDKBolt11InvoiceDescription { + LDKBolt11InvoiceDescription_Tag tag; + union { + struct { + struct LDKDescription direct; + }; + struct { + struct LDKSha256 hash; + }; + }; +} LDKBolt11InvoiceDescription; + + + +/** + * An [`Offer`] which was fetched from a human readable name, ie through BIP 353. + */ +typedef struct MUST_USE_STRUCT LDKOfferFromHrn { + /** + * 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. + */ + LDKnativeOfferFromHrn *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; +} LDKOfferFromHrn; + +/** + * A trait to describe an object which can receive channel messages. + * + * Messages MAY be called in parallel when they originate from different `their_node_ids`, however + * they MUST NOT be called in parallel when the two calls have the same `their_node_id`. + */ +typedef struct LDKChannelMessageHandler { + /** + * 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; + /** + * Handle an incoming `open_channel` message from the given peer. + */ + void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); + /** + * Handle an incoming `open_channel2` message from the given peer. + */ + void (*handle_open_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); + /** + * Handle an incoming `accept_channel` message from the given peer. + */ + void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); + /** + * Handle an incoming `accept_channel2` message from the given peer. + */ + void (*handle_accept_channel_v2)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAcceptChannelV2 *NONNULL_PTR msg); + /** + * Handle an incoming `funding_created` message from the given peer. + */ + void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg); + /** + * Handle an incoming `funding_signed` message from the given peer. + */ + void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); + /** + * Handle an incoming `channel_ready` message from the given peer. + */ + void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); + /** + * Handle an incoming `peer_storage` message from the given peer. + */ + void (*handle_peer_storage)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKPeerStorage msg); + /** + * Handle an incoming `peer_storage_retrieval` message from the given peer. + */ + void (*handle_peer_storage_retrieval)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKPeerStorageRetrieval msg); + /** + * Handle an incoming `shutdown` message from the given peer. + */ + void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg); + /** + * Handle an incoming `closing_signed` message from the given peer. + */ + void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg); + /** + * Handle an incoming `stfu` message from the given peer. + */ + void (*handle_stfu)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg); + /** + * Handle an incoming `splice_init` message from the given peer. + */ + void (*handle_splice_init)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSpliceInit *NONNULL_PTR msg); + /** + * Handle an incoming `splice_ack` message from the given peer. + */ + void (*handle_splice_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSpliceAck *NONNULL_PTR msg); + /** + * Handle an incoming `splice_locked` message from the given peer. + */ + void (*handle_splice_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKSpliceLocked *NONNULL_PTR msg); + /** + * Handle an incoming `tx_add_input message` from the given peer. + */ + void (*handle_tx_add_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg); + /** + * Handle an incoming `tx_add_output` message from the given peer. + */ + void (*handle_tx_add_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAddOutput *NONNULL_PTR msg); + /** + * Handle an incoming `tx_remove_input` message from the given peer. + */ + void (*handle_tx_remove_input)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveInput *NONNULL_PTR msg); + /** + * Handle an incoming `tx_remove_output` message from the given peer. + */ + void (*handle_tx_remove_output)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxRemoveOutput *NONNULL_PTR msg); + /** + * Handle an incoming `tx_complete message` from the given peer. + */ + void (*handle_tx_complete)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxComplete *NONNULL_PTR msg); + /** + * Handle an incoming `tx_signatures` message from the given peer. + */ + void (*handle_tx_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxSignatures *NONNULL_PTR msg); + /** + * Handle an incoming `tx_init_rbf` message from the given peer. + */ + void (*handle_tx_init_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxInitRbf *NONNULL_PTR msg); + /** + * Handle an incoming `tx_ack_rbf` message from the given peer. + */ + void (*handle_tx_ack_rbf)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAckRbf *NONNULL_PTR msg); + /** + * Handle an incoming `tx_abort message` from the given peer. + */ + void (*handle_tx_abort)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKTxAbort *NONNULL_PTR msg); + /** + * Handle an incoming `update_add_htlc` message from the given peer. + */ + void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg); + /** + * Handle an incoming `update_fulfill_htlc` message from the given peer. + */ + void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKUpdateFulfillHTLC msg); + /** + * Handle an incoming `update_fail_htlc` message from the given peer. + */ + void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg); + /** + * Handle an incoming `update_fail_malformed_htlc` message from the given peer. + */ + void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg); + /** + * Handle an incoming `commitment_signed` message from the given peer. + */ + void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); + /** + * Handle a batch of incoming `commitment_signed` message from the given peer. + */ + void (*handle_commitment_signed_batch)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKChannelId channel_id, struct LDKCVec_CommitmentSignedZ batch); + /** + * Handle an incoming `revoke_and_ack` message from the given peer. + */ + void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg); + /** + * Handle an incoming `update_fee` message from the given peer. + */ + void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg); + /** + * Handle an incoming `announcement_signatures` message from the given peer. + */ + void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); + /** + * Handle an incoming `channel_reestablish` message from the given peer. + */ + void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg); + /** + * Handle an incoming `channel_update` message from the given peer. + */ + void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); + /** + * Handle an incoming `error` message from the given peer. + */ + void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); + /** + * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * - * If `their_node_id` is `None`, the message was generated by our own local node. + * If it's `None`, then no particular network chain hash compatibility will be enforced when + * connecting to peers. + */ + struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); + /** + * Indicates that a message was received from any peer for any handler. + * Called before the message is passed to the appropriate handler. + * Useful for indicating that a network connection is active. * - * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note: Since this function is called frequently, it should be as + * efficient as possible for its intended purpose. */ - struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelAnnouncement *NONNULL_PTR msg); + void (*message_received)(const void *this_arg); /** - * Handle an incoming `channel_update` message, returning true if it should be forwarded on, - * `false` or returning an `Err` otherwise. + * Implementation of BaseMessageHandler for this object. + */ + struct LDKBaseMessageHandler BaseMessageHandler; + /** + * 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); +} LDKChannelMessageHandler; + +/** + * A handler for an [`OnionMessage`] containing a BOLT 12 Offers message as its payload. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef struct LDKOffersMessageHandler { + /** + * 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; + /** + * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, + * or replying with an error. * - * If `their_node_id` is `None`, the message was generated by our own local node. + * If the provided [`OffersContext`] is `Some`, then the message was sent to a blinded path that we + * created and was authenticated as such by the [`OnionMessenger`]. There is one exception to + * this: [`OffersContext::InvoiceRequest`]. * - * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * In order to support offers created prior to LDK 0.2, [`OffersContext::InvoiceRequest`]s are + * not authenticated by the [`OnionMessenger`]. It is the responsibility of message handling code + * to authenticate the provided [`OffersContext`] in this case. + * + * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); + struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ (*handle_message)(const void *this_arg, struct LDKOffersMessage message, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); /** - * Gets channel announcements and updates required to dump our routing table to a remote node, - * starting at the `short_channel_id` indicated by `starting_point` and including announcements - * for a single channel. + * Releases any [`OffersMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a payment flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_message`]. */ - struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point); + struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); /** - * Gets a node announcement required to dump our routing table to a remote node, starting at - * the node *after* the provided pubkey and including up to one announcement immediately - * higher (as defined by `::cmp`) than `starting_point`. - * If `None` is provided for `starting_point`, we start at the first node. + * 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); +} LDKOffersMessageHandler; + +/** + * A handler for an [`OnionMessage`] containing an async payments message as its payload. + * + * The [`AsyncPaymentsContext`]s provided to each method was authenticated by the + * [`OnionMessenger`] as coming from a blinded path that we created. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + */ +typedef struct LDKAsyncPaymentsMessageHandler { + /** + * 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; + /** + * Handle an [`OfferPathsRequest`] message. If we are a static invoice server and the message was + * sent over paths that we previously provided to an async recipient, an [`OfferPaths`] message + * should be returned. * - * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point); + struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ (*handle_offer_paths_request)(const void *this_arg, struct LDKOfferPathsRequest message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); /** - * Called when a connection is established with a peer. This can be used to - * perform routing table synchronization using a strategy defined by the - * implementor. + * Handle an [`OfferPaths`] message. If this is in response to an [`OfferPathsRequest`] that + * we previously sent as an async recipient, we should build an [`Offer`] containing the + * included [`OfferPaths::paths`] and a corresponding [`StaticInvoice`], and reply with + * [`ServeStaticInvoice`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); + struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ (*handle_offer_paths)(const void *this_arg, struct LDKOfferPaths message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); /** - * Handles the reply of a query we initiated to learn about channels - * for a given range of blocks. We can expect to receive one or more - * replies to a single query. + * Handle a [`ServeStaticInvoice`] message. If this is in response to an [`OfferPaths`] message + * we previously sent as a static invoice server, a [`StaticInvoicePersisted`] message should be + * sent once the message is handled. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg); + void (*handle_serve_static_invoice)(const void *this_arg, struct LDKServeStaticInvoice message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); /** - * Handles the reply of a query we initiated asking for routing gossip - * messages for a list of channels. We should receive this message when - * a node has completed its best effort to send us the pertaining routing - * gossip messages. + * Handle a [`StaticInvoicePersisted`] message. If this is in response to a + * [`ServeStaticInvoice`] message we previously sent as an async recipient, then the offer we + * generated on receipt of a previous [`OfferPaths`] message is now ready to be used for async + * payments. */ - struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg); + void (*handle_static_invoice_persisted)(const void *this_arg, struct LDKStaticInvoicePersisted message, struct LDKAsyncPaymentsContext context); /** - * Handles when a peer asks us to send a list of `short_channel_id`s - * for the requested range of blocks. + * Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release + * the held funds. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg); + struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ (*handle_held_htlc_available)(const void *this_arg, struct LDKHeldHtlcAvailable message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); /** - * Handles when a peer asks us to send routing gossip messages for a - * list of `short_channel_id`s. + * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC + * should be released to the corresponding payee. */ - struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); + void (*handle_release_held_htlc)(const void *this_arg, struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context); /** - * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages - * pending some async action. While there is no guarantee of the rate of future messages, the - * caller should seek to reduce the rate of new gossip messages handled, especially - * [`ChannelAnnouncement`]s. + * Release any [`AsyncPaymentsMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating an async payment flow rather than in response + * to another message. */ - bool (*processing_queue_high)(const void *this_arg); + struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ (*release_pending_messages)(const void *this_arg); /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. + * 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. */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + void (*free)(void *this_arg); +} LDKAsyncPaymentsMessageHandler; + +/** + * A handler for an [`OnionMessage`] containing a DNS(SEC) query or a DNSSEC proof + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef struct LDKDNSResolverMessageHandler { /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. + * 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; + /** + * Handle a [`DNSSECQuery`] message. * - * Note that this method is called before [`Self::peer_connected`]. + * If we provide DNS resolution services to third parties, we should respond with a + * [`DNSSECProof`] message. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ (*handle_dnssec_query)(const void *this_arg, struct LDKDNSSECQuery message, struct LDKResponder responder); + /** + * Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). + * + * The provided [`DNSResolverContext`] was authenticated by the [`OnionMessenger`] as coming from + * a blinded path that we created. + * + * With this, we should be able to validate the DNS record we requested. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + */ + void (*handle_dnssec_proof)(const void *this_arg, struct LDKDNSSECProof message, struct LDKDNSResolverContext context); + /** + * Gets the node feature flags which this handler itself supports. Useful for setting the + * `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response + * to [`DNSSECQuery`] messages. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); /** - * Implementation of MessageSendEventsProvider for this object. + * Release any [`DNSResolverMessage`]s that need to be sent. */ - struct LDKMessageSendEventsProvider MessageSendEventsProvider; + struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ (*release_pending_messages)(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); -} LDKRoutingMessageHandler; +} LDKDNSResolverMessageHandler; + + + +/** + * Arguments for the creation of a ChannelManager that are not deserialized. + * + * At a high-level, the process for deserializing a ChannelManager and resuming normal operation + * is: + * 1) Deserialize all stored [`ChannelMonitor`]s. + * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling: + * `<(BlockHash, ChannelManager)>::read(reader, args)` + * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored + * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted. + * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the + * same way you would handle a [`chain::Filter`] call using + * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. + * 4) Disconnect/connect blocks on your [`ChannelMonitor`]s to get them in sync with the chain. + * 5) Disconnect/connect blocks on the [`ChannelManager`] to get it in sync with the chain. + * 6) Optionally re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. + * This is important if you have replayed a nontrivial number of blocks in step (4), allowing + * you to avoid having to replay the same blocks if you shut down quickly after startup. It is + * otherwise not required. + * + * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you + * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in + * the next step. + * + * If you wish to avoid this for performance reasons, use + * [`ChainMonitor::load_existing_monitor`]. + * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a + * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. + * + * Note that the ordering of #4-7 is not of importance, however all four must occur before you + * call any other methods on the newly-deserialized [`ChannelManager`]. + * + * Note that because some channels may be closed during deserialization, it is critical that you + * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to + * you. If you deserialize an old ChannelManager (during which force-closure transactions may be + * broadcast), and then later deserialize a newer version of the same ChannelManager (which will + * not force-close the same channels but consider them live), you may end up revoking a state for + * which you've already broadcasted the transaction. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor + * [`ChainMonitor::load_existing_monitor`]: crate::chain::chainmonitor::ChainMonitor::load_existing_monitor + */ +typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { + /** + * 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. + */ + LDKnativeChannelManagerReadArgs *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; +} LDKChannelManagerReadArgs; + + + +/** + * Contains fields that are both common to [`open_channel`] and [`open_channel2`] messages. + * + * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message + * [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message + */ +typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields { + /** + * 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. + */ + LDKnativeCommonOpenChannelFields *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; +} LDKCommonOpenChannelFields; + + + +/** + * Contains fields that are both common to [`accept_channel`] and [`accept_channel2`] messages. + * + * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message + * [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message + */ +typedef struct MUST_USE_STRUCT LDKCommonAcceptChannelFields { + /** + * 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. + */ + LDKnativeCommonAcceptChannelFields *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; +} LDKCommonAcceptChannelFields; + +/** + * A 3-byte byte array. + */ +typedef struct LDKThreeBytes { + /** + * The three bytes + */ + uint8_t data[3]; +} LDKThreeBytes; + +/** + * A trait to describe an object which can receive routing messages. + * + * # Implementor DoS Warnings + * + * For messages enabled with the `gossip_queries` feature there are potential DoS vectors when + * handling inbound queries. Implementors using an on-disk network graph should be aware of + * repeated disk I/O for queries accessing different parts of the network graph. + */ +typedef struct LDKRoutingMessageHandler { + /** + * 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; + /** + * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, + * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + /** + * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` + * or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelAnnouncement *NONNULL_PTR msg); + /** + * Handle an incoming `channel_update` message, returning true if it should be forwarded on, + * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); + /** + * Gets channel announcements and updates required to dump our routing table to a remote node, + * starting at the `short_channel_id` indicated by `starting_point` and including announcements + * for a single channel. + */ + struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point); + /** + * Gets a node announcement required to dump our routing table to a remote node, starting at + * the node *after* the provided pubkey and including up to one announcement immediately + * higher (as defined by `::cmp`) than `starting_point`. + * If `None` is provided for `starting_point`, we start at the first node. + * + * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKNodeId starting_point); + /** + * Handles the reply of a query we initiated to learn about channels + * for a given range of blocks. We can expect to receive one or more + * replies to a single query. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg); + /** + * Handles the reply of a query we initiated asking for routing gossip + * messages for a list of channels. We should receive this message when + * a node has completed its best effort to send us the pertaining routing + * gossip messages. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg); + /** + * Handles when a peer asks us to send a list of `short_channel_id`s + * for the requested range of blocks. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg); + /** + * Handles when a peer asks us to send routing gossip messages for a + * list of `short_channel_id`s. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); + /** + * Indicates that there are a large number of [`ChannelAnnouncement`] (or other) messages + * pending some async action. While there is no guarantee of the rate of future messages, the + * caller should seek to reduce the rate of new gossip messages handled, especially + * [`ChannelAnnouncement`]s. + */ + bool (*processing_queue_high)(const void *this_arg); + /** + * Implementation of BaseMessageHandler for this object. + */ + struct LDKBaseMessageHandler BaseMessageHandler; + /** + * 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); +} LDKRoutingMessageHandler; + +/** + * A handler for received [`OnionMessage`]s and for providing generated ones to send. + */ +typedef struct LDKOnionMessageHandler { + /** + * 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; + /** + * Handle an incoming `onion_message` message from the given peer. + */ + void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); + /** + * Returns the next pending onion message for the peer with the given node id. + * + * Note that onion messages can only be provided upstream via this method and *not* via + * [`BaseMessageHandler::get_and_clear_pending_msg_events`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); + /** + * Performs actions that should happen roughly every ten seconds after startup. Allows handlers + * to drop any buffered onion messages intended for prospective peerst. + */ + void (*timer_tick_occurred)(const void *this_arg); + /** + * Implementation of BaseMessageHandler for this object. + */ + struct LDKBaseMessageHandler BaseMessageHandler; + /** + * 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); +} LDKOnionMessageHandler; + +/** + * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) + * decoders. + */ +typedef struct LDKCustomMessageReader { + /** + * 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; + /** + * Decodes a custom message to `CustomMessageType`. If the given message type is known to the + * implementation and the message could be decoded, must return `Ok(Some(message))`. If the + * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error + * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. + */ + struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer); + /** + * 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); +} LDKCustomMessageReader; + +/** + * A handler provided to [`PeerManager`] for reading and handling custom messages. + * + * [BOLT 1] specifies a custom message type range for use with experimental or application-specific + * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the + * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler. + * + * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md + * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message + */ +typedef struct LDKCustomMessageHandler { + /** + * 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; + /** + * Handles the given message sent from `sender_node_id`, possibly producing messages for + * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`] + * to send. + */ + struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id); + /** + * Returns the list of pending messages that were generated by the handler, clearing the list + * in the process. Each message is paired with the node id of the intended recipient. If no + * connection to the node exists, then the message is simply not sent. + */ + struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg); + /** + * Indicates a peer disconnected. + */ + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Handle a peer connecting. + * + * May return an `Err(())` to indicate that we should immediately disconnect from the peer + * (e.g. because the features they support are not sufficient to communicate with us). + * + * Note, of course, that other message handlers may wish to communicate with the peer, which + * disconnecting them will prevent. + * + * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. + */ + struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); + /** + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + * + * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * [`Init`]: crate::ln::msgs::Init + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Implementation of CustomMessageReader for this object. + */ + struct LDKCustomMessageReader CustomMessageReader; + /** + * 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); +} LDKCustomMessageHandler; + + + +/** + * A dummy struct which implements `RoutingMessageHandler` without storing any routing information + * or doing any processing. You can provide one of these as the route_handler in a MessageHandler. + */ +typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler { + /** + * 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. + */ + LDKnativeIgnoringMessageHandler *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; +} LDKIgnoringMessageHandler; + +/** + * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`], + * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages, + * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom + * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported + * message types. + * + * See [`OnionMessenger`] for example usage. + * + * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler + * [`CustomMessage`]: Self::CustomMessage + */ +typedef struct LDKCustomOnionMessageHandler { + /** + * 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; + /** + * Called with the custom message that was received, returning a response to send, if any. + * + * If the provided `context` is `Some`, then the message was sent to a blinded path that we + * created and was authenticated as such by the [`OnionMessenger`]. + * + * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents message, struct LDKCOption_CVec_u8ZZ context, struct LDKResponder responder); + /** + * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the + * message type is unknown. + */ + struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); + /** + * Releases any [`Self::CustomMessage`]s that need to be sent. + * + * Typically, this is used for messages initiating a message flow rather than in response to + * another message. The latter should use the return value of [`Self::handle_custom_message`]. + */ + struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ (*release_pending_custom_messages)(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); +} LDKCustomOnionMessageHandler; + + + +/** + * A dummy struct which implements `ChannelMessageHandler` without having any channels. + * You can provide one of these as the route_handler in a MessageHandler. + */ +typedef struct MUST_USE_STRUCT LDKErroringMessageHandler { + /** + * 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. + */ + LDKnativeErroringMessageHandler *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; +} LDKErroringMessageHandler; + + + +/** + * Provides references to trait impls which handle different types of messages. + */ +typedef struct MUST_USE_STRUCT LDKMessageHandler { + /** + * 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. + */ + LDKnativeMessageHandler *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; +} LDKMessageHandler; + +/** + * Provides an object which can be used to send data to and which uniquely identifies a connection + * to a remote host. You will need to be able to generate multiple of these which meet Eq and + * implement Hash to meet the PeerManager API. + * + * For efficiency, [`Clone`] should be relatively cheap for this type. + * + * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original + * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it + * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no + * further calls to the [`PeerManager`] related to the original socket occur. This allows you to + * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish + * to simply use another value which is guaranteed to be globally unique instead. + */ +typedef struct LDKSocketDescriptor { + /** + * 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; + /** + * Attempts to send some data from the given slice to the peer. + * + * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. + * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be + * called and further write attempts may occur until that time. + * + * If the returned size is smaller than `data.len()`, a + * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be + * written. + * + * If `continue_read` is *not* set, further [`PeerManager::read_event`] calls should be + * avoided until another call is made with it set. This allows us to pause read if there are + * too many outgoing messages queued for a peer to avoid DoS issues where a peer fills our + * buffer by sending us messages that need response without reading the responses. + * + * Note that calls may be made with an empty `data` to update the `continue_read` flag. + */ + uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool continue_read); + /** + * Disconnect the socket pointed to by this SocketDescriptor. + * + * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this + * call (doing so is a noop). + */ + void (*disconnect_socket)(void *this_arg); + /** + * Checks if two objects are equal given this object's this_arg pointer and another object. + */ + bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); + /** + * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. + * This is used, for example, for inclusion of this object in a hash map. + */ + uint64_t (*hash)(const void *this_arg); + /** + * Called, if set, after this SocketDescriptor has been cloned into a duplicate object. + * The new SocketDescriptor 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 LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor); + /** + * 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); +} LDKSocketDescriptor; + + + +/** + * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls + * socket events into messages which it passes on to its [`MessageHandler`]. + * + * Locks are taken internally, so you must never assume that reentrancy from a + * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock. + * + * Calls to [`read_event`] will decode relevant messages and pass them to the + * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of + * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any + * [`PeerManager`] functions related to the same connection must occur only in serial, making new + * calls only after previous ones have returned. + * + * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`] + * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but + * essentially you should default to using a [`SimpleRefPeerManager`], and use a + * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when + * you're using lightning-net-tokio. + * + * [`read_event`]: PeerManager::read_event + */ +typedef struct MUST_USE_STRUCT LDKPeerManager { + /** + * 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. + */ + LDKnativePeerManager *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; +} LDKPeerManager; + + + +/** + * Builds an [`Offer`] for the \"offer to be paid\" flow. + * + * See [module-level documentation] for usage. + * + * [module-level documentation]: self + */ +typedef struct MUST_USE_STRUCT LDKOfferWithExplicitMetadataBuilder { + /** + * 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. + */ + LDKnativeOfferWithExplicitMetadataBuilder *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; +} LDKOfferWithExplicitMetadataBuilder; + + + +/** + * A string that displays only printable characters, replacing control characters with + * [`core::char::REPLACEMENT_CHARACTER`]. + */ +typedef struct MUST_USE_STRUCT LDKPrintableString { + /** + * 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. + */ + LDKnativePrintableString *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; +} LDKPrintableString; + + + +/** + * Features used within an `offer`. + */ +typedef struct MUST_USE_STRUCT LDKOfferFeatures { + /** + * 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. + */ + LDKnativeOfferFeatures *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; +} LDKOfferFeatures; + + + +/** + * A BOLT12 offers code and flow utility provider, which facilitates + * BOLT12 builder generation and onion message handling. + * + * [`OffersMessageFlow`] is parameterized by a [`MessageRouter`], which is responsible + * for finding message paths when initiating and retrying onion messages. + */ +typedef struct MUST_USE_STRUCT LDKOffersMessageFlow { + /** + * 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. + */ + LDKnativeOffersMessageFlow *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; +} LDKOffersMessageFlow; + +/** + * Parameters for the reply path to a [`HeldHtlcAvailable`] onion message. + */ +typedef enum LDKHeldHtlcReplyPath_Tag { + /** + * The reply path to the [`HeldHtlcAvailable`] message should terminate at our node. + */ + LDKHeldHtlcReplyPath_ToUs, + /** + * The reply path to the [`HeldHtlcAvailable`] message should terminate at our next-hop channel + * counterparty, as they are holding our HTLC until they receive the corresponding + * [`ReleaseHeldHtlc`] message. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + */ + LDKHeldHtlcReplyPath_ToCounterparty, + /** + * Must be last for serialization purposes + */ + LDKHeldHtlcReplyPath_Sentinel, +} LDKHeldHtlcReplyPath_Tag; + +typedef struct LDKHeldHtlcReplyPath_LDKToUs_Body { + /** + * The id of the payment. + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The peers to use when creating this reply path. + */ + struct LDKCVec_MessageForwardNodeZ peers; +} LDKHeldHtlcReplyPath_LDKToUs_Body; + +typedef struct LDKHeldHtlcReplyPath_LDKToCounterparty_Body { + /** + * The blinded path provided to us by our counterparty. + */ + struct LDKBlindedMessagePath path; +} LDKHeldHtlcReplyPath_LDKToCounterparty_Body; + +typedef struct MUST_USE_STRUCT LDKHeldHtlcReplyPath { + LDKHeldHtlcReplyPath_Tag tag; + union { + LDKHeldHtlcReplyPath_LDKToUs_Body to_us; + LDKHeldHtlcReplyPath_LDKToCounterparty_Body to_counterparty; + }; +} LDKHeldHtlcReplyPath; + +/** + * Represents a tweaked X-only public key as required for BIP 340 (Taproot). + */ +typedef struct LDKTweakedPublicKey { + /** + * The bytes of the public key X coordinate + */ + uint8_t x_coordinate[32]; +} LDKTweakedPublicKey; + +/** + * A function for signing an [`UnsignedBolt12Invoice`]. + */ +typedef struct LDKSignBolt12InvoiceFn { + /** + * 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; + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR message); + /** + * 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); +} LDKSignBolt12InvoiceFn; + + + +/** + * 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 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. + */ + 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; +} LDKTaggedHash; + + + +/** + * Features used within an `invoice_request`. + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { + /** + * 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. + */ + LDKnativeInvoiceRequestFeatures *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; +} LDKInvoiceRequestFeatures; + + + +/** + * 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 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. + */ + 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; +} LDKErroneousField; + + + +/** + * 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 function for signing an [`UnsignedInvoiceRequest`]. + */ +typedef struct LDKSignInvoiceRequestFn { + /** + * 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; + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message); + /** + * 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); +} LDKSignInvoiceRequestFn; + + + +/** + * A semantically valid [`StaticInvoice`] that hasn't been signed. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedStaticInvoice { + /** + * 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. + */ + LDKnativeUnsignedStaticInvoice *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; +} LDKUnsignedStaticInvoice; + +/** + * A function for signing an [`UnsignedStaticInvoice`]. + */ +typedef struct LDKSignStaticInvoiceFn { + /** + * 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; + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKUnsignedStaticInvoice *NONNULL_PTR message); + /** + * 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); +} LDKSignStaticInvoiceFn; + + + +/** + * A stateful resolver which maps BIP 353 Human Readable Names to URIs and BOLT12 [`Offer`]s. + * + * It does not directly implement [`DNSResolverMessageHandler`] but implements all the core logic + * which is required in a client which intends to. + * + * It relies on being made aware of the passage of time with regular calls to + * [`Self::new_best_block`] in order to time out existing queries. Queries time out after two + * blocks. + */ +typedef struct MUST_USE_STRUCT LDKOMNameResolver { + /** + * 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. + */ + LDKnativeOMNameResolver *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; +} LDKOMNameResolver; + + + +/** + * A sender, receiver and forwarder of [`OnionMessage`]s. + * + * # Handling Messages + * + * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding + * messages to peers or delegating to the appropriate handler for the message type. Currently, the + * available handlers are: + * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s + * * [`CustomOnionMessageHandler`], for handling user-defined message types + * + * # Sending Messages + * + * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling + * a message, the matched handler may return a response message which `OnionMessenger` will send + * on its behalf. + * + * # Example + * + * ``` + * # extern crate bitcoin; + * # use bitcoin::hashes::_export::_core::time::Duration; + * # use bitcoin::hex::FromHex; + * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey, self}; + * # use lightning::blinded_path::EmptyNodeIdLookUp; + * # use lightning::blinded_path::message::{BlindedMessagePath, MessageForwardNode, MessageContext}; + * # use lightning::sign::{EntropySource, KeysManager}; + * # use lightning::ln::peer_handler::IgnoringMessageHandler; + * # use lightning::onion_message::messenger::{Destination, MessageRouter, MessageSendInstructions, OnionMessagePath, OnionMessenger}; + * # use lightning::onion_message::packet::OnionMessageContents; + * # use lightning::sign::{NodeSigner, ReceiveAuthKey}; + * # use lightning::util::logger::{Logger, Record}; + * # use lightning::util::ser::{Writeable, Writer}; + * # use lightning::io; + * # use std::sync::Arc; + * # struct FakeLogger; + * # impl Logger for FakeLogger { + * # fn log(&self, record: Record) { println!(\"{:?}\" , record); } + * # } + * # struct FakeMessageRouter {} + * # impl MessageRouter for FakeMessageRouter { + * # fn find_path(&self, sender: PublicKey, peers: Vec, destination: Destination) -> Result { + * # let secp_ctx = Secp256k1::new(); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let hop_node_id2 = hop_node_id1; + * # Ok(OnionMessagePath { + * # intermediate_nodes: vec![hop_node_id1, hop_node_id2], + * # destination, + * # first_node_addresses: Vec::new(), + * # }) + * # } + * # fn create_blinded_paths( + * # &self, _recipient: PublicKey, _local_node_receive_key: ReceiveAuthKey, + * # _context: MessageContext, _peers: Vec, _secp_ctx: &Secp256k1 + * # ) -> Result, ()> { + * # unreachable!() + * # } + * # } + * # let seed = [42u8; 32]; + * # let time = Duration::from_secs(123456); + * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos(), true); + * # let logger = Arc::new(FakeLogger {}); + * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let secp_ctx = Secp256k1::new(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let (hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1); + * # let destination_node_id = hop_node_id1; + * # let node_id_lookup = EmptyNodeIdLookUp {}; + * # let message_router = Arc::new(FakeMessageRouter {}); + * # let custom_message_handler = IgnoringMessageHandler {}; + * # let offers_message_handler = IgnoringMessageHandler {}; + * # let async_payments_message_handler = IgnoringMessageHandler {}; + * # let dns_resolution_message_handler = IgnoringMessageHandler {}; + * // Create the onion messenger. This must use the same `keys_manager` as is passed to your + * // ChannelManager. + * let onion_messenger = OnionMessenger::new( + * &keys_manager, &keys_manager, logger, &node_id_lookup, message_router, + * &offers_message_handler, &async_payments_message_handler, &dns_resolution_message_handler, + * &custom_message_handler, + * ); + * + * # #[derive(Clone, Debug)] + * # struct YourCustomMessage {} + * impl Writeable for YourCustomMessage { + * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { + * \t\t# Ok(()) + * \t\t// Write your custom onion message to `w` + * \t} + * } + * impl OnionMessageContents for YourCustomMessage { + * \tfn tlv_type(&self) -> u64 { + * \t\t# let your_custom_message_type = 42; + * \t\tyour_custom_message_type + * \t} + * \tfn msg_type(&self) -> &'static str { \"YourCustomMessageType\" } + * } + * // Send a custom onion message to a node id. + * let destination = Destination::Node(destination_node_id); + * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, instructions); + * + * // Create a blinded path to yourself, for someone to send an onion message to. + * # let your_node_id = hop_node_id1; + * let hops = [ + * \tMessageForwardNode { node_id: hop_node_id3, short_channel_id: None }, + * \tMessageForwardNode { node_id: hop_node_id4, short_channel_id: None }, + * ]; + * let context = MessageContext::Custom(Vec::new()); + * let receive_key = keys_manager.get_receive_auth_key(); + * let blinded_path = BlindedMessagePath::new(&hops, your_node_id, receive_key, context, &keys_manager, &secp_ctx); + * + * // Send a custom onion message to a blinded path. + * let destination = Destination::BlindedPath(blinded_path); + * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; + * # let message = YourCustomMessage {}; + * onion_messenger.send_onion_message(message, instructions); + * ``` + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +typedef struct MUST_USE_STRUCT LDKOnionMessenger { + /** + * 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. + */ + LDKnativeOnionMessenger *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; +} LDKOnionMessenger; + + + +/** + * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. + * + * [`DefaultMessageRouter`] constructs compact [`BlindedMessagePath`]s on a best-effort basis. + * That is, if appropriate SCID information is available for the intermediate peers, it will + * default to creating compact paths. + * + * # Compact Blinded Paths + * + * Compact blinded paths use short channel IDs (SCIDs) instead of pubkeys, resulting in smaller + * serialization. This is particularly useful when encoding data into space-constrained formats + * such as QR codes. The SCID is communicated via a [`MessageForwardNode`], but may be `None` + * to allow for graceful degradation. + * + * **Note:** + * If any SCID in the blinded path becomes invalid, the entire compact blinded path may fail to route. + * For the immediate hop, this can happen if the corresponding channel is closed. + * For other intermediate hops, it can happen if the channel is closed or modified (e.g., due to splicing). + * + * # Privacy + * + * Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, + * it will create a one-hop path using the recipient as the introduction node if it is an announced + * node. Otherwise, there is no way to find a path to the introduction node in order to send a + * message, and thus an `Err` is returned. + */ +typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { + /** + * 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. + */ + LDKnativeDefaultMessageRouter *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; +} LDKDefaultMessageRouter; + + + +/** + * This message router is similar to [`DefaultMessageRouter`], but it always creates + * full-length blinded paths, using the peer's [`NodeId`]. + * + * This message router can only route to a directly connected [`Destination`]. + * + * # Privacy + * + * Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, + * it will create a one-hop path using the recipient as the introduction node if it is an announced + * node. Otherwise, there is no way to find a path to the introduction node in order to send a + * message, and thus an `Err` is returned. + */ +typedef struct MUST_USE_STRUCT LDKNodeIdMessageRouter { + /** + * 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. + */ + LDKnativeNodeIdMessageRouter *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; +} LDKNodeIdMessageRouter; + + + +/** + * A special [`MessageRouter`] that performs no routing and does not create blinded paths. + * Its purpose is to enable the creation of [`Offer`]s and [`Refund`]s without blinded paths, + * where the user's `node_id` is used directly as the [`Destination`]. + * + * # Note + * [`NullMessageRouter`] **must not** be used as the type parameter for [`ChannelManager`], + * since [`ChannelManager`] requires a functioning [`MessageRouter`] to create blinded paths, + * which are necessary for constructing reply paths in onion message communication. + * However, [`NullMessageRouter`] *can* still be passed as an argument to [`ChannelManager`] + * methods that accepts a [`MessageRouter`], such as [`ChannelManager::create_offer_builder_using_router`], + * when blinded paths are not needed. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_offer_builder_using_router`]: crate::ln::channelmanager::ChannelManager::create_offer_builder_using_router + */ +typedef struct MUST_USE_STRUCT LDKNullMessageRouter { + /** + * 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. + */ + LDKnativeNullMessageRouter *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; +} LDKNullMessageRouter; + +/** + * The contents of an [`OnionMessage`] as read from the wire. + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef enum LDKParsedOnionMessageContents_Tag { + /** + * A message related to BOLT 12 Offers. + */ + LDKParsedOnionMessageContents_Offers, + /** + * A message related to async payments. + */ + LDKParsedOnionMessageContents_AsyncPayments, + /** + * A message requesting or providing a DNSSEC proof + */ + LDKParsedOnionMessageContents_DNSResolver, + /** + * A custom onion message specified by the user. + */ + LDKParsedOnionMessageContents_Custom, + /** + * Must be last for serialization purposes + */ + LDKParsedOnionMessageContents_Sentinel, +} LDKParsedOnionMessageContents_Tag; + +typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents { + LDKParsedOnionMessageContents_Tag tag; + union { + struct { + struct LDKOffersMessage offers; + }; + struct { + struct LDKAsyncPaymentsMessage async_payments; + }; + struct { + struct LDKDNSResolverMessage dns_resolver; + }; + struct { + struct LDKOnionMessageContents custom; + }; + }; +} LDKParsedOnionMessageContents; + + + +/** + * Receives and validates network updates from peers, + * stores authentic and relevant data as a network graph. + * This network graph is then used for routing payments. + * Provides interface to help with initial routing sync by + * serving historical announcements. + */ +typedef struct MUST_USE_STRUCT LDKP2PGossipSync { + /** + * 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. + */ + LDKnativeP2PGossipSync *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; +} LDKP2PGossipSync; + + + +/** + * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a + * source node to a target node. + */ +typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo { + /** + * 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. + */ + LDKnativeDirectedChannelInfo *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; +} LDKDirectedChannelInfo; + +/** + * The effective capacity of a channel for routing purposes. + * + * While this may be smaller than the actual channel capacity, amounts greater than + * [`Self::as_msat`] should not be routed through the channel. + */ +typedef enum LDKEffectiveCapacity_Tag { + /** + * The available liquidity in the channel known from being a channel counterparty, and thus a + * direct hop. + */ + LDKEffectiveCapacity_ExactLiquidity, + /** + * The maximum HTLC amount in one direction as advertised on the gossip network. + */ + LDKEffectiveCapacity_AdvertisedMaxHTLC, + /** + * The total capacity of the channel as determined by the funding transaction. + */ + LDKEffectiveCapacity_Total, + /** + * A capacity sufficient to route any payment, typically used for private channels provided by + * an invoice. + */ + LDKEffectiveCapacity_Infinite, + /** + * The maximum HTLC amount as provided by an invoice route hint. + */ + LDKEffectiveCapacity_HintMaxHTLC, + /** + * A capacity that is unknown possibly because either the chain state is unavailable to know + * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. + */ + LDKEffectiveCapacity_Unknown, + /** + * Must be last for serialization purposes + */ + LDKEffectiveCapacity_Sentinel, +} LDKEffectiveCapacity_Tag; + +typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body { + /** + * Either the inbound or outbound liquidity depending on the direction, denominated in + * millisatoshi. + */ + uint64_t liquidity_msat; +} LDKEffectiveCapacity_LDKExactLiquidity_Body; + +typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t amount_msat; +} LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body; + +typedef struct LDKEffectiveCapacity_LDKTotal_Body { + /** + * The funding amount denominated in millisatoshi. + */ + uint64_t capacity_msat; + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t htlc_maximum_msat; +} LDKEffectiveCapacity_LDKTotal_Body; + +typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body { + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + uint64_t amount_msat; +} LDKEffectiveCapacity_LDKHintMaxHTLC_Body; + +typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { + LDKEffectiveCapacity_Tag tag; + union { + LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity; + LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc; + LDKEffectiveCapacity_LDKTotal_Body total; + LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc; + }; +} LDKEffectiveCapacity; + + + +/** + * A [`Router`] implemented using [`find_route`]. + * + * # Privacy + * + * Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found, + * it will create a one-hop path using the recipient as the introduction node if it is an announced + * node. Otherwise, there is no way to find a path to the introduction node in order to send a + * payment, and thus an `Err` is returned. + */ +typedef struct MUST_USE_STRUCT LDKDefaultRouter { + /** + * 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. + */ + LDKnativeDefaultRouter *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; +} LDKDefaultRouter; + + + +/** + * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. + * + * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling + * [`find_route`]. + * + * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp + */ +typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { + /** + * 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. + */ + LDKnativeScorerAccountingForInFlightHtlcs *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; +} LDKScorerAccountingForInFlightHtlcs; + +/** + * The recipient of a payment, differing based on whether they've hidden their identity with route + * blinding. + */ +typedef enum LDKPayee_Tag { + /** + * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves + * will be included in the final [`Route`]. + */ + LDKPayee_Blinded, + /** + * The recipient included these route hints in their BOLT11 invoice. + */ + LDKPayee_Clear, + /** + * Must be last for serialization purposes + */ + LDKPayee_Sentinel, +} LDKPayee_Tag; + +typedef struct LDKPayee_LDKBlinded_Body { + /** + * Aggregated routing info and blinded paths, for routing to the payee without knowing their + * node id. + */ + struct LDKCVec_BlindedPaymentPathZ route_hints; + /** + * Features supported by the payee. + * + * May be set from the payee's invoice. May be `None` if the invoice does not contain any + * features. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBolt12InvoiceFeatures features; +} LDKPayee_LDKBlinded_Body; + +typedef struct LDKPayee_LDKClear_Body { + /** + * The node id of the payee. + */ + struct LDKPublicKey node_id; + /** + * Hints for routing to the payee, containing channels connecting the payee to public nodes. + */ + struct LDKCVec_RouteHintZ route_hints; + /** + * Features supported by the payee. + * + * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice + * does not contain any features. + * + * [`for_keysend`]: PaymentParameters::for_keysend + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKBolt11InvoiceFeatures features; + /** + * The minimum CLTV delta at the end of the route. This value must not be zero. + */ + uint32_t final_cltv_expiry_delta; +} LDKPayee_LDKClear_Body; + +typedef struct MUST_USE_STRUCT LDKPayee { + LDKPayee_Tag tag; + union { + LDKPayee_LDKBlinded_Body blinded; + LDKPayee_LDKClear_Body clear; + }; +} 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; + + + +/** + * A concrete implementation of [`LockableScore`] which supports multi-threading. + */ +typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { + /** + * 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. + */ + LDKnativeMultiThreadedLockableScore *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; +} LDKMultiThreadedLockableScore; + + + +/** + * A locked `MultiThreadedLockableScore`. + */ +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. + */ + 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; +} LDKMultiThreadedScoreLockWrite; + + + +/** + * Parameters for configuring [`ProbabilisticScorer`]. + * + * Used to configure decay parameters that are static throughout the lifetime of the scorer. + * these decay parameters affect the score of the channel penalty and are not changed on a + * per-route penalty cost call. + */ +typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters { + /** + * 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. + */ + LDKnativeProbabilisticScoringDecayParameters *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; +} LDKProbabilisticScoringDecayParameters; + + + +/** + * A probabilistic scorer that combines local and external information to score channels. This scorer is + * shadow-tracking local only scores, so that it becomes possible to cleanly merge external scores when they become + * available. + * + * This is useful for nodes that have a limited local view of the network and need to augment their view with scores + * from an external source to improve payment reliability. The external source may use something like background + * probing to gather a more complete view of the network. Merging reduces the likelihood of losing unique local data on + * particular channels. + * + * Note that only the locally acquired data is persisted. After a restart, the external scores will be lost and must be + * resupplied. + */ +typedef struct MUST_USE_STRUCT LDKCombinedScorer { + /** + * 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. + */ + LDKnativeCombinedScorer *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; +} LDKCombinedScorer; + + + +/** + * A wrapper around [`ChangeDestinationSource`] to allow for async calls. + * + * You should likely never use this directly but rather allow LDK to build this when required to + * build higher-level sync wrappers. + */ +typedef struct MUST_USE_STRUCT LDKChangeDestinationSourceSyncWrapper { + /** + * 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. + */ + LDKnativeChangeDestinationSourceSyncWrapper *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; +} LDKChangeDestinationSourceSyncWrapper; + + + +/** + * A simple implementation of [`EcdsaChannelSigner`] that just keeps the private keys in memory. + * + * This implementation performs no policy checks and is insufficient by itself as + * a secure external signer. + */ +typedef struct MUST_USE_STRUCT LDKInMemorySigner { + /** + * 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. + */ + LDKnativeInMemorySigner *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; +} LDKInMemorySigner; + + + +/** + * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a + * 32-byte seed for use as a BIP 32 extended key and derives keys from that. + * + * Your `node_id` is seed/0'. + * Unilateral closes may use seed/1'. + * Cooperative closes may use seed/2'. + * The two close keys may be needed to claim on-chain funds! + * + * This struct cannot be used for nodes that wish to support receiving phantom payments; + * [`PhantomKeysManager`] must be used instead. + * + * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any + * previously issued invoices and attempts to pay previous invoices will fail. + */ +typedef struct MUST_USE_STRUCT LDKKeysManager { + /** + * 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. + */ + LDKnativeKeysManager *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; +} LDKKeysManager; + + + +/** + * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node + * payments. + * + * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be + * paid to one of multiple nodes. This works because we encode the invoice route hints such that + * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment + * itself without ever needing to forward to this fake node. + * + * Phantom node payments are useful for load balancing between multiple LDK nodes. They also + * provide some fault tolerance, because payers will automatically retry paying other provided + * nodes in the case that one node goes down. + * + * Note that multi-path payments are not supported in phantom invoices for security reasons. + * Switching between this struct and [`KeysManager`] will invalidate any previously issued + * invoices and attempts to pay previous invoices will fail. + */ +typedef struct MUST_USE_STRUCT LDKPhantomKeysManager { + /** + * 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. + */ + LDKnativePhantomKeysManager *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; +} LDKPhantomKeysManager; + + + +/** + * An implementation of [`EntropySource`] using ChaCha20. + */ +typedef struct MUST_USE_STRUCT LDKRandomBytes { + /** + * 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. + */ + LDKnativeRandomBytes *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; +} LDKRandomBytes; + + + +/** + * A [`KVStore`] and [`KVStoreSync`] implementation that writes to and reads from the file system. + * + * [`KVStore`]: lightning::util::persist::KVStore + */ +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. + */ + 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; +} LDKFilesystemStore; + + + +/** + * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep + * Rust-Lightning running properly, and (2) either can or should be run in the background. Its + * responsibilities are: + * * Processing [`Event`]s with a user-provided [`EventHandler`]. + * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, + * writing it to disk/backups by invoking the callback given to it at startup. + * [`ChannelManager`] persistence should be done in the background. + * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`] + * and [`PeerManager::timer_tick_occurred`] at the appropriate intervals. + * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a + * [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]). + * + * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied + * upon as doing so may result in high latency. + * + * # Note + * + * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then + * there is a risk of channels force-closing on startup when the manager realizes it's outdated. + * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for + * unilateral chain closure fees are at risk. + * + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * [`ChannelManager::timer_tick_occurred`]: lightning::ln::channelmanager::ChannelManager::timer_tick_occurred + * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor + * [`Event`]: lightning::events::Event + * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred + * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events + *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. + */ +typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { + /** + * 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. + */ + LDKnativeBackgroundProcessor *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; +} LDKBackgroundProcessor; + + + +/** + * The main Rapid Gossip Sync object. + * + * See [crate-level documentation] for usage. + * + * [crate-level documentation]: crate + */ +typedef struct MUST_USE_STRUCT LDKRapidGossipSync { + /** + * 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. + */ + LDKnativeRapidGossipSync *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; +} LDKRapidGossipSync; + +/** + * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + */ +typedef enum LDKGossipSync_Tag { + /** + * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. + */ + LDKGossipSync_P2P, + /** + * Rapid gossip sync from a trusted server. + */ + LDKGossipSync_Rapid, + /** + * No gossip sync. + */ + LDKGossipSync_None, + /** + * Must be last for serialization purposes + */ + LDKGossipSync_Sentinel, +} LDKGossipSync_Tag; + +typedef struct MUST_USE_STRUCT LDKGossipSync { + LDKGossipSync_Tag tag; + union { + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKP2PGossipSync p2p; + }; + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKRapidGossipSync rapid; + }; + }; +} LDKGossipSync; + + + +/** + * Data of the [`RawBolt11Invoice`] that is encoded in the data part + */ +typedef struct MUST_USE_STRUCT LDKRawDataPart { + /** + * 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. + */ + LDKnativeRawDataPart *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; +} LDKRawDataPart; + + + +/** + * Positive duration that defines when (relatively to the timestamp) in the future the invoice + * expires + */ +typedef struct MUST_USE_STRUCT LDKExpiryTime { + /** + * 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. + */ + LDKnativeExpiryTime *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; +} LDKExpiryTime; + + + +/** + * `min_final_cltv_expiry_delta` to use for the last HTLC in the route + */ +typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta { + /** + * 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. + */ + LDKnativeMinFinalCltvExpiryDelta *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; +} LDKMinFinalCltvExpiryDelta; + +/** + * A 20-byte byte array. + */ +typedef struct LDKTwentyBytes { + /** + * The twenty bytes + */ + uint8_t data[20]; +} LDKTwentyBytes; + +/** + * Fallback address in case no LN payment is possible + */ +typedef enum LDKFallback_Tag { + LDKFallback_SegWitProgram, + LDKFallback_PubKeyHash, + LDKFallback_ScriptHash, + /** + * Must be last for serialization purposes + */ + LDKFallback_Sentinel, +} LDKFallback_Tag; + +typedef struct LDKFallback_LDKSegWitProgram_Body { + struct LDKWitnessVersion version; + struct LDKCVec_u8Z program; +} LDKFallback_LDKSegWitProgram_Body; + +typedef struct MUST_USE_STRUCT LDKFallback { + LDKFallback_Tag tag; + union { + LDKFallback_LDKSegWitProgram_Body seg_wit_program; + struct { + struct LDKTwentyBytes pub_key_hash; + }; + struct { + struct LDKTwentyBytes script_hash; + }; + }; +} LDKFallback; + +/** + * Sub-errors which don't have specific information in them use this type. + */ +typedef struct LDKError { + /** + * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here + */ + uint8_t _dummy; +} LDKError; + +extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; + +extern const uint64_t MAX_SCID_BLOCK; + +extern const uint64_t MAX_SCID_TX_INDEX; + +extern const uint64_t MAX_SCID_VOUT_INDEX; + +extern const uintptr_t MAX_BUF_SIZE; + +extern const uint32_t PRUNE_DELAY_BLOCKS; + +extern const uintptr_t MAX_DUMMY_HOPS_COUNT; + +extern const uint64_t INCREMENTAL_RELAY_FEE_SAT_PER_1000_WEIGHT; + +extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; + +extern const uint32_t ANTI_REORG_DELAY; + +extern const uint32_t ARCHIVAL_DELAY_BLOCKS; + +extern const uint32_t HTLC_FAIL_BACK_BUFFER; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS; + +extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; + +extern const uint64_t ANCHOR_INPUT_WITNESS_WEIGHT; + +extern const uint64_t EMPTY_WITNESS_WEIGHT; + +extern const uint64_t P2A_MAX_VALUE; + +extern const uint64_t TRUC_MAX_WEIGHT; + +extern const uint64_t TRUC_CHILD_MAX_WEIGHT; + +extern const uint64_t HTLC_TIMEOUT_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT; + +extern const uint64_t HTLC_TIMEOUT_INPUT_P2A_ANCHOR_WITNESS_WEIGHT; + +extern const uint64_t HTLC_SUCCESS_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT; + +extern const uint64_t HTLC_SUCCESS_INPUT_P2A_ANCHOR_WITNESS_WEIGHT; + +extern const uint64_t FUNDING_TRANSACTION_WITNESS_WEIGHT; + +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + +extern const uint16_t BREAKDOWN_TIMEOUT; + +extern const uint16_t MIN_CLTV_EXPIRY_DELTA; + +extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uintptr_t MAX_STATIC_INVOICE_SIZE_BYTES; + +extern const uintptr_t PAYER_NOTE_LIMIT; + +extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; + +extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t DEFAULT_MAX_PATH_COUNT; + +extern const uint8_t MAX_PATH_LENGTH_ESTIMATE; + +extern const uint16_t STATIC_PAYMENT_KEY_COUNT; + +extern const uint64_t MAX_TIMESTAMP; + +extern const uint64_t DEFAULT_EXPIRY_TIME; + +extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uintptr_t MAX_LENGTH; + +extern const uint8_t TAG_PAYMENT_HASH; + +extern const uint8_t TAG_DESCRIPTION; + +extern const uint8_t TAG_PAYEE_PUB_KEY; + +extern const uint8_t TAG_DESCRIPTION_HASH; + +extern const uint8_t TAG_EXPIRY_TIME; + +extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t TAG_FALLBACK; + +extern const uint8_t TAG_PRIVATE_ROUTE; + +extern const uint8_t TAG_PAYMENT_SECRET; + +extern const uint8_t TAG_PAYMENT_METADATA; + +extern const uint8_t TAG_FEATURES; + +struct LDKStr _ldk_get_compiled_version(void); + +struct LDKStr _ldk_c_bindings_get_compiled_version(void); + +/** + * Gets the 128-bit integer, as 16 little-endian bytes + */ +struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); + +/** + * Constructs a new U128 from 16 little-endian bytes + */ +struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); + +/** + * Constructs a new WitnessProgram given a version and program bytes. + * + * The program MUST be at least 2 bytes and no longer than 40 bytes long. + * Further, if the version is 0, the program MUST be either exactly 20 or exactly 32 bytes long. + */ +struct LDKWitnessProgram WitnessProgram_new(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); + +/** + * Gets the `WitnessVersion` of the given `WitnessProgram` + */ +struct LDKWitnessVersion WitnessProgram_get_version(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Gets the witness program bytes of the given `WitnessProgram` + */ +struct LDKu8slice WitnessProgram_get_program(const struct LDKWitnessProgram *NONNULL_PTR prog); + +/** + * Creates a new WitnessProgram which has the same data as `orig` + */ +struct LDKWitnessProgram WitnessProgram_clone(const struct LDKWitnessProgram *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `WitnessProgram` (which is currently none) + */ +void WitnessProgram_free(struct LDKWitnessProgram o); + +/** + * Gets the string representation of the address in `addr` + */ +struct LDKStr Address_to_string(const struct LDKAddress *NONNULL_PTR addr); + +/** + * Constructs a new `Address` (option) from the given string representation. + * + * Returns `None` only if the address is invalid. + */ +struct LDKCOption_AddressZ Address_new(struct LDKStr s); + +/** + * Releases any memory held by the given `Address` + */ +void Address_free(struct LDKAddress o); + +/** + * Creates a new Address which has the same data as `orig` + */ +struct LDKAddress Address_clone(const struct LDKAddress *NONNULL_PTR orig); + +/** + * Convenience function for constructing a new BigEndianScalar + */ +struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); + +/** + * Creates a new BigEndianScalar which has the same data as `orig` + */ +struct LDKBigEndianScalar BigEndianScalar_clone(const struct LDKBigEndianScalar *NONNULL_PTR orig); + +/** + * Creates a new Bech32Error which has the same data as `orig` + */ +struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `Bech32Error` (which is currently none) + */ +void Bech32Error_free(struct LDKBech32Error o); + +/** + * Frees the data buffer, if data_is_owned is set and datalen > 0. + */ +void Transaction_free(struct LDKTransaction _res); + +/** + * Creates a new Witness which has the same data as `orig` but with a new buffer. + */ +struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig); + +/** + * Frees the data pointed to by data + */ +void Witness_free(struct LDKWitness _res); + +/** + * Convenience function for constructing a new TxIn + */ +struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); + +/** + * Gets the `witness` in the given `TxIn`. + */ +struct LDKWitness TxIn_get_witness(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the `script_sig` in the given `TxIn`. + */ +struct LDKu8slice TxIn_get_script_sig(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the `sequence` in the given `TxIn`. + */ +uint32_t TxIn_get_sequence(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the previous outpoint txid in the given `TxIn`. + */ +struct LDKThirtyTwoBytes TxIn_get_previous_txid(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Gets the previout outpoint index in the given `TxIn`. + */ +uint32_t TxIn_get_previous_vout(const struct LDKTxIn *NONNULL_PTR txin); + +/** + * Frees the witness and script_sig in a TxIn + */ +void TxIn_free(struct LDKTxIn _res); + +/** + * Convenience function for constructing a new TxOut + */ +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); + +/** + * Gets the `script_pubkey` in the given `TxOut`. + */ +struct LDKu8slice TxOut_get_script_pubkey(const struct LDKTxOut *NONNULL_PTR txout); + +/** + * Gets the value in the given `TxOut`. + */ +uint64_t TxOut_get_value(const struct LDKTxOut *NONNULL_PTR txout); + +/** + * Frees the data pointed to by script_pubkey. + */ +void TxOut_free(struct LDKTxOut _res); + +/** + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + */ +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +/** + * Frees the data buffer, if chars_is_owned is set and len > 0. + */ +void Str_free(struct LDKStr _res); + +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_u8Z_free(struct LDKCVec_u8Z _res); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKRefundMaybeWithDerivedMetadataBuilder o); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ. + */ +void CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundBolt12SemanticErrorZ. + */ +void CResult_RefundBolt12SemanticErrorZ_free(struct LDKCResult_RefundBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_RefundBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_u64Z containing a u64 + */ +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); + +/** + * Constructs a new COption_u64Z containing nothing + */ +struct LDKCOption_u64Z COption_u64Z_none(void); + +/** + * Frees any resources associated with the u64, if we are in the Some state + */ +void COption_u64Z_free(struct LDKCOption_u64Z _res); + +/** + * Creates a new COption_u64Z 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); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedMessagePathZ_free(struct LDKCVec_BlindedMessagePathZ _res); + +/** + * Creates a new CResult_RefundDecodeErrorZ in the success state. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundDecodeErrorZ in the error state. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundDecodeErrorZ_is_ok(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RefundDecodeErrorZ. + */ +void CResult_RefundDecodeErrorZ_free(struct LDKCResult_RefundDecodeErrorZ _res); + +/** + * Creates a new CResult_RefundDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_clone(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. + */ +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); + +/** + * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. + */ +struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RefundBolt12ParseErrorZ_is_ok(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR o); + +/** + * 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 LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_clone(const struct LDKCResult_RefundBolt12ParseErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RetryDecodeErrorZ in the success state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); + +/** + * Creates a new CResult_RetryDecodeErrorZ in the error state. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RetryDecodeErrorZ. + */ +void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); + +/** + * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes + */ +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); + +/** + * Constructs a new COption_ThirtyTwoBytesZ containing nothing + */ +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_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); + +/** + * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o); + +/** + * Constructs a new COption_CVec_u8ZZ containing nothing + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + */ +void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res); + +/** + * Creates a new COption_CVec_u8ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state. + */ +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state. + */ +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ. + */ +void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res); + +/** + * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +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); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_clone(const struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_DNSResolverMessageResponseInstructionZ from the contained elements. + */ +struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_new(struct LDKDNSResolverMessage a, struct LDKResponseInstruction b); + +/** + * Frees any resources used by the C2Tuple_DNSResolverMessageResponseInstructionZ. + */ +void C2Tuple_DNSResolverMessageResponseInstructionZ_free(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ _res); + +/** + * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_some(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ *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_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_DNSResolverMessageMessageSendInstructionsZ from the contained elements. + */ +struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_new(struct LDKDNSResolverMessage a, struct LDKMessageSendInstructions b); + +/** + * Frees any resources used by the C2Tuple_DNSResolverMessageMessageSendInstructionsZ. + */ +void C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ _res); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_ok(struct LDKDNSResolverMessage o); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DNSResolverMessageDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DNSResolverMessageDecodeErrorZ. + */ +void CResult_DNSResolverMessageDecodeErrorZ_free(struct LDKCResult_DNSResolverMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_clone(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HumanReadableNameNoneZ in the success state. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_ok(struct LDKHumanReadableName o); + +/** + * Creates a new CResult_HumanReadableNameNoneZ in the error state. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HumanReadableNameNoneZ_is_ok(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HumanReadableNameNoneZ. + */ +void CResult_HumanReadableNameNoneZ_free(struct LDKCResult_HumanReadableNameNoneZ _res); + +/** + * Creates a new CResult_HumanReadableNameNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_clone(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ in the success state. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_ok(struct LDKHumanReadableName o); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ in the error state. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HumanReadableNameDecodeErrorZ_is_ok(const struct LDKCResult_HumanReadableNameDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HumanReadableNameDecodeErrorZ. + */ +void CResult_HumanReadableNameDecodeErrorZ_free(struct LDKCResult_HumanReadableNameDecodeErrorZ _res); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_clone(const struct LDKCResult_HumanReadableNameDecodeErrorZ *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_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_clone(const struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ *NONNULL_PTR orig); /** - * A handler for received [`OnionMessage`]s and for providing generated ones to send. + * Creates a new C2Tuple_DNSSECQueryDNSResolverContextZ from the contained elements. */ -typedef struct LDKOnionMessageHandler { - /** - * 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; - /** - * Handle an incoming `onion_message` message from the given peer. - */ - void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); - /** - * Returns the next pending onion message for the peer with the given node id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_id); - /** - * Called when a connection is established with a peer. Can be used to track which peers - * advertise onion message support and are online. - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - * - * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); - /** - * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to - * drop and refuse to forward onion messages to this peer. - */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Performs actions that should happen roughly every ten seconds after startup. Allows handlers - * to drop any buffered onion messages intended for prospective peers. - */ - void (*timer_tick_occurred)(const void *this_arg); - /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. - */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. - */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_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); -} LDKOnionMessageHandler; +struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_new(struct LDKDNSSECQuery a, struct LDKDNSResolverContext b); +/** + * Frees any resources used by the C2Tuple_DNSSECQueryDNSResolverContextZ. + */ +void C2Tuple_DNSSECQueryDNSResolverContextZ_free(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ _res); +/** + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_ok(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ o); /** - * BOLT 4 onion packet including hop data for the next peer. + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKTrampolineOnionPacket { - /** - * 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. - */ - LDKnativeTrampolineOnionPacket *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; -} LDKTrampolineOnionPacket; +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_err(void); /** - * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) - * decoders. + * Checks if the given object is currently in the success state */ -typedef struct LDKCustomMessageReader { - /** - * 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; - /** - * Decodes a custom message to `CustomMessageType`. If the given message type is known to the - * implementation and the message could be decoded, must return `Ok(Some(message))`. If the - * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error - * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. - */ - struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer); - /** - * 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); -} LDKCustomMessageReader; +bool CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_is_ok(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *NONNULL_PTR o); /** - * A handler provided to [`PeerManager`] for reading and handling custom messages. - * - * [BOLT 1] specifies a custom message type range for use with experimental or application-specific - * messages. `CustomMessageHandler` allows for user-defined handling of such types. See the - * [`lightning_custom_message`] crate for tools useful in composing more than one custom handler. - * - * [BOLT 1]: https://github.com/lightning/bolts/blob/master/01-messaging.md - * [`lightning_custom_message`]: https://docs.rs/lightning_custom_message/latest/lightning_custom_message + * Frees any resources used by the CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ. */ -typedef struct LDKCustomMessageHandler { - /** - * 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; - /** - * Handles the given message sent from `sender_node_id`, possibly producing messages for - * [`CustomMessageHandler::get_and_clear_pending_msg`] to return and thus for [`PeerManager`] - * to send. - */ - struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id); - /** - * Returns the list of pending messages that were generated by the handler, clearing the list - * in the process. Each message is paired with the node id of the intended recipient. If no - * connection to the node exists, then the message is simply not sent. - */ - struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg); - /** - * Indicates a peer disconnected. - */ - void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Handle a peer connecting. - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - * - * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - */ - struct LDKCResult_NoneNoneZ (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); - /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. - * - * [`NodeAnnouncement`]: crate::ln::msgs::NodeAnnouncement - */ - struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * [`Init`]: crate::ln::msgs::Init - */ - struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); - /** - * Implementation of CustomMessageReader for this object. - */ - struct LDKCustomMessageReader CustomMessageReader; - /** - * 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); -} LDKCustomMessageHandler; +void CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ _res); +/** + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_clone(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *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_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_clone(const struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ *NONNULL_PTR orig); /** - * A dummy struct which implements `RoutingMessageHandler` without storing any routing information - * or doing any processing. You can provide one of these as the route_handler in a MessageHandler. + * Creates a new C2Tuple_HumanReadableNameThirtyTwoBytesZ from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler { - /** - * 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. - */ - LDKnativeIgnoringMessageHandler *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; -} LDKIgnoringMessageHandler; +struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_new(struct LDKHumanReadableName a, struct LDKThirtyTwoBytes b); /** - * Handler for custom onion messages. If you are using [`SimpleArcOnionMessenger`], - * [`SimpleRefOnionMessenger`], or prefer to ignore inbound custom onion messages, - * [`IgnoringMessageHandler`] must be provided to [`OnionMessenger::new`]. Otherwise, a custom - * implementation of this trait must be provided, with [`CustomMessage`] specifying the supported - * message types. - * - * See [`OnionMessenger`] for example usage. - * - * [`IgnoringMessageHandler`]: crate::ln::peer_handler::IgnoringMessageHandler - * [`CustomMessage`]: Self::CustomMessage + * Frees any resources used by the C2Tuple_HumanReadableNameThirtyTwoBytesZ. */ -typedef struct LDKCustomOnionMessageHandler { - /** - * 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; - /** - * Called with the custom message that was received, returning a response to send, if any. - * - * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. - * - * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ (*handle_custom_message)(const void *this_arg, struct LDKOnionMessageContents message, struct LDKCOption_CVec_u8ZZ context, struct LDKResponder responder); - /** - * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the - * message type is unknown. - */ - struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ (*read_custom_message)(const void *this_arg, uint64_t message_type, struct LDKu8slice buffer); - /** - * Releases any [`Self::CustomMessage`]s that need to be sent. - * - * Typically, this is used for messages initiating a message flow rather than in response to - * another message. The latter should use the return value of [`Self::handle_custom_message`]. - */ - struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ (*release_pending_custom_messages)(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); -} LDKCustomOnionMessageHandler; +void C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ _res); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ *NONNULL_PTR orig); /** - * A dummy struct which implements `ChannelMessageHandler` without having any channels. - * You can provide one of these as the route_handler in a MessageHandler. + * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKErroringMessageHandler { - /** - * 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. - */ - LDKnativeErroringMessageHandler *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; -} LDKErroringMessageHandler; +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKOffer b); +/** + * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ. + */ +void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ _res); +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ o); /** - * Provides references to trait impls which handle different types of messages. + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing nothing */ -typedef struct MUST_USE_STRUCT LDKMessageHandler { - /** - * 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. - */ - LDKnativeMessageHandler *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; -} LDKMessageHandler; +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_none(void); /** - * Provides an object which can be used to send data to and which uniquely identifies a connection - * to a remote host. You will need to be able to generate multiple of these which meet Eq and - * implement Hash to meet the PeerManager API. - * - * For efficiency, [`Clone`] should be relatively cheap for this type. - * - * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original - * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it - * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no - * further calls to the [`PeerManager`] related to the original socket occur. This allows you to - * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish - * to simply use another value which is guaranteed to be globally unique instead. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ, if we are in the Some state */ -typedef struct LDKSocketDescriptor { - /** - * 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; - /** - * Attempts to send some data from the given slice to the peer. - * - * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. - * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be - * called and further write attempts may occur until that time. - * - * If the returned size is smaller than `data.len()`, a - * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be - * written. Additionally, until a `send_data` event completes fully, no further - * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to - * prevent denial-of-service issues, you should not read or buffer any data from the socket - * until then. - * - * If a [`PeerManager::read_event`] call on this descriptor had previously returned true - * (indicating that read events should be paused to prevent DoS in the send buffer), - * `resume_read` may be set indicating that read events on this descriptor should resume. A - * `resume_read` of false carries no meaning, and should not cause any action. - */ - uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read); - /** - * Disconnect the socket pointed to by this SocketDescriptor. - * - * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this - * call (doing so is a noop). - */ - void (*disconnect_socket)(void *this_arg); - /** - * Checks if two objects are equal given this object's this_arg pointer and another object. - */ - bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg); - /** - * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. - * This is used, for example, for inclusion of this object in a hash map. - */ - uint64_t (*hash)(const void *this_arg); - /** - * Called, if set, after this SocketDescriptor has been cloned into a duplicate object. - * The new SocketDescriptor 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 LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor); - /** - * 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); -} LDKSocketDescriptor; +void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ _res); +/** + * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ *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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ *NONNULL_PTR orig); /** - * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls - * socket events into messages which it passes on to its [`MessageHandler`]. - * - * Locks are taken internally, so you must never assume that reentrancy from a - * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock. - * - * Calls to [`read_event`] will decode relevant messages and pass them to the - * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of - * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any - * [`PeerManager`] functions related to the same connection must occur only in serial, making new - * calls only after previous ones have returned. - * - * Rather than using a plain [`PeerManager`], it is preferable to use either a [`SimpleArcPeerManager`] - * a [`SimpleRefPeerManager`], for conciseness. See their documentation for more details, but - * essentially you should default to using a [`SimpleRefPeerManager`], and use a - * [`SimpleArcPeerManager`] when you require a `PeerManager` with a static lifetime, such as when - * you're using lightning-net-tokio. - * - * [`read_event`]: PeerManager::read_event + * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKPeerManager { - /** - * 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. - */ - LDKnativePeerManager *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; -} LDKPeerManager; +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKStr b); /** - * Represents a valid secp256k1 secret key serialized as a 32 byte array. + * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ. */ -typedef struct LDKSecretKey { - /** - * The bytes of the secret key - */ - uint8_t bytes[32]; -} LDKSecretKey; +void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ _res); +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ o); +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing nothing + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_none(void); /** - * Static channel fields used to build transactions given per-commitment fields, organized by - * broadcaster/countersignatory. - * - * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the - * as_holder_broadcastable and as_counterparty_broadcastable functions. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ, if we are in the Some state */ -typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { - /** - * 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. - */ - LDKnativeDirectedChannelTransactionParameters *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; -} LDKDirectedChannelTransactionParameters; +void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ _res); +/** + * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ *NONNULL_PTR orig); +/** + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKUnsignedBolt12Invoice o); /** - * Builds an [`Offer`] for the \"offer to be paid\" flow. - * - * See [module-level documentation] for usage. - * - * [module-level documentation]: self + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKOfferWithExplicitMetadataBuilder { - /** - * 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. - */ - LDKnativeOfferWithExplicitMetadataBuilder *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; -} LDKOfferWithExplicitMetadataBuilder; +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ. + */ +void CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res); /** - * A string that displays only printable characters, replacing control characters with - * [`core::char::REPLACEMENT_CHARACTER`]. + * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKPrintableString { - /** - * 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. - */ - LDKnativePrintableString *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; -} LDKPrintableString; +struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKBolt12Invoice o); + +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ. + */ +void CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res); +/** + * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); /** - * Features used within an `offer`. + * Creates a new CResult_SchnorrSignatureNoneZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKOfferFeatures { - /** - * 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. - */ - LDKnativeOfferFeatures *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; -} LDKOfferFeatures; +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); /** - * Represents a tweaked X-only public key as required for BIP 340 (Taproot). + * Creates a new CResult_SchnorrSignatureNoneZ in the error state. */ -typedef struct LDKTweakedPublicKey { - /** - * The bytes of the public key X coordinate - */ - uint8_t x_coordinate[32]; -} LDKTweakedPublicKey; +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); /** - * A function for signing an [`UnsignedBolt12Invoice`]. + * Checks if the given object is currently in the success state */ -typedef struct LDKSignBolt12InvoiceFn { - /** - * 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; - /** - * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. - */ - struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKUnsignedBolt12Invoice *NONNULL_PTR message); - /** - * 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); -} LDKSignBolt12InvoiceFn; - - +bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); /** - * 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 + * Frees any resources used by the CResult_SchnorrSignatureNoneZ. */ -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. - */ - 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; -} LDKTaggedHash; +void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); +/** + * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedPaymentPathZ_free(struct LDKCVec_BlindedPaymentPathZ _res); /** - * Features used within an `invoice_request`. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { - /** - * 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. - */ - LDKnativeInvoiceRequestFeatures *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; -} LDKInvoiceRequestFeatures; +void CVec_AddressZ_free(struct LDKCVec_AddressZ _res); +/** + * 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); /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing */ -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. - */ - 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; -} LDKErroneousField; +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); /** - * 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. + * Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount */ -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; +struct LDKCOption_AmountZ COption_AmountZ_some(struct LDKAmount o); /** - * A function for signing an [`UnsignedInvoiceRequest`]. + * Constructs a new COption_AmountZ containing nothing */ -typedef struct LDKSignInvoiceRequestFn { - /** - * 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; - /** - * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. - */ - struct LDKCResult_SchnorrSignatureNoneZ (*sign_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message); - /** - * 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); -} LDKSignInvoiceRequestFn; +struct LDKCOption_AmountZ COption_AmountZ_none(void); /** - * Error when signing messages. + * Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state */ -typedef enum LDKSignError_Tag { - /** - * User-defined error when signing the message. - */ - LDKSignError_Signing, - /** - * Error when verifying the produced signature using the given pubkey. - */ - LDKSignError_Verification, - /** - * Must be last for serialization purposes - */ - LDKSignError_Sentinel, -} LDKSignError_Tag; +void COption_AmountZ_free(struct LDKCOption_AmountZ _res); -typedef struct MUST_USE_STRUCT LDKSignError { - LDKSignError_Tag tag; - union { - struct { - enum LDKSecp256k1Error verification; - }; - }; -} LDKSignError; +/** + * Creates a new COption_AmountZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_AmountZ COption_AmountZ_clone(const struct LDKCOption_AmountZ *NONNULL_PTR orig); +/** + * Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity + */ +struct LDKCOption_QuantityZ COption_QuantityZ_some(struct LDKQuantity o); +/** + * Constructs a new COption_QuantityZ containing nothing + */ +struct LDKCOption_QuantityZ COption_QuantityZ_none(void); /** - * Receives and validates network updates from peers, - * stores authentic and relevant data as a network graph. - * This network graph is then used for routing payments. - * Provides interface to help with initial routing sync by - * serving historical announcements. + * Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state */ -typedef struct MUST_USE_STRUCT LDKP2PGossipSync { - /** - * 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. - */ - LDKnativeP2PGossipSync *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; -} LDKP2PGossipSync; +void COption_QuantityZ_free(struct LDKCOption_QuantityZ _res); +/** + * Creates a new COption_QuantityZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_QuantityZ COption_QuantityZ_clone(const struct LDKCOption_QuantityZ *NONNULL_PTR orig); +/** + * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * A read-only view of [`NetworkGraph`]. + * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { - /** - * 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. - */ - LDKnativeReadOnlyNetworkGraph *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; -} LDKReadOnlyNetworkGraph; +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); /** - * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a - * source node to a target node. + * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo { - /** - * 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. - */ - LDKnativeDirectedChannelInfo *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; -} LDKDirectedChannelInfo; +struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_clone(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR orig); /** - * The effective capacity of a channel for routing purposes. - * - * While this may be smaller than the actual channel capacity, amounts greater than - * [`Self::as_msat`] should not be routed through the channel. + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the success state. */ -typedef enum LDKEffectiveCapacity_Tag { - /** - * The available liquidity in the channel known from being a channel counterparty, and thus a - * direct hop. - */ - LDKEffectiveCapacity_ExactLiquidity, - /** - * The maximum HTLC amount in one direction as advertised on the gossip network. - */ - LDKEffectiveCapacity_AdvertisedMaxHTLC, - /** - * The total capacity of the channel as determined by the funding transaction. - */ - LDKEffectiveCapacity_Total, - /** - * A capacity sufficient to route any payment, typically used for private channels provided by - * an invoice. - */ - LDKEffectiveCapacity_Infinite, - /** - * The maximum HTLC amount as provided by an invoice route hint. - */ - LDKEffectiveCapacity_HintMaxHTLC, - /** - * A capacity that is unknown possibly because either the chain state is unavailable to know - * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network. - */ - LDKEffectiveCapacity_Unknown, - /** - * Must be last for serialization purposes - */ - LDKEffectiveCapacity_Sentinel, -} LDKEffectiveCapacity_Tag; +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_ok(struct LDKBolt12Invoice o); -typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body { - /** - * Either the inbound or outbound liquidity depending on the direction, denominated in - * millisatoshi. - */ - uint64_t liquidity_msat; -} LDKEffectiveCapacity_LDKExactLiquidity_Body; +/** + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body { - /** - * The maximum HTLC amount denominated in millisatoshi. - */ - uint64_t amount_msat; -} LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *NONNULL_PTR o); -typedef struct LDKEffectiveCapacity_LDKTotal_Body { - /** - * The funding amount denominated in millisatoshi. - */ - uint64_t capacity_msat; - /** - * The maximum HTLC amount denominated in millisatoshi. - */ - uint64_t htlc_maximum_msat; -} LDKEffectiveCapacity_LDKTotal_Body; +/** + * Frees any resources used by the CResult_Bolt12InvoiceDecodeErrorZ. + */ +void CResult_Bolt12InvoiceDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceDecodeErrorZ _res); -typedef struct LDKEffectiveCapacity_LDKHintMaxHTLC_Body { - /** - * The maximum HTLC amount denominated in millisatoshi. - */ - uint64_t amount_msat; -} LDKEffectiveCapacity_LDKHintMaxHTLC_Body; +/** + * Creates a new CResult_Bolt12InvoiceDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *NONNULL_PTR orig); -typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { - LDKEffectiveCapacity_Tag tag; - union { - LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity; - LDKEffectiveCapacity_LDKAdvertisedMaxHTLC_Body advertised_max_htlc; - LDKEffectiveCapacity_LDKTotal_Body total; - LDKEffectiveCapacity_LDKHintMaxHTLC_Body hint_max_htlc; - }; -} LDKEffectiveCapacity; +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); /** - * A [`Router`] implemented using [`find_route`]. - * - * # Privacy - * - * Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found, - * it will create a one-hop path using the recipient as the introduction node if it is a announced - * node. Otherwise, there is no way to find a path to the introduction node in order to send a - * payment, and thus an `Err` is returned. + * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKDefaultRouter { - /** - * 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. - */ - LDKnativeDefaultRouter *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; -} LDKDefaultRouter; +void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); +/** + * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); /** - * [`ScoreLookUp`] implementation that factors in in-flight HTLC liquidity. - * - * Useful for custom [`Router`] implementations to wrap their [`ScoreLookUp`] on-the-fly when calling - * [`find_route`]. - * - * [`ScoreLookUp`]: crate::routing::scoring::ScoreLookUp + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { - /** - * 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. - */ - LDKnativeScorerAccountingForInFlightHtlcs *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; -} LDKScorerAccountingForInFlightHtlcs; +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); /** - * The recipient of a payment, differing based on whether they've hidden their identity with route - * blinding. + * Checks if the given object is currently in the success state */ -typedef enum LDKPayee_Tag { - /** - * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves - * will be included in the final [`Route`]. - */ - LDKPayee_Blinded, - /** - * The recipient included these route hints in their BOLT11 invoice. - */ - LDKPayee_Clear, - /** - * Must be last for serialization purposes - */ - LDKPayee_Sentinel, -} LDKPayee_Tag; +bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); -typedef struct LDKPayee_LDKBlinded_Body { - /** - * Aggregated routing info and blinded paths, for routing to the payee without knowing their - * node id. - */ - struct LDKCVec_BlindedPaymentPathZ route_hints; - /** - * Features supported by the payee. - * - * May be set from the payee's invoice. May be `None` if the invoice does not contain any - * features. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKBolt12InvoiceFeatures features; -} LDKPayee_LDKBlinded_Body; +/** + * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + */ +void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); -typedef struct LDKPayee_LDKClear_Body { - /** - * The node id of the payee. - */ - struct LDKPublicKey node_id; - /** - * Hints for routing to the payee, containing channels connecting the payee to public nodes. - */ - struct LDKCVec_RouteHintZ route_hints; - /** - * Features supported by the payee. - * - * May be set from the payee's invoice or via [`for_keysend`]. May be `None` if the invoice - * does not contain any features. - * - * [`for_keysend`]: PaymentParameters::for_keysend - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKBolt11InvoiceFeatures features; - /** - * The minimum CLTV delta at the end of the route. This value must not be zero. - */ - uint32_t final_cltv_expiry_delta; -} LDKPayee_LDKClear_Body; +/** + * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); -typedef struct MUST_USE_STRUCT LDKPayee { - LDKPayee_Tag tag; - union { - LDKPayee_LDKBlinded_Body blinded; - LDKPayee_LDKClear_Body clear; - }; -} LDKPayee; +/** + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + */ +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); /** - * 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. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. */ -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; +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + */ +void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); /** - * A concrete implementation of [`LockableScore`] which supports multi-threading. + * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { - /** - * 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. - */ - LDKnativeMultiThreadedLockableScore *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; -} LDKMultiThreadedLockableScore; +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * A locked `MultiThreadedLockableScore`. + * Constructs a new COption_u32Z containing a u32 */ -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; +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); /** - * A locked `MultiThreadedLockableScore`. + * Creates a new COption_u32Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -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. - */ - 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; -} LDKMultiThreadedScoreLockWrite; +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_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_clone(const struct LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR orig); +/** + * Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. + */ +struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_new(struct LDKCVec_u8Z a, uint64_t b); /** - * Parameters for configuring [`ProbabilisticScorer`]. - * - * Used to configure decay parameters that are static throughout the lifetime of the scorer. - * these decay parameters affect the score of the channel penalty and are not changed on a - * per-route penalty cost call. + * Frees any resources used by the C2Tuple_CVec_u8Zu64Z. */ -typedef struct MUST_USE_STRUCT LDKProbabilisticScoringDecayParameters { - /** - * 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. - */ - LDKnativeProbabilisticScoringDecayParameters *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; -} LDKProbabilisticScoringDecayParameters; +void C2Tuple_CVec_u8Zu64Z_free(struct LDKC2Tuple_CVec_u8Zu64Z _res); +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu64Z o); +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err(void); /** - * Simple implementation of [`EntropySource`], [`NodeSigner`], and [`SignerProvider`] that takes a - * 32-byte seed for use as a BIP 32 extended key and derives keys from that. - * - * Your `node_id` is seed/0'. - * Unilateral closes may use seed/1'. - * Cooperative closes may use seed/2'. - * The two close keys may be needed to claim on-chain funds! - * - * This struct cannot be used for nodes that wish to support receiving phantom payments; - * [`PhantomKeysManager`] must be used instead. - * - * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any - * previously issued invoices and attempts to pay previous invoices will fail. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKKeysManager { - /** - * 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. - */ - LDKnativeKeysManager *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; -} LDKKeysManager; +bool CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. + */ +void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res); +/** + * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR orig); /** - * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node - * payments. - * - * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be - * paid to one of multiple nodes. This works because we encode the invoice route hints such that - * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment - * itself without ever needing to forward to this fake node. - * - * Phantom node payments are useful for load balancing between multiple LDK nodes. They also - * provide some fault tolerance, because payers will automatically retry paying other provided - * nodes in the case that one node goes down. - * - * Note that multi-path payments are not supported in phantom invoices for security reasons. - * Switching between this struct and [`KeysManager`] will invalidate any previously issued - * invoices and attempts to pay previous invoices will fail. + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKPhantomKeysManager { - /** - * 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. - */ - LDKnativePhantomKeysManager *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; -} LDKPhantomKeysManager; +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); +/** + * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); /** - * An implementation of [`EntropySource`] using ChaCha20. + * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKRandomBytes { - /** - * 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. - */ - LDKnativeRandomBytes *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; -} LDKRandomBytes; +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); /** - * A stateful resolver which maps BIP 353 Human Readable Names to URIs and BOLT12 [`Offer`]s. - * - * It does not directly implement [`DNSResolverMessageHandler`] but implements all the core logic - * which is required in a client which intends to. - * - * It relies on being made aware of the passage of time with regular calls to - * [`Self::new_best_block`] in order to time out existing queries. Queries time out after two - * blocks. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKOMNameResolver { - /** - * 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. - */ - LDKnativeOMNameResolver *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; -} LDKOMNameResolver; +bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. + */ +void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); +/** + * Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); /** - * A sender, receiver and forwarder of [`OnionMessage`]s. - * - * # Handling Messages - * - * `OnionMessenger` implements [`OnionMessageHandler`], making it responsible for either forwarding - * messages to peers or delegating to the appropriate handler for the message type. Currently, the - * available handlers are: - * * [`OffersMessageHandler`], for responding to [`InvoiceRequest`]s and paying [`Bolt12Invoice`]s - * * [`CustomOnionMessageHandler`], for handling user-defined message types - * - * # Sending Messages - * - * [`OnionMessage`]s are sent initially using [`OnionMessenger::send_onion_message`]. When handling - * a message, the matched handler may return a response message which `OnionMessenger` will send - * on its behalf. - * - * # Example - * - * ``` - * # extern crate bitcoin; - * # use bitcoin::hashes::_export::_core::time::Duration; - * # use bitcoin::hex::FromHex; - * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey, self}; - * # use lightning::blinded_path::EmptyNodeIdLookUp; - * # use lightning::blinded_path::message::{BlindedMessagePath, MessageForwardNode, MessageContext}; - * # use lightning::sign::{EntropySource, KeysManager}; - * # use lightning::ln::peer_handler::IgnoringMessageHandler; - * # use lightning::onion_message::messenger::{Destination, MessageRouter, MessageSendInstructions, OnionMessagePath, OnionMessenger}; - * # use lightning::onion_message::packet::OnionMessageContents; - * # use lightning::util::logger::{Logger, Record}; - * # use lightning::util::ser::{Writeable, Writer}; - * # use lightning::io; - * # use std::sync::Arc; - * # struct FakeLogger; - * # impl Logger for FakeLogger { - * # fn log(&self, record: Record) { println!(\"{:?}\" , record); } - * # } - * # struct FakeMessageRouter {} - * # impl MessageRouter for FakeMessageRouter { - * # fn find_path(&self, sender: PublicKey, peers: Vec, destination: Destination) -> Result { - * # let secp_ctx = Secp256k1::new(); - * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); - * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); - * # let hop_node_id2 = hop_node_id1; - * # Ok(OnionMessagePath { - * # intermediate_nodes: vec![hop_node_id1, hop_node_id2], - * # destination, - * # first_node_addresses: None, - * # }) - * # } - * # fn create_blinded_paths( - * # &self, _recipient: PublicKey, _context: MessageContext, _peers: Vec, _secp_ctx: &Secp256k1 - * # ) -> Result, ()> { - * # unreachable!() - * # } - * # } - * # let seed = [42u8; 32]; - * # let time = Duration::from_secs(123456); - * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); - * # let logger = Arc::new(FakeLogger {}); - * # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); - * # let secp_ctx = Secp256k1::new(); - * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); - * # let (hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1); - * # let destination_node_id = hop_node_id1; - * # let node_id_lookup = EmptyNodeIdLookUp {}; - * # let message_router = Arc::new(FakeMessageRouter {}); - * # let custom_message_handler = IgnoringMessageHandler {}; - * # let offers_message_handler = IgnoringMessageHandler {}; - * # let async_payments_message_handler = IgnoringMessageHandler {}; - * # let dns_resolution_message_handler = IgnoringMessageHandler {}; - * // Create the onion messenger. This must use the same `keys_manager` as is passed to your - * // ChannelManager. - * let onion_messenger = OnionMessenger::new( - * &keys_manager, &keys_manager, logger, &node_id_lookup, message_router, - * &offers_message_handler, &async_payments_message_handler, &dns_resolution_message_handler, - * &custom_message_handler, - * ); - * - * # #[derive(Clone, Debug)] - * # struct YourCustomMessage {} - * impl Writeable for YourCustomMessage { - * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { - * \t\t# Ok(()) - * \t\t// Write your custom onion message to `w` - * \t} - * } - * impl OnionMessageContents for YourCustomMessage { - * \tfn tlv_type(&self) -> u64 { - * \t\t# let your_custom_message_type = 42; - * \t\tyour_custom_message_type - * \t} - * \tfn msg_type(&self) -> &'static str { \"YourCustomMessageType\" } - * } - * // Send a custom onion message to a node id. - * let destination = Destination::Node(destination_node_id); - * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; - * # let message = YourCustomMessage {}; - * onion_messenger.send_onion_message(message, instructions); - * - * // Create a blinded path to yourself, for someone to send an onion message to. - * # let your_node_id = hop_node_id1; - * let hops = [ - * \tMessageForwardNode { node_id: hop_node_id3, short_channel_id: None }, - * \tMessageForwardNode { node_id: hop_node_id4, short_channel_id: None }, - * ]; - * let context = MessageContext::Custom(Vec::new()); - * let blinded_path = BlindedMessagePath::new(&hops, your_node_id, context, &keys_manager, &secp_ctx).unwrap(); - * - * // Send a custom onion message to a blinded path. - * let destination = Destination::BlindedPath(blinded_path); - * let instructions = MessageSendInstructions::WithoutReplyPath { destination }; - * # let message = YourCustomMessage {}; - * onion_messenger.send_onion_message(message, instructions); - * ``` - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Creates a new CResult_PublicKeyNoneZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKOnionMessenger { - /** - * 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. - */ - LDKnativeOnionMessenger *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; -} LDKOnionMessenger; +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); +/** + * Creates a new CResult_PublicKeyNoneZ in the error state. + */ +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); /** - * A [`MessageRouter`] that can only route to a directly connected [`Destination`]. - * - * # Privacy - * - * Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, - * it will create a one-hop path using the recipient as the introduction node if it is a announced - * node. Otherwise, there is no way to find a path to the introduction node in order to send a - * message, and thus an `Err` is returned. + * Frees any resources used by the CResult_PublicKeyNoneZ. */ -typedef struct MUST_USE_STRUCT LDKDefaultMessageRouter { - /** - * 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. - */ - LDKnativeDefaultMessageRouter *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; -} LDKDefaultMessageRouter; +void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); /** - * The unblinded node in a blinded path. + * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef enum LDKIntroductionNode_Tag { - /** - * The node id of the introduction node. - */ - LDKIntroductionNode_NodeId, - /** - * The short channel id of the channel leading to the introduction node. The [`Direction`] - * identifies which side of the channel is the introduction node. - */ - LDKIntroductionNode_DirectedShortChannelId, - /** - * Must be last for serialization purposes - */ - LDKIntroductionNode_Sentinel, -} LDKIntroductionNode_Tag; +struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); -typedef struct LDKIntroductionNode_LDKDirectedShortChannelId_Body { - enum LDKDirection _0; - uint64_t _1; -} LDKIntroductionNode_LDKDirectedShortChannelId_Body; +/** + * Creates a new CResult__u832NoneZ in the success state. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_ok(struct LDKThirtyTwoBytes o); -typedef struct MUST_USE_STRUCT LDKIntroductionNode { - LDKIntroductionNode_Tag tag; - union { - struct { - struct LDKPublicKey node_id; - }; - LDKIntroductionNode_LDKDirectedShortChannelId_Body directed_short_channel_id; - }; -} LDKIntroductionNode; +/** + * Creates a new CResult__u832NoneZ in the error state. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult__u832NoneZ_is_ok(const struct LDKCResult__u832NoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult__u832NoneZ. + */ +void CResult__u832NoneZ_free(struct LDKCResult__u832NoneZ _res); +/** + * Creates a new CResult__u832NoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult__u832NoneZ CResult__u832NoneZ_clone(const struct LDKCResult__u832NoneZ *NONNULL_PTR orig); /** - * A [`NodeIdLookUp`] that always returns `None`. + * Creates a new CResult_NoneNoneZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKEmptyNodeIdLookUp { - /** - * 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. - */ - LDKnativeEmptyNodeIdLookUp *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; -} LDKEmptyNodeIdLookUp; +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +/** + * Creates a new CResult_NoneNoneZ in the error state. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); /** - * Data to construct a [`BlindedHop`] for forwarding a payment. + * Frees any resources used by the CResult_NoneNoneZ. */ -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; +void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); /** - * An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can - * sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, - * which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`], - * which can provide a default implementation of this trait when used with [`Wallet`]. + * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct LDKCoinSelectionSource { - /** - * 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; - /** - * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are - * available to spend. Implementations are free to pick their coin selection algorithm of - * choice, as long as the following requirements are met: - * - * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction - * throughout coin selection, but must not be returned as part of the result. - * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction - * throughout coin selection. In some cases, like when funding an anchor transaction, this - * set is empty. Implementations should ensure they handle this correctly on their end, - * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be - * provided, in which case a zero-value empty OP_RETURN output can be used instead. - * 3. Enough inputs must be selected/contributed for the resulting transaction (including the - * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. - * - * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of - * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require - * providing the full input weight. Failing to do so may lead to underestimating fee bumps and - * delaying block inclusion. - * - * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they - * can be re-used within new fee-bumped iterations of the original claiming transaction, - * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a - * transaction associated with it, and all of the available UTXOs have already been assigned to - * other claims, implementations must be willing to double spend their UTXOs. The choice of - * which UTXOs to double spend is left to the implementation, but it must strive to keep the - * set of other claims being double spent to a minimum. - */ - struct LDKCResult_CoinSelectionNoneZ (*select_confirmed_utxos)(const void *this_arg, struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight); - /** - * Signs and provides the full witness for all inputs within the transaction known to the - * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). - * - * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - * unsigned transaction and then sign it with your wallet. - */ - struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); - /** - * 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); -} LDKCoinSelectionSource; +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); /** - * An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to - * provide a default implementation to [`CoinSelectionSource`]. + * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar */ -typedef struct LDKWalletSource { - /** - * 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 all UTXOs, with at least 1 confirmation each, that are available to spend. - */ - struct LDKCResult_CVec_UtxoZNoneZ (*list_confirmed_utxos)(const void *this_arg); - /** - * Returns a script to use for change above dust resulting from a successful coin selection - * attempt. - */ - 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 - * [`WalletSource::list_confirmed_utxos`]). - * - * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - * unsigned transaction and then sign it with your wallet. - */ - struct LDKCResult_TransactionNoneZ (*sign_psbt)(const void *this_arg, struct LDKCVec_u8Z psbt); - /** - * 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); -} LDKWalletSource; +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); +/** + * Constructs a new COption_BigEndianScalarZ containing nothing + */ +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_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); /** - * A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would - * avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double - * spends may happen. + * Creates a new COption_BigEndianScalarZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKWallet { - /** - * 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. - */ - LDKnativeWallet *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; -} LDKWallet; +struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); +/** + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + */ +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +/** + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + */ +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** - * A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a - * [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or - * Replace-By-Fee (RBF). - * - * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKBumpTransactionEventHandler { - /** - * 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. - */ - LDKnativeBumpTransactionEventHandler *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; -} LDKBumpTransactionEventHandler; +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + */ +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +/** + * Creates a new CResult_RecoverableSignatureNoneZ 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); /** - * A [`KVStore`] implementation that writes to and reads from the file system. + * Creates a new CResult_ECDSASignatureNoneZ in the success state. */ -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. - */ - 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; -} LDKFilesystemStore; +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); +/** + * Creates a new CResult_ECDSASignatureNoneZ in the error state. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); /** - * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep - * Rust-Lightning running properly, and (2) either can or should be run in the background. Its - * responsibilities are: - * * Processing [`Event`]s with a user-provided [`EventHandler`]. - * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so, - * writing it to disk/backups by invoking the callback given to it at startup. - * [`ChannelManager`] persistence should be done in the background. - * * Calling [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`] - * and [`PeerManager::timer_tick_occurred`] at the appropriate intervals. - * * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a - * [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]). - * - * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied - * upon as doing so may result in high latency. - * - * # Note - * - * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then - * there is a risk of channels force-closing on startup when the manager realizes it's outdated. - * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for - * unilateral chain closure fees are at risk. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - * [`ChannelManager::timer_tick_occurred`]: lightning::ln::channelmanager::ChannelManager::timer_tick_occurred - * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor - * [`Event`]: lightning::events::Event - * [`PeerManager::timer_tick_occurred`]: lightning::ln::peer_handler::PeerManager::timer_tick_occurred - * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events - *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown. + * Frees any resources used by the CResult_ECDSASignatureNoneZ. */ -typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { - /** - * 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. - */ - LDKnativeBackgroundProcessor *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; -} LDKBackgroundProcessor; +void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); +/** + * Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_StrNoneZ in the success state. + */ +struct LDKCResult_StrNoneZ CResult_StrNoneZ_ok(struct LDKStr o); /** - * The main Rapid Gossip Sync object. - * - * See [crate-level documentation] for usage. - * - * [crate-level documentation]: crate + * Creates a new CResult_StrNoneZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKRapidGossipSync { - /** - * 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. - */ - LDKnativeRapidGossipSync *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; -} LDKRapidGossipSync; +struct LDKCResult_StrNoneZ CResult_StrNoneZ_err(void); /** - * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + * Checks if the given object is currently in the success state */ -typedef enum LDKGossipSync_Tag { - /** - * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. - */ - LDKGossipSync_P2P, - /** - * Rapid gossip sync from a trusted server. - */ - LDKGossipSync_Rapid, - /** - * No gossip sync. - */ - LDKGossipSync_None, - /** - * Must be last for serialization purposes - */ - LDKGossipSync_Sentinel, -} LDKGossipSync_Tag; +bool CResult_StrNoneZ_is_ok(const struct LDKCResult_StrNoneZ *NONNULL_PTR o); -typedef struct MUST_USE_STRUCT LDKGossipSync { - LDKGossipSync_Tag tag; - union { - struct { - /** - * Note that this field is expected to be a reference. - */ - struct LDKP2PGossipSync p2p; - }; - struct { - /** - * Note that this field is expected to be a reference. - */ - struct LDKRapidGossipSync rapid; - }; - }; -} LDKGossipSync; +/** + * Frees any resources used by the CResult_StrNoneZ. + */ +void CResult_StrNoneZ_free(struct LDKCResult_StrNoneZ _res); +/** + * Creates a new CResult_StrNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_StrNoneZ CResult_StrNoneZ_clone(const struct LDKCResult_StrNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_TransactionNoneZ in the success state. + */ +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); /** - * Data of the [`RawBolt11Invoice`] that is encoded in the data part + * Creates a new CResult_TransactionNoneZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKRawDataPart { - /** - * 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. - */ - LDKnativeRawDataPart *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; -} LDKRawDataPart; +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_TransactionNoneZ. + */ +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); /** - * Positive duration that defines when (relatively to the timestamp) in the future the invoice - * expires + * Creates a new CResult_TransactionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKExpiryTime { - /** - * 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. - */ - LDKnativeExpiryTime *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; -} LDKExpiryTime; +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_CVec_u8ZNoneZ in the success state. + */ +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); /** - * `min_final_cltv_expiry_delta` to use for the last HTLC in the route + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiryDelta { - /** - * 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. - */ - LDKnativeMinFinalCltvExpiryDelta *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; -} LDKMinFinalCltvExpiryDelta; +bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); /** - * A 20-byte byte array. + * Frees any resources used by the CResult_CVec_u8ZNoneZ. */ -typedef struct LDKTwentyBytes { - /** - * The twenty bytes - */ - uint8_t data[20]; -} LDKTwentyBytes; +void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); /** - * Fallback address in case no LN payment is possible + * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef enum LDKFallback_Tag { - LDKFallback_SegWitProgram, - LDKFallback_PubKeyHash, - LDKFallback_ScriptHash, - /** - * Must be last for serialization purposes - */ - LDKFallback_Sentinel, -} LDKFallback_Tag; +struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); -typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKWitnessVersion version; - struct LDKCVec_u8Z program; -} LDKFallback_LDKSegWitProgram_Body; +/** + * Creates a new CResult_ShutdownScriptNoneZ in the success state. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o); -typedef struct MUST_USE_STRUCT LDKFallback { - LDKFallback_Tag tag; - union { - LDKFallback_LDKSegWitProgram_Body seg_wit_program; - struct { - struct LDKTwentyBytes pub_key_hash; - }; - struct { - struct LDKTwentyBytes script_hash; - }; - }; -} LDKFallback; +/** + * Creates a new CResult_ShutdownScriptNoneZ in the error state. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void); /** - * An event which an bLIP-50 / LSPS0 client may want to take some action in response to. + * Checks if the given object is currently in the success state */ -typedef enum LDKLSPS0ClientEvent_Tag { - /** - * Information from the LSP about the protocols they support. - */ - LDKLSPS0ClientEvent_ListProtocolsResponse, - /** - * Must be last for serialization purposes - */ - LDKLSPS0ClientEvent_Sentinel, -} LDKLSPS0ClientEvent_Tag; +bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o); -typedef struct LDKLSPS0ClientEvent_LDKListProtocolsResponse_Body { - /** - * The node id of the LSP. - */ - struct LDKPublicKey counterparty_node_id; - /** - * A list of supported protocols. - */ - struct LDKCVec_u16Z protocols; -} LDKLSPS0ClientEvent_LDKListProtocolsResponse_Body; +/** + * Frees any resources used by the CResult_ShutdownScriptNoneZ. + */ +void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS0ClientEvent { - LDKLSPS0ClientEvent_Tag tag; - union { - LDKLSPS0ClientEvent_LDKListProtocolsResponse_Body list_protocols_response; - }; -} LDKLSPS0ClientEvent; +/** + * Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); +/** + * Creates a new CResult_WitnessNoneZ in the success state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_ok(struct LDKWitness o); +/** + * Creates a new CResult_WitnessNoneZ in the error state. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_err(void); /** - * An object representing the supported protocol options. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKLSPS1Options { - /** - * 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. - */ - LDKnativeLSPS1Options *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; -} LDKLSPS1Options; +bool CResult_WitnessNoneZ_is_ok(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_WitnessNoneZ. + */ +void CResult_WitnessNoneZ_free(struct LDKCResult_WitnessNoneZ _res); +/** + * Creates a new CResult_WitnessNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_clone(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR orig); /** - * An error returned in response to an JSON-RPC request. - * - * Please refer to the [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification#error_object) for - * more information. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef struct MUST_USE_STRUCT LDKLSPSResponseError { - /** - * 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. - */ - LDKnativeLSPSResponseError *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; -} LDKLSPSResponseError; +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_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); +/** + * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. + */ +struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); /** - * The identifier of an order. + * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. */ -typedef struct MUST_USE_STRUCT LDKLSPS1OrderId { - /** - * 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. - */ - LDKnativeLSPS1OrderId *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; -} LDKLSPS1OrderId; +void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); +/** + * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); /** - * An object representing an bLIP-51 / LSPS1 channel order. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKLSPS1OrderParams { - /** - * 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. - */ - LDKnativeLSPS1OrderParams *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; -} LDKLSPS1OrderParams; +bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. + */ +void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); +/** + * 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_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); /** - * Details regarding how to pay for an order. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef struct MUST_USE_STRUCT LDKLSPS1PaymentInfo { - /** - * 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. - */ - LDKnativeLSPS1PaymentInfo *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; -} LDKLSPS1PaymentInfo; +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); +/** + * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + */ +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +/** + * Constructs a new COption_WriteableScoreZ containing nothing + */ +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); /** - * Details regarding the state of an ordered channel. + * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state */ -typedef struct MUST_USE_STRUCT LDKLSPS1ChannelInfo { - /** - * 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. - */ - LDKnativeLSPS1ChannelInfo *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; -} LDKLSPS1ChannelInfo; +void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); /** - * An event which an bLIP-51 / LSPS1 client should take some action in response to. + * Creates a new CResult_NoneIOErrorZ in the success state. */ -typedef enum LDKLSPS1ClientEvent_Tag { - /** - * A request previously issued via [`LSPS1ClientHandler::request_supported_options`] - * succeeded as the LSP returned the options it supports. - * - * You must check whether LSP supports the parameters the client wants and then call - * [`LSPS1ClientHandler::create_order`] to place an order. - * - * [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - * [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - */ - LDKLSPS1ClientEvent_SupportedOptionsReady, - /** - * A request previously issued via [`LSPS1ClientHandler::request_supported_options`] - * failed as the LSP returned an error response. - * - * [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - */ - LDKLSPS1ClientEvent_SupportedOptionsRequestFailed, - /** - * Confirmation from the LSP about the order created by the client. - * - * When the payment is confirmed, the LSP will open a channel to you - * with the below agreed upon parameters. - * - * You must pay the invoice or onchain address if you want to continue and then - * call [`LSPS1ClientHandler::check_order_status`] with the order id - * to get information from LSP about progress of the order. - * - * [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - */ - LDKLSPS1ClientEvent_OrderCreated, - /** - * Information from the LSP about the status of a previously created order. - * - * Will be emitted in response to calling [`LSPS1ClientHandler::check_order_status`]. - * - * [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - */ - LDKLSPS1ClientEvent_OrderStatus, - /** - * A request previously issued via [`LSPS1ClientHandler::create_order`] or [`LSPS1ClientHandler::check_order_status`]. - * failed as the LSP returned an error response. - * - * [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - * [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - */ - LDKLSPS1ClientEvent_OrderRequestFailed, - /** - * Must be last for serialization purposes - */ - LDKLSPS1ClientEvent_Sentinel, -} LDKLSPS1ClientEvent_Tag; +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); -typedef struct LDKLSPS1ClientEvent_LDKSupportedOptionsReady_Body { - /** - * The identifier of the issued bLIP-51 / LSPS1 `get_info` request, as returned by - * [`LSPS1ClientHandler::request_supported_options`] - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP that provided this response. - */ - struct LDKPublicKey counterparty_node_id; - /** - * All options supported by the LSP. - */ - struct LDKLSPS1Options supported_options; -} LDKLSPS1ClientEvent_LDKSupportedOptionsReady_Body; +/** + * Creates a new CResult_NoneIOErrorZ in the error state. + */ +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e); -typedef struct LDKLSPS1ClientEvent_LDKSupportedOptionsRequestFailed_Body { - /** - * The identifier of the issued bLIP-51 / LSPS1 `get_info` request, as returned by - * [`LSPS1ClientHandler::request_supported_options`] - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP that provided this response. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The error that was returned. - */ - struct LDKLSPSResponseError error; -} LDKLSPS1ClientEvent_LDKSupportedOptionsRequestFailed_Body; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); -typedef struct LDKLSPS1ClientEvent_LDKOrderCreated_Body { - /** - * The identifier of the issued bLIP-51 / LSPS1 `create_order` request, as returned by - * [`LSPS1ClientHandler::create_order`] - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The id of the channel order. - */ - struct LDKLSPS1OrderId order_id; - /** - * The order created by client and approved by LSP. - */ - struct LDKLSPS1OrderParams order; - /** - * The details regarding payment of the order - */ - struct LDKLSPS1PaymentInfo payment; - /** - * The details regarding state of the channel ordered. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKLSPS1ChannelInfo channel; -} LDKLSPS1ClientEvent_LDKOrderCreated_Body; +/** + * Frees any resources used by the CResult_NoneIOErrorZ. + */ +void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); -typedef struct LDKLSPS1ClientEvent_LDKOrderStatus_Body { - /** - * The identifier of the issued bLIP-51 / LSPS1 `get_order` request, as returned by - * [`LSPS1ClientHandler::check_order_status`] - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The id of the channel order. - */ - struct LDKLSPS1OrderId order_id; - /** - * The order created by client and approved by LSP. - */ - struct LDKLSPS1OrderParams order; - /** - * The details regarding payment of the order - */ - struct LDKLSPS1PaymentInfo payment; - /** - * The details regarding state of the channel ordered. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKLSPS1ChannelInfo channel; -} LDKLSPS1ClientEvent_LDKOrderStatus_Body; +/** + * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); -typedef struct LDKLSPS1ClientEvent_LDKOrderRequestFailed_Body { - /** - * The identifier of the issued LSPS1 `create_order` or `get_order` request, as returned by - * [`LSPS1ClientHandler::create_order`] or [`LSPS1ClientHandler::check_order_status`]. - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - * [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The error that was returned. - */ - struct LDKLSPSResponseError error; -} LDKLSPS1ClientEvent_LDKOrderRequestFailed_Body; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS1ClientEvent { - LDKLSPS1ClientEvent_Tag tag; - union { - LDKLSPS1ClientEvent_LDKSupportedOptionsReady_Body supported_options_ready; - LDKLSPS1ClientEvent_LDKSupportedOptionsRequestFailed_Body supported_options_request_failed; - LDKLSPS1ClientEvent_LDKOrderCreated_Body order_created; - LDKLSPS1ClientEvent_LDKOrderStatus_Body order_status; - LDKLSPS1ClientEvent_LDKOrderRequestFailed_Body order_request_failed; - }; -} LDKLSPS1ClientEvent; +/** + * Creates a new CResult_RouteStrZ in the success state. + */ +struct LDKCResult_RouteStrZ CResult_RouteStrZ_ok(struct LDKRoute o); /** - * An event which an LSPS2 client should take some action in response to. + * Creates a new CResult_RouteStrZ in the error state. */ -typedef enum LDKLSPS2ClientEvent_Tag { - /** - * Information from the LSP about their current fee rates and channel parameters. - * - * You must call [`LSPS2ClientHandler::select_opening_params`] with the fee parameter - * you want to use if you wish to proceed opening a channel. - * - * [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params - */ - LDKLSPS2ClientEvent_OpeningParametersReady, - /** - * Provides the necessary information to generate a payable invoice that then may be given to - * the payer. - * - * When the invoice is paid, the LSP will open a channel with the previously agreed upon - * parameters to you. - */ - LDKLSPS2ClientEvent_InvoiceParametersReady, - /** - * Must be last for serialization purposes - */ - LDKLSPS2ClientEvent_Sentinel, -} LDKLSPS2ClientEvent_Tag; +struct LDKCResult_RouteStrZ CResult_RouteStrZ_err(struct LDKStr e); -typedef struct LDKLSPS2ClientEvent_LDKOpeningParametersReady_Body { - /** - * The identifier of the issued bLIP-52 / LSPS2 `get_info` request, as returned by - * [`LSPS2ClientHandler::request_opening_params`] - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS2ClientHandler::request_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::request_opening_params - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP that provided this response. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The menu of fee parameters the LSP is offering at this time. - * You must select one of these if you wish to proceed. - */ - struct LDKCVec_LSPS2OpeningFeeParamsZ opening_fee_params_menu; -} LDKLSPS2ClientEvent_LDKOpeningParametersReady_Body; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteStrZ_is_ok(const struct LDKCResult_RouteStrZ *NONNULL_PTR o); -typedef struct LDKLSPS2ClientEvent_LDKInvoiceParametersReady_Body { - /** - * The identifier of the issued bLIP-52 / LSPS2 `buy` request, as returned by - * [`LSPS2ClientHandler::select_opening_params`]. - * - * This can be used to track which request this event corresponds to. - * - * [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the LSP. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The intercept short channel id to use in the route hint. - */ - uint64_t intercept_scid; - /** - * The `cltv_expiry_delta` to use in the route hint. - */ - uint32_t cltv_expiry_delta; - /** - * The initial payment size you specified. - */ - struct LDKCOption_u64Z payment_size_msat; -} LDKLSPS2ClientEvent_LDKInvoiceParametersReady_Body; +/** + * Frees any resources used by the CResult_RouteStrZ. + */ +void CResult_RouteStrZ_free(struct LDKCResult_RouteStrZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS2ClientEvent { - LDKLSPS2ClientEvent_Tag tag; - union { - LDKLSPS2ClientEvent_LDKOpeningParametersReady_Body opening_parameters_ready; - LDKLSPS2ClientEvent_LDKInvoiceParametersReady_Body invoice_parameters_ready; - }; -} LDKLSPS2ClientEvent; +/** + * Creates a new CResult_RouteStrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteStrZ CResult_RouteStrZ_clone(const struct LDKCResult_RouteStrZ *NONNULL_PTR orig); /** - * An event which an bLIP-52 / LSPS2 server should take some action in response to. + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. */ -typedef enum LDKLSPS2ServiceEvent_Tag { - /** - * A request from a client for information about JIT Channel parameters. - * - * You must calculate the parameters for this client and pass them to - * [`LSPS2ServiceHandler::opening_fee_params_generated`]. - * - * If an unrecognized or stale token is provided you can use - * `[LSPS2ServiceHandler::invalid_token_provided`] to error the request. - * - * [`LSPS2ServiceHandler::opening_fee_params_generated`]: crate::lsps2::service::LSPS2ServiceHandler::opening_fee_params_generated - * [`LSPS2ServiceHandler::invalid_token_provided`]: crate::lsps2::service::LSPS2ServiceHandler::invalid_token_provided - */ - LDKLSPS2ServiceEvent_GetInfo, - /** - * A client has selected a opening fee parameter to use and would like to - * purchase a channel with an optional initial payment size. - * - * If `payment_size_msat` is [`Option::Some`] then the payer is allowed to use MPP. - * If `payment_size_msat` is [`Option::None`] then the payer cannot use MPP. - * - * You must generate an intercept scid and `cltv_expiry_delta` for them to use - * and call [`LSPS2ServiceHandler::invoice_parameters_generated`]. - * - * [`LSPS2ServiceHandler::invoice_parameters_generated`]: crate::lsps2::service::LSPS2ServiceHandler::invoice_parameters_generated - */ - LDKLSPS2ServiceEvent_BuyRequest, - /** - * You should open a channel using [`ChannelManager::create_channel`]. - * - * [`ChannelManager::create_channel`]: lightning::ln::channelmanager::ChannelManager::create_channel - */ - LDKLSPS2ServiceEvent_OpenChannel, - /** - * Must be last for serialization purposes - */ - LDKLSPS2ServiceEvent_Sentinel, -} LDKLSPS2ServiceEvent_Tag; +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_ok(struct LDKCVec_BlindedPaymentPathZ o); -typedef struct LDKLSPS2ServiceEvent_LDKGetInfo_Body { - /** - * An identifier that must be passed to [`LSPS2ServiceHandler::opening_fee_params_generated`]. - * - * [`LSPS2ServiceHandler::opening_fee_params_generated`]: crate::lsps2::service::LSPS2ServiceHandler::opening_fee_params_generated - */ - struct LDKLSPSRequestId request_id; - /** - * The node id of the client making the information request. - */ - struct LDKPublicKey counterparty_node_id; - /** - * An optional token that can be used as an API key, coupon code, etc. - */ - struct LDKCOption_StrZ token; -} LDKLSPS2ServiceEvent_LDKGetInfo_Body; +/** + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the error state. + */ +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_err(void); -typedef struct LDKLSPS2ServiceEvent_LDKBuyRequest_Body { - /** - * An identifier that must be passed into [`LSPS2ServiceHandler::invoice_parameters_generated`]. - * - * [`LSPS2ServiceHandler::invoice_parameters_generated`]: crate::lsps2::service::LSPS2ServiceHandler::invoice_parameters_generated - */ - struct LDKLSPSRequestId request_id; - /** - * The client node id that is making this request. - */ - struct LDKPublicKey counterparty_node_id; - /** - * The channel parameters they have selected. - */ - struct LDKLSPS2OpeningFeeParams opening_fee_params; - /** - * The size of the initial payment they would like to receive. - */ - struct LDKCOption_u64Z payment_size_msat; -} LDKLSPS2ServiceEvent_LDKBuyRequest_Body; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_BlindedPaymentPathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR o); -typedef struct LDKLSPS2ServiceEvent_LDKOpenChannel_Body { - /** - * The node to open channel with. - */ - struct LDKPublicKey their_network_key; - /** - * The amount to forward after fees. - */ - uint64_t amt_to_forward_msat; - /** - * The fee earned for opening the channel. - */ - uint64_t opening_fee_msat; - /** - * A user specified id used to track channel open. - */ - struct LDKU128 user_channel_id; - /** - * The intercept short channel id to use in the route hint. - */ - uint64_t intercept_scid; -} LDKLSPS2ServiceEvent_LDKOpenChannel_Body; +/** + * Frees any resources used by the CResult_CVec_BlindedPaymentPathZNoneZ. + */ +void CResult_CVec_BlindedPaymentPathZNoneZ_free(struct LDKCResult_CVec_BlindedPaymentPathZNoneZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS2ServiceEvent { - LDKLSPS2ServiceEvent_Tag tag; - union { - LDKLSPS2ServiceEvent_LDKGetInfo_Body get_info; - LDKLSPS2ServiceEvent_LDKBuyRequest_Body buy_request; - LDKLSPS2ServiceEvent_LDKOpenChannel_Body open_channel; - }; -} LDKLSPS2ServiceEvent; +/** + * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR orig); /** - * An event which you should probably take some action in response to. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ -typedef enum LDKLiquidityEvent_Tag { - /** - * An LSPS0 client event. - */ - LDKLiquidityEvent_LSPS0Client, - /** - * An LSPS1 (Channel Request) client event. - */ - LDKLiquidityEvent_LSPS1Client, - /** - * An LSPS2 (JIT Channel) client event. - */ - LDKLiquidityEvent_LSPS2Client, - /** - * An LSPS2 (JIT Channel) server event. - */ - LDKLiquidityEvent_LSPS2Service, - /** - * Must be last for serialization purposes - */ - LDKLiquidityEvent_Sentinel, -} LDKLiquidityEvent_Tag; +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); -typedef struct MUST_USE_STRUCT LDKLiquidityEvent { - LDKLiquidityEvent_Tag tag; - union { - struct { - struct LDKLSPS0ClientEvent lsps0_client; - }; - struct { - struct LDKLSPS1ClientEvent lsps1_client; - }; - struct { - struct LDKLSPS2ClientEvent lsps2_client; - }; - struct { - struct LDKLSPS2ServiceEvent lsps2_service; - }; - }; -} LDKLiquidityEvent; +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + */ +void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); /** - * A message handler capable of sending and handling bLIP-50 / LSPS0 messages. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKLSPS0ClientHandler { - /** - * 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. - */ - LDKnativeLSPS0ClientHandler *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; -} LDKLSPS0ClientHandler; +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +/** + * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); /** - * A `list_protocols` request. - * - * Please refer to the [bLIP-50 / LSPS0 - * specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKLSPS0ListProtocolsRequest { - /** - * 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. - */ - LDKnativeLSPS0ListProtocolsRequest *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; -} LDKLSPS0ListProtocolsRequest; +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + */ +void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +/** + * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); /** - * A response to a `list_protocols` request. - * - * Please refer to the [bLIP-50 / LSPS0 - * specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Creates a new CResult_TrampolineHopDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKLSPS0ListProtocolsResponse { - /** - * 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. - */ - LDKnativeLSPS0ListProtocolsResponse *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; -} LDKLSPS0ListProtocolsResponse; +struct LDKCResult_TrampolineHopDecodeErrorZ CResult_TrampolineHopDecodeErrorZ_ok(struct LDKTrampolineHop o); /** - * An bLIP-50 / LSPS0 protocol request. - * - * Please refer to the [bLIP-50 / LSPS0 - * specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Creates a new CResult_TrampolineHopDecodeErrorZ in the error state. */ -typedef enum LDKLSPS0Request_Tag { - /** - * A request calling `list_protocols`. - */ - LDKLSPS0Request_ListProtocols, - /** - * Must be last for serialization purposes - */ - LDKLSPS0Request_Sentinel, -} LDKLSPS0Request_Tag; +struct LDKCResult_TrampolineHopDecodeErrorZ CResult_TrampolineHopDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct MUST_USE_STRUCT LDKLSPS0Request { - LDKLSPS0Request_Tag tag; - union { - struct { - struct LDKLSPS0ListProtocolsRequest list_protocols; - }; - }; -} LDKLSPS0Request; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrampolineHopDecodeErrorZ_is_ok(const struct LDKCResult_TrampolineHopDecodeErrorZ *NONNULL_PTR o); /** - * An bLIP-50 / LSPS0 protocol request. - * - * Please refer to the [bLIP-50 / LSPS0 - * specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Frees any resources used by the CResult_TrampolineHopDecodeErrorZ. */ -typedef enum LDKLSPS0Response_Tag { - /** - * A response to a `list_protocols` request. - */ - LDKLSPS0Response_ListProtocols, - /** - * An error response to a `list_protocols` request. - */ - LDKLSPS0Response_ListProtocolsError, - /** - * Must be last for serialization purposes - */ - LDKLSPS0Response_Sentinel, -} LDKLSPS0Response_Tag; +void CResult_TrampolineHopDecodeErrorZ_free(struct LDKCResult_TrampolineHopDecodeErrorZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS0Response { - LDKLSPS0Response_Tag tag; - union { - struct { - struct LDKLSPS0ListProtocolsResponse list_protocols; - }; - struct { - struct LDKLSPSResponseError list_protocols_error; - }; - }; -} LDKLSPS0Response; +/** + * Creates a new CResult_TrampolineHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TrampolineHopDecodeErrorZ CResult_TrampolineHopDecodeErrorZ_clone(const struct LDKCResult_TrampolineHopDecodeErrorZ *NONNULL_PTR orig); /** - * An bLIP-50 / LSPS0 protocol message. - * - * Please refer to the [bLIP-50 / LSPS0 - * specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef enum LDKLSPS0Message_Tag { - /** - * A request variant. - */ - LDKLSPS0Message_Request, - /** - * A response variant. - */ - LDKLSPS0Message_Response, - /** - * Must be last for serialization purposes - */ - LDKLSPS0Message_Sentinel, -} LDKLSPS0Message_Tag; +void CVec_TrampolineHopZ_free(struct LDKCVec_TrampolineHopZ _res); -typedef struct LDKLSPS0Message_LDKRequest_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS0Request _1; -} LDKLSPS0Message_LDKRequest_Body; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res); -typedef struct LDKLSPS0Message_LDKResponse_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS0Response _1; -} LDKLSPS0Message_LDKResponse_Body; +/** + * Creates a new CResult_BlindedTailDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o); -typedef struct MUST_USE_STRUCT LDKLSPS0Message { - LDKLSPS0Message_Tag tag; - union { - LDKLSPS0Message_LDKRequest_Body request; - LDKLSPS0Message_LDKResponse_Body response; - }; -} LDKLSPS0Message; +/** + * Creates a new CResult_BlindedTailDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_BlindedTailDecodeErrorZ. + */ +void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res); /** - * A request made to an LSP to retrieve the supported options. - * - * Please refer to the [bLIP-51 / LSPS1 - * specification](https://github.com/lightning/blips/blob/master/blip-0051.md#1-lsps1get_info) for - * more information. + * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKLSPS1GetInfoRequest { - /** - * 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. - */ - LDKnativeLSPS1GetInfoRequest *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; -} LDKLSPS1GetInfoRequest; +struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PathZ_free(struct LDKCVec_PathZ _res); /** - * A request made to an LSP to create an order. - * - * Please refer to the [bLIP-51 / LSPS1 - * specification](https://github.com/lightning/blips/blob/master/blip-0051.md#2-lsps1create_order) - * for more information. + * Creates a new CResult_RouteDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKLSPS1CreateOrderRequest { - /** - * 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. - */ - LDKnativeLSPS1CreateOrderRequest *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; -} LDKLSPS1CreateOrderRequest; +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +/** + * Creates a new CResult_RouteDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); /** - * A request made to an LSP to retrieve information about an previously made order. - * - * Please refer to the [bLIP-51 / LSPS1 - * specification](https://github.com/lightning/blips/blob/master/blip-0051.md#21-lsps1get_order) - * for more information. + * Frees any resources used by the CResult_RouteDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKLSPS1GetOrderRequest { - /** - * 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. - */ - LDKnativeLSPS1GetOrderRequest *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; -} LDKLSPS1GetOrderRequest; +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); + +/** + * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); /** - * An enum that captures all the valid JSON-RPC requests in the bLIP-51 / LSPS1 protocol. + * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. */ -typedef enum LDKLSPS1Request_Tag { - /** - * A request to learn about the options supported by the LSP. - */ - LDKLSPS1Request_GetInfo, - /** - * A request to create a channel order. - */ - LDKLSPS1Request_CreateOrder, - /** - * A request to query a previously created channel order. - */ - LDKLSPS1Request_GetOrder, - /** - * Must be last for serialization purposes - */ - LDKLSPS1Request_Sentinel, -} LDKLSPS1Request_Tag; - -typedef struct MUST_USE_STRUCT LDKLSPS1Request { - LDKLSPS1Request_Tag tag; - union { - struct { - struct LDKLSPS1GetInfoRequest get_info; - }; - struct { - struct LDKLSPS1CreateOrderRequest create_order; - }; - struct { - struct LDKLSPS1GetOrderRequest get_order; - }; - }; -} LDKLSPS1Request; +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); +/** + * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); /** - * A response to a [`LSPS1GetInfoRequest`]. + * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKLSPS1GetInfoResponse { - /** - * 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. - */ - LDKnativeLSPS1GetInfoResponse *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; -} LDKLSPS1GetInfoResponse; +void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); +/** + * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_u64Z_free(struct LDKCVec_u64Z _res); /** - * A response to a [`LSPS1CreateOrderRequest`]. + * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKLSPS1CreateOrderResponse { - /** - * 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. - */ - LDKnativeLSPS1CreateOrderResponse *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; -} LDKLSPS1CreateOrderResponse; +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); /** - * An enum that captures all the valid JSON-RPC responses in the bLIP-51 / LSPS1 protocol. + * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. */ -typedef enum LDKLSPS1Response_Tag { - /** - * A successful response to a [`LSPS1GetInfoRequest`]. - */ - LDKLSPS1Response_GetInfo, - /** - * An error response to a [`LSPS1GetInfoRequest`]. - */ - LDKLSPS1Response_GetInfoError, - /** - * A successful response to a [`LSPS1CreateOrderRequest`]. - */ - LDKLSPS1Response_CreateOrder, - /** - * An error response to a [`LSPS1CreateOrderRequest`]. - */ - LDKLSPS1Response_CreateOrderError, - /** - * A successful response to a [`LSPS1GetOrderRequest`]. - */ - LDKLSPS1Response_GetOrder, - /** - * An error response to a [`LSPS1GetOrderRequest`]. - */ - LDKLSPS1Response_GetOrderError, - /** - * Must be last for serialization purposes - */ - LDKLSPS1Response_Sentinel, -} LDKLSPS1Response_Tag; +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct MUST_USE_STRUCT LDKLSPS1Response { - LDKLSPS1Response_Tag tag; - union { - struct { - struct LDKLSPS1GetInfoResponse get_info; - }; - struct { - struct LDKLSPSResponseError get_info_error; - }; - struct { - struct LDKLSPS1CreateOrderResponse create_order; - }; - struct { - struct LDKLSPSResponseError create_order_error; - }; - struct { - struct LDKLSPS1CreateOrderResponse get_order; - }; - struct { - struct LDKLSPSResponseError get_order_error; - }; - }; -} LDKLSPS1Response; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); /** - * An enum that captures all valid JSON-RPC messages in the bLIP-51 / LSPS1 protocol. + * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. */ -typedef enum LDKLSPS1Message_Tag { - /** - * An LSPS1 JSON-RPC request. - */ - LDKLSPS1Message_Request, - /** - * An LSPS1 JSON-RPC response. - */ - LDKLSPS1Message_Response, - /** - * Must be last for serialization purposes - */ - LDKLSPS1Message_Sentinel, -} LDKLSPS1Message_Tag; +void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); -typedef struct LDKLSPS1Message_LDKRequest_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS1Request _1; -} LDKLSPS1Message_LDKRequest_Body; +/** + * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); -typedef struct LDKLSPS1Message_LDKResponse_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS1Response _1; -} LDKLSPS1Message_LDKResponse_Body; +/** + * Creates a new CResult_RouteParametersConfigDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteParametersConfigDecodeErrorZ CResult_RouteParametersConfigDecodeErrorZ_ok(struct LDKRouteParametersConfig o); -typedef struct MUST_USE_STRUCT LDKLSPS1Message { - LDKLSPS1Message_Tag tag; - union { - LDKLSPS1Message_LDKRequest_Body request; - LDKLSPS1Message_LDKResponse_Body response; - }; -} LDKLSPS1Message; +/** + * Creates a new CResult_RouteParametersConfigDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteParametersConfigDecodeErrorZ CResult_RouteParametersConfigDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteParametersConfigDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersConfigDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_RouteParametersConfigDecodeErrorZ. + */ +void CResult_RouteParametersConfigDecodeErrorZ_free(struct LDKCResult_RouteParametersConfigDecodeErrorZ _res); /** - * A request made to an LSP to learn their current channel fees and parameters. + * Creates a new CResult_RouteParametersConfigDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKLSPS2GetInfoRequest { - /** - * 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. - */ - LDKnativeLSPS2GetInfoRequest *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; -} LDKLSPS2GetInfoRequest; +struct LDKCResult_RouteParametersConfigDecodeErrorZ CResult_RouteParametersConfigDecodeErrorZ_clone(const struct LDKCResult_RouteParametersConfigDecodeErrorZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +/** + * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); /** - * A request to buy a JIT channel. + * Creates a new CResult_RouteHintDecodeErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKLSPS2BuyRequest { - /** - * 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. - */ - LDKnativeLSPS2BuyRequest *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; -} LDKLSPS2BuyRequest; +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); /** - * An enum that captures all the valid JSON-RPC requests in the bLIP-52 / LSPS2 protocol. + * Checks if the given object is currently in the success state */ -typedef enum LDKLSPS2Request_Tag { - /** - * A request to learn an LSP's channel fees and parameters. - */ - LDKLSPS2Request_GetInfo, - /** - * A request to buy a JIT channel from an LSP. - */ - LDKLSPS2Request_Buy, - /** - * Must be last for serialization purposes - */ - LDKLSPS2Request_Sentinel, -} LDKLSPS2Request_Tag; +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); -typedef struct MUST_USE_STRUCT LDKLSPS2Request { - LDKLSPS2Request_Tag tag; - union { - struct { - struct LDKLSPS2GetInfoRequest get_info; - }; - struct { - struct LDKLSPS2BuyRequest buy; - }; - }; -} LDKLSPS2Request; +/** + * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + */ +void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); +/** + * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); /** - * A response to a [`LSPS2GetInfoRequest`] + * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKLSPS2GetInfoResponse { - /** - * 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. - */ - LDKnativeLSPS2GetInfoResponse *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; -} LDKLSPS2GetInfoResponse; +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + */ +void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); /** - * A response to a [`LSPS2BuyRequest`]. - * - * Includes information needed to construct an invoice. + * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKLSPS2BuyResponse { - /** - * 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. - */ - LDKnativeLSPS2BuyResponse *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; -} LDKLSPS2BuyResponse; +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); /** - * An enum that captures all the valid JSON-RPC responses in the bLIP-52 / LSPS2 protocol. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -typedef enum LDKLSPS2Response_Tag { - /** - * A successful response to a [`LSPS2Request::GetInfo`] request. - */ - LDKLSPS2Response_GetInfo, - /** - * An error response to a [`LSPS2Request::GetInfo`] request. - */ - LDKLSPS2Response_GetInfoError, - /** - * A successful response to a [`LSPS2Request::Buy`] request. - */ - LDKLSPS2Response_Buy, - /** - * An error response to a [`LSPS2Request::Buy`] request. - */ - LDKLSPS2Response_BuyError, - /** - * Must be last for serialization purposes - */ - LDKLSPS2Response_Sentinel, -} LDKLSPS2Response_Tag; +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS2Response { - LDKLSPS2Response_Tag tag; - union { - struct { - struct LDKLSPS2GetInfoResponse get_info; - }; - struct { - struct LDKLSPSResponseError get_info_error; - }; - struct { - struct LDKLSPS2BuyResponse buy; - }; - struct { - struct LDKLSPSResponseError buy_error; - }; - }; -} LDKLSPS2Response; +/** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + */ +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); /** - * An enum that captures all valid JSON-RPC messages in the bLIP-52 / LSPS2 protocol. + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. */ -typedef enum LDKLSPS2Message_Tag { - /** - * An LSPS2 JSON-RPC request. - */ - LDKLSPS2Message_Request, - /** - * An LSPS2 JSON-RPC response. - */ - LDKLSPS2Message_Response, - /** - * Must be last for serialization purposes - */ - LDKLSPS2Message_Sentinel, -} LDKLSPS2Message_Tag; +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); -typedef struct LDKLSPS2Message_LDKRequest_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS2Request _1; -} LDKLSPS2Message_LDKRequest_Body; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); -typedef struct LDKLSPS2Message_LDKResponse_Body { - struct LDKLSPSRequestId _0; - struct LDKLSPS2Response _1; -} LDKLSPS2Message_LDKResponse_Body; +/** + * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + */ +void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); -typedef struct MUST_USE_STRUCT LDKLSPS2Message { - LDKLSPS2Message_Tag tag; - union { - LDKLSPS2Message_LDKRequest_Body request; - LDKLSPS2Message_LDKResponse_Body response; - }; -} LDKLSPS2Message; +/** + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); /** - * A (de-)serializable LSPS message allowing to be sent over the wire. + * Creates a new CResult_ChannelLiquiditiesDecodeErrorZ in the success state. */ -typedef enum LDKLSPSMessage_Tag { - /** - * An invalid variant. - */ - LDKLSPSMessage_Invalid, - /** - * An LSPS0 message. - */ - LDKLSPSMessage_LSPS0, - /** - * An LSPS1 message. - */ - LDKLSPSMessage_LSPS1, - /** - * An LSPS2 message. - */ - LDKLSPSMessage_LSPS2, - /** - * Must be last for serialization purposes - */ - LDKLSPSMessage_Sentinel, -} LDKLSPSMessage_Tag; +struct LDKCResult_ChannelLiquiditiesDecodeErrorZ CResult_ChannelLiquiditiesDecodeErrorZ_ok(struct LDKChannelLiquidities o); -typedef struct MUST_USE_STRUCT LDKLSPSMessage { - LDKLSPSMessage_Tag tag; - union { - struct { - struct LDKLSPSResponseError invalid; - }; - struct { - struct LDKLSPS0Message lsps0; - }; - struct { - struct LDKLSPS1Message lsps1; - }; - struct { - struct LDKLSPS2Message lsps2; - }; - }; -} LDKLSPSMessage; +/** + * Creates a new CResult_ChannelLiquiditiesDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelLiquiditiesDecodeErrorZ CResult_ChannelLiquiditiesDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelLiquiditiesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelLiquiditiesDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_ChannelLiquiditiesDecodeErrorZ. + */ +void CResult_ChannelLiquiditiesDecodeErrorZ_free(struct LDKCResult_ChannelLiquiditiesDecodeErrorZ _res); /** - * The main server-side object allowing to send and receive bLIP-50 / LSPS0 messages. + * Creates a new CResult_ChannelLiquiditiesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKLSPS0ServiceHandler { - /** - * 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. - */ - LDKnativeLSPS0ServiceHandler *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; -} LDKLSPS0ServiceHandler; +struct LDKCResult_ChannelLiquiditiesDecodeErrorZ CResult_ChannelLiquiditiesDecodeErrorZ_clone(const struct LDKCResult_ChannelLiquiditiesDecodeErrorZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); /** - * Client-side configuration options for bLIP-51 / LSPS1 channel requests. + * Creates a new C2Tuple_u64u64Z from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKLSPS1ClientConfig { - /** - * 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. - */ - LDKnativeLSPS1ClientConfig *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; -} LDKLSPS1ClientConfig; +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +/** + * Frees any resources used by the C2Tuple_u64u64Z. + */ +void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); +/** + * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); /** - * The main object allowing to send and receive bLIP-51 / LSPS1 messages. + * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing */ -typedef struct MUST_USE_STRUCT LDKLSPS1ClientHandler { - /** - * 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. - */ - LDKnativeLSPS1ClientHandler *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; -} LDKLSPS1ClientHandler; +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + */ +void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); +/** + * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); /** - * A Lightning payment using BOLT 11. + * Creates a new C2Tuple_Z from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKLSPS1Bolt11PaymentInfo { - /** - * 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. - */ - LDKnativeLSPS1Bolt11PaymentInfo *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; -} LDKLSPS1Bolt11PaymentInfo; +struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); +/** + * Frees any resources used by the C2Tuple_Z. + */ +void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); +/** + * Creates a new C2Tuple__u1632_u1632Z from the contained elements. + */ +struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); /** - * An onchain payment. + * Frees any resources used by the C2Tuple__u1632_u1632Z. */ -typedef struct MUST_USE_STRUCT LDKLSPS1OnchainPaymentInfo { - /** - * 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. - */ - LDKnativeLSPS1OnchainPaymentInfo *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; -} LDKLSPS1OnchainPaymentInfo; +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 LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); +/** + * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing + */ +struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); /** - * Details regarding a detected on-chain payment. + * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state */ -typedef struct MUST_USE_STRUCT LDKLSPS1OnchainPayment { - /** - * 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. - */ - LDKnativeLSPS1OnchainPayment *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; -} LDKLSPS1OnchainPayment; +void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); +/** + * Constructs a new COption_f64Z containing a f64 + */ +struct LDKCOption_f64Z COption_f64Z_some(double o); +/** + * Constructs a new COption_f64Z containing nothing + */ +struct LDKCOption_f64Z COption_f64Z_none(void); /** - * Client-side configuration options for JIT channels. + * Frees any resources associated with the f64, if we are in the Some state */ -typedef struct MUST_USE_STRUCT LDKLSPS2ClientConfig { - /** - * 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. - */ - LDKnativeLSPS2ClientConfig *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; -} LDKLSPS2ClientConfig; +void COption_f64Z_free(struct LDKCOption_f64Z _res); +/** + * Creates a new COption_f64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); +/** + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + */ +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); /** - * The main object allowing to send and receive bLIP-52 / LSPS2 messages. - * - * Note that currently only the 'client-trusts-LSP' trust model is supported, i.e., we don't - * provide any additional API guidance to allow withholding the preimage until the channel is - * opened. Please refer to the [`bLIP-52 / LSPS2 specification`] for more information. - * - * [`bLIP-52 / LSPS2 specification`]: https://github.com/lightning/blips/blob/master/blip-0052.md#trust-models + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. */ -typedef struct MUST_USE_STRUCT LDKLSPS2ClientHandler { - /** - * 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. - */ - LDKnativeLSPS2ClientHandler *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; -} LDKLSPS2ClientHandler; +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + */ +void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); /** - * A newtype that holds a `short_channel_id` in human readable format of BBBxTTTx000. + * Creates a new CResult_BestBlockDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKLSPS2InterceptScid { - /** - * 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. - */ - LDKnativeLSPS2InterceptScid *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; -} LDKLSPS2InterceptScid; +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_ok(struct LDKBestBlock o); +/** + * Creates a new CResult_BestBlockDecodeErrorZ in the error state. + */ +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_err(struct LDKDecodeError e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BestBlockDecodeErrorZ_is_ok(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR o); /** - * Server-side configuration options for JIT channels. + * Frees any resources used by the CResult_BestBlockDecodeErrorZ. */ -typedef struct MUST_USE_STRUCT LDKLSPS2ServiceConfig { - /** - * 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. - */ - LDKnativeLSPS2ServiceConfig *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; -} LDKLSPS2ServiceConfig; +void CResult_BestBlockDecodeErrorZ_free(struct LDKCResult_BestBlockDecodeErrorZ _res); +/** + * Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_clone(const struct LDKCResult_BestBlockDecodeErrorZ *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_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); /** - * The main object allowing to send and receive bLIP-52 / LSPS2 messages. + * Creates a new C2Tuple_usizeTransactionZ from the contained elements. */ -typedef struct MUST_USE_STRUCT LDKLSPS2ServiceHandler { - /** - * 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. - */ - LDKnativeLSPS2ServiceHandler *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; -} LDKLSPS2ServiceHandler; +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +/** + * Frees any resources used by the C2Tuple_usizeTransactionZ. + */ +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** - * The default [`MessageQueue`] Implementation used by [`LiquidityManager`]. - * - * [`LiquidityManager`]: crate::LiquidityManager + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef struct MUST_USE_STRUCT LDKMessageQueue { - /** - * 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. - */ - LDKnativeMessageQueue *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; -} LDKMessageQueue; +struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR orig); /** - * A callback which will be called to trigger network message processing. - * - * Usually, this should call [`PeerManager::process_events`]. - * - * [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events + * Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. */ -typedef struct LDKProcessMessagesCallback { - /** - * 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; - /** - * The method which is called. - */ - void (*call)(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); -} LDKProcessMessagesCallback; +struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, uint32_t b, struct LDKCOption_ThirtyTwoBytesZ c); -extern const uintptr_t MAX_BUF_SIZE; +/** + * Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. + */ +void C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res); -extern const uintptr_t KVSTORE_NAMESPACE_KEY_MAX_LEN; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res); -extern const uint64_t MAX_SCID_BLOCK; +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); -extern const uint64_t MAX_SCID_TX_INDEX; +/** + * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. + */ +struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); -extern const uint64_t MAX_SCID_VOUT_INDEX; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); -extern const uint32_t PRUNE_DELAY_BLOCKS; +/** + * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. + */ +void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +/** + * 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); -extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); -extern const uint32_t ANTI_REORG_DELAY; +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); -extern const uint32_t ARCHIVAL_DELAY_BLOCKS; +/** + * Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements. + */ +struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKChannelId b, struct LDKCVec_MonitorEventZ c, struct LDKPublicKey d); -extern const uint16_t BREAKDOWN_TIMEOUT; +/** + * Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ. + */ +void C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _res); -extern const uint16_t MIN_CLTV_EXPIRY_DELTA; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res); -extern const uint16_t MIN_FINAL_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_OfferIdDecodeErrorZ in the success state. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_ok(struct LDKOfferId o); -extern const uint16_t MAX_HTLCS; +/** + * Creates a new CResult_OfferIdDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferIdDecodeErrorZ_is_ok(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR o); -extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; +/** + * Frees any resources used by the CResult_OfferIdDecodeErrorZ. + */ +void CResult_OfferIdDecodeErrorZ_free(struct LDKCResult_OfferIdDecodeErrorZ _res); -extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; +/** + * Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_clone(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t ANCHOR_INPUT_WITNESS_WEIGHT; +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); -extern const uint64_t HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT; +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); -extern const uint64_t HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); -extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; +/** + * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. + */ +void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); -extern const uintptr_t PAYER_NOTE_LIMIT; +/** + * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); -extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_ok(struct LDKOffer o); -extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); -extern const uint8_t DEFAULT_MAX_PATH_COUNT; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR o); -extern const uint8_t MAX_PATH_LENGTH_ESTIMATE; +/** + * Frees any resources used by the CResult_OfferBolt12SemanticErrorZ. + */ +void CResult_OfferBolt12SemanticErrorZ_free(struct LDKCResult_OfferBolt12SemanticErrorZ _res); -extern const uint64_t MAX_TIMESTAMP; +/** + * Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR orig); -extern const uint64_t DEFAULT_EXPIRY_TIME; +/** + * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder o); -extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); -extern const uintptr_t MAX_LENGTH; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_PAYMENT_HASH; +/** + * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ. + */ +void CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ _res); -extern const uint8_t TAG_DESCRIPTION; +/** + * Creates a new CResult_OfferDecodeErrorZ in the success state. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_ok(struct LDKOffer o); -extern const uint8_t TAG_PAYEE_PUB_KEY; +/** + * Creates a new CResult_OfferDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint8_t TAG_DESCRIPTION_HASH; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferDecodeErrorZ_is_ok(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_EXPIRY_TIME; +/** + * Frees any resources used by the CResult_OfferDecodeErrorZ. + */ +void CResult_OfferDecodeErrorZ_free(struct LDKCResult_OfferDecodeErrorZ _res); -extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_OfferDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_clone(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR orig); -extern const uint8_t TAG_FALLBACK; +/** + * Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ in the success state. + */ +struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ CResult_CurrencyCodeCurrencyCodeErrorZ_ok(struct LDKCurrencyCode o); -extern const uint8_t TAG_PRIVATE_ROUTE; +/** + * Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ in the error state. + */ +struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ CResult_CurrencyCodeCurrencyCodeErrorZ_err(struct LDKCurrencyCodeError e); -extern const uint8_t TAG_PAYMENT_SECRET; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CurrencyCodeCurrencyCodeErrorZ_is_ok(const struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_PAYMENT_METADATA; +/** + * Frees any resources used by the CResult_CurrencyCodeCurrencyCodeErrorZ. + */ +void CResult_CurrencyCodeCurrencyCodeErrorZ_free(struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ _res); -extern const uint8_t TAG_FEATURES; +/** + * Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ CResult_CurrencyCodeCurrencyCodeErrorZ_clone(const struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ *NONNULL_PTR orig); -extern const uintptr_t MAX_EVENT_QUEUE_SIZE; +/** + * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. + */ +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o); -extern const uint16_t LSPS_MESSAGE_TYPE_ID; +/** + * Creates a new CResult_OfferBolt12ParseErrorZ in the error state. + */ +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); -struct LDKStr _ldk_get_compiled_version(void); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o); -struct LDKStr _ldk_c_bindings_get_compiled_version(void); +/** + * Frees any resources used by the CResult_OfferBolt12ParseErrorZ. + */ +void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res); /** - * Gets the 128-bit integer, as 16 little-endian bytes + * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); +struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig); /** - * Constructs a new U128 from 16 little-endian bytes + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); +void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res); /** - * Constructs a new WitnessProgram given a version and program bytes. - * - * The program MUST be at least 2 bytes and no longer than 40 bytes long. - * Further, if the version is 0, the program MUST be either exactly 20 or exactly 32 bytes long. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKWitnessProgram WitnessProgram_new(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); +void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res); /** - * Gets the `WitnessVersion` of the given `WitnessProgram` + * Creates a new CResult_UtxoDecodeErrorZ in the success state. */ -struct LDKWitnessVersion WitnessProgram_get_version(const struct LDKWitnessProgram *NONNULL_PTR prog); +struct LDKCResult_UtxoDecodeErrorZ CResult_UtxoDecodeErrorZ_ok(struct LDKUtxo o); /** - * Gets the witness program bytes of the given `WitnessProgram` + * Creates a new CResult_UtxoDecodeErrorZ in the error state. */ -struct LDKu8slice WitnessProgram_get_program(const struct LDKWitnessProgram *NONNULL_PTR prog); +struct LDKCResult_UtxoDecodeErrorZ CResult_UtxoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new WitnessProgram which has the same data as `orig` + * Checks if the given object is currently in the success state */ -struct LDKWitnessProgram WitnessProgram_clone(const struct LDKWitnessProgram *NONNULL_PTR orig); +bool CResult_UtxoDecodeErrorZ_is_ok(const struct LDKCResult_UtxoDecodeErrorZ *NONNULL_PTR o); /** - * Releases any memory held by the given `WitnessProgram` (which is currently none) + * Frees any resources used by the CResult_UtxoDecodeErrorZ. */ -void WitnessProgram_free(struct LDKWitnessProgram o); +void CResult_UtxoDecodeErrorZ_free(struct LDKCResult_UtxoDecodeErrorZ _res); /** - * Gets the string representation of the address in `addr` + * Creates a new CResult_UtxoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKStr Address_to_string(const struct LDKAddress *NONNULL_PTR addr); +struct LDKCResult_UtxoDecodeErrorZ CResult_UtxoDecodeErrorZ_clone(const struct LDKCResult_UtxoDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new `Address` (option) from the given string representation. - * - * Returns `None` only if the address is invalid. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_AddressZ Address_new(struct LDKStr s); +void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res); /** - * Releases any memory held by the given `Address` + * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut */ -void Address_free(struct LDKAddress o); +struct LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o); /** - * Creates a new Address which has the same data as `orig` + * Constructs a new COption_TxOutZ containing nothing */ -struct LDKAddress Address_clone(const struct LDKAddress *NONNULL_PTR orig); +struct LDKCOption_TxOutZ COption_TxOutZ_none(void); /** - * Convenience function for constructing a new BigEndianScalar + * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state */ -struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); +void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res); /** - * Creates a new BigEndianScalar which has the same data as `orig` + * Creates a new COption_TxOutZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKBigEndianScalar BigEndianScalar_clone(const struct LDKBigEndianScalar *NONNULL_PTR orig); +struct LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig); /** - * Creates a new Bech32Error which has the same data as `orig` + * Creates a new CResult_u64ShortChannelIdErrorZ in the success state. */ -struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); +struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_ok(uint64_t o); /** - * Releases any memory held by the given `Bech32Error` (which is currently none) + * Creates a new CResult_u64ShortChannelIdErrorZ in the error state. */ -void Bech32Error_free(struct LDKBech32Error o); +struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_err(enum LDKShortChannelIdError e); /** - * Frees the data buffer, if data_is_owned is set and datalen > 0. + * Checks if the given object is currently in the success state */ -void Transaction_free(struct LDKTransaction _res); +bool CResult_u64ShortChannelIdErrorZ_is_ok(const struct LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR o); /** - * Creates a new Witness which has the same data as `orig` but with a new buffer. + * Frees any resources used by the CResult_u64ShortChannelIdErrorZ. */ -struct LDKWitness Witness_clone(const struct LDKWitness *NONNULL_PTR orig); +void CResult_u64ShortChannelIdErrorZ_free(struct LDKCResult_u64ShortChannelIdErrorZ _res); /** - * Frees the data pointed to by data + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. */ -void Witness_free(struct LDKWitness _res); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_ok(struct LDKPendingHTLCInfo o); /** - * Convenience function for constructing a new TxIn + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. */ -struct LDKTxIn TxIn_new(struct LDKWitness witness, struct LDKCVec_u8Z script_sig, uint32_t sequence, struct LDKThirtyTwoBytes previous_txid, uint32_t previous_vout); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_err(struct LDKInboundHTLCErr e); /** - * Gets the `witness` in the given `TxIn`. + * Checks if the given object is currently in the success state */ -struct LDKWitness TxIn_get_witness(const struct LDKTxIn *NONNULL_PTR txin); +bool CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR o); /** - * Gets the `script_sig` in the given `TxIn`. + * Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. */ -struct LDKu8slice TxIn_get_script_sig(const struct LDKTxIn *NONNULL_PTR txin); +void CResult_PendingHTLCInfoInboundHTLCErrZ_free(struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res); /** - * Gets the `sequence` in the given `TxIn`. + * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -uint32_t TxIn_get_sequence(const struct LDKTxIn *NONNULL_PTR txin); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_clone(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR orig); /** - * Gets the previous outpoint txid in the given `TxIn`. + * Creates a new CResult_CVec_UtxoZNoneZ in the success state. */ -struct LDKThirtyTwoBytes TxIn_get_previous_txid(const struct LDKTxIn *NONNULL_PTR txin); +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o); /** - * Gets the previout outpoint index in the given `TxIn`. + * Creates a new CResult_CVec_UtxoZNoneZ in the error state. */ -uint32_t TxIn_get_previous_vout(const struct LDKTxIn *NONNULL_PTR txin); +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void); /** - * Frees the witness and script_sig in a TxIn + * Checks if the given object is currently in the success state */ -void TxIn_free(struct LDKTxIn _res); +bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o); /** - * Convenience function for constructing a new TxOut + * Frees any resources used by the CResult_CVec_UtxoZNoneZ. */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); /** - * Gets the `script_pubkey` in the given `TxOut`. + * Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKu8slice TxOut_get_script_pubkey(const struct LDKTxOut *NONNULL_PTR txout); +struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); /** - * Gets the value in the given `TxOut`. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -uint64_t TxOut_get_value(const struct LDKTxOut *NONNULL_PTR txout); +void CVec_InputZ_free(struct LDKCVec_InputZ _res); /** - * Frees the data pointed to by script_pubkey. + * Creates a new CResult_CoinSelectionNoneZ in the success state. */ -void TxOut_free(struct LDKTxOut _res); +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Creates a new CResult_CoinSelectionNoneZ in the error state. */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Checks if the given object is currently in the success state */ -void Str_free(struct LDKStr _res); +bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Frees any resources used by the CResult_CoinSelectionNoneZ. */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_u8Z_free(struct LDKCVec_u8Z _res); +struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + * Creates a new CResult_NodeIdDecodeErrorZ in the success state. */ -struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKRefundMaybeWithDerivedMetadataBuilder o); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); /** - * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + * Creates a new CResult_NodeIdDecodeErrorZ in the error state. */ -struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ. + * Frees any resources used by the CResult_NodeIdDecodeErrorZ. */ -void CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); +void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); /** - * Creates a new CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RefundBolt12SemanticErrorZ in the success state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_ok(struct LDKRefund o); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_RefundBolt12SemanticErrorZ in the error state. + * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_RefundBolt12SemanticErrorZ_is_ok(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RefundBolt12SemanticErrorZ. + * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. */ -void CResult_RefundBolt12SemanticErrorZ_free(struct LDKCResult_RefundBolt12SemanticErrorZ _res); +void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); /** - * Creates a new CResult_RefundBolt12SemanticErrorZ 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_RefundBolt12SemanticErrorZ CResult_RefundBolt12SemanticErrorZ_clone(const struct LDKCResult_RefundBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u64Z containing a u64 + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); /** - * Constructs a new COption_u64Z containing nothing + * Constructs a new COption_NetworkUpdateZ containing nothing */ -struct LDKCOption_u64Z COption_u64Z_none(void); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); /** - * Frees any resources associated with the u64, if we are in the Some state + * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); /** - * Creates a new COption_u64Z which has the same data as `orig` + * Creates a new COption_NetworkUpdateZ 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 LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. */ -void CVec_BlindedMessagePathZ_free(struct LDKCVec_BlindedMessagePathZ _res); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); /** - * Creates a new CResult_RefundDecodeErrorZ in the success state. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. */ -struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_ok(struct LDKRefund o); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RefundDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. */ -bool CResult_RefundDecodeErrorZ_is_ok(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR o); +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_RefundDecodeErrorZ. + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_RefundDecodeErrorZ_free(struct LDKCResult_RefundDecodeErrorZ _res); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RefundDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup */ -struct LDKCResult_RefundDecodeErrorZ CResult_RefundDecodeErrorZ_clone(const struct LDKCResult_RefundDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the success state. + * Constructs a new COption_UtxoLookupZ containing nothing */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_ok(struct LDKRefund o); +struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); /** - * Creates a new CResult_RefundBolt12ParseErrorZ in the error state. + * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state */ -struct LDKCResult_RefundBolt12ParseErrorZ CResult_RefundBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); +void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); + +/** + * Creates a new CResult_NoneLightningErrorZ in the success state. + */ +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); + +/** + * Creates a new CResult_NoneLightningErrorZ in the error state. + */ +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError 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_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RefundBolt12ParseErrorZ. + * Frees any resources used by the CResult_NoneLightningErrorZ. */ -void CResult_RefundBolt12ParseErrorZ_free(struct LDKCResult_RefundBolt12ParseErrorZ _res); +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); /** - * Creates a new CResult_RefundBolt12ParseErrorZ which has the same data as `orig` + * Creates a new CResult_NoneLightningErrorZ 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_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RetryDecodeErrorZ in the success state. + * Creates a new CResult_boolLightningErrorZ in the success state. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_ok(struct LDKRetry o); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); /** - * Creates a new CResult_RetryDecodeErrorZ in the error state. + * Creates a new CResult_boolLightningErrorZ in the error state. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RetryDecodeErrorZ_is_ok(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR o); +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RetryDecodeErrorZ. + * Frees any resources used by the CResult_boolLightningErrorZ. */ -void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); /** - * Creates a new CResult_RetryDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ThirtyTwoBytesZ 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_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_some(struct LDKThirtyTwoBytes o); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); /** - * Constructs a new COption_ThirtyTwoBytesZ containing nothing + * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. */ -struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_none(void); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); /** - * Frees any resources associated with the crate::c_types::ThirtyTwoBytes, if we are in the Some state + * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. */ -void COption_ThirtyTwoBytesZ_free(struct LDKCOption_ThirtyTwoBytesZ _res); +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); /** - * Creates a new COption_ThirtyTwoBytesZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ */ -struct LDKCOption_ThirtyTwoBytesZ COption_ThirtyTwoBytesZ_clone(const struct LDKCOption_ThirtyTwoBytesZ *NONNULL_PTR orig); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); /** - * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing */ -struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); /** - * Constructs a new COption_CVec_u8ZZ containing nothing + * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state */ -struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void); +void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); /** - * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state + * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); /** - * Creates a new COption_CVec_u8ZZ 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_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig); +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. */ -void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res); +void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); /** - * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); /** - * 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_ChannelInfoDecodeErrorZ in the success state. */ -struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_clone(const struct LDKC2Tuple_u64CVec_u8ZZ *NONNULL_PTR orig); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); /** - * Creates a new C2Tuple_u64CVec_u8ZZ from the contained elements. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. */ -struct LDKC2Tuple_u64CVec_u8ZZ C2Tuple_u64CVec_u8ZZ_new(uint64_t a, struct LDKCVec_u8Z b); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_u64CVec_u8ZZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_u64CVec_u8ZZ_free(struct LDKC2Tuple_u64CVec_u8ZZ _res); +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. */ -void CVec_C2Tuple_u64CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u64CVec_u8ZZZ _res); +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ in the success state. + * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_ok(struct LDKRecipientOnionFields o); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ in the error state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_err(void); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. */ -bool CResult_RecipientOnionFieldsNoneZ_is_ok(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_RecipientOnionFieldsNoneZ. + * Checks if the given object is currently in the success state */ -void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFieldsNoneZ _res); +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RecipientOnionFieldsNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. */ -struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_clone(const struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ *NONNULL_PTR orig); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_DNSResolverMessageResponseInstructionZ from the contained elements. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_new(struct LDKDNSResolverMessage a, struct LDKResponseInstruction b); +void CVec_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); /** - * Frees any resources used by the C2Tuple_DNSResolverMessageResponseInstructionZ. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. */ -void C2Tuple_DNSResolverMessageResponseInstructionZ_free(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ _res); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); /** - * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. */ -struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_some(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ o); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_none(void); +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ, if we are in the Some state + * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. */ -void COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ _res); +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); /** - * Creates a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ which has the same data as `orig` + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ *NONNULL_PTR orig); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); /** - * 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_NodeAliasDecodeErrorZ in the success state. */ -struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ *NONNULL_PTR orig); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); /** - * Creates a new C2Tuple_DNSResolverMessageMessageSendInstructionsZ from the contained elements. + * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. */ -struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_new(struct LDKDNSResolverMessage a, struct LDKMessageSendInstructions b); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_DNSResolverMessageMessageSendInstructionsZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ _res); +bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. */ -void CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ _res); +void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); /** - * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the success state. + * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_ok(struct LDKDNSResolverMessage o); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the error state. + * Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo */ -struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_some(struct LDKNodeAnnouncementInfo o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_NodeAnnouncementInfoZ containing nothing */ -bool CResult_DNSResolverMessageDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_none(void); /** - * Frees any resources used by the CResult_DNSResolverMessageDecodeErrorZ. + * Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state */ -void CResult_DNSResolverMessageDecodeErrorZ_free(struct LDKCResult_DNSResolverMessageDecodeErrorZ _res); +void COption_NodeAnnouncementInfoZ_free(struct LDKCOption_NodeAnnouncementInfoZ _res); /** - * Creates a new CResult_DNSResolverMessageDecodeErrorZ which has the same data as `orig` + * Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_clone(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_clone(const struct LDKCOption_NodeAnnouncementInfoZ *NONNULL_PTR orig); /** - * Creates a new CResult_HumanReadableNameNoneZ in the success state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. */ -struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_ok(struct LDKHumanReadableName o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); /** - * Creates a new CResult_HumanReadableNameNoneZ in the error state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. */ -struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_err(void); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HumanReadableNameNoneZ_is_ok(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR o); +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HumanReadableNameNoneZ. + * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. */ -void CResult_HumanReadableNameNoneZ_free(struct LDKCResult_HumanReadableNameNoneZ _res); +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); /** - * Creates a new CResult_HumanReadableNameNoneZ which has the same data as `orig` + * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_clone(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR orig); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HumanReadableNameDecodeErrorZ in the success state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ -struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_ok(struct LDKHumanReadableName o); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); /** - * Creates a new CResult_HumanReadableNameDecodeErrorZ in the error state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. */ -struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HumanReadableNameDecodeErrorZ_is_ok(const struct LDKCResult_HumanReadableNameDecodeErrorZ *NONNULL_PTR o); +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HumanReadableNameDecodeErrorZ. + * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. */ -void CResult_HumanReadableNameDecodeErrorZ_free(struct LDKCResult_HumanReadableNameDecodeErrorZ _res); +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Creates a new CResult_HumanReadableNameDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ */ -struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_clone(const struct LDKCResult_HumanReadableNameDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); /** - * Creates a new tuple which has the same data as `orig` + * Constructs a new COption_CVec_SocketAddressZZ containing nothing + */ +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state + */ +void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); + +/** + * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_clone(const struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ *NONNULL_PTR orig); +struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_DNSSECQueryDNSResolverContextZ from the contained elements. + * Constructs a new COption_NoneZ containing a */ -struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_new(struct LDKDNSSECQuery a, struct LDKDNSResolverContext b); +enum LDKCOption_NoneZ COption_NoneZ_some(void); /** - * Frees any resources used by the C2Tuple_DNSSECQueryDNSResolverContextZ. + * Constructs a new COption_NoneZ containing nothing */ -void C2Tuple_DNSSECQueryDNSResolverContextZ_free(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ _res); +enum LDKCOption_NoneZ COption_NoneZ_none(void); /** - * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the success state. + * Frees any resources associated with the , if we are in the Some state */ -struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_ok(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ o); +void COption_NoneZ_free(enum LDKCOption_NoneZ _res); /** - * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the error state. + * Creates a new COption_NoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_err(void); +enum LDKCOption_NoneZ COption_NoneZ_clone(const enum LDKCOption_NoneZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext */ -bool CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_is_ok(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *NONNULL_PTR o); +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_some(struct LDKPaymentContext o); /** - * Frees any resources used by the CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ. + * Constructs a new COption_PaymentContextZ containing nothing */ -void CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ _res); +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_none(void); /** - * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state */ -struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_clone(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *NONNULL_PTR orig); +void COption_PaymentContextZ_free(struct LDKCOption_PaymentContextZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new COption_PaymentContextZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_clone(const struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ *NONNULL_PTR orig); +struct LDKCOption_PaymentContextZ COption_PaymentContextZ_clone(const struct LDKCOption_PaymentContextZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_HumanReadableNameThirtyTwoBytesZ from the contained elements. + * Constructs a new COption_StrZ containing a crate::c_types::Str */ -struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_new(struct LDKHumanReadableName a, struct LDKThirtyTwoBytes b); +struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); /** - * Frees any resources used by the C2Tuple_HumanReadableNameThirtyTwoBytesZ. + * Constructs a new COption_StrZ containing nothing */ -void C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ _res); +struct LDKCOption_StrZ COption_StrZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::c_types::Str, if we are in the Some state */ -void CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ _res); +void COption_StrZ_free(struct LDKCOption_StrZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new COption_StrZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ *NONNULL_PTR orig); +struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ 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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKOffer b); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ. + * Creates a new C2Tuple_u64u16Z from the contained elements. */ -void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ _res); +struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); /** - * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ + * Frees any resources used by the C2Tuple_u64u16Z. */ -struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ o); +void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); /** - * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing nothing + * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z */ -struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_none(void); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ, if we are in the Some state + * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing */ -void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ _res); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); /** - * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state */ -struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ *NONNULL_PTR orig); +void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); /** - * Creates a new tuple 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 LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ from the contained elements. + * Creates a new CResult_ChannelIdAPIErrorZ in the success state. */ -struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKStr b); +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_ok(struct LDKChannelId o); /** - * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ. + * Creates a new CResult_ChannelIdAPIErrorZ in the error state. */ -void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ _res); +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_err(struct LDKAPIError e); /** - * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ o); +bool CResult_ChannelIdAPIErrorZ_is_ok(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing nothing + * Frees any resources used by the CResult_ChannelIdAPIErrorZ. */ -struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_none(void); +void CResult_ChannelIdAPIErrorZ_free(struct LDKCResult_ChannelIdAPIErrorZ _res); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ, if we are in the Some state + * Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ _res); +struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_clone(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ 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_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ *NONNULL_PTR orig); +void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); /** - * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. + * Creates a new CResult_NoneAPIErrorZ in the success state. */ -struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKUnsignedBolt12Invoice o); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); /** - * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state. + * Creates a new CResult_NoneAPIErrorZ in the error state. */ -struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ. + * Frees any resources used by the CResult_NoneAPIErrorZ. */ -void CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ _res); +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); /** - * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state. + * Creates a new CResult_NoneRetryableSendFailureZ in the success state. */ -struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(struct LDKBolt12Invoice o); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); /** - * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state. + * Creates a new CResult_NoneRetryableSendFailureZ in the error state. */ -struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ. + * Frees any resources used by the CResult_NoneRetryableSendFailureZ. */ -void CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ _res); +void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); /** - * Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(const struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_SchnorrSignatureNoneZ in the success state. + * Creates a new CResult_NoneBolt11PaymentErrorZ in the success state. */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_ok(struct LDKSchnorrSignature o); +struct LDKCResult_NoneBolt11PaymentErrorZ CResult_NoneBolt11PaymentErrorZ_ok(void); /** - * Creates a new CResult_SchnorrSignatureNoneZ in the error state. + * Creates a new CResult_NoneBolt11PaymentErrorZ in the error state. */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_err(void); +struct LDKCResult_NoneBolt11PaymentErrorZ CResult_NoneBolt11PaymentErrorZ_err(struct LDKBolt11PaymentError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SchnorrSignatureNoneZ_is_ok(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR o); +bool CResult_NoneBolt11PaymentErrorZ_is_ok(const struct LDKCResult_NoneBolt11PaymentErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SchnorrSignatureNoneZ. + * Frees any resources used by the CResult_NoneBolt11PaymentErrorZ. */ -void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ _res); +void CResult_NoneBolt11PaymentErrorZ_free(struct LDKCResult_NoneBolt11PaymentErrorZ _res); /** - * Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext */ -struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); +struct LDKCOption_OffersContextZ COption_OffersContextZ_some(struct LDKOffersContext o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_OffersContextZ containing nothing */ -void CVec_BlindedPaymentPathZ_free(struct LDKCVec_BlindedPaymentPathZ _res); +struct LDKCOption_OffersContextZ COption_OffersContextZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state */ -void CVec_AddressZ_free(struct LDKCVec_AddressZ _res); +void COption_OffersContextZ_free(struct LDKCOption_OffersContextZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new COption_OffersContextZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); +struct LDKCOption_OffersContextZ COption_OffersContextZ_clone(const struct LDKCOption_OffersContextZ *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ + * Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_some(struct LDKCVec_ThirtyTwoBytesZ o); +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_ok(void); /** - * Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing + * Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ COption_CVec_ThirtyTwoBytesZZ_none(void); +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_err(struct LDKBolt12PaymentError e); /** - * Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_CVec_ThirtyTwoBytesZZ_free(struct LDKCOption_CVec_ThirtyTwoBytesZZ _res); +bool CResult_NoneBolt12PaymentErrorZ_is_ok(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR o); /** - * Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` + * Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. + */ +void CResult_NoneBolt12PaymentErrorZ_free(struct LDKCResult_NoneBolt12PaymentErrorZ _res); + +/** + * Creates a new CResult_NoneBolt12PaymentErrorZ 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); +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_clone(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. */ -struct LDKCOption_AmountZ COption_AmountZ_some(struct LDKAmount o); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Constructs a new COption_AmountZ containing nothing + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. */ -struct LDKCOption_AmountZ COption_AmountZ_none(void); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); /** - * Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_AmountZ_free(struct LDKCOption_AmountZ _res); +bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); /** - * Creates a new COption_AmountZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. */ -struct LDKCOption_AmountZ COption_AmountZ_clone(const struct LDKCOption_AmountZ *NONNULL_PTR orig); +void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); /** - * Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_QuantityZ COption_QuantityZ_some(struct LDKQuantity o); +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); /** - * Constructs a new COption_QuantityZ containing nothing + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_QuantityZ COption_QuantityZ_none(void); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state + * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. */ -void COption_QuantityZ_free(struct LDKCOption_QuantityZ _res); +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Creates a new COption_QuantityZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. */ -struct LDKCOption_QuantityZ COption_QuantityZ_clone(const struct LDKCOption_QuantityZ *NONNULL_PTR orig); +void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. */ -struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. */ -struct LDKCResult_ThirtyTwoBytesNoneZ CResult_ThirtyTwoBytesNoneZ_err(void); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(struct LDKProbeSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_ThirtyTwoBytesNoneZ_is_ok(const struct LDKCResult_ThirtyTwoBytesNoneZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. */ -void CResult_ThirtyTwoBytesNoneZ_free(struct LDKCResult_ThirtyTwoBytesNoneZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ _res); /** - * Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ 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); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_ok(struct LDKBolt12Invoice o); +void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); /** - * Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the error state. + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. */ -struct LDKCResult_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + */ +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_Bolt12InvoiceDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *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_Bolt12InvoiceDecodeErrorZ. + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. */ -void CResult_Bolt12InvoiceDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceDecodeErrorZ _res); +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); /** - * Creates a new CResult_Bolt12InvoiceDecodeErrorZ 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_Bolt12InvoiceDecodeErrorZ CResult_Bolt12InvoiceDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b); + +/** + * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o); +void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res); /** - * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res); +struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_clone(const struct LDKC2Tuple_PublicKeyChannelIdZ *NONNULL_PTR orig); /** - * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_new(struct LDKPublicKey a, struct LDKChannelId b); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o); +void C2Tuple_PublicKeyChannelIdZ_free(struct LDKC2Tuple_PublicKeyChannelIdZ _res); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. + * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_some(struct LDKC2Tuple_PublicKeyChannelIdZ o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing */ -bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_none(void); /** - * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state */ -void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res); +void COption_C2Tuple_PublicKeyChannelIdZZ_free(struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ _res); /** - * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` + * Creates a new COption_C2Tuple_PublicKeyChannelIdZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_clone(const struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. */ -void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res); +void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); /** - * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_u16Z containing a u16 */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_u16Z containing nothing */ -void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); +struct LDKCOption_u16Z COption_u16Z_none(void); /** - * Constructs a new COption_u32Z containing a u32 + * Frees any resources associated with the u16, if we are in the Some state */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); +void COption_u16Z_free(struct LDKCOption_u16Z _res); /** - * Constructs a new COption_u32Z containing nothing + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u32Z COption_u32Z_none(void); +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); /** - * Frees any resources associated with the u32, if we are in the Some state + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o); /** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_clone(const struct LDKC2Tuple_CVec_u8Zu64Z *NONNULL_PTR orig); +bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. + * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. */ -struct LDKC2Tuple_CVec_u8Zu64Z C2Tuple_CVec_u8Zu64Z_new(struct LDKCVec_u8Z a, uint64_t b); +void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); /** - * Frees any resources used by the C2Tuple_CVec_u8Zu64Z. + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_CVec_u8Zu64Z_free(struct LDKC2Tuple_CVec_u8Zu64Z _res); +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. + * Creates a new CResult_OfferNoneZ in the success state. */ -struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu64Z o); +struct LDKCResult_OfferNoneZ CResult_OfferNoneZ_ok(struct LDKOffer o); /** - * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. + * Creates a new CResult_OfferNoneZ in the error state. */ -struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err(void); +struct LDKCResult_OfferNoneZ CResult_OfferNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR o); +bool CResult_OfferNoneZ_is_ok(const struct LDKCResult_OfferNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. + * Frees any resources used by the CResult_OfferNoneZ. */ -void CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ _res); +void CResult_OfferNoneZ_free(struct LDKCResult_OfferNoneZ _res); /** - * Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` + * Creates a new CResult_OfferNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ *NONNULL_PTR orig); +struct LDKCResult_OfferNoneZ CResult_OfferNoneZ_clone(const struct LDKCResult_OfferNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_ok(struct LDKChannelDerivationParameters o); +void CVec_DestinationZ_free(struct LDKCVec_DestinationZ _res); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. */ -void CResult_ChannelDerivationParametersDecodeErrorZ_free(struct LDKCResult_ChannelDerivationParametersDecodeErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); /** - * Creates a new CResult_ChannelDerivationParametersDecodeErrorZ 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 LDKCResult_ChannelDerivationParametersDecodeErrorZ CResult_ChannelDerivationParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelDerivationParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_ok(struct LDKHTLCDescriptor o); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR o); +bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. + * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. */ -void CResult_HTLCDescriptorDecodeErrorZ_free(struct LDKCResult_HTLCDescriptorDecodeErrorZ _res); +void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); /** - * Creates a new CResult_HTLCDescriptorDecodeErrorZ 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_HTLCDescriptorDecodeErrorZ CResult_HTLCDescriptorDecodeErrorZ_clone(const struct LDKCResult_HTLCDescriptorDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyNoneZ in the success state. + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_ok(struct LDKPublicKey o); +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_ok(struct LDKCVec_BlindedMessagePathZ o); /** - * Creates a new CResult_PublicKeyNoneZ in the error state. + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_err(void); +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeyNoneZ_is_ok(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR o); +bool CResult_CVec_BlindedMessagePathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyNoneZ. + * Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. */ -void CResult_PublicKeyNoneZ_free(struct LDKCResult_PublicKeyNoneZ _res); +void CResult_CVec_BlindedMessagePathZNoneZ_free(struct LDKCResult_CVec_BlindedMessagePathZNoneZ _res); /** - * Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeyNoneZ CResult_PublicKeyNoneZ_clone(const struct LDKCResult_PublicKeyNoneZ *NONNULL_PTR orig); +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_clone(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult__u832NoneZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult__u832NoneZ CResult__u832NoneZ_ok(struct LDKThirtyTwoBytes o); +void CVec_CommitmentSignedZ_free(struct LDKCVec_CommitmentSignedZ _res); /** - * Creates a new CResult__u832NoneZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult__u832NoneZ CResult__u832NoneZ_err(void); +struct LDKC2Tuple_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_clone(const struct LDKC2Tuple_OffersMessageResponseInstructionZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_OffersMessageResponseInstructionZ from the contained elements. */ -bool CResult__u832NoneZ_is_ok(const struct LDKCResult__u832NoneZ *NONNULL_PTR o); +struct LDKC2Tuple_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_new(struct LDKOffersMessage a, struct LDKResponseInstruction b); /** - * Frees any resources used by the CResult__u832NoneZ. + * Frees any resources used by the C2Tuple_OffersMessageResponseInstructionZ. */ -void CResult__u832NoneZ_free(struct LDKCResult__u832NoneZ _res); +void C2Tuple_OffersMessageResponseInstructionZ_free(struct LDKC2Tuple_OffersMessageResponseInstructionZ _res); /** - * Creates a new CResult__u832NoneZ which has the same data as `orig` + * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ + */ +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_some(struct LDKC2Tuple_OffersMessageResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_OffersMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_OffersMessageResponseInstructionZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult__u832NoneZ CResult__u832NoneZ_clone(const struct LDKCResult__u832NoneZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneNoneZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneNoneZ in the error state. + * Creates a new C2Tuple_OffersMessageMessageSendInstructionsZ from the contained elements. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_new(struct LDKOffersMessage a, struct LDKMessageSendInstructions b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_OffersMessageMessageSendInstructionsZ. */ -bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); +void C2Tuple_OffersMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ _res); /** - * Frees any resources used by the CResult_NoneNoneZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); +void CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ _res); /** - * Creates a new CResult_NoneNoneZ 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_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); +struct LDKC2Tuple_OfferPathsResponseInstructionZ C2Tuple_OfferPathsResponseInstructionZ_clone(const struct LDKC2Tuple_OfferPathsResponseInstructionZ *NONNULL_PTR orig); /** - * Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar + * Creates a new C2Tuple_OfferPathsResponseInstructionZ from the contained elements. */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_some(struct LDKBigEndianScalar o); +struct LDKC2Tuple_OfferPathsResponseInstructionZ C2Tuple_OfferPathsResponseInstructionZ_new(struct LDKOfferPaths a, struct LDKResponseInstruction b); /** - * Constructs a new COption_BigEndianScalarZ containing nothing + * Frees any resources used by the C2Tuple_OfferPathsResponseInstructionZ. */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_none(void); +void C2Tuple_OfferPathsResponseInstructionZ_free(struct LDKC2Tuple_OfferPathsResponseInstructionZ _res); /** - * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state + * Constructs a new COption_C2Tuple_OfferPathsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ */ -void COption_BigEndianScalarZ_free(struct LDKCOption_BigEndianScalarZ _res); +struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ COption_C2Tuple_OfferPathsResponseInstructionZZ_some(struct LDKC2Tuple_OfferPathsResponseInstructionZ o); /** - * Creates a new COption_BigEndianScalarZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_C2Tuple_OfferPathsResponseInstructionZZ containing nothing */ -struct LDKCOption_BigEndianScalarZ COption_BigEndianScalarZ_clone(const struct LDKCOption_BigEndianScalarZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ COption_C2Tuple_OfferPathsResponseInstructionZZ_none(void); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ, if we are in the Some state */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); +void COption_C2Tuple_OfferPathsResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ _res); /** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. + * Creates a new COption_C2Tuple_OfferPathsResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); +struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ COption_C2Tuple_OfferPathsResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); +struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ C2Tuple_ServeStaticInvoiceResponseInstructionZ_clone(const struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. + * Creates a new C2Tuple_ServeStaticInvoiceResponseInstructionZ from the contained elements. */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); +struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ C2Tuple_ServeStaticInvoiceResponseInstructionZ_new(struct LDKServeStaticInvoice a, struct LDKResponseInstruction b); /** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_ServeStaticInvoiceResponseInstructionZ. */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); +void C2Tuple_ServeStaticInvoiceResponseInstructionZ_free(struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ _res); /** - * Creates a new CResult_ECDSASignatureNoneZ in the success state. + * Constructs a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ */ -struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_ok(struct LDKECDSASignature o); +struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_some(struct LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ o); /** - * Creates a new CResult_ECDSASignatureNoneZ in the error state. + * Constructs a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ containing nothing */ -struct LDKCResult_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_err(void); +struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ, if we are in the Some state */ -bool CResult_ECDSASignatureNoneZ_is_ok(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR o); +void COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_free(struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ _res); /** - * Frees any resources used by the CResult_ECDSASignatureNoneZ. + * Creates a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ECDSASignatureNoneZ_free(struct LDKCResult_ECDSASignatureNoneZ _res); +struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ *NONNULL_PTR orig); /** - * Creates a new CResult_ECDSASignatureNoneZ 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_ECDSASignatureNoneZ CResult_ECDSASignatureNoneZ_clone(const struct LDKCResult_ECDSASignatureNoneZ *NONNULL_PTR orig); +struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_clone(const struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ *NONNULL_PTR orig); /** - * Creates a new CResult_TransactionNoneZ in the success state. + * Creates a new C2Tuple_ReleaseHeldHtlcResponseInstructionZ from the contained elements. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); +struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_new(struct LDKReleaseHeldHtlc a, struct LDKResponseInstruction b); /** - * Creates a new CResult_TransactionNoneZ in the error state. + * Frees any resources used by the C2Tuple_ReleaseHeldHtlcResponseInstructionZ. */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); +void C2Tuple_ReleaseHeldHtlcResponseInstructionZ_free(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ _res); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ */ -bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_some(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ o); /** - * Frees any resources used by the CResult_TransactionNoneZ. + * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing nothing */ -void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_none(void); /** - * Creates a new CResult_TransactionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ, if we are in the Some state */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); +void COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ _res); /** - * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the success state. + * Creates a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_ok(struct LDKEcdsaChannelSigner o); +struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ *NONNULL_PTR orig); /** - * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ from the contained elements. */ -bool CResult_EcdsaChannelSignerDecodeErrorZ_is_ok(const struct LDKCResult_EcdsaChannelSignerDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_new(struct LDKAsyncPaymentsMessage a, struct LDKMessageSendInstructions b); /** - * Frees any resources used by the CResult_EcdsaChannelSignerDecodeErrorZ. + * Frees any resources used by the C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ. */ -void CResult_EcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_EcdsaChannelSignerDecodeErrorZ _res); +void C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ _res); /** - * Creates a new CResult_EcdsaChannelSignerDecodeErrorZ 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 LDKCResult_EcdsaChannelSignerDecodeErrorZ CResult_EcdsaChannelSignerDecodeErrorZ_clone(const struct LDKCResult_EcdsaChannelSignerDecodeErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ _res); /** - * Creates a new CResult_CVec_u8ZNoneZ in the success state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); /** - * Creates a new CResult_CVec_u8ZNoneZ in the error state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_err(void); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_u8ZNoneZ_is_ok(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR o); +bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZNoneZ. + * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. */ -void CResult_CVec_u8ZNoneZ_free(struct LDKCResult_CVec_u8ZNoneZ _res); +void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); /** - * Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_u8ZNoneZ CResult_CVec_u8ZNoneZ_clone(const struct LDKCResult_CVec_u8ZNoneZ *NONNULL_PTR orig); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptNoneZ in the success state. + * Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_ok(struct LDKShutdownScript o); +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_ok(struct LDKBlindedForward o); /** - * Creates a new CResult_ShutdownScriptNoneZ in the error state. + * Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_err(void); +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptNoneZ_is_ok(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR o); +bool CResult_BlindedForwardDecodeErrorZ_is_ok(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptNoneZ. + * Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. */ -void CResult_ShutdownScriptNoneZ_free(struct LDKCResult_ShutdownScriptNoneZ _res); +void CResult_BlindedForwardDecodeErrorZ_free(struct LDKCResult_BlindedForwardDecodeErrorZ _res); /** - * Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig` + * Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptNoneZ CResult_ShutdownScriptNoneZ_clone(const struct LDKCResult_ShutdownScriptNoneZ *NONNULL_PTR orig); +struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_clone(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_u16Z containing a u16 + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_ok(struct LDKPendingHTLCRouting o); /** - * Constructs a new COption_u16Z containing nothing + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. */ -struct LDKCOption_u16Z COption_u16Z_none(void); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the u16, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +bool CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_u16Z which has the same data as `orig` + * Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. + */ +void CResult_PendingHTLCRoutingDecodeErrorZ_free(struct LDKCResult_PendingHTLCRoutingDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ 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); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_boolZ containing a bool + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. */ -struct LDKCOption_boolZ COption_boolZ_some(bool o); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_ok(struct LDKPendingHTLCInfo o); /** - * Constructs a new COption_boolZ containing nothing + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. */ -struct LDKCOption_boolZ COption_boolZ_none(void); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the bool, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_boolZ_free(struct LDKCOption_boolZ _res); +bool CResult_PendingHTLCInfoDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_boolZ which has the same data as `orig` + * Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. + */ +void CResult_PendingHTLCInfoDecodeErrorZ_free(struct LDKCResult_PendingHTLCInfoDecodeErrorZ _res); + +/** + * Creates a new CResult_PendingHTLCInfoDecodeErrorZ 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); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_WitnessNoneZ in the success state. + * Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. */ -struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_ok(struct LDKWitness o); +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_ok(enum LDKBlindedFailure o); /** - * Creates a new CResult_WitnessNoneZ in the error state. + * Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. */ -struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_err(void); +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_WitnessNoneZ_is_ok(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR o); +bool CResult_BlindedFailureDecodeErrorZ_is_ok(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_WitnessNoneZ. + * Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. */ -void CResult_WitnessNoneZ_free(struct LDKCResult_WitnessNoneZ _res); +void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDecodeErrorZ _res); /** - * Creates a new CResult_WitnessNoneZ which has the same data as `orig` + * Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_WitnessNoneZ CResult_WitnessNoneZ_clone(const struct LDKCResult_WitnessNoneZ *NONNULL_PTR orig); +struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_ECDSASignatureZ_free(struct LDKCVec_ECDSASignatureZ _res); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _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_ThirtyTwoBytesChannelManagerZ from the contained elements. */ -struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_clone(const struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ *NONNULL_PTR orig); +struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. */ -struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(struct LDKECDSASignature a, struct LDKCVec_ECDSASignatureZ b); +void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); /** - * Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. */ -void C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ _res); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(struct LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err(void); +bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. */ -bool CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR o); +void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. + * Creates a new CResult_NoneSecp256k1ErrorZ in the success state. */ -void CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ _res); +struct LDKCResult_NoneSecp256k1ErrorZ CResult_NoneSecp256k1ErrorZ_ok(void); /** - * Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneSecp256k1ErrorZ in the error state. */ -struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneSecp256k1ErrorZ CResult_NoneSecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); +bool CResult_NoneSecp256k1ErrorZ_is_ok(const struct LDKCResult_NoneSecp256k1ErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NoneSecp256k1ErrorZ. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NoneSecp256k1ErrorZ_free(struct LDKCResult_NoneSecp256k1ErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NoneSecp256k1ErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NoneSecp256k1ErrorZ CResult_NoneSecp256k1ErrorZ_clone(const struct LDKCResult_NoneSecp256k1ErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o); /** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + * Checks if the given object is currently in the success state */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +bool CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_WriteableScoreZ containing nothing + * Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); +void CResult_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res); /** - * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneIOErrorZ in the success state. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_ok(void); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); /** - * Creates a new CResult_NoneIOErrorZ in the error state. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneIOErrorZ_is_ok(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR o); +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneIOErrorZ. + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ -void CResult_NoneIOErrorZ_free(struct LDKCResult_NoneIOErrorZ _res); +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); /** - * Creates a new CResult_NoneIOErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneIOErrorZ CResult_NoneIOErrorZ_clone(const struct LDKCResult_NoneIOErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure */ -struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ *NONNULL_PTR orig); +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o); /** - * Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. + * Constructs a new COption_MaxDustHTLCExposureZ containing nothing */ -struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(struct LDKThirtyTwoBytes a, struct LDKRecipientOnionFields b, struct LDKRouteParameters c); +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void); /** - * Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. + * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state */ -void C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ _res); +void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res); /** - * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. + * Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(struct LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ o); +struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig); /** - * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. + * Constructs a new COption_boolZ containing a bool */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err(void); +struct LDKCOption_boolZ COption_boolZ_some(bool o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_boolZ containing nothing */ -bool CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR o); +struct LDKCOption_boolZ COption_boolZ_none(void); /** - * Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. + * Frees any resources associated with the bool, if we are in the Some state */ -void CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ _res); +void COption_boolZ_free(struct LDKCOption_boolZ _res); /** - * Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig` + * Creates a new COption_boolZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(const struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ *NONNULL_PTR orig); +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. + * Constructs a new COption_u8Z containing a u8 */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +struct LDKCOption_u8Z COption_u8Z_some(uint8_t o); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Constructs a new COption_u8Z containing nothing */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +struct LDKCOption_u8Z COption_u8Z_none(void); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Frees any resources associated with the u8, if we are in the Some state */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +void COption_u8Z_free(struct LDKCOption_u8Z _res); /** - * Checks if the given object is currently in the success state + * Creates a new COption_u8Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); +struct LDKCOption_u8Z COption_u8Z_clone(const struct LDKCOption_u8Z *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_APIErrorZ containing nothing */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); /** - * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. + * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state */ -struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_ok(struct LDKCVec_BlindedPaymentPathZ o); +void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); /** - * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the error state. + * Creates a new COption_APIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_err(void); +struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. */ -bool CResult_CVec_BlindedPaymentPathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR o); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); /** - * Frees any resources used by the CResult_CVec_BlindedPaymentPathZNoneZ. + * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. */ -void CResult_CVec_BlindedPaymentPathZNoneZ_free(struct LDKCResult_CVec_BlindedPaymentPathZNoneZ _res); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *NONNULL_PTR orig); +bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); +void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_EncryptedOurPeerStorageNoneZ in the success state. */ -bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_EncryptedOurPeerStorageNoneZ CResult_EncryptedOurPeerStorageNoneZ_ok(struct LDKEncryptedOurPeerStorage o); /** - * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + * Creates a new CResult_EncryptedOurPeerStorageNoneZ in the error state. */ -void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); +struct LDKCResult_EncryptedOurPeerStorageNoneZ CResult_EncryptedOurPeerStorageNoneZ_err(void); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); +bool CResult_EncryptedOurPeerStorageNoneZ_is_ok(const struct LDKCResult_EncryptedOurPeerStorageNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + * Frees any resources used by the CResult_EncryptedOurPeerStorageNoneZ. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +void CResult_EncryptedOurPeerStorageNoneZ_free(struct LDKCResult_EncryptedOurPeerStorageNoneZ _res); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + * Creates a new CResult_DecryptedOurPeerStorageNoneZ in the success state. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DecryptedOurPeerStorageNoneZ CResult_DecryptedOurPeerStorageNoneZ_ok(struct LDKDecryptedOurPeerStorage o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_DecryptedOurPeerStorageNoneZ in the error state. */ -bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_DecryptedOurPeerStorageNoneZ CResult_DecryptedOurPeerStorageNoneZ_err(void); /** - * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +bool CResult_DecryptedOurPeerStorageNoneZ_is_ok(const struct LDKCResult_DecryptedOurPeerStorageNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_DecryptedOurPeerStorageNoneZ. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); +void CResult_DecryptedOurPeerStorageNoneZ_free(struct LDKCResult_DecryptedOurPeerStorageNoneZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res); +void CVec_MessageForwardNodeZ_free(struct LDKCVec_MessageForwardNodeZ _res); /** - * Creates a new CResult_BlindedTailDecodeErrorZ in the success state. + * Creates a new CResult_InvreqResponseInstructionsNoneZ in the success state. */ -struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o); +struct LDKCResult_InvreqResponseInstructionsNoneZ CResult_InvreqResponseInstructionsNoneZ_ok(struct LDKInvreqResponseInstructions o); /** - * Creates a new CResult_BlindedTailDecodeErrorZ in the error state. + * Creates a new CResult_InvreqResponseInstructionsNoneZ in the error state. */ -struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvreqResponseInstructionsNoneZ CResult_InvreqResponseInstructionsNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o); +bool CResult_InvreqResponseInstructionsNoneZ_is_ok(const struct LDKCResult_InvreqResponseInstructionsNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedTailDecodeErrorZ. + * Frees any resources used by the CResult_InvreqResponseInstructionsNoneZ. */ -void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res); +void CResult_InvreqResponseInstructionsNoneZ_free(struct LDKCResult_InvreqResponseInstructionsNoneZ _res); /** - * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext */ -struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_MessageContextZ COption_MessageContextZ_some(struct LDKMessageContext o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_MessageContextZ containing nothing */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +struct LDKCOption_MessageContextZ COption_MessageContextZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::lightning::blinded_path::message::MessageContext, if we are in the Some state */ -void CVec_PathZ_free(struct LDKCVec_PathZ _res); +void COption_MessageContextZ_free(struct LDKCOption_MessageContextZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ in the success state. + * Creates a new COption_MessageContextZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +struct LDKCOption_MessageContextZ COption_MessageContextZ_clone(const struct LDKCOption_MessageContextZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ C2Tuple_OffersMessageCOption_MessageContextZZ_clone(const struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_OffersMessageCOption_MessageContextZZ from the contained elements. */ -bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ C2Tuple_OffersMessageCOption_MessageContextZZ_new(struct LDKOffersMessage a, struct LDKCOption_MessageContextZ b); /** - * Frees any resources used by the CResult_RouteDecodeErrorZ. + * Frees any resources used by the C2Tuple_OffersMessageCOption_MessageContextZZ. */ -void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); +void C2Tuple_OffersMessageCOption_MessageContextZZ_free(struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ 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_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_OfferboolZ C2Tuple_OfferboolZ_clone(const struct LDKC2Tuple_OfferboolZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + * Creates a new C2Tuple_OfferboolZ from the contained elements. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); +struct LDKC2Tuple_OfferboolZ C2Tuple_OfferboolZ_new(struct LDKOffer a, bool b); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_OfferboolZ. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +void C2Tuple_OfferboolZ_free(struct LDKC2Tuple_OfferboolZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_C2Tuple_OfferboolZNoneZ in the success state. */ -bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_C2Tuple_OfferboolZNoneZ CResult_C2Tuple_OfferboolZNoneZ_ok(struct LDKC2Tuple_OfferboolZ o); /** - * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + * Creates a new CResult_C2Tuple_OfferboolZNoneZ in the error state. */ -void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); +struct LDKCResult_C2Tuple_OfferboolZNoneZ CResult_C2Tuple_OfferboolZNoneZ_err(void); /** - * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); +bool CResult_C2Tuple_OfferboolZNoneZ_is_ok(const struct LDKCResult_C2Tuple_OfferboolZNoneZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_C2Tuple_OfferboolZNoneZ. */ -void CVec_u64Z_free(struct LDKCVec_u64Z _res); +void CResult_C2Tuple_OfferboolZNoneZ_free(struct LDKCResult_C2Tuple_OfferboolZNoneZ _res); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_OfferboolZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); +struct LDKCResult_C2Tuple_OfferboolZNoneZ CResult_C2Tuple_OfferboolZNoneZ_clone(const struct LDKCResult_C2Tuple_OfferboolZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OfferPathsMessageContextZ C2Tuple_OfferPathsMessageContextZ_clone(const struct LDKC2Tuple_OfferPathsMessageContextZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_OfferPathsMessageContextZ from the contained elements. */ -bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_OfferPathsMessageContextZ C2Tuple_OfferPathsMessageContextZ_new(struct LDKOfferPaths a, struct LDKMessageContext b); /** - * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. + * Frees any resources used by the C2Tuple_OfferPathsMessageContextZ. */ -void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); +void C2Tuple_OfferPathsMessageContextZ_free(struct LDKC2Tuple_OfferPathsMessageContextZ _res); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_C2Tuple_OfferPathsMessageContextZZ containing a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ COption_C2Tuple_OfferPathsMessageContextZZ_some(struct LDKC2Tuple_OfferPathsMessageContextZ o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_C2Tuple_OfferPathsMessageContextZZ containing nothing */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ COption_C2Tuple_OfferPathsMessageContextZZ_none(void); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ, if we are in the Some state */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); +void COption_C2Tuple_OfferPathsMessageContextZZ_free(struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ _res); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + * Creates a new COption_C2Tuple_OfferPathsMessageContextZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ COption_C2Tuple_OfferPathsMessageContextZZ_clone(const struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ C2Tuple_ServeStaticInvoiceMessageContextZ_clone(const struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + * Creates a new C2Tuple_ServeStaticInvoiceMessageContextZ from the contained elements. */ -void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); +struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ C2Tuple_ServeStaticInvoiceMessageContextZ_new(struct LDKServeStaticInvoice a, struct LDKMessageContext b); /** - * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_ServeStaticInvoiceMessageContextZ. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_ServeStaticInvoiceMessageContextZ_free(struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ _res); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + * Constructs a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ containing a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); +struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_some(struct LDKC2Tuple_ServeStaticInvoiceMessageContextZ o); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + * Constructs a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ containing nothing */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ, if we are in the Some state */ -bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); +void COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_free(struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ _res); /** - * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + * Creates a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); +struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_clone(const struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ 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_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_CVec_u8Zu16Z C2Tuple_CVec_u8Zu16Z_clone(const struct LDKC2Tuple_CVec_u8Zu16Z *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new C2Tuple_CVec_u8Zu16Z from the contained elements. */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); +struct LDKC2Tuple_CVec_u8Zu16Z C2Tuple_CVec_u8Zu16Z_new(struct LDKCVec_u8Z a, uint16_t b); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the C2Tuple_CVec_u8Zu16Z. */ -void CVec_u16Z_free(struct LDKCVec_u16Z _res); +void C2Tuple_CVec_u8Zu16Z_free(struct LDKC2Tuple_CVec_u8Zu16Z _res); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ in the success state. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); +struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ CResult_C2Tuple_CVec_u8Zu16ZNoneZ_ok(struct LDKC2Tuple_CVec_u8Zu16Z o); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ in the error state. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ CResult_C2Tuple_CVec_u8Zu16ZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_CVec_u8Zu16ZNoneZ_is_ok(const struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_CVec_u8Zu16ZNoneZ. */ -void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); +void CResult_C2Tuple_CVec_u8Zu16ZNoneZ_free(struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ _res); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); +struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ CResult_C2Tuple_CVec_u8Zu16ZNoneZ_clone(const struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ *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_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_u64u64Z from the contained elements. + * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. */ -struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); +struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Frees any resources used by the C2Tuple_u64u64Z. + * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. */ -void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); +void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); +void CVec_C2Tuple_OutPointCVec_u8ZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_u8ZZZ _res); /** - * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. */ -void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_Z from the contained elements. + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. */ -struct LDKC2Tuple_Z C2Tuple_Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_Z. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_Z_free(struct LDKC2Tuple_Z _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple__u1632_u1632Z from the contained elements. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKC2Tuple__u1632_u1632Z C2Tuple__u1632_u1632Z_new(struct LDKThirtyTwoU16s a, struct LDKThirtyTwoU16s b); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); /** - * Frees any resources used by the C2Tuple__u1632_u1632Z. + * Constructs a new COption_MonitorEventZ containing nothing */ -void C2Tuple__u1632_u1632Z_free(struct LDKC2Tuple__u1632_u1632Z _res); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(struct LDKC2Tuple__u1632_u1632Z o); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing + * Creates a new COption_MonitorEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none(void); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. */ -void COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ _res); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); /** - * Constructs a new COption_f64Z containing a f64 + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. */ -struct LDKCOption_f64Z COption_f64Z_some(double o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_f64Z containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_f64Z COption_f64Z_none(void); +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the f64, if we are in the Some state + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. */ -void COption_f64Z_free(struct LDKCOption_f64Z _res); +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); /** - * Creates a new COption_f64Z which has the same data as `orig` + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_f64Z COption_f64Z_clone(const struct LDKCOption_f64Z *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_BestBlockDecodeErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_ok(struct LDKBestBlock o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BestBlockDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_HolderCommitmentTransactionBalanceZ_free(struct LDKCVec_HolderCommitmentTransactionBalanceZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_BestBlockDecodeErrorZ_is_ok(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_BestBlockDecodeErrorZ. + * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. */ -void CResult_BestBlockDecodeErrorZ_free(struct LDKCResult_BestBlockDecodeErrorZ _res); +struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. */ -struct LDKCResult_BestBlockDecodeErrorZ CResult_BestBlockDecodeErrorZ_clone(const struct LDKCResult_BestBlockDecodeErrorZ *NONNULL_PTR orig); +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_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_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *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_usizeTransactionZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction 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_usizeTransactionZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _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_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _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_NoneReplayEventZ in the success state. */ -struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(const struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ *NONNULL_PTR orig); +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_ok(void); /** - * Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. + * Creates a new CResult_NoneReplayEventZ in the error state. */ -struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(struct LDKThirtyTwoBytes a, uint32_t b, struct LDKCOption_ThirtyTwoBytesZ c); +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_err(struct LDKReplayEvent e); /** - * Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. + * Checks if the given object is currently in the success state */ -void C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(struct LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ _res); +bool CResult_NoneReplayEventZ_is_ok(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_NoneReplayEventZ. */ -void CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(struct LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ _res); +void CResult_NoneReplayEventZ_free(struct LDKCResult_NoneReplayEventZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. + * Creates a new CResult_NoneReplayEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_ok(enum LDKChannelMonitorUpdateStatus o); +struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_clone(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_err(void); +void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR o); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. + * Creates a new C2Tuple_u32TxOutZ from the contained elements. */ -void CResult_ChannelMonitorUpdateStatusNoneZ_free(struct LDKCResult_ChannelMonitorUpdateStatusNoneZ _res); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); /** - * Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_u32TxOutZ. */ -struct LDKCResult_ChannelMonitorUpdateStatusNoneZ CResult_ChannelMonitorUpdateStatusNoneZ_clone(const struct LDKCResult_ChannelMonitorUpdateStatusNoneZ *NONNULL_PTR orig); +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +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 LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *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 C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements. + * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKChannelId b, struct LDKCVec_MonitorEventZ c, struct LDKPublicKey d); +struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. */ -void C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ _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. */ -void CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res); +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); /** - * Constructs a new COption_AddressZ containing a crate::c_types::Address + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_AddressZ COption_AddressZ_some(struct LDKAddress o); +struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_clone(const struct LDKC2Tuple_boolboolZ *NONNULL_PTR orig); /** - * Constructs a new COption_AddressZ containing nothing + * Creates a new C2Tuple_boolboolZ from the contained elements. */ -struct LDKCOption_AddressZ COption_AddressZ_none(void); +struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_new(bool a, bool b); /** - * Frees any resources associated with the crate::c_types::Address, if we are in the Some state + * Frees any resources used by the C2Tuple_boolboolZ. */ -void COption_AddressZ_free(struct LDKCOption_AddressZ _res); +void C2Tuple_boolboolZ_free(struct LDKC2Tuple_boolboolZ _res); /** - * Constructs a new COption_StrZ containing a crate::c_types::Str + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Constructs a new COption_StrZ containing nothing + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_StrZ COption_StrZ_none(void); +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::c_types::Str, if we are in the Some state + * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. */ -void COption_StrZ_free(struct LDKCOption_StrZ _res); +struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Creates a new COption_StrZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. */ -struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); +void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); /** - * Creates a new CResult_LSPSRequestIdAPIErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. */ -struct LDKCResult_LSPSRequestIdAPIErrorZ CResult_LSPSRequestIdAPIErrorZ_ok(struct LDKLSPSRequestId o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); /** - * Creates a new CResult_LSPSRequestIdAPIErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_LSPSRequestIdAPIErrorZ CResult_LSPSRequestIdAPIErrorZ_err(struct LDKAPIError 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_LSPSRequestIdAPIErrorZ_is_ok(const struct LDKCResult_LSPSRequestIdAPIErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_LSPSRequestIdAPIErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. */ -void CResult_LSPSRequestIdAPIErrorZ_free(struct LDKCResult_LSPSRequestIdAPIErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); /** - * Creates a new CResult_LSPSRequestIdAPIErrorZ which has the same data as `orig` + * 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_LSPSRequestIdAPIErrorZ CResult_LSPSRequestIdAPIErrorZ_clone(const struct LDKCResult_LSPSRequestIdAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_LSPS2OpeningFeeParamsZ_free(struct LDKCVec_LSPS2OpeningFeeParamsZ _res); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferIdDecodeErrorZ in the success state. + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ -struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_ok(struct LDKOfferId o); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); /** - * Creates a new CResult_OfferIdDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. */ -struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_err(struct LDKDecodeError e); +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_OfferIdDecodeErrorZ_is_ok(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR o); +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Frees any resources used by the CResult_OfferIdDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_OfferIdDecodeErrorZ_free(struct LDKCResult_OfferIdDecodeErrorZ _res); +struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_clone(const struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. */ -struct LDKCResult_OfferIdDecodeErrorZ CResult_OfferIdDecodeErrorZ_clone(const struct LDKCResult_OfferIdDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_new(struct LDKOnionMessageContents a, struct LDKResponseInstruction b); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. + * Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. */ -struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_ok(void); +void C2Tuple_OnionMessageContentsResponseInstructionZ_free(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ _res); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. + * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ */ -struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing */ -bool CResult_NoneBolt12SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR o); +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none(void); /** - * Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state */ -void CResult_NoneBolt12SemanticErrorZ_free(struct LDKCResult_NoneBolt12SemanticErrorZ _res); +void COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ _res); /** - * Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneBolt12SemanticErrorZ CResult_NoneBolt12SemanticErrorZ_clone(const struct LDKCResult_NoneBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferBolt12SemanticErrorZ in the success state. + * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents */ -struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_ok(struct LDKOffer o); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); /** - * Creates a new CResult_OfferBolt12SemanticErrorZ in the error state. + * Constructs a new COption_OnionMessageContentsZ containing nothing */ -struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state */ -bool CResult_OfferBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR o); +void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); /** - * Frees any resources used by the CResult_OfferBolt12SemanticErrorZ. + * Creates a new COption_OnionMessageContentsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_OfferBolt12SemanticErrorZ_free(struct LDKCResult_OfferBolt12SemanticErrorZ _res); +struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. */ -struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); /** - * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder o); +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. */ -bool CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ. + * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ _res); +struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_ok(struct LDKOffer o); +struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferDecodeErrorZ in the error state. + * Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. */ -struct LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(struct LDKOnionMessageContents a, struct LDKMessageSendInstructions b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. */ -bool CResult_OfferDecodeErrorZ_is_ok(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ _res); /** - * Frees any resources used by the CResult_OfferDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_OfferDecodeErrorZ_free(struct LDKCResult_OfferDecodeErrorZ _res); +void CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ _res); /** - * Creates a new CResult_OfferDecodeErrorZ which has the same data as `orig` + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + */ +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); + +/** + * Constructs a new COption_TypeZ containing nothing + */ +struct LDKCOption_TypeZ COption_TypeZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + */ +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 LDKCResult_OfferDecodeErrorZ CResult_OfferDecodeErrorZ_clone(const struct LDKCResult_OfferDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferBolt12ParseErrorZ in the success state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ -struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_ok(struct LDKOffer o); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); /** - * Creates a new CResult_OfferBolt12ParseErrorZ in the error state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. */ -struct LDKCResult_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_err(struct LDKBolt12ParseError e); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OfferBolt12ParseErrorZ_is_ok(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR o); +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OfferBolt12ParseErrorZ. + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ -void CResult_OfferBolt12ParseErrorZ_free(struct LDKCResult_OfferBolt12ParseErrorZ _res); +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` + * 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_OfferBolt12ParseErrorZ CResult_OfferBolt12ParseErrorZ_clone(const struct LDKCResult_OfferBolt12ParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the success state. + * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the error state. + * Constructs a new COption_SocketAddressZ containing nothing */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state */ -bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); +void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); /** - * Frees any resources used by the CResult_NodeIdDecodeErrorZ. + * Creates a new COption_SocketAddressZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); +struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeIdDecodeErrorZ 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 LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); +void CVec_PeerDetailsZ_free(struct LDKCVec_PeerDetailsZ _res); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR o); +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ -void CResult_PublicKeySecp256k1ErrorZ_free(struct LDKCResult_PublicKeySecp256k1ErrorZ _res); +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); /** - * Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ CResult_PublicKeySecp256k1ErrorZ_clone(const struct LDKCResult_PublicKeySecp256k1ErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate + * Creates a new CResult_NonePeerHandleErrorZ in the success state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Creates a new CResult_NonePeerHandleErrorZ in the error state. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); /** - * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); /** - * Creates a new COption_NetworkUpdateZ which has the same data as `orig` + * Frees any resources used by the CResult_NonePeerHandleErrorZ. + */ +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); + +/** + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + * Creates a new CResult_u32GraphSyncErrorZ in the success state. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + * Creates a new CResult_u32GraphSyncErrorZ in the error state. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); +bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + * Frees any resources used by the CResult_u32GraphSyncErrorZ. */ -void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); +void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_AsyncReceiveOfferCacheDecodeErrorZ in the success state. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ CResult_AsyncReceiveOfferCacheDecodeErrorZ_ok(struct LDKAsyncReceiveOfferCache o); /** - * Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup + * Creates a new CResult_AsyncReceiveOfferCacheDecodeErrorZ in the error state. */ -struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_some(struct LDKUtxoLookup o); +struct LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ CResult_AsyncReceiveOfferCacheDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_UtxoLookupZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_UtxoLookupZ COption_UtxoLookupZ_none(void); +bool CResult_AsyncReceiveOfferCacheDecodeErrorZ_is_ok(const struct LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state + * Frees any resources used by the CResult_AsyncReceiveOfferCacheDecodeErrorZ. */ -void COption_UtxoLookupZ_free(struct LDKCOption_UtxoLookupZ _res); +void CResult_AsyncReceiveOfferCacheDecodeErrorZ_free(struct LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ _res); /** - * Creates a new CResult_NoneLightningErrorZ in the success state. + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_ok(struct LDKInvoiceRequest o); /** - * Creates a new CResult_NoneLightningErrorZ in the error state. + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); +bool CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneLightningErrorZ. + * Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. */ -void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); +void CResult_InvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res); /** - * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolLightningErrorZ in the success state. + * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); +struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithExplicitSigningPubkeyBuilder o); /** - * Creates a new CResult_boolLightningErrorZ in the error state. + * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); +bool CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolLightningErrorZ. + * Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. */ -void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); +void CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res); /** - * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); /** - * 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_VerifiedInvoiceRequestNoneZ in the error state. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); /** - * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. */ -void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); +void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); /** - * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); +struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_clone(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing + * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); +struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithDerivedSigningPubkeyBuilder o); /** - * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state + * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. */ -void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); +struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** - * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); +bool CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +void CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. + * Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_ok(struct LDKInvoiceRequest o); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + * Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_InvoiceRequestDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. + * Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. */ -void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); +void CResult_InvoiceRequestDecodeErrorZ_free(struct LDKCResult_InvoiceRequestDecodeErrorZ _res); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_ok(struct LDKInvoiceRequestFields o); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + * Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. */ -void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +void CResult_InvoiceRequestFieldsDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. + * Creates a new CResult_CVec_u8ZIOErrorZ in the success state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. */ -void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); +void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ 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 LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *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_SocketAddressZ_free(struct LDKCVec_SocketAddressZ _res); +void CVec_StrZ_free(struct LDKCVec_StrZ _res); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. + * Creates a new CResult_CVec_StrZIOErrorZ in the success state. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. + * Creates a new CResult_CVec_StrZIOErrorZ in the error state. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + * Frees any resources used by the CResult_CVec_StrZIOErrorZ. */ -void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); +void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ 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_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); +struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_clone(const struct LDKC3Tuple_StrStrStrZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. + * Creates a new C3Tuple_StrStrStrZ from the contained elements. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_new(struct LDKStr a, struct LDKStr b, struct LDKStr c); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C3Tuple_StrStrStrZ. */ -bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); +void C3Tuple_StrStrStrZ_free(struct LDKC3Tuple_StrStrStrZ _res); /** - * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); +void CVec_C3Tuple_StrStrStrZZ_free(struct LDKCVec_C3Tuple_StrStrStrZZ _res); /** - * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. */ -struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(struct LDKCVec_C3Tuple_StrStrStrZZ o); /** - * Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. */ -struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_some(struct LDKNodeAnnouncementInfo o); +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(enum LDKIOError e); /** - * Constructs a new COption_NodeAnnouncementInfoZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_none(void); +bool CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state + * Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. */ -void COption_NodeAnnouncementInfoZ_free(struct LDKCOption_NodeAnnouncementInfoZ _res); +void CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ _res); /** - * Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_NodeAnnouncementInfoZ COption_NodeAnnouncementInfoZ_clone(const struct LDKCOption_NodeAnnouncementInfoZ *NONNULL_PTR orig); +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); +void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); + +/** + * 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_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. */ -void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); +void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ 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. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. */ -void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); /** - * Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ + * 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_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_some(struct LDKCVec_SocketAddressZ o); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_CVec_SocketAddressZZ containing nothing + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_none(void); +struct LDKC2Tuple_ChannelIdu64Z C2Tuple_ChannelIdu64Z_clone(const struct LDKC2Tuple_ChannelIdu64Z *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state + * Creates a new C2Tuple_ChannelIdu64Z from the contained elements. */ -void COption_CVec_SocketAddressZZ_free(struct LDKCOption_CVec_SocketAddressZZ _res); +struct LDKC2Tuple_ChannelIdu64Z C2Tuple_ChannelIdu64Z_new(struct LDKChannelId a, uint64_t b); /** - * Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_ChannelIdu64Z. */ -struct LDKCOption_CVec_SocketAddressZZ COption_CVec_SocketAddressZZ_clone(const struct LDKCOption_CVec_SocketAddressZZ *NONNULL_PTR orig); +void C2Tuple_ChannelIdu64Z_free(struct LDKC2Tuple_ChannelIdu64Z _res); /** - * Creates a new CResult_u64ShortChannelIdErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_ok(uint64_t o); +void CVec_C2Tuple_ChannelIdu64ZZ_free(struct LDKCVec_C2Tuple_ChannelIdu64ZZ _res); /** - * Creates a new CResult_u64ShortChannelIdErrorZ in the error state. + * Creates a new CResult_UpdateNameIOErrorZ in the success state. */ -struct LDKCResult_u64ShortChannelIdErrorZ CResult_u64ShortChannelIdErrorZ_err(enum LDKShortChannelIdError e); +struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_ok(struct LDKUpdateName o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_UpdateNameIOErrorZ in the error state. */ -bool CResult_u64ShortChannelIdErrorZ_is_ok(const struct LDKCResult_u64ShortChannelIdErrorZ *NONNULL_PTR o); +struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_err(enum LDKIOError e); /** - * Frees any resources used by the CResult_u64ShortChannelIdErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_u64ShortChannelIdErrorZ_free(struct LDKCResult_u64ShortChannelIdErrorZ _res); +bool CResult_UpdateNameIOErrorZ_is_ok(const struct LDKCResult_UpdateNameIOErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. + * Frees any resources used by the CResult_UpdateNameIOErrorZ. */ -struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_ok(struct LDKPendingHTLCInfo o); +void CResult_UpdateNameIOErrorZ_free(struct LDKCResult_UpdateNameIOErrorZ _res); /** - * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. + * Constructs a new COption_TransactionZ containing a crate::c_types::Transaction */ -struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_err(struct LDKInboundHTLCErr e); +struct LDKCOption_TransactionZ COption_TransactionZ_some(struct LDKTransaction o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_TransactionZ containing nothing */ -bool CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR o); +struct LDKCOption_TransactionZ COption_TransactionZ_none(void); /** - * Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. + * Frees any resources associated with the crate::c_types::Transaction, if we are in the Some state */ -void CResult_PendingHTLCInfoInboundHTLCErrZ_free(struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ _res); +void COption_TransactionZ_free(struct LDKCOption_TransactionZ _res); /** - * Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` + * Creates a new COption_TransactionZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ CResult_PendingHTLCInfoInboundHTLCErrZ_clone(const struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ *NONNULL_PTR orig); +struct LDKCOption_TransactionZ COption_TransactionZ_clone(const struct LDKCOption_TransactionZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_HTLCOutputInCommitmentZ_free(struct LDKCVec_HTLCOutputInCommitmentZ _res); +void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature */ -void CVec_HTLCDescriptorZ_free(struct LDKCVec_HTLCDescriptorZ _res); +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_some(struct LDKECDSASignature o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ECDSASignatureZ containing nothing */ -void CVec_UtxoZ_free(struct LDKCVec_UtxoZ _res); +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_none(void); /** - * Constructs a new COption_TxOutZ containing a crate::c_types::TxOut + * Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state */ -struct LDKCOption_TxOutZ COption_TxOutZ_some(struct LDKTxOut o); +void COption_ECDSASignatureZ_free(struct LDKCOption_ECDSASignatureZ _res); /** - * Constructs a new COption_TxOutZ containing nothing + * Creates a new COption_ECDSASignatureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TxOutZ COption_TxOutZ_none(void); +struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_clone(const struct LDKCOption_ECDSASignatureZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state + * Constructs a new COption_i64Z containing a i64 */ -void COption_TxOutZ_free(struct LDKCOption_TxOutZ _res); +struct LDKCOption_i64Z COption_i64Z_some(int64_t o); /** - * Creates a new COption_TxOutZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_i64Z containing nothing */ -struct LDKCOption_TxOutZ COption_TxOutZ_clone(const struct LDKCOption_TxOutZ *NONNULL_PTR orig); +struct LDKCOption_i64Z COption_i64Z_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the i64, if we are in the Some state */ -void CVec_InputZ_free(struct LDKCVec_InputZ _res); +void COption_i64Z_free(struct LDKCOption_i64Z _res); /** - * Creates a new CResult_CoinSelectionNoneZ in the success state. + * Creates a new COption_i64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_ok(struct LDKCoinSelection o); +struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); /** - * Creates a new CResult_CoinSelectionNoneZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_err(void); +struct LDKC2Tuple_u64BlindedMessagePathZ C2Tuple_u64BlindedMessagePathZ_clone(const struct LDKC2Tuple_u64BlindedMessagePathZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_u64BlindedMessagePathZ from the contained elements. */ -bool CResult_CoinSelectionNoneZ_is_ok(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR o); +struct LDKC2Tuple_u64BlindedMessagePathZ C2Tuple_u64BlindedMessagePathZ_new(uint64_t a, struct LDKBlindedMessagePath b); /** - * Frees any resources used by the CResult_CoinSelectionNoneZ. + * Frees any resources used by the C2Tuple_u64BlindedMessagePathZ. */ -void CResult_CoinSelectionNoneZ_free(struct LDKCResult_CoinSelectionNoneZ _res); +void C2Tuple_u64BlindedMessagePathZ_free(struct LDKC2Tuple_u64BlindedMessagePathZ _res); /** - * Creates a new CResult_CoinSelectionNoneZ 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 LDKCResult_CoinSelectionNoneZ CResult_CoinSelectionNoneZ_clone(const struct LDKCResult_CoinSelectionNoneZ *NONNULL_PTR orig); +void CVec_C2Tuple_u64BlindedMessagePathZZ_free(struct LDKCVec_C2Tuple_u64BlindedMessagePathZZ _res); /** - * Creates a new CResult_CVec_UtxoZNoneZ in the success state. + * Creates a new CResult_SocketAddressDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_ok(struct LDKCVec_UtxoZ o); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); /** - * Creates a new CResult_CVec_UtxoZNoneZ in the error state. + * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_err(void); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_UtxoZNoneZ_is_ok(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR o); +bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_UtxoZNoneZ. + * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. */ -void CResult_CVec_UtxoZNoneZ_free(struct LDKCResult_CVec_UtxoZNoneZ _res); +void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); /** - * Creates a new CResult_CVec_UtxoZNoneZ 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. */ -struct LDKCResult_CVec_UtxoZNoneZ CResult_CVec_UtxoZNoneZ_clone(const struct LDKCResult_CVec_UtxoZNoneZ *NONNULL_PTR orig); +struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. */ -struct LDKCOption_PaymentContextZ COption_PaymentContextZ_some(struct LDKPaymentContext o); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); /** - * Constructs a new COption_PaymentContextZ containing nothing + * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. */ -struct LDKCOption_PaymentContextZ COption_PaymentContextZ_none(void); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); /** - * Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_PaymentContextZ_free(struct LDKCOption_PaymentContextZ _res); +bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); /** - * Creates a new COption_PaymentContextZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. */ -struct LDKCOption_PaymentContextZ COption_PaymentContextZ_clone(const struct LDKCOption_PaymentContextZ *NONNULL_PTR orig); +void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); /** - * Creates a new tuple 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 LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_clone(const struct LDKC2Tuple_u64u16Z *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_u64u16Z from the contained elements. - */ -struct LDKC2Tuple_u64u16Z C2Tuple_u64u16Z_new(uint64_t a, uint16_t b); - -/** - * Frees any resources used by the C2Tuple_u64u16Z. - */ -void C2Tuple_u64u16Z_free(struct LDKC2Tuple_u64u16Z _res); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_some(struct LDKC2Tuple_u64u16Z o); +void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); /** - * Constructs a new COption_C2Tuple_u64u16ZZ containing nothing + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_none(void); +void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void COption_C2Tuple_u64u16ZZ_free(struct LDKCOption_C2Tuple_u64u16ZZ _res); +void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); /** - * Creates a new COption_C2Tuple_u64u16ZZ 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_C2Tuple_u64u16ZZ COption_C2Tuple_u64u16ZZ_clone(const struct LDKCOption_C2Tuple_u64u16ZZ *NONNULL_PTR orig); +void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); /** - * Creates a new CResult_ChannelIdAPIErrorZ in the success state. + * Creates a new CResult_TrampolineOnionPacketDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_ok(struct LDKChannelId o); +struct LDKCResult_TrampolineOnionPacketDecodeErrorZ CResult_TrampolineOnionPacketDecodeErrorZ_ok(struct LDKTrampolineOnionPacket o); /** - * Creates a new CResult_ChannelIdAPIErrorZ in the error state. + * Creates a new CResult_TrampolineOnionPacketDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_TrampolineOnionPacketDecodeErrorZ CResult_TrampolineOnionPacketDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelIdAPIErrorZ_is_ok(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR o); +bool CResult_TrampolineOnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_TrampolineOnionPacketDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelIdAPIErrorZ. + * Frees any resources used by the CResult_TrampolineOnionPacketDecodeErrorZ. */ -void CResult_ChannelIdAPIErrorZ_free(struct LDKCResult_ChannelIdAPIErrorZ _res); +void CResult_TrampolineOnionPacketDecodeErrorZ_free(struct LDKCResult_TrampolineOnionPacketDecodeErrorZ _res); /** - * Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` + * Creates a new CResult_TrampolineOnionPacketDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_clone(const struct LDKCResult_ChannelIdAPIErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); +struct LDKCResult_TrampolineOnionPacketDecodeErrorZ CResult_TrampolineOnionPacketDecodeErrorZ_clone(const struct LDKCResult_TrampolineOnionPacketDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); +bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); /** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneRetryableSendFailureZ in the success state. + * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_ok(void); +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o); /** - * Creates a new CResult_NoneRetryableSendFailureZ in the error state. + * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneRetryableSendFailureZ_is_ok(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR o); +bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneRetryableSendFailureZ. + * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. */ -void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendFailureZ _res); +void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res); /** - * Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` + * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext + * Creates a new CResult_StfuDecodeErrorZ in the success state. */ -struct LDKCOption_OffersContextZ COption_OffersContextZ_some(struct LDKOffersContext o); +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_ok(struct LDKStfu o); /** - * Constructs a new COption_OffersContextZ containing nothing + * Creates a new CResult_StfuDecodeErrorZ in the error state. */ -struct LDKCOption_OffersContextZ COption_OffersContextZ_none(void); +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_OffersContextZ_free(struct LDKCOption_OffersContextZ _res); +bool CResult_StfuDecodeErrorZ_is_ok(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_StfuDecodeErrorZ. + */ +void CResult_StfuDecodeErrorZ_free(struct LDKCResult_StfuDecodeErrorZ _res); /** - * Creates a new COption_OffersContextZ which has the same data as `orig` + * Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_OffersContextZ COption_OffersContextZ_clone(const struct LDKCOption_OffersContextZ *NONNULL_PTR orig); +struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_clone(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. + * Creates a new CResult_SpliceInitDecodeErrorZ in the success state. */ -struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_ok(void); +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_ok(struct LDKSpliceInit o); /** - * Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. + * Creates a new CResult_SpliceInitDecodeErrorZ in the error state. */ -struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_err(struct LDKBolt12PaymentError e); +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneBolt12PaymentErrorZ_is_ok(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR o); +bool CResult_SpliceInitDecodeErrorZ_is_ok(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. + * Frees any resources used by the CResult_SpliceInitDecodeErrorZ. */ -void CResult_NoneBolt12PaymentErrorZ_free(struct LDKCResult_NoneBolt12PaymentErrorZ _res); +void CResult_SpliceInitDecodeErrorZ_free(struct LDKCResult_SpliceInitDecodeErrorZ _res); /** - * Creates a new CResult_NoneBolt12PaymentErrorZ which has the same data as `orig` + * Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_clone(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_clone(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. + * Creates a new CResult_SpliceAckDecodeErrorZ in the success state. */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_ok(struct LDKSpliceAck o); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. + * Creates a new CResult_SpliceAckDecodeErrorZ in the error state. */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); +bool CResult_SpliceAckDecodeErrorZ_is_ok(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. + * Frees any resources used by the CResult_SpliceAckDecodeErrorZ. */ -void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); +void CResult_SpliceAckDecodeErrorZ_free(struct LDKCResult_SpliceAckDecodeErrorZ _res); /** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` + * Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_clone(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR orig); /** - * 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_SpliceLockedDecodeErrorZ in the success state. */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_ok(struct LDKSpliceLocked o); /** - * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. + * Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); +bool CResult_SpliceLockedDecodeErrorZ_is_ok(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. + * Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); +void CResult_SpliceLockedDecodeErrorZ_free(struct LDKCResult_SpliceLockedDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. + * Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(struct LDKProbeSendFailure e); +struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_clone(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_TxAddInputDecodeErrorZ in the success state. */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR o); +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. + * Creates a new CResult_TxAddInputDecodeErrorZ in the error state. */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ _res); +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR orig); +bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_TxAddInputDecodeErrorZ. */ -void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); +void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. + * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); +struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. */ -bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. + * Checks if the given object is currently in the success state */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); +bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); +void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig); +struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. + * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. */ -struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b); +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o); /** - * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. + * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. */ -void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res); +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res); +bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. */ -void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res); +void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_clone(const struct LDKC2Tuple_PublicKeyChannelIdZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. - */ -struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_new(struct LDKPublicKey a, struct LDKChannelId b); +struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. + * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. */ -void C2Tuple_PublicKeyChannelIdZ_free(struct LDKC2Tuple_PublicKeyChannelIdZ _res); +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o); /** - * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ + * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. */ -struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_some(struct LDKC2Tuple_PublicKeyChannelIdZ o); +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_none(void); +bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state + * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. */ -void COption_C2Tuple_PublicKeyChannelIdZZ_free(struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ _res); +void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res); /** - * Creates a new COption_C2Tuple_PublicKeyChannelIdZZ which has the same data as `orig` + * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_clone(const struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ *NONNULL_PTR orig); +struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. + * Creates a new CResult_TxCompleteDecodeErrorZ in the success state. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. + * Creates a new CResult_TxCompleteDecodeErrorZ in the error state. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); +bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. + * Frees any resources used by the CResult_TxCompleteDecodeErrorZ. */ -void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); +void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res); /** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` + * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o); +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o); /** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. + * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. */ -void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); +void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res); /** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_DestinationZ_free(struct LDKCVec_DestinationZ _res); +struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. + * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. + * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); +bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. + * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); +void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` + * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); +struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. + * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. + * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. - */ -void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); +bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); +void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_clone(const struct LDKC2Tuple_OffersMessageResponseInstructionZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_OffersMessageResponseInstructionZ from the contained elements. - */ -struct LDKC2Tuple_OffersMessageResponseInstructionZ C2Tuple_OffersMessageResponseInstructionZ_new(struct LDKOffersMessage a, struct LDKResponseInstruction b); +struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_OffersMessageResponseInstructionZ. + * Creates a new CResult_TxAbortDecodeErrorZ in the success state. */ -void C2Tuple_OffersMessageResponseInstructionZ_free(struct LDKC2Tuple_OffersMessageResponseInstructionZ _res); +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o); /** - * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ + * Creates a new CResult_TxAbortDecodeErrorZ in the error state. */ -struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_some(struct LDKC2Tuple_OffersMessageResponseInstructionZ o); +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_none(void); +bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ, if we are in the Some state + * Frees any resources used by the CResult_TxAbortDecodeErrorZ. */ -void COption_C2Tuple_OffersMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ _res); +void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res); /** - * Creates a new COption_C2Tuple_OffersMessageResponseInstructionZZ which has the same data as `orig` + * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ COption_C2Tuple_OffersMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ *NONNULL_PTR orig); +struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig); /** - * 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_AnnouncementSignaturesDecodeErrorZ in the success state. */ -struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ *NONNULL_PTR orig); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); /** - * Creates a new C2Tuple_OffersMessageMessageSendInstructionsZ from the contained elements. + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. */ -struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ C2Tuple_OffersMessageMessageSendInstructionsZ_new(struct LDKOffersMessage a, struct LDKMessageSendInstructions b); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_OffersMessageMessageSendInstructionsZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_OffersMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_OffersMessageMessageSendInstructionsZ _res); +bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. */ -void CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ _res); +void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_clone(const struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ *NONNULL_PTR orig); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_ReleaseHeldHtlcResponseInstructionZ from the contained elements. + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. */ -struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ C2Tuple_ReleaseHeldHtlcResponseInstructionZ_new(struct LDKReleaseHeldHtlc a, struct LDKResponseInstruction b); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); /** - * Frees any resources used by the C2Tuple_ReleaseHeldHtlcResponseInstructionZ. + * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. */ -void C2Tuple_ReleaseHeldHtlcResponseInstructionZ_free(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ _res); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_some(struct LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ o); +bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing nothing + * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. */ -struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_none(void); +void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ, if we are in the Some state + * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ _res); +struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NextFundingDecodeErrorZ in the success state. */ -struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ *NONNULL_PTR orig); +struct LDKCResult_NextFundingDecodeErrorZ CResult_NextFundingDecodeErrorZ_ok(struct LDKNextFunding o); /** - * 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_NextFundingDecodeErrorZ in the error state. */ -struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ *NONNULL_PTR orig); +struct LDKCResult_NextFundingDecodeErrorZ CResult_NextFundingDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_new(struct LDKAsyncPaymentsMessage a, struct LDKMessageSendInstructions b); +bool CResult_NextFundingDecodeErrorZ_is_ok(const struct LDKCResult_NextFundingDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ. + * Frees any resources used by the CResult_NextFundingDecodeErrorZ. */ -void C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ _res); +void CResult_NextFundingDecodeErrorZ_free(struct LDKCResult_NextFundingDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NextFundingDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ _res); +struct LDKCResult_NextFundingDecodeErrorZ CResult_NextFundingDecodeErrorZ_clone(const struct LDKCResult_NextFundingDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + * Creates a new CResult_FundingLockedDecodeErrorZ in the success state. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + * Creates a new CResult_FundingLockedDecodeErrorZ in the error state. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); +bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. + * Frees any resources used by the CResult_FundingLockedDecodeErrorZ. */ -void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); +void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. + * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. */ -struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_ok(struct LDKBlindedForward o); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); /** - * Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. + * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. */ -struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedForwardDecodeErrorZ_is_ok(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR o); +bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. + * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. */ -void CResult_BlindedForwardDecodeErrorZ_free(struct LDKCResult_BlindedForwardDecodeErrorZ _res); +void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); /** - * Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BlindedForwardDecodeErrorZ CResult_BlindedForwardDecodeErrorZ_clone(const struct LDKCResult_BlindedForwardDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. + * Creates a new CResult_ClosingCompleteDecodeErrorZ in the success state. */ -struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_ok(struct LDKPendingHTLCRouting o); +struct LDKCResult_ClosingCompleteDecodeErrorZ CResult_ClosingCompleteDecodeErrorZ_ok(struct LDKClosingComplete o); /** - * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. + * Creates a new CResult_ClosingCompleteDecodeErrorZ in the error state. */ -struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ClosingCompleteDecodeErrorZ CResult_ClosingCompleteDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR o); +bool CResult_ClosingCompleteDecodeErrorZ_is_ok(const struct LDKCResult_ClosingCompleteDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. + * Frees any resources used by the CResult_ClosingCompleteDecodeErrorZ. */ -void CResult_PendingHTLCRoutingDecodeErrorZ_free(struct LDKCResult_PendingHTLCRoutingDecodeErrorZ _res); +void CResult_ClosingCompleteDecodeErrorZ_free(struct LDKCResult_ClosingCompleteDecodeErrorZ _res); /** - * Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ClosingCompleteDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PendingHTLCRoutingDecodeErrorZ CResult_PendingHTLCRoutingDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCRoutingDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ClosingCompleteDecodeErrorZ CResult_ClosingCompleteDecodeErrorZ_clone(const struct LDKCResult_ClosingCompleteDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. + * Creates a new CResult_ClosingSigDecodeErrorZ in the success state. */ -struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_ok(struct LDKPendingHTLCInfo o); +struct LDKCResult_ClosingSigDecodeErrorZ CResult_ClosingSigDecodeErrorZ_ok(struct LDKClosingSig o); /** - * Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. + * Creates a new CResult_ClosingSigDecodeErrorZ in the error state. */ -struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ClosingSigDecodeErrorZ CResult_ClosingSigDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PendingHTLCInfoDecodeErrorZ_is_ok(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_ClosingSigDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSigDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. + * Frees any resources used by the CResult_ClosingSigDecodeErrorZ. */ -void CResult_PendingHTLCInfoDecodeErrorZ_free(struct LDKCResult_PendingHTLCInfoDecodeErrorZ _res); +void CResult_ClosingSigDecodeErrorZ_free(struct LDKCResult_ClosingSigDecodeErrorZ _res); /** - * Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ClosingSigDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PendingHTLCInfoDecodeErrorZ CResult_PendingHTLCInfoDecodeErrorZ_clone(const struct LDKCResult_PendingHTLCInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ClosingSigDecodeErrorZ CResult_ClosingSigDecodeErrorZ_clone(const struct LDKCResult_ClosingSigDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. */ -struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_ok(enum LDKBlindedFailure o); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); /** - * Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. */ -struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BlindedFailureDecodeErrorZ_is_ok(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR o); +bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. + * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. */ -void CResult_BlindedFailureDecodeErrorZ_free(struct LDKCResult_BlindedFailureDecodeErrorZ _res); +void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); /** - * Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BlindedFailureDecodeErrorZ CResult_BlindedFailureDecodeErrorZ_clone(const struct LDKCResult_BlindedFailureDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. */ -void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); /** - * Creates a new C2Tuple_ThirtyTwoBytesChannelManagerZ from the contained elements. + * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. */ -struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ C2Tuple_ThirtyTwoBytesChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelManagerZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_ThirtyTwoBytesChannelManagerZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ _res); +bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the success state. + * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelManagerZ o); +void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ in the error state. + * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. */ -bool CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ. + * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. */ -void CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ _res); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_ok(struct LDKMaxDustHTLCExposure o); +bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. + * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. */ -struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. + * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. */ -void CResult_MaxDustHTLCExposureDecodeErrorZ_free(struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ _res); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); /** - * Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. */ -struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ CResult_MaxDustHTLCExposureDecodeErrorZ_clone(const struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); +bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. */ -void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure + * Checks if the given object is currently in the success state */ -struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_some(struct LDKMaxDustHTLCExposure o); +bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_MaxDustHTLCExposureZ containing nothing + * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. */ -struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_none(void); +void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); /** - * Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state + * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_MaxDustHTLCExposureZ_free(struct LDKCOption_MaxDustHTLCExposureZ _res); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InitDecodeErrorZ in the success state. */ -struct LDKCOption_MaxDustHTLCExposureZ COption_MaxDustHTLCExposureZ_clone(const struct LDKCOption_MaxDustHTLCExposureZ *NONNULL_PTR orig); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); /** - * Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError + * Creates a new CResult_InitDecodeErrorZ in the error state. */ -struct LDKCOption_APIErrorZ COption_APIErrorZ_some(struct LDKAPIError o); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_APIErrorZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_APIErrorZ COption_APIErrorZ_none(void); +bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state + * Frees any resources used by the CResult_InitDecodeErrorZ. */ -void COption_APIErrorZ_free(struct LDKCOption_APIErrorZ _res); +void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); /** - * Creates a new COption_APIErrorZ which has the same data as `orig` + * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_APIErrorZ COption_APIErrorZ_clone(const struct LDKCOption_APIErrorZ *NONNULL_PTR orig); +struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. + * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_ok(struct LDKCOption_APIErrorZ o); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. + * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_APIErrorZDecodeErrorZ_is_ok(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR o); +bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. + * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. */ -void CResult_COption_APIErrorZDecodeErrorZ_free(struct LDKCResult_COption_APIErrorZDecodeErrorZ _res); +void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); /** - * Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_LSPS2RawOpeningFeeParamsZ_free(struct LDKCVec_LSPS2RawOpeningFeeParamsZ _res); +struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); /** - * Constructs a new COption_MonitorEventZ containing nothing + * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); +bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_MonitorEventZ which has the same data as `orig` + * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + */ +void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); + +/** + * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); +struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + * Creates a new CResult_ShutdownDecodeErrorZ in the success state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownDecodeErrorZ in the error state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); +bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + * Frees any resources used by the CResult_ShutdownDecodeErrorZ. */ -void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); +void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. - */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u8ZZ *NONNULL_PTR orig); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OutPointCVec_u8ZZ from the contained elements. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. */ -struct LDKC2Tuple_OutPointCVec_u8ZZ C2Tuple_OutPointCVec_u8ZZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); /** - * Frees any resources used by the C2Tuple_OutPointCVec_u8ZZ. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. */ -void C2Tuple_OutPointCVec_u8ZZ_free(struct LDKC2Tuple_OutPointCVec_u8ZZ _res); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_clone(const struct LDKC2Tuple_u32CVec_u8ZZ *NONNULL_PTR orig); +bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_u32CVec_u8ZZ from the contained elements. + * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. */ -struct LDKC2Tuple_u32CVec_u8ZZ C2Tuple_u32CVec_u8ZZ_new(uint32_t a, struct LDKCVec_u8Z b); +void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_u32CVec_u8ZZ. + * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_u32CVec_u8ZZ_free(struct LDKC2Tuple_u32CVec_u8ZZ _res); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. */ -void CVec_C2Tuple_u32CVec_u8ZZZ_free(struct LDKCVec_C2Tuple_u32CVec_u8ZZZ _res); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); /** - * 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_UpdateFeeDecodeErrorZ in the error state. */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ *NONNULL_PTR orig); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32CVec_u8ZZZ b); +bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ. + * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. */ -void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ _res); +void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ _res); +struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneReplayEventZ in the success state. + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_ok(void); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); /** - * Creates a new CResult_NoneReplayEventZ in the error state. + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_err(struct LDKReplayEvent e); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneReplayEventZ_is_ok(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR o); +bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneReplayEventZ. + * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. */ -void CResult_NoneReplayEventZ_free(struct LDKCResult_NoneReplayEventZ _res); +void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); /** - * Creates a new CResult_NoneReplayEventZ which has the same data as `orig` + * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneReplayEventZ CResult_NoneReplayEventZ_clone(const struct LDKCResult_NoneReplayEventZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_CommitmentTransactionZ_free(struct LDKCVec_CommitmentTransactionZ _res); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * 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_PeerStorageDecodeErrorZ in the success state. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +struct LDKCResult_PeerStorageDecodeErrorZ CResult_PeerStorageDecodeErrorZ_ok(struct LDKPeerStorage o); /** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. + * Creates a new CResult_PeerStorageDecodeErrorZ in the error state. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +struct LDKCResult_PeerStorageDecodeErrorZ CResult_PeerStorageDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_u32TxOutZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +bool CResult_PeerStorageDecodeErrorZ_is_ok(const struct LDKCResult_PeerStorageDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PeerStorageDecodeErrorZ. */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +void CResult_PeerStorageDecodeErrorZ_free(struct LDKCResult_PeerStorageDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_PeerStorageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKCResult_PeerStorageDecodeErrorZ CResult_PeerStorageDecodeErrorZ_clone(const struct LDKCResult_PeerStorageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Creates a new CResult_PeerStorageRetrievalDecodeErrorZ in the success state. */ -struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +struct LDKCResult_PeerStorageRetrievalDecodeErrorZ CResult_PeerStorageRetrievalDecodeErrorZ_ok(struct LDKPeerStorageRetrieval o); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ. + * Creates a new CResult_PeerStorageRetrievalDecodeErrorZ in the error state. */ -void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ _res); +struct LDKCResult_PeerStorageRetrievalDecodeErrorZ CResult_PeerStorageRetrievalDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +bool CResult_PeerStorageRetrievalDecodeErrorZ_is_ok(const struct LDKCResult_PeerStorageRetrievalDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_PeerStorageRetrievalDecodeErrorZ. */ -struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_clone(const struct LDKC2Tuple_boolboolZ *NONNULL_PTR orig); +void CResult_PeerStorageRetrievalDecodeErrorZ_free(struct LDKCResult_PeerStorageRetrievalDecodeErrorZ _res); /** - * Creates a new C2Tuple_boolboolZ from the contained elements. + * Creates a new CResult_PeerStorageRetrievalDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_new(bool a, bool b); +struct LDKCResult_PeerStorageRetrievalDecodeErrorZ CResult_PeerStorageRetrievalDecodeErrorZ_clone(const struct LDKCResult_PeerStorageRetrievalDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_boolboolZ. + * Creates a new CResult_StartBatchDecodeErrorZ in the success state. */ -void C2Tuple_boolboolZ_free(struct LDKC2Tuple_boolboolZ _res); +struct LDKCResult_StartBatchDecodeErrorZ CResult_StartBatchDecodeErrorZ_ok(struct LDKStartBatch o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_StartBatchDecodeErrorZ in the error state. */ -void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); +struct LDKCResult_StartBatchDecodeErrorZ CResult_StartBatchDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ *NONNULL_PTR orig); +bool CResult_StartBatchDecodeErrorZ_is_ok(const struct LDKCResult_StartBatchDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. + * Frees any resources used by the CResult_StartBatchDecodeErrorZ. */ -struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); +void CResult_StartBatchDecodeErrorZ_free(struct LDKCResult_StartBatchDecodeErrorZ _res); /** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. + * Creates a new CResult_StartBatchDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ _res); +struct LDKCResult_StartBatchDecodeErrorZ CResult_StartBatchDecodeErrorZ_clone(const struct LDKCResult_StartBatchDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. + * Creates a new CResult_OnionPacketDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_ok(struct LDKOnionPacket o); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. + * Creates a new CResult_OnionPacketDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +bool CResult_OnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. + * Frees any resources used by the CResult_OnionPacketDecodeErrorZ. */ -void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ _res); +void CResult_OnionPacketDecodeErrorZ_free(struct LDKCResult_OnionPacketDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OnionPacketDecodeErrorZ 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); +struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_clone(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR orig); /** - * 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_UpdateAddHTLCDecodeErrorZ in the success state. */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); /** - * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. */ -void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_clone(const struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ *NONNULL_PTR orig); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. + * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. */ -struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ C2Tuple_OnionMessageContentsResponseInstructionZ_new(struct LDKOnionMessageContents a, struct LDKResponseInstruction b); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); /** - * Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. + * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. */ -void C2Tuple_OnionMessageContentsResponseInstructionZ_free(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ _res); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(struct LDKC2Tuple_OnionMessageContentsResponseInstructionZ o); +bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing + * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. */ -struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none(void); +void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state + * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ _res); +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. */ -struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ *NONNULL_PTR orig); +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_ok(struct LDKFinalOnionHopData o); /** - * Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. */ -struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_some(struct LDKOnionMessageContents o); +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_OnionMessageContentsZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_none(void); +bool CResult_FinalOnionHopDataDecodeErrorZ_is_ok(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state + * Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. */ -void COption_OnionMessageContentsZ_free(struct LDKCOption_OnionMessageContentsZ _res); +void CResult_FinalOnionHopDataDecodeErrorZ_free(struct LDKCResult_FinalOnionHopDataDecodeErrorZ _res); /** - * Creates a new COption_OnionMessageContentsZ which has the same data as `orig` + * Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_OnionMessageContentsZ COption_OnionMessageContentsZ_clone(const struct LDKCOption_OnionMessageContentsZ *NONNULL_PTR orig); +struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_clone(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. + * Creates a new CResult_PingDecodeErrorZ in the success state. */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_OnionMessageContentsZ o); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. + * Creates a new CResult_PingDecodeErrorZ in the error state. */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. + * Frees any resources used by the CResult_PingDecodeErrorZ. */ -void CResult_COption_OnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ _res); +void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); /** - * Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(const struct LDKCResult_COption_OnionMessageContentsZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); /** - * 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_PongDecodeErrorZ in the success state. */ -struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_clone(const struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ *NONNULL_PTR orig); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); /** - * Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. + * Creates a new CResult_PongDecodeErrorZ in the error state. */ -struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(struct LDKOnionMessageContents a, struct LDKMessageSendInstructions b); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(struct LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ _res); +bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PongDecodeErrorZ. */ -void CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ _res); +void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); /** - * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type + * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); +struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_TypeZ containing nothing + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. */ -struct LDKCOption_TypeZ COption_TypeZ_none(void); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); /** - * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_TypeZ which has the same data as `orig` + * Checks if the given object is currently in the success state + */ +bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + */ +void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); + +/** + * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ 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); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. */ -void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); +void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelAnnouncementDecodeErrorZ 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); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. */ -struct LDKCOption_SocketAddressZ COption_SocketAddressZ_some(struct LDKSocketAddress o); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); /** - * Constructs a new COption_SocketAddressZ containing nothing + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. */ -struct LDKCOption_SocketAddressZ COption_SocketAddressZ_none(void); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_SocketAddressZ_free(struct LDKCOption_SocketAddressZ _res); +bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_SocketAddressZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. */ -struct LDKCOption_SocketAddressZ COption_SocketAddressZ_clone(const struct LDKCOption_SocketAddressZ *NONNULL_PTR orig); +void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_PeerDetailsZ_free(struct LDKCVec_PeerDetailsZ _res); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); +bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_u32GraphSyncErrorZ in the success state. + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); /** - * Creates a new CResult_u32GraphSyncErrorZ in the error state. + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. */ -struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); +bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_u32GraphSyncErrorZ. + * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. */ -void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); +void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); /** - * Creates a new CResult_CVec_u8ZIOErrorZ in the success state. + * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZIOErrorZ in the error state. + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. */ -bool CResult_CVec_u8ZIOErrorZ_is_ok(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR o); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_CVec_u8ZIOErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_CVec_u8ZIOErrorZ_free(struct LDKCResult_CVec_u8ZIOErrorZ _res); +bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. */ -struct LDKCResult_CVec_u8ZIOErrorZ CResult_CVec_u8ZIOErrorZ_clone(const struct LDKCResult_CVec_u8ZIOErrorZ *NONNULL_PTR orig); +void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_StrZ_free(struct LDKCVec_StrZ _res); +struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_StrZIOErrorZ in the success state. + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_ok(struct LDKCVec_StrZ o); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); /** - * Creates a new CResult_CVec_StrZIOErrorZ in the error state. + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_StrZIOErrorZ_is_ok(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR o); +bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_StrZIOErrorZ. + * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. */ -void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); +void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); /** - * Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` + * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); /** - * 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_ReplyShortChannelIdsEndDecodeErrorZ in the success state. */ -struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_clone(const struct LDKC3Tuple_StrStrStrZ *NONNULL_PTR orig); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); /** - * Creates a new C3Tuple_StrStrStrZ from the contained elements. + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. */ -struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_new(struct LDKStr a, struct LDKStr b, struct LDKStr c); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C3Tuple_StrStrStrZ. + * Checks if the given object is currently in the success state */ -void C3Tuple_StrStrStrZ_free(struct LDKC3Tuple_StrStrStrZ _res); +bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. */ -void CVec_C3Tuple_StrStrStrZZ_free(struct LDKCVec_C3Tuple_StrStrStrZZ _res); +void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); /** - * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. + * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(struct LDKCVec_C3Tuple_StrStrStrZZ o); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. */ -bool CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR o); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ _res); +bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. */ -struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR orig); +void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ _res); +struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ o); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError 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); +bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. + * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ _res); +void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); /** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` + * Creates a new CResult_ReplyChannelRangeDecodeErrorZ 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); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(struct LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ o); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError 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); +bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. + * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. */ -void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ _res); +void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` + * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_MonitorNameIOErrorZ in the success state. + * Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails */ -struct LDKCResult_MonitorNameIOErrorZ CResult_MonitorNameIOErrorZ_ok(struct LDKMonitorName o); +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_some(enum LDKInboundHTLCStateDetails o); /** - * Creates a new CResult_MonitorNameIOErrorZ in the error state. + * Constructs a new COption_InboundHTLCStateDetailsZ containing nothing */ -struct LDKCResult_MonitorNameIOErrorZ CResult_MonitorNameIOErrorZ_err(enum LDKIOError e); +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state */ -bool CResult_MonitorNameIOErrorZ_is_ok(const struct LDKCResult_MonitorNameIOErrorZ *NONNULL_PTR o); +void COption_InboundHTLCStateDetailsZ_free(struct LDKCOption_InboundHTLCStateDetailsZ _res); /** - * Frees any resources used by the CResult_MonitorNameIOErrorZ. + * Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_MonitorNameIOErrorZ_free(struct LDKCResult_MonitorNameIOErrorZ _res); +struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_clone(const struct LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateNameIOErrorZ in the success state. + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. */ -struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_ok(struct LDKUpdateName o); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_InboundHTLCStateDetailsZ o); /** - * Creates a new CResult_UpdateNameIOErrorZ in the error state. + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_err(enum LDKIOError e); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UpdateNameIOErrorZ_is_ok(const struct LDKCResult_UpdateNameIOErrorZ *NONNULL_PTR o); +bool CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateNameIOErrorZ. + * Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. */ -void CResult_UpdateNameIOErrorZ_free(struct LDKCResult_UpdateNameIOErrorZ _res); +void CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. + * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_ok(struct LDKInvoiceRequest o); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_ok(struct LDKInboundHTLCDetails o); + +/** + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. + * Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. */ -void CResult_InvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ _res); +void CResult_InboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_InboundHTLCDetailsDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ CResult_InvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + * Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails */ -struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithExplicitSigningPubkeyBuilder o); +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_some(enum LDKOutboundHTLCStateDetails o); /** - * Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + * Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing */ -struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state */ -bool CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +void COption_OutboundHTLCStateDetailsZ_free(struct LDKCOption_OutboundHTLCStateDetailsZ _res); /** - * Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. + * Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ _res); +struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_clone(const struct LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR orig); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. */ -struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_ok(struct LDKVerifiedInvoiceRequest o); +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_OutboundHTLCStateDetailsZ o); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. */ -struct LDKCResult_VerifiedInvoiceRequestNoneZ CResult_VerifiedInvoiceRequestNoneZ_err(void); +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_VerifiedInvoiceRequestNoneZ_is_ok(const struct LDKCResult_VerifiedInvoiceRequestNoneZ *NONNULL_PTR o); +bool CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. + * Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. */ -void CResult_VerifiedInvoiceRequestNoneZ_free(struct LDKCResult_VerifiedInvoiceRequestNoneZ _res); +void CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res); /** - * Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` + * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ 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); +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceWithDerivedSigningPubkeyBuilder o); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_ok(struct LDKOutboundHTLCDetails o); /** - * Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. + * Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. */ -void CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res); +void CResult_OutboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. + * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_ok(struct LDKInvoiceRequest o); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); + +/** + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceRequestDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR o); +bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. + * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. */ -void CResult_InvoiceRequestDecodeErrorZ_free(struct LDKCResult_InvoiceRequestDecodeErrorZ _res); +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_ok(struct LDKInvoiceRequestFields o); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); /** - * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. */ -void CResult_InvoiceRequestFieldsDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ _res); +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ CResult_InvoiceRequestFieldsDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_NoneZ containing a - */ -enum LDKCOption_NoneZ COption_NoneZ_some(void); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_NoneZ containing nothing + * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState */ -enum LDKCOption_NoneZ COption_NoneZ_none(void); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); /** - * Frees any resources associated with the , if we are in the Some state + * Constructs a new COption_ChannelShutdownStateZ containing nothing */ -void COption_NoneZ_free(enum LDKCOption_NoneZ _res); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state */ -void CVec_WitnessZ_free(struct LDKCVec_WitnessZ _res); +void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); /** - * Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature + * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_some(struct LDKECDSASignature o); +struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); /** - * Constructs a new COption_ECDSASignatureZ containing nothing + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_none(void); +void CVec_InboundHTLCDetailsZ_free(struct LDKCVec_InboundHTLCDetailsZ _res); /** - * Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void COption_ECDSASignatureZ_free(struct LDKCOption_ECDSASignatureZ _res); +void CVec_OutboundHTLCDetailsZ_free(struct LDKCVec_OutboundHTLCDetailsZ _res); /** - * Creates a new COption_ECDSASignatureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. */ -struct LDKCOption_ECDSASignatureZ COption_ECDSASignatureZ_clone(const struct LDKCOption_ECDSASignatureZ *NONNULL_PTR orig); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); /** - * Constructs a new COption_i64Z containing a i64 + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. */ -struct LDKCOption_i64Z COption_i64Z_some(int64_t o); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_i64Z containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_i64Z COption_i64Z_none(void); +bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the i64, if we are in the Some state + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. */ -void COption_i64Z_free(struct LDKCOption_i64Z _res); +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); /** - * Creates a new COption_i64Z which has the same data as `orig` + * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_i64Z COption_i64Z_clone(const struct LDKCOption_i64Z *NONNULL_PTR orig); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SocketAddressDecodeErrorZ in the success state. + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. */ -struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_ok(struct LDKSocketAddress o); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); /** - * Creates a new CResult_SocketAddressDecodeErrorZ in the error state. + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. */ -struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SocketAddressDecodeErrorZ_is_ok(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SocketAddressDecodeErrorZ. + * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. */ -void CResult_SocketAddressDecodeErrorZ_free(struct LDKCResult_SocketAddressDecodeErrorZ _res); +void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); /** - * Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SocketAddressDecodeErrorZ CResult_SocketAddressDecodeErrorZ_clone(const struct LDKCResult_SocketAddressDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_ok(struct LDKSocketAddress o); +void CVec_FutureZ_free(struct LDKCVec_FutureZ _res); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. + * Creates a new CResult_OfferPathsRequestDecodeErrorZ in the success state. */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_err(enum LDKSocketAddressParseError e); +struct LDKCResult_OfferPathsRequestDecodeErrorZ CResult_OfferPathsRequestDecodeErrorZ_ok(struct LDKOfferPathsRequest o); + +/** + * Creates a new CResult_OfferPathsRequestDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferPathsRequestDecodeErrorZ CResult_OfferPathsRequestDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SocketAddressSocketAddressParseErrorZ_is_ok(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR o); +bool CResult_OfferPathsRequestDecodeErrorZ_is_ok(const struct LDKCResult_OfferPathsRequestDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. + * Frees any resources used by the CResult_OfferPathsRequestDecodeErrorZ. */ -void CResult_SocketAddressSocketAddressParseErrorZ_free(struct LDKCResult_SocketAddressSocketAddressParseErrorZ _res); +void CResult_OfferPathsRequestDecodeErrorZ_free(struct LDKCResult_OfferPathsRequestDecodeErrorZ _res); /** - * Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` + * Creates a new CResult_OfferPathsRequestDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ CResult_SocketAddressSocketAddressParseErrorZ_clone(const struct LDKCResult_SocketAddressSocketAddressParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_OfferPathsRequestDecodeErrorZ CResult_OfferPathsRequestDecodeErrorZ_clone(const struct LDKCResult_OfferPathsRequestDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_OfferPathsDecodeErrorZ in the success state. */ -void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res); +struct LDKCResult_OfferPathsDecodeErrorZ CResult_OfferPathsDecodeErrorZ_ok(struct LDKOfferPaths o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_OfferPathsDecodeErrorZ in the error state. */ -void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res); +struct LDKCResult_OfferPathsDecodeErrorZ CResult_OfferPathsDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res); +bool CResult_OfferPathsDecodeErrorZ_is_ok(const struct LDKCResult_OfferPathsDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_OfferPathsDecodeErrorZ. */ -void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res); +void CResult_OfferPathsDecodeErrorZ_free(struct LDKCResult_OfferPathsDecodeErrorZ _res); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. + * Creates a new CResult_OfferPathsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o); +struct LDKCResult_OfferPathsDecodeErrorZ CResult_OfferPathsDecodeErrorZ_clone(const struct LDKCResult_OfferPathsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. + * Creates a new CResult_ServeStaticInvoiceDecodeErrorZ in the success state. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ServeStaticInvoiceDecodeErrorZ CResult_ServeStaticInvoiceDecodeErrorZ_ok(struct LDKServeStaticInvoice o); + +/** + * Creates a new CResult_ServeStaticInvoiceDecodeErrorZ in the error state. + */ +struct LDKCResult_ServeStaticInvoiceDecodeErrorZ CResult_ServeStaticInvoiceDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o); +bool CResult_ServeStaticInvoiceDecodeErrorZ_is_ok(const struct LDKCResult_ServeStaticInvoiceDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. + * Frees any resources used by the CResult_ServeStaticInvoiceDecodeErrorZ. */ -void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res); +void CResult_ServeStaticInvoiceDecodeErrorZ_free(struct LDKCResult_ServeStaticInvoiceDecodeErrorZ _res); /** - * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ServeStaticInvoiceDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ServeStaticInvoiceDecodeErrorZ CResult_ServeStaticInvoiceDecodeErrorZ_clone(const struct LDKCResult_ServeStaticInvoiceDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. + * Creates a new CResult_StaticInvoicePersistedDecodeErrorZ in the success state. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_ok(struct LDKAcceptChannelV2 o); +struct LDKCResult_StaticInvoicePersistedDecodeErrorZ CResult_StaticInvoicePersistedDecodeErrorZ_ok(struct LDKStaticInvoicePersisted o); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. + * Creates a new CResult_StaticInvoicePersistedDecodeErrorZ in the error state. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_StaticInvoicePersistedDecodeErrorZ CResult_StaticInvoicePersistedDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_AcceptChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR o); +bool CResult_StaticInvoicePersistedDecodeErrorZ_is_ok(const struct LDKCResult_StaticInvoicePersistedDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. + * Frees any resources used by the CResult_StaticInvoicePersistedDecodeErrorZ. */ -void CResult_AcceptChannelV2DecodeErrorZ_free(struct LDKCResult_AcceptChannelV2DecodeErrorZ _res); +void CResult_StaticInvoicePersistedDecodeErrorZ_free(struct LDKCResult_StaticInvoicePersistedDecodeErrorZ _res); /** - * Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` + * Creates a new CResult_StaticInvoicePersistedDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ CResult_AcceptChannelV2DecodeErrorZ_clone(const struct LDKCResult_AcceptChannelV2DecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_StaticInvoicePersistedDecodeErrorZ CResult_StaticInvoicePersistedDecodeErrorZ_clone(const struct LDKCResult_StaticInvoicePersistedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_StfuDecodeErrorZ in the success state. + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. */ -struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_ok(struct LDKStfu o); +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_ok(struct LDKHeldHtlcAvailable o); /** - * Creates a new CResult_StfuDecodeErrorZ in the error state. + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. */ -struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_StfuDecodeErrorZ_is_ok(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR o); +bool CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_StfuDecodeErrorZ. + * Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. */ -void CResult_StfuDecodeErrorZ_free(struct LDKCResult_StfuDecodeErrorZ _res); +void CResult_HeldHtlcAvailableDecodeErrorZ_free(struct LDKCResult_HeldHtlcAvailableDecodeErrorZ _res); /** - * Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StfuDecodeErrorZ CResult_StfuDecodeErrorZ_clone(const struct LDKCResult_StfuDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_clone(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpliceInitDecodeErrorZ in the success state. + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. */ -struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_ok(struct LDKSpliceInit o); +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_ok(struct LDKReleaseHeldHtlc o); /** - * Creates a new CResult_SpliceInitDecodeErrorZ in the error state. + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. */ -struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SpliceInitDecodeErrorZ_is_ok(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR o); +bool CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SpliceInitDecodeErrorZ. + * Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. */ -void CResult_SpliceInitDecodeErrorZ_free(struct LDKCResult_SpliceInitDecodeErrorZ _res); +void CResult_ReleaseHeldHtlcDecodeErrorZ_free(struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ _res); /** - * Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SpliceInitDecodeErrorZ CResult_SpliceInitDecodeErrorZ_clone(const struct LDKCResult_SpliceInitDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_clone(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpliceAckDecodeErrorZ in the success state. + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. */ -struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_ok(struct LDKSpliceAck o); +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_ok(struct LDKAsyncPaymentsMessage o); /** - * Creates a new CResult_SpliceAckDecodeErrorZ in the error state. + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. */ -struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SpliceAckDecodeErrorZ_is_ok(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR o); +bool CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SpliceAckDecodeErrorZ. + * Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. */ -void CResult_SpliceAckDecodeErrorZ_free(struct LDKCResult_SpliceAckDecodeErrorZ _res); +void CResult_AsyncPaymentsMessageDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ _res); /** - * Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SpliceAckDecodeErrorZ CResult_SpliceAckDecodeErrorZ_clone(const struct LDKCResult_SpliceAckDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. + * Creates a new CResult_StaticInvoiceSignErrorZ in the success state. */ -struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_ok(struct LDKSpliceLocked o); +struct LDKCResult_StaticInvoiceSignErrorZ CResult_StaticInvoiceSignErrorZ_ok(struct LDKStaticInvoice o); /** - * Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. + * Creates a new CResult_StaticInvoiceSignErrorZ in the error state. */ -struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_StaticInvoiceSignErrorZ CResult_StaticInvoiceSignErrorZ_err(struct LDKSignError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SpliceLockedDecodeErrorZ_is_ok(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. - */ -void CResult_SpliceLockedDecodeErrorZ_free(struct LDKCResult_SpliceLockedDecodeErrorZ _res); +bool CResult_StaticInvoiceSignErrorZ_is_ok(const struct LDKCResult_StaticInvoiceSignErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_StaticInvoiceSignErrorZ. */ -struct LDKCResult_SpliceLockedDecodeErrorZ CResult_SpliceLockedDecodeErrorZ_clone(const struct LDKCResult_SpliceLockedDecodeErrorZ *NONNULL_PTR orig); +void CResult_StaticInvoiceSignErrorZ_free(struct LDKCResult_StaticInvoiceSignErrorZ _res); /** - * Creates a new CResult_TxAddInputDecodeErrorZ in the success state. + * Creates a new CResult_StaticInvoiceDecodeErrorZ in the success state. */ -struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_ok(struct LDKTxAddInput o); +struct LDKCResult_StaticInvoiceDecodeErrorZ CResult_StaticInvoiceDecodeErrorZ_ok(struct LDKStaticInvoice o); /** - * Creates a new CResult_TxAddInputDecodeErrorZ in the error state. + * Creates a new CResult_StaticInvoiceDecodeErrorZ in the error state. */ -struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_StaticInvoiceDecodeErrorZ CResult_StaticInvoiceDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxAddInputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR o); +bool CResult_StaticInvoiceDecodeErrorZ_is_ok(const struct LDKCResult_StaticInvoiceDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxAddInputDecodeErrorZ. + * Frees any resources used by the CResult_StaticInvoiceDecodeErrorZ. */ -void CResult_TxAddInputDecodeErrorZ_free(struct LDKCResult_TxAddInputDecodeErrorZ _res); +void CResult_StaticInvoiceDecodeErrorZ_free(struct LDKCResult_StaticInvoiceDecodeErrorZ _res); /** - * Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_StaticInvoiceDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxAddInputDecodeErrorZ CResult_TxAddInputDecodeErrorZ_clone(const struct LDKCResult_TxAddInputDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_StaticInvoiceDecodeErrorZ CResult_StaticInvoiceDecodeErrorZ_clone(const struct LDKCResult_StaticInvoiceDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. + * Creates a new CResult_OffersMessageDecodeErrorZ in the success state. */ -struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_ok(struct LDKTxAddOutput o); +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. + * Creates a new CResult_OffersMessageDecodeErrorZ in the error state. */ -struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxAddOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR o); +bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. + * Frees any resources used by the CResult_OffersMessageDecodeErrorZ. */ -void CResult_TxAddOutputDecodeErrorZ_free(struct LDKCResult_TxAddOutputDecodeErrorZ _res); +void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res); /** - * Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxAddOutputDecodeErrorZ CResult_TxAddOutputDecodeErrorZ_clone(const struct LDKCResult_TxAddOutputDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. + * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim */ -struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_ok(struct LDKTxRemoveInput o); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. + * Constructs a new COption_HTLCClaimZ containing nothing */ -struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state + */ +void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxRemoveInputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR o); +bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. + * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. */ -void CResult_TxRemoveInputDecodeErrorZ_free(struct LDKCResult_TxRemoveInputDecodeErrorZ _res); +void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); /** - * Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxRemoveInputDecodeErrorZ CResult_TxRemoveInputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveInputDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_ok(struct LDKTxRemoveOutput o); +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxRemoveOutputDecodeErrorZ_is_ok(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR o); +bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. + * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. */ -void CResult_TxRemoveOutputDecodeErrorZ_free(struct LDKCResult_TxRemoveOutputDecodeErrorZ _res); +void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); /** - * Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ CResult_TxRemoveOutputDecodeErrorZ_clone(const struct LDKCResult_TxRemoveOutputDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxCompleteDecodeErrorZ in the success state. + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_ok(struct LDKTxComplete o); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); /** - * Creates a new CResult_TxCompleteDecodeErrorZ in the error state. + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxCompleteDecodeErrorZ_is_ok(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxCompleteDecodeErrorZ. + * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. */ -void CResult_TxCompleteDecodeErrorZ_free(struct LDKCResult_TxCompleteDecodeErrorZ _res); +void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); /** - * Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCompleteDecodeErrorZ CResult_TxCompleteDecodeErrorZ_clone(const struct LDKCResult_TxCompleteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_ok(struct LDKTxSignatures o); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. + * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. */ -void CResult_TxSignaturesDecodeErrorZ_free(struct LDKCResult_TxSignaturesDecodeErrorZ _res); +void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); /** - * Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxSignaturesDecodeErrorZ CResult_TxSignaturesDecodeErrorZ_clone(const struct LDKCResult_TxSignaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_ok(struct LDKTxInitRbf o); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxInitRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR o); +bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. + * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. */ -void CResult_TxInitRbfDecodeErrorZ_free(struct LDKCResult_TxInitRbfDecodeErrorZ _res); +void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); /** - * Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxInitRbfDecodeErrorZ CResult_TxInitRbfDecodeErrorZ_clone(const struct LDKCResult_TxInitRbfDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_ok(struct LDKTxAckRbf o); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxAckRbfDecodeErrorZ_is_ok(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. + * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. */ -void CResult_TxAckRbfDecodeErrorZ_free(struct LDKCResult_TxAckRbfDecodeErrorZ _res); +void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); /** - * Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxAckRbfDecodeErrorZ CResult_TxAckRbfDecodeErrorZ_clone(const struct LDKCResult_TxAckRbfDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxAbortDecodeErrorZ in the success state. + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_ok(struct LDKTxAbort o); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); /** - * Creates a new CResult_TxAbortDecodeErrorZ in the error state. + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxAbortDecodeErrorZ_is_ok(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR o); +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxAbortDecodeErrorZ. + * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. */ -void CResult_TxAbortDecodeErrorZ_free(struct LDKCResult_TxAbortDecodeErrorZ _res); +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); /** - * Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxAbortDecodeErrorZ CResult_TxAbortDecodeErrorZ_clone(const struct LDKCResult_TxAbortDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. + * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. */ -void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res); +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); /** - * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o); +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. - */ -void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res); +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig); +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o); +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. */ -void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res); +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); /** - * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o); +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. - */ -void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res); +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig); +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); /** - * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the success state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. */ -struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_ok(struct LDKCommitmentSignedBatch o); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); /** - * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the error state. + * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. */ -struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_CommitmentSignedBatchDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedBatchDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CommitmentSignedBatchDecodeErrorZ. + * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. */ -void CResult_CommitmentSignedBatchDecodeErrorZ_free(struct LDKCResult_CommitmentSignedBatchDecodeErrorZ _res); +void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); /** - * Creates a new CResult_CommitmentSignedBatchDecodeErrorZ which has the same data as `orig` + * 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_CommitmentSignedBatchDecodeErrorZ CResult_CommitmentSignedBatchDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedBatchDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. - */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o); +struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. + * Constructs a new COption_usizeZ containing a usize */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_usizeZ containing nothing */ -bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_usizeZ COption_usizeZ_none(void); /** - * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. + * Frees any resources associated with the usize, if we are in the Some state */ -void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res); +void COption_usizeZ_free(struct LDKCOption_usizeZ _res); /** - * Creates a new CResult_CommitmentSignedDecodeErrorZ 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_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o); +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. + * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. */ -void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res); +void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); /** - * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the success state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); /** - * Creates a new CResult_FundingSignedDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); /** * Checks if the given object is currently in the success state */ -bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o); +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FundingSignedDecodeErrorZ. + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. */ -void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res); +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); /** - * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. + * Creates a new CResult_FundingInfoDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_ok(struct LDKFundingInfo o); + +/** + * Creates a new CResult_FundingInfoDecodeErrorZ in the error state. + */ +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); +bool CResult_FundingInfoDecodeErrorZ_is_ok(const struct LDKCResult_FundingInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. + * Frees any resources used by the CResult_FundingInfoDecodeErrorZ. */ -void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); +void CResult_FundingInfoDecodeErrorZ_free(struct LDKCResult_FundingInfoDecodeErrorZ _res); /** - * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_clone(const struct LDKCResult_FundingInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InitDecodeErrorZ in the success state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); /** - * Creates a new CResult_InitDecodeErrorZ in the error state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InitDecodeErrorZ. + * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. */ -void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res); +void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); /** - * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the success state. + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_ok(struct LDKClaimedHTLC o); /** - * Creates a new CResult_OpenChannelDecodeErrorZ in the error state. + * Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o); +bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OpenChannelDecodeErrorZ. + * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. */ -void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res); +void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); /** - * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. - */ -struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_ok(struct LDKOpenChannelV2 o); +struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. + * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure */ -struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_PathFailureZ containing nothing */ -bool CResult_OpenChannelV2DecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); /** - * Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state */ -void CResult_OpenChannelV2DecodeErrorZ_free(struct LDKCResult_OpenChannelV2DecodeErrorZ _res); +void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); /** - * Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` + * Creates a new COption_PathFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OpenChannelV2DecodeErrorZ CResult_OpenChannelV2DecodeErrorZ_clone(const struct LDKCResult_OpenChannelV2DecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. + * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. + * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. */ -void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res); +void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); /** - * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ShutdownDecodeErrorZ in the success state. - */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o); +struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownDecodeErrorZ in the error state. + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_ClosureReasonZ containing nothing */ -bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); /** - * Frees any resources used by the CResult_ShutdownDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state */ -void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res); +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); /** - * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` + * Creates a new COption_ClosureReasonZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. */ -void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res); +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. - */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. + * Constructs a new COption_HTLCHandlingFailureTypeZ containing a crate::lightning::events::HTLCHandlingFailureType */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCHandlingFailureTypeZ COption_HTLCHandlingFailureTypeZ_some(struct LDKHTLCHandlingFailureType o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCHandlingFailureTypeZ containing nothing */ -bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCHandlingFailureTypeZ COption_HTLCHandlingFailureTypeZ_none(void); /** - * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::HTLCHandlingFailureType, if we are in the Some state */ -void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res); +void COption_HTLCHandlingFailureTypeZ_free(struct LDKCOption_HTLCHandlingFailureTypeZ _res); /** - * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new COption_HTLCHandlingFailureTypeZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_HTLCHandlingFailureTypeZ COption_HTLCHandlingFailureTypeZ_clone(const struct LDKCOption_HTLCHandlingFailureTypeZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. + * Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ in the success state. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o); +struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_ok(struct LDKCOption_HTLCHandlingFailureTypeZ o); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. + * Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. + * Frees any resources used by the CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ. */ -void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res); +void CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_free(struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ _res); /** - * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. + * Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ in the success state. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o); +struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ CResult_HTLCHandlingFailureReasonDecodeErrorZ_ok(struct LDKHTLCHandlingFailureReason o); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. + * Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ CResult_HTLCHandlingFailureReasonDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o); +bool CResult_HTLCHandlingFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. + * Frees any resources used by the CResult_HTLCHandlingFailureReasonDecodeErrorZ. */ -void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res); +void CResult_HTLCHandlingFailureReasonDecodeErrorZ_free(struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ _res); /** - * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_OnionPacketDecodeErrorZ in the success state. - */ -struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_ok(struct LDKOnionPacket o); +struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ CResult_HTLCHandlingFailureReasonDecodeErrorZ_clone(const struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OnionPacketDecodeErrorZ in the error state. + * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason */ -struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_PaymentFailureReasonZ containing nothing */ -bool CResult_OnionPacketDecodeErrorZ_is_ok(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void); /** - * Frees any resources used by the CResult_OnionPacketDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state */ -void CResult_OnionPacketDecodeErrorZ_free(struct LDKCResult_OnionPacketDecodeErrorZ _res); +void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res); /** - * Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` + * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OnionPacketDecodeErrorZ CResult_OnionPacketDecodeErrorZ_clone(const struct LDKCResult_OnionPacketDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(struct LDKCOption_PaymentFailureReasonZ o); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. + * Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. */ -void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res); +void CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. - */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. + * Constructs a new COption_U128Z containing a crate::c_types::U128 */ -struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_U128Z containing nothing */ -bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_U128Z COption_U128Z_none(void); /** - * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. + * Frees any resources associated with the crate::c_types::U128, if we are in the Some state */ -void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); +void COption_U128Z_free(struct LDKCOption_U128Z _res); /** - * Creates a new CResult_OnionMessageDecodeErrorZ 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 LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. - */ -struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_ok(struct LDKFinalOnionHopData o); +struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); /** - * Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_ChannelIdCOption_U128ZZ C2Tuple_ChannelIdCOption_U128ZZ_clone(const struct LDKC2Tuple_ChannelIdCOption_U128ZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_ChannelIdCOption_U128ZZ from the contained elements. */ -bool CResult_FinalOnionHopDataDecodeErrorZ_is_ok(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_ChannelIdCOption_U128ZZ C2Tuple_ChannelIdCOption_U128ZZ_new(struct LDKChannelId a, struct LDKCOption_U128Z b); /** - * Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. + * Frees any resources used by the C2Tuple_ChannelIdCOption_U128ZZ. */ -void CResult_FinalOnionHopDataDecodeErrorZ_free(struct LDKCResult_FinalOnionHopDataDecodeErrorZ _res); +void C2Tuple_ChannelIdCOption_U128ZZ_free(struct LDKC2Tuple_ChannelIdCOption_U128ZZ _res); /** - * Creates a new CResult_FinalOnionHopDataDecodeErrorZ 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 LDKCResult_FinalOnionHopDataDecodeErrorZ CResult_FinalOnionHopDataDecodeErrorZ_clone(const struct LDKCResult_FinalOnionHopDataDecodeErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_ChannelIdCOption_U128ZZZ_free(struct LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ _res); /** - * Creates a new CResult_PingDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o); +void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); /** - * Creates a new CResult_PingDecodeErrorZ in the error state. + * Constructs a new COption_PaidBolt12InvoiceZ containing a crate::lightning::events::PaidBolt12Invoice */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_PaidBolt12InvoiceZ COption_PaidBolt12InvoiceZ_some(struct LDKPaidBolt12Invoice o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_PaidBolt12InvoiceZ containing nothing */ -bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_PaidBolt12InvoiceZ COption_PaidBolt12InvoiceZ_none(void); /** - * Frees any resources used by the CResult_PingDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::PaidBolt12Invoice, if we are in the Some state */ -void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res); +void COption_PaidBolt12InvoiceZ_free(struct LDKCOption_PaidBolt12InvoiceZ _res); /** - * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` + * Creates a new COption_PaidBolt12InvoiceZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_PaidBolt12InvoiceZ COption_PaidBolt12InvoiceZ_clone(const struct LDKCOption_PaidBolt12InvoiceZ *NONNULL_PTR orig); /** - * Creates a new CResult_PongDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o); +void CVec_u32Z_free(struct LDKCVec_u32Z _res); /** - * Creates a new CResult_PongDecodeErrorZ in the error state. + * Constructs a new COption_OutPointZ containing a crate::lightning::chain::transaction::OutPoint */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_OutPointZ COption_OutPointZ_some(struct LDKOutPoint o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_OutPointZ containing nothing */ -bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_OutPointZ COption_OutPointZ_none(void); /** - * Frees any resources used by the CResult_PongDecodeErrorZ. + * Frees any resources associated with the crate::lightning::chain::transaction::OutPoint, if we are in the Some state */ -void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res); +void COption_OutPointZ_free(struct LDKCOption_OutPointZ _res); /** - * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` + * Creates a new COption_OutPointZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_OutPointZ COption_OutPointZ_clone(const struct LDKCOption_OutPointZ *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o); +void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. + * Constructs a new COption_HTLCHandlingFailureReasonZ containing a crate::lightning::events::HTLCHandlingFailureReason */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCHandlingFailureReasonZ COption_HTLCHandlingFailureReasonZ_some(struct LDKHTLCHandlingFailureReason o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCHandlingFailureReasonZ containing nothing */ -bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCHandlingFailureReasonZ COption_HTLCHandlingFailureReasonZ_none(void); /** - * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::HTLCHandlingFailureReason, if we are in the Some state */ -void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res); +void COption_HTLCHandlingFailureReasonZ_free(struct LDKCOption_HTLCHandlingFailureReasonZ _res); /** - * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * Creates a new COption_HTLCHandlingFailureReasonZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o); +struct LDKCOption_HTLCHandlingFailureReasonZ COption_HTLCHandlingFailureReasonZ_clone(const struct LDKCOption_HTLCHandlingFailureReasonZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. + * Constructs a new COption_EventZ containing a crate::lightning::events::Event */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_EventZ containing nothing */ -bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. + * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state */ -void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` + * Creates a new COption_EventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. */ -void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res); +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); /** - * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. + * Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o); +struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ CResult_PaidBolt12InvoiceDecodeErrorZ_ok(struct LDKPaidBolt12Invoice o); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. + * Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ CResult_PaidBolt12InvoiceDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaidBolt12InvoiceDecodeErrorZ_is_ok(const struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. + * Frees any resources used by the CResult_PaidBolt12InvoiceDecodeErrorZ. */ -void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res); +void CResult_PaidBolt12InvoiceDecodeErrorZ_free(struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ _res); /** - * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ CResult_PaidBolt12InvoiceDecodeErrorZ_clone(const struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. + * Creates a new CResult_PacketDecodeErrorZ in the success state. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o); +struct LDKCResult_PacketDecodeErrorZ CResult_PacketDecodeErrorZ_ok(struct LDKPacket o); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. + * Creates a new CResult_PacketDecodeErrorZ in the error state. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PacketDecodeErrorZ CResult_PacketDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o); +bool CResult_PacketDecodeErrorZ_is_ok(const struct LDKCResult_PacketDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. + * Frees any resources used by the CResult_PacketDecodeErrorZ. */ -void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res); +void CResult_PacketDecodeErrorZ_free(struct LDKCResult_PacketDecodeErrorZ _res); /** - * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PacketDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PacketDecodeErrorZ CResult_PacketDecodeErrorZ_clone(const struct LDKCResult_PacketDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the success state. + * Creates a new CResult_NonceDecodeErrorZ in the success state. */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o); +struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_ok(struct LDKNonce o); /** - * Creates a new CResult_WarningMessageDecodeErrorZ in the error state. + * Creates a new CResult_NonceDecodeErrorZ in the error state. */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o); +bool CResult_NonceDecodeErrorZ_is_ok(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_WarningMessageDecodeErrorZ. + * Frees any resources used by the CResult_NonceDecodeErrorZ. */ -void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res); +void CResult_NonceDecodeErrorZ_free(struct LDKCResult_NonceDecodeErrorZ _res); /** - * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NonceDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_clone(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. + * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. + * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. + * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. */ -void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res); +void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res); /** - * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o); +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. + * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. */ -void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res); +void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res); /** - * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o); +bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. + * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. */ -void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res); +void CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res); /** - * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. - */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. */ -bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o); +struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c); /** - * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. + * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. */ -void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res); +void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res); /** - * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. */ -bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o); +void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); /** - * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. + * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res); +struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_QueryChannelRangeDecodeErrorZ 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 LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o); +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. */ -void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. + * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. + * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o); +bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. + * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. */ -void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res); +void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res); /** - * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. */ -struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_some(enum LDKInboundHTLCStateDetails o); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o); /** - * Constructs a new COption_InboundHTLCStateDetailsZ containing nothing + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. */ -struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_none(void); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); /** - * Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_InboundHTLCStateDetailsZ_free(struct LDKCOption_InboundHTLCStateDetailsZ _res); +bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o); /** - * Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. */ -struct LDKCOption_InboundHTLCStateDetailsZ COption_InboundHTLCStateDetailsZ_clone(const struct LDKCOption_InboundHTLCStateDetailsZ *NONNULL_PTR orig); +void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res); /** - * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. + * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_InboundHTLCStateDetailsZ o); +struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. + * Constructs a new COption_AddressZ containing a crate::c_types::Address */ -struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_AddressZ COption_AddressZ_some(struct LDKAddress o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_AddressZ containing nothing */ -bool CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_AddressZ COption_AddressZ_none(void); /** - * Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. + * Frees any resources associated with the crate::c_types::Address, if we are in the Some state */ -void CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ _res); +void COption_AddressZ_free(struct LDKCOption_AddressZ _res); /** - * Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_ok(struct LDKInboundHTLCDetails o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** - * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -bool CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. + * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_InboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_InboundHTLCDetailsDecodeErrorZ _res); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_InboundHTLCDetailsDecodeErrorZ CResult_InboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_InboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_some(enum LDKOutboundHTLCStateDetails o); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); /** - * Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_none(void); +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void COption_OutboundHTLCStateDetailsZ_free(struct LDKCOption_OutboundHTLCStateDetailsZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); /** - * Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_OutboundHTLCStateDetailsZ COption_OutboundHTLCStateDetailsZ_clone(const struct LDKCOption_OutboundHTLCStateDetailsZ *NONNULL_PTR orig); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(struct LDKCOption_OutboundHTLCStateDetailsZ o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR o); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. + * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ -void CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ _res); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); /** - * Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(const struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. + * Creates a new CResult_BigSizeDecodeErrorZ in the success state. */ -struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_ok(struct LDKOutboundHTLCDetails o); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o); /** - * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. + * Creates a new CResult_BigSizeDecodeErrorZ in the error state. */ -struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR o); +bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. + * Frees any resources used by the CResult_BigSizeDecodeErrorZ. */ -void CResult_OutboundHTLCDetailsDecodeErrorZ_free(struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ _res); +void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res); /** - * Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ CResult_OutboundHTLCDetailsDecodeErrorZ_clone(const struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + * Creates a new CResult_CollectionLengthDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); +struct LDKCResult_CollectionLengthDecodeErrorZ CResult_CollectionLengthDecodeErrorZ_ok(struct LDKCollectionLength o); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + * Creates a new CResult_CollectionLengthDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CollectionLengthDecodeErrorZ CResult_CollectionLengthDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. - */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); +bool CResult_CollectionLengthDecodeErrorZ_is_ok(const struct LDKCResult_CollectionLengthDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_CollectionLengthDecodeErrorZ. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); +void CResult_CollectionLengthDecodeErrorZ_free(struct LDKCResult_CollectionLengthDecodeErrorZ _res); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); +bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. */ -void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); +void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState - */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_some(enum LDKChannelShutdownState o); +struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ChannelShutdownStateZ containing nothing + * Creates a new CResult_HostnameDecodeErrorZ in the success state. */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_none(void); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o); /** - * Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state + * Creates a new CResult_HostnameDecodeErrorZ in the error state. */ -void COption_ChannelShutdownStateZ_free(struct LDKCOption_ChannelShutdownStateZ _res); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_ChannelShutdownStateZ COption_ChannelShutdownStateZ_clone(const struct LDKCOption_ChannelShutdownStateZ *NONNULL_PTR orig); +bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_HostnameDecodeErrorZ. */ -void CVec_InboundHTLCDetailsZ_free(struct LDKCVec_InboundHTLCDetailsZ _res); +void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_OutboundHTLCDetailsZ_free(struct LDKCVec_OutboundHTLCDetailsZ _res); +struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. + * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); +void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. + * Creates a new CResult_BlindedPaymentPathNoneZ in the success state. */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_ok(enum LDKChannelShutdownState o); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_ok(struct LDKBlindedPaymentPath o); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. + * Creates a new CResult_BlindedPaymentPathNoneZ in the error state. */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelShutdownStateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedPaymentPathNoneZ_is_ok(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. + * Frees any resources used by the CResult_BlindedPaymentPathNoneZ. */ -void CResult_ChannelShutdownStateDecodeErrorZ_free(struct LDKCResult_ChannelShutdownStateDecodeErrorZ _res); +void CResult_BlindedPaymentPathNoneZ_free(struct LDKCResult_BlindedPaymentPathNoneZ _res); /** - * Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedPaymentPathNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ CResult_ChannelShutdownStateDecodeErrorZ_clone(const struct LDKCResult_ChannelShutdownStateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_clone(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_FutureZ_free(struct LDKCVec_FutureZ _res); +void CVec_PaymentForwardNodeZ_free(struct LDKCVec_PaymentForwardNodeZ _res); /** - * Creates a new CResult_RawLSPSMessageDecodeErrorZ in the success state. + * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. */ -struct LDKCResult_RawLSPSMessageDecodeErrorZ CResult_RawLSPSMessageDecodeErrorZ_ok(struct LDKRawLSPSMessage o); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); /** - * Creates a new CResult_RawLSPSMessageDecodeErrorZ in the error state. + * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. */ -struct LDKCResult_RawLSPSMessageDecodeErrorZ CResult_RawLSPSMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RawLSPSMessageDecodeErrorZ_is_ok(const struct LDKCResult_RawLSPSMessageDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RawLSPSMessageDecodeErrorZ. + * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. */ -void CResult_RawLSPSMessageDecodeErrorZ_free(struct LDKCResult_RawLSPSMessageDecodeErrorZ _res); +void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); /** - * Creates a new CResult_RawLSPSMessageDecodeErrorZ 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. */ -struct LDKCResult_RawLSPSMessageDecodeErrorZ CResult_RawLSPSMessageDecodeErrorZ_clone(const struct LDKCResult_RawLSPSMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_LSPSDateTimeNoneZ in the success state. + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. */ -struct LDKCResult_LSPSDateTimeNoneZ CResult_LSPSDateTimeNoneZ_ok(struct LDKLSPSDateTime o); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); /** - * Creates a new CResult_LSPSDateTimeNoneZ in the error state. + * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. */ -struct LDKCResult_LSPSDateTimeNoneZ CResult_LSPSDateTimeNoneZ_err(void); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_LSPSDateTimeNoneZ_is_ok(const struct LDKCResult_LSPSDateTimeNoneZ *NONNULL_PTR o); +bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_LSPSDateTimeNoneZ. + * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. */ -void CResult_LSPSDateTimeNoneZ_free(struct LDKCResult_LSPSDateTimeNoneZ _res); +void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); /** - * Creates a new CResult_LSPSDateTimeNoneZ 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. */ -struct LDKCResult_LSPSDateTimeNoneZ CResult_LSPSDateTimeNoneZ_clone(const struct LDKCResult_LSPSDateTimeNoneZ *NONNULL_PTR orig); +struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. + * Creates a new CResult_PaymentContextDecodeErrorZ in the success state. */ -struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_ok(struct LDKHeldHtlcAvailable o); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_ok(struct LDKPaymentContext o); /** - * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. + * Creates a new CResult_PaymentContextDecodeErrorZ in the error state. */ -struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. + * Frees any resources used by the CResult_PaymentContextDecodeErrorZ. */ -void CResult_HeldHtlcAvailableDecodeErrorZ_free(struct LDKCResult_HeldHtlcAvailableDecodeErrorZ _res); +void CResult_PaymentContextDecodeErrorZ_free(struct LDKCResult_PaymentContextDecodeErrorZ _res); /** - * Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HeldHtlcAvailableDecodeErrorZ CResult_HeldHtlcAvailableDecodeErrorZ_clone(const struct LDKCResult_HeldHtlcAvailableDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_clone(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. */ -struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_ok(struct LDKReleaseHeldHtlc o); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_ok(struct LDKBolt12OfferContext o); /** - * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state. */ -struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt12OfferContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. + * Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ. */ -void CResult_ReleaseHeldHtlcDecodeErrorZ_free(struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ _res); +void CResult_Bolt12OfferContextDecodeErrorZ_free(struct LDKCResult_Bolt12OfferContextDecodeErrorZ _res); /** - * Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ CResult_ReleaseHeldHtlcDecodeErrorZ_clone(const struct LDKCResult_ReleaseHeldHtlcDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. + * Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ in the success state. */ -struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_ok(struct LDKAsyncPaymentsMessage o); +struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ CResult_AsyncBolt12OfferContextDecodeErrorZ_ok(struct LDKAsyncBolt12OfferContext o); /** - * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. + * Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ in the error state. */ -struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ CResult_AsyncBolt12OfferContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR o); +bool CResult_AsyncBolt12OfferContextDecodeErrorZ_is_ok(const struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. + * Frees any resources used by the CResult_AsyncBolt12OfferContextDecodeErrorZ. */ -void CResult_AsyncPaymentsMessageDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ _res); +void CResult_AsyncBolt12OfferContextDecodeErrorZ_free(struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ _res); /** - * Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ CResult_AsyncPaymentsMessageDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ CResult_AsyncBolt12OfferContextDecodeErrorZ_clone(const struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OffersMessageDecodeErrorZ in the success state. + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state. */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_ok(struct LDKOffersMessage o); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_ok(struct LDKBolt12RefundContext o); /** - * Creates a new CResult_OffersMessageDecodeErrorZ in the error state. + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state. */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OffersMessageDecodeErrorZ_is_ok(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt12RefundContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OffersMessageDecodeErrorZ. + * Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ. */ -void CResult_OffersMessageDecodeErrorZ_free(struct LDKCResult_OffersMessageDecodeErrorZ _res); +void CResult_Bolt12RefundContextDecodeErrorZ_free(struct LDKCResult_Bolt12RefundContextDecodeErrorZ _res); /** - * Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OffersMessageDecodeErrorZ CResult_OffersMessageDecodeErrorZ_clone(const struct LDKCResult_OffersMessageDecodeErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim - */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); - -/** - * Constructs a new COption_HTLCClaimZ containing nothing - */ -struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); - -/** - * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state - */ -void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); +struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelIdDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_ok(struct LDKChannelId o); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelIdDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelIdDecodeErrorZ_is_ok(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelIdDecodeErrorZ. */ -void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); +void CResult_ChannelIdDecodeErrorZ_free(struct LDKCResult_ChannelIdDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_clone(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. */ -void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. */ -void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. */ -void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. */ -void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. */ -void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); +void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. */ -void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); +void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. */ -void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. - */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_clone(const struct LDKC2Tuple__u832u16Z *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple__u832u16Z from the contained elements. */ -bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); +struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_new(struct LDKThirtyTwoBytes a, uint16_t b); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * Frees any resources used by the C2Tuple__u832u16Z. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +void C2Tuple__u832u16Z_free(struct LDKC2Tuple__u832u16Z _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_ResponderDecodeErrorZ in the success state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_ok(struct LDKResponder o); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_ResponderDecodeErrorZ in the error state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_ResponderDecodeErrorZ_is_ok(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_ResponderDecodeErrorZ. */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +void CResult_ResponderDecodeErrorZ_free(struct LDKCResult_ResponderDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_clone(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * Creates a new CResult_OnionMessagePathNoneZ in the success state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * Creates a new CResult_OnionMessagePathNoneZ in the error state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); +bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * Frees any resources used by the CResult_OnionMessagePathNoneZ. */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. + * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_ok(struct LDKCVec_ECDSASignatureZ o); +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_err(void); +struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_clone(const struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ from the contained elements. */ -bool CResult_CVec_ECDSASignatureZNoneZ_is_ok(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR o); +struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_new(struct LDKPublicKey a, struct LDKOnionMessage b, struct LDKCVec_SocketAddressZ c); /** - * Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. + * Frees any resources used by the C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ. */ -void CResult_CVec_ECDSASignatureZNoneZ_free(struct LDKCResult_CVec_ECDSASignatureZNoneZ _res); +void C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_free(struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ _res); /** - * Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ in the success state. */ -struct LDKCResult_CVec_ECDSASignatureZNoneZ CResult_CVec_ECDSASignatureZNoneZ_clone(const struct LDKCResult_CVec_ECDSASignatureZNoneZ *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_ok(struct LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ o); /** - * Constructs a new COption_usizeZ containing a usize + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ in the error state. */ -struct LDKCOption_usizeZ COption_usizeZ_some(uintptr_t o); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_err(struct LDKSendError e); /** - * Constructs a new COption_usizeZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_usizeZ COption_usizeZ_none(void); +bool CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_is_ok(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the usize, if we are in the Some state + * Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ. */ -void COption_usizeZ_free(struct LDKCOption_usizeZ _res); +void CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_free(struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ _res); /** - * Creates a new COption_usizeZ which has the same data as `orig` + * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_usizeZ COption_usizeZ_clone(const struct LDKCOption_usizeZ *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_clone(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Creates a new CResult_PeeledOnionNoneZ in the success state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Creates a new CResult_PeeledOnionNoneZ in the error state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); +bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Frees any resources used by the CResult_PeeledOnionNoneZ. */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_clone(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Creates a new CResult_SendSuccessSendErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_ok(struct LDKSendSuccess o); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Creates a new CResult_SendSuccessSendErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); +bool CResult_SendSuccessSendErrorZ_is_ok(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees any resources used by the CResult_SendSuccessSendErrorZ. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void CResult_SendSuccessSendErrorZ_free(struct LDKCResult_SendSuccessSendErrorZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_clone(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_u64NoneZ in the success state. + * Creates a new CResult_NoneSendErrorZ in the success state. */ -struct LDKCResult_u64NoneZ CResult_u64NoneZ_ok(uint64_t o); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); /** - * Creates a new CResult_u64NoneZ in the error state. + * Creates a new CResult_NoneSendErrorZ in the error state. */ -struct LDKCResult_u64NoneZ CResult_u64NoneZ_err(void); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_u64NoneZ_is_ok(const struct LDKCResult_u64NoneZ *NONNULL_PTR o); +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_u64NoneZ. + * Frees any resources used by the CResult_NoneSendErrorZ. */ -void CResult_u64NoneZ_free(struct LDKCResult_u64NoneZ _res); +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); /** - * Creates a new CResult_u64NoneZ which has the same data as `orig` + * Creates a new CResult_NoneSendErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_u64NoneZ CResult_u64NoneZ_clone(const struct LDKCResult_u64NoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_clone(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingInfoDecodeErrorZ in the success state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. */ -struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_ok(struct LDKFundingInfo o); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); /** - * Creates a new CResult_FundingInfoDecodeErrorZ in the error state. + * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. */ -struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); /** * Checks if the given object is currently in the success state */ -bool CResult_FundingInfoDecodeErrorZ_is_ok(const struct LDKCResult_FundingInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FundingInfoDecodeErrorZ. + * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. */ -void CResult_FundingInfoDecodeErrorZ_free(struct LDKCResult_FundingInfoDecodeErrorZ _res); +void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); /** - * Creates a new CResult_FundingInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingInfoDecodeErrorZ CResult_FundingInfoDecodeErrorZ_clone(const struct LDKCResult_FundingInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. */ -void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); /** - * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -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); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_ClaimedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR o); +void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); /** - * Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_ClaimedHTLCDecodeErrorZ_free(struct LDKCResult_ClaimedHTLCDecodeErrorZ _res); +void CVec_FundingTxInputZ_free(struct LDKCVec_FundingTxInputZ _res); /** - * Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_FundingTxInputDecodeErrorZ in the success state. */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ CResult_ClaimedHTLCDecodeErrorZ_clone(const struct LDKCResult_ClaimedHTLCDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingTxInputDecodeErrorZ CResult_FundingTxInputDecodeErrorZ_ok(struct LDKFundingTxInput o); /** - * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure + * Creates a new CResult_FundingTxInputDecodeErrorZ in the error state. */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o); +struct LDKCResult_FundingTxInputDecodeErrorZ CResult_FundingTxInputDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_PathFailureZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void); +bool CResult_FundingTxInputDecodeErrorZ_is_ok(const struct LDKCResult_FundingTxInputDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state + * Frees any resources used by the CResult_FundingTxInputDecodeErrorZ. */ -void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res); +void CResult_FundingTxInputDecodeErrorZ_free(struct LDKCResult_FundingTxInputDecodeErrorZ _res); /** - * Creates a new COption_PathFailureZ which has the same data as `orig` + * Creates a new CResult_FundingTxInputDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig); +struct LDKCResult_FundingTxInputDecodeErrorZ CResult_FundingTxInputDecodeErrorZ_clone(const struct LDKCResult_FundingTxInputDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. + * Creates a new CResult_FundingTxInputNoneZ in the success state. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o); +struct LDKCResult_FundingTxInputNoneZ CResult_FundingTxInputNoneZ_ok(struct LDKFundingTxInput o); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. + * Creates a new CResult_FundingTxInputNoneZ in the error state. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_FundingTxInputNoneZ CResult_FundingTxInputNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o); +bool CResult_FundingTxInputNoneZ_is_ok(const struct LDKCResult_FundingTxInputNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. + * Frees any resources used by the CResult_FundingTxInputNoneZ. */ -void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res); +void CResult_FundingTxInputNoneZ_free(struct LDKCResult_FundingTxInputNoneZ _res); /** - * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_FundingTxInputNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_FundingTxInputNoneZ CResult_FundingTxInputNoneZ_clone(const struct LDKCResult_FundingTxInputNoneZ *NONNULL_PTR orig); /** - * Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason + * Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ in the success state. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); +struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ CResult_LocalHTLCFailureReasonDecodeErrorZ_ok(struct LDKLocalHTLCFailureReason o); /** - * Constructs a new COption_ClosureReasonZ containing nothing + * Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ in the error state. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); +struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ CResult_LocalHTLCFailureReasonDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); +bool CResult_LocalHTLCFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_ClosureReasonZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_LocalHTLCFailureReasonDecodeErrorZ. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); +void CResult_LocalHTLCFailureReasonDecodeErrorZ_free(struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ _res); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + * Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); +struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ CResult_LocalHTLCFailureReasonDecodeErrorZ_clone(const struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_OnionPacketu64u32Z C3Tuple_OnionPacketu64u32Z_clone(const struct LDKC3Tuple_OnionPacketu64u32Z *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C3Tuple_OnionPacketu64u32Z from the contained elements. */ -bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); +struct LDKC3Tuple_OnionPacketu64u32Z C3Tuple_OnionPacketu64u32Z_new(struct LDKOnionPacket a, uint64_t b, uint32_t c); /** - * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + * Frees any resources used by the C3Tuple_OnionPacketu64u32Z. */ -void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); +void C3Tuple_OnionPacketu64u32Z_free(struct LDKC3Tuple_OnionPacketu64u32Z _res); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ in the success state. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_ok(struct LDKC3Tuple_OnionPacketu64u32Z o); /** - * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination + * Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ in the error state. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); +struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_err(struct LDKAPIError e); /** - * Constructs a new COption_HTLCDestinationZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); +bool CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_is_ok(const struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state + * Frees any resources used by the CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ. */ -void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); +void CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_free(struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ _res); /** - * Creates a new COption_HTLCDestinationZ which has the same data as `orig` + * Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); +struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_clone(const struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. + * Creates a new CResult_AttributionDataDecodeErrorZ in the success state. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); +struct LDKCResult_AttributionDataDecodeErrorZ CResult_AttributionDataDecodeErrorZ_ok(struct LDKAttributionData o); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. + * Creates a new CResult_AttributionDataDecodeErrorZ in the error state. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_AttributionDataDecodeErrorZ CResult_AttributionDataDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); +bool CResult_AttributionDataDecodeErrorZ_is_ok(const struct LDKCResult_AttributionDataDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. + * Frees any resources used by the CResult_AttributionDataDecodeErrorZ. */ -void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); +void CResult_AttributionDataDecodeErrorZ_free(struct LDKCResult_AttributionDataDecodeErrorZ _res); /** - * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_AttributionDataDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AttributionDataDecodeErrorZ CResult_AttributionDataDecodeErrorZ_clone(const struct LDKCResult_AttributionDataDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason + * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state. */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o); +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o); /** - * Constructs a new COption_PaymentFailureReasonZ containing nothing + * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state. */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void); +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res); +bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` + * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ. + */ +void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res); + +/** + * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state. */ -struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(struct LDKCOption_PaymentFailureReasonZ o); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_ok(struct LDKTrackedSpendableOutput o); /** - * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state. */ -struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR o); +bool CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. + * Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ. */ -void CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ _res); +void CResult_TrackedSpendableOutputDecodeErrorZ_free(struct LDKCResult_TrackedSpendableOutputDecodeErrorZ _res); /** - * Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_clone(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_U128Z containing a crate::c_types::U128 + * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state. */ -struct LDKCOption_U128Z COption_U128Z_some(struct LDKU128 o); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_ok(struct LDKOutputSpendStatus o); /** - * Constructs a new COption_U128Z containing nothing + * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state. */ -struct LDKCOption_U128Z COption_U128Z_none(void); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::c_types::U128, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_U128Z_free(struct LDKCOption_U128Z _res); +bool CResult_OutputSpendStatusDecodeErrorZ_is_ok(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_U128Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ. */ -struct LDKCOption_U128Z COption_U128Z_clone(const struct LDKCOption_U128Z *NONNULL_PTR orig); +void CResult_OutputSpendStatusDecodeErrorZ_free(struct LDKCResult_OutputSpendStatusDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_ClaimedHTLCZ_free(struct LDKCVec_ClaimedHTLCZ _res); +struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_clone(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_EventZ containing a crate::lightning::events::Event + * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter */ -struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); +struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); /** - * Constructs a new COption_EventZ containing nothing + * Constructs a new COption_FilterZ containing nothing */ -struct LDKCOption_EventZ COption_EventZ_none(void); +struct LDKCOption_FilterZ COption_FilterZ_none(void); /** - * Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state + * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state */ -void COption_EventZ_free(struct LDKCOption_EventZ _res); +void COption_FilterZ_free(struct LDKCOption_FilterZ _res); /** - * Creates a new COption_EventZ 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_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); +void CVec_TrackedSpendableOutputZ_free(struct LDKCVec_TrackedSpendableOutputZ _res); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. + * Creates a new C2Tuple_BestBlockOutputSweeperSyncZ from the contained elements. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); +struct LDKC2Tuple_BestBlockOutputSweeperSyncZ C2Tuple_BestBlockOutputSweeperSyncZ_new(struct LDKBestBlock a, struct LDKOutputSweeperSync b); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. + * Frees any resources used by the C2Tuple_BestBlockOutputSweeperSyncZ. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); +void C2Tuple_BestBlockOutputSweeperSyncZ_free(struct LDKC2Tuple_BestBlockOutputSweeperSyncZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ in the success state. */ -bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_ok(struct LDKC2Tuple_BestBlockOutputSweeperSyncZ o); /** - * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + * Creates a new CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ in the error state. */ -void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); +bool CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NonceDecodeErrorZ in the success state. + * Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ. */ -struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_ok(struct LDKNonce o); +void CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ _res); /** - * Creates a new CResult_NonceDecodeErrorZ in the error state. + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state. */ -struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_ok(struct LDKDelayedPaymentBasepoint o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state. */ -bool CResult_NonceDecodeErrorZ_is_ok(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_NonceDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_NonceDecodeErrorZ_free(struct LDKCResult_NonceDecodeErrorZ _res); +bool CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NonceDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ. */ -struct LDKCResult_NonceDecodeErrorZ CResult_NonceDecodeErrorZ_clone(const struct LDKCResult_NonceDecodeErrorZ *NONNULL_PTR orig); +void CResult_DelayedPaymentBasepointDecodeErrorZ_free(struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state. */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_ok(enum LDKSiPrefix o); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_ok(struct LDKDelayedPaymentKey o); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state. */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SiPrefixBolt11ParseErrorZ_is_ok(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR o); +bool CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. + * Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ. */ -void CResult_SiPrefixBolt11ParseErrorZ_free(struct LDKCResult_SiPrefixBolt11ParseErrorZ _res); +void CResult_DelayedPaymentKeyDecodeErrorZ_free(struct LDKCResult_DelayedPaymentKeyDecodeErrorZ _res); /** - * Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` + * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ CResult_SiPrefixBolt11ParseErrorZ_clone(const struct LDKCResult_SiPrefixBolt11ParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state. */ -struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(struct LDKBolt11Invoice o); +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_ok(struct LDKHtlcBasepoint o); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. + * Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state. */ -struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); +bool CResult_HtlcBasepointDecodeErrorZ_is_ok(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. + * Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ. */ -void CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ _res); +void CResult_HtlcBasepointDecodeErrorZ_free(struct LDKCResult_HtlcBasepointDecodeErrorZ _res); /** - * Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_clone(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. + * Creates a new CResult_HtlcKeyDecodeErrorZ in the success state. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(struct LDKSignedRawBolt11Invoice o); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_ok(struct LDKHtlcKey o); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. + * Creates a new CResult_HtlcKeyDecodeErrorZ in the error state. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(struct LDKBolt11ParseError e); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. - */ -void CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ _res); +bool CResult_HtlcKeyDecodeErrorZ_is_ok(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_HtlcKeyDecodeErrorZ. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(const struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ *NONNULL_PTR orig); +void CResult_HtlcKeyDecodeErrorZ_free(struct LDKCResult_HtlcKeyDecodeErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ *NONNULL_PTR orig); +struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_clone(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state. */ -struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(struct LDKRawBolt11Invoice a, struct LDKThirtyTwoBytes b, struct LDKBolt11InvoiceSignature c); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_ok(struct LDKRevocationBasepoint o); /** - * Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. + * Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state. */ -void C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ _res); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_ok(struct LDKPayeePubKey o); +bool CResult_RevocationBasepointDecodeErrorZ_is_ok(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. + * Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ. */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_err(enum LDKSecp256k1Error e); +void CResult_RevocationBasepointDecodeErrorZ_free(struct LDKCResult_RevocationBasepointDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_PayeePubKeySecp256k1ErrorZ_is_ok(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR o); +struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_clone(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. + * Creates a new CResult_RevocationKeyDecodeErrorZ in the success state. */ -void CResult_PayeePubKeySecp256k1ErrorZ_free(struct LDKCResult_PayeePubKeySecp256k1ErrorZ _res); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_ok(struct LDKRevocationKey o); /** - * Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RevocationKeyDecodeErrorZ in the error state. */ -struct LDKCResult_PayeePubKeySecp256k1ErrorZ CResult_PayeePubKeySecp256k1ErrorZ_clone(const struct LDKCResult_PayeePubKeySecp256k1ErrorZ *NONNULL_PTR orig); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Checks if the given object is currently in the success state */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +bool CResult_RevocationKeyDecodeErrorZ_is_ok(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Frees any resources used by the CResult_RevocationKeyDecodeErrorZ. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +void CResult_RevocationKeyDecodeErrorZ_free(struct LDKCResult_RevocationKeyDecodeErrorZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_clone(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. + * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. */ -struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_ok(void); +void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); +struct LDKC2Tuple_ChannelIdCVec_u64ZZ C2Tuple_ChannelIdCVec_u64ZZ_clone(const struct LDKC2Tuple_ChannelIdCVec_u64ZZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_ChannelIdCVec_u64ZZ from the contained elements. */ -bool CResult_NoneBolt11SemanticErrorZ_is_ok(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_ChannelIdCVec_u64ZZ C2Tuple_ChannelIdCVec_u64ZZ_new(struct LDKChannelId a, struct LDKCVec_u64Z b); /** - * Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. + * Frees any resources used by the C2Tuple_ChannelIdCVec_u64ZZ. */ -void CResult_NoneBolt11SemanticErrorZ_free(struct LDKCResult_NoneBolt11SemanticErrorZ _res); +void C2Tuple_ChannelIdCVec_u64ZZ_free(struct LDKC2Tuple_ChannelIdCVec_u64ZZ _res); /** - * Creates a new CResult_NoneBolt11SemanticErrorZ 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 LDKCResult_NoneBolt11SemanticErrorZ CResult_NoneBolt11SemanticErrorZ_clone(const struct LDKCResult_NoneBolt11SemanticErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_ChannelIdCVec_u64ZZZ_free(struct LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ _res); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. + * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the success state. */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(struct LDKBolt11Invoice o); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_ok(struct LDKBlindedMessagePath o); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. + * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the error state. */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(enum LDKBolt11SemanticError e); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR o); +bool CResult_BlindedMessagePathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. + * Frees any resources used by the CResult_BlindedMessagePathDecodeErrorZ. */ -void CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ _res); +void CResult_BlindedMessagePathDecodeErrorZ_free(struct LDKCResult_BlindedMessagePathDecodeErrorZ _res); /** - * Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedMessagePathDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(const struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_clone(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Creates a new CResult_MessageContextDecodeErrorZ in the success state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_ok(struct LDKMessageContext o); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Creates a new CResult_MessageContextDecodeErrorZ in the error state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +bool CResult_MessageContextDecodeErrorZ_is_ok(const struct LDKCResult_MessageContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Frees any resources used by the CResult_MessageContextDecodeErrorZ. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +void CResult_MessageContextDecodeErrorZ_free(struct LDKCResult_MessageContextDecodeErrorZ _res); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` + * Creates a new CResult_MessageContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_clone(const struct LDKCResult_MessageContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Creates a new CResult_OffersContextDecodeErrorZ in the success state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_ok(struct LDKOffersContext o); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Creates a new CResult_OffersContextDecodeErrorZ in the error state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); +bool CResult_OffersContextDecodeErrorZ_is_ok(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Frees any resources used by the CResult_OffersContextDecodeErrorZ. */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +void CResult_OffersContextDecodeErrorZ_free(struct LDKCResult_OffersContextDecodeErrorZ _res); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * Creates a new CResult_OffersContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_clone(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the success state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_ok(struct LDKAsyncPaymentsContext o); /** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the error state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); +bool CResult_AsyncPaymentsContextDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Frees any resources used by the CResult_AsyncPaymentsContextDecodeErrorZ. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +void CResult_AsyncPaymentsContextDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsContextDecodeErrorZ _res); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BigSizeDecodeErrorZ in the success state. + * Creates a new CResult_DNSResolverContextDecodeErrorZ in the success state. */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_ok(struct LDKBigSize o); +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_ok(struct LDKDNSResolverContext o); /** - * Creates a new CResult_BigSizeDecodeErrorZ in the error state. + * Creates a new CResult_DNSResolverContextDecodeErrorZ in the error state. */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_BigSizeDecodeErrorZ_is_ok(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR o); +bool CResult_DNSResolverContextDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_BigSizeDecodeErrorZ. + * Frees any resources used by the CResult_DNSResolverContextDecodeErrorZ. */ -void CResult_BigSizeDecodeErrorZ_free(struct LDKCResult_BigSizeDecodeErrorZ _res); +void CResult_DNSResolverContextDecodeErrorZ_free(struct LDKCResult_DNSResolverContextDecodeErrorZ _res); /** - * Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_DNSResolverContextDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BigSizeDecodeErrorZ CResult_BigSizeDecodeErrorZ_clone(const struct LDKCResult_BigSizeDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_clone(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. + * Frees any resources used by the AnchorChannelReserveContext, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o); +void AnchorChannelReserveContext_free(struct LDKAnchorChannelReserveContext this_obj); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. + * The expected number of accepted in-flight HTLCs per channel. + * + * Note that malicious counterparties can saturate the number of accepted in-flight HTLCs up to + * the maximum prior to forcing a unilateral closure. This estimate can include that case as a + * weighted average, assuming some percentage of channels are controlled by malicious peers and + * have the maximum number of accepted in-flight HTLCs. + * + * See [ChannelHandshakeConfig::our_max_accepted_htlcs] to configure the maximum number of + * accepted in-flight HTLCs. + * + * [ChannelHandshakeConfig::our_max_accepted_htlcs]: crate::util::config::ChannelHandshakeConfig::our_max_accepted_htlcs */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e); +uint16_t AnchorChannelReserveContext_get_expected_accepted_htlcs(const struct LDKAnchorChannelReserveContext *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The expected number of accepted in-flight HTLCs per channel. + * + * Note that malicious counterparties can saturate the number of accepted in-flight HTLCs up to + * the maximum prior to forcing a unilateral closure. This estimate can include that case as a + * weighted average, assuming some percentage of channels are controlled by malicious peers and + * have the maximum number of accepted in-flight HTLCs. + * + * See [ChannelHandshakeConfig::our_max_accepted_htlcs] to configure the maximum number of + * accepted in-flight HTLCs. + * + * [ChannelHandshakeConfig::our_max_accepted_htlcs]: crate::util::config::ChannelHandshakeConfig::our_max_accepted_htlcs */ -bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o); +void AnchorChannelReserveContext_set_expected_accepted_htlcs(struct LDKAnchorChannelReserveContext *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. + * Whether the wallet handling anchor channel reserves creates Taproot P2TR outputs for any new + * outputs, or Segwit P2WPKH outputs otherwise. */ -void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res); +bool AnchorChannelReserveContext_get_taproot_wallet(const struct LDKAnchorChannelReserveContext *NONNULL_PTR this_ptr); /** - * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Whether the wallet handling anchor channel reserves creates Taproot P2TR outputs for any new + * outputs, or Segwit P2WPKH outputs otherwise. */ -struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig); +void AnchorChannelReserveContext_set_taproot_wallet(struct LDKAnchorChannelReserveContext *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_HostnameDecodeErrorZ in the success state. + * Creates a copy of the AnchorChannelReserveContext */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_ok(struct LDKHostname o); +struct LDKAnchorChannelReserveContext AnchorChannelReserveContext_clone(const struct LDKAnchorChannelReserveContext *NONNULL_PTR orig); /** - * Creates a new CResult_HostnameDecodeErrorZ in the error state. + * Checks if two AnchorChannelReserveContexts 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. */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_err(struct LDKDecodeError e); +bool AnchorChannelReserveContext_eq(const struct LDKAnchorChannelReserveContext *NONNULL_PTR a, const struct LDKAnchorChannelReserveContext *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Creates a "default" AnchorChannelReserveContext. See struct and individual field documentaiton for details on which values are used. */ -bool CResult_HostnameDecodeErrorZ_is_ok(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKAnchorChannelReserveContext AnchorChannelReserveContext_default(void); /** - * Frees any resources used by the CResult_HostnameDecodeErrorZ. + * Returns the amount that needs to be maintained as a reserve per anchor channel. + * + * This reserve currently needs to be allocated as a disjoint set of at least 1 UTXO per channel, + * as claims are not yet aggregated across channels. + * + * To only require 1 UTXO per channel, it is assumed that, on average, transactions are able to + * get confirmed within 1 block with [ConfirmationTarget::UrgentOnChainSweep], or that only a + * portion of channels will go through unilateral closure at the same time, allowing UTXOs to be + * shared. Otherwise, multiple UTXOs would be needed per channel: + * - HTLC time-out transactions with different expiries cannot be aggregated. This could result in + * many individual transactions that need to be confirmed starting from different, but potentially + * sequential block heights. + * - If each transaction takes N blocks to confirm, at least N UTXOs per channel are needed to + * provide the necessary concurrency. + * + * The returned amount includes the fee to spend a single UTXO of the type indicated by + * [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more complex witnesses + * will need to include the corresponding fee required to spend them. + * + * [ConfirmationTarget::UrgentOnChainSweep]: crate::chain::chaininterface::ConfirmationTarget::UrgentOnChainSweep */ -void CResult_HostnameDecodeErrorZ_free(struct LDKCResult_HostnameDecodeErrorZ _res); +uint64_t get_reserve_per_channel(const struct LDKAnchorChannelReserveContext *NONNULL_PTR context); /** - * Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Calculates the number of anchor channels that can be supported by the reserve provided + * by `utxos`. */ -struct LDKCResult_HostnameDecodeErrorZ CResult_HostnameDecodeErrorZ_clone(const struct LDKCResult_HostnameDecodeErrorZ *NONNULL_PTR orig); +uint64_t get_supportable_anchor_channels(const struct LDKAnchorChannelReserveContext *NONNULL_PTR context, struct LDKCVec_UtxoZ utxos); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state. + * Verifies whether the anchor channel reserve provided by `utxos` is sufficient to support + * an additional anchor channel. + * + * This should be verified: + * - Before opening a new outbound anchor channel with [ChannelManager::create_channel]. + * - Before accepting a new inbound anchor channel while handling [Event::OpenChannelRequest]. + * + * [ChannelManager::create_channel]: crate::ln::channelmanager::ChannelManager::create_channel + * [Event::OpenChannelRequest]: crate::events::Event::OpenChannelRequest */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_ok(struct LDKTransactionU16LenLimited o); +bool can_support_additional_anchor_channel(const struct LDKAnchorChannelReserveContext *NONNULL_PTR context, struct LDKCVec_UtxoZ utxos, const struct LDKChannelManager *NONNULL_PTR a_channel_manager, const struct LDKChainMonitor *NONNULL_PTR chain_monitor); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state. + * Frees any resources used by the APIError */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_err(void); +void APIError_free(struct LDKAPIError this_ptr); /** - * Checks if the given object is currently in the success state + * Creates a copy of the APIError */ -bool CResult_TransactionU16LenLimitedNoneZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR o); +struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ. + * Utility method to constructs a new APIMisuseError-variant APIError */ -void CResult_TransactionU16LenLimitedNoneZ_free(struct LDKCResult_TransactionU16LenLimitedNoneZ _res); +struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); /** - * Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new FeeRateTooHigh-variant APIError */ -struct LDKCResult_TransactionU16LenLimitedNoneZ CResult_TransactionU16LenLimitedNoneZ_clone(const struct LDKCResult_TransactionU16LenLimitedNoneZ *NONNULL_PTR orig); +struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state. + * Utility method to constructs a new InvalidRoute-variant APIError */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_ok(struct LDKTransactionU16LenLimited o); +struct LDKAPIError APIError_invalid_route(struct LDKStr err); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. + * Utility method to constructs a new ChannelUnavailable-variant APIError */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new MonitorUpdateInProgress-variant APIError */ -bool CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR o); +struct LDKAPIError APIError_monitor_update_in_progress(void); /** - * Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. + * Utility method to constructs a new IncompatibleShutdownScript-variant APIError */ -void CResult_TransactionU16LenLimitedDecodeErrorZ_free(struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ _res); +struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); /** - * Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two APIErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ CResult_TransactionU16LenLimitedDecodeErrorZ_clone(const struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ *NONNULL_PTR orig); +bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); /** - * Creates a new CResult_ChannelIdDecodeErrorZ in the success state. + * Serialize the APIError object into a byte array which can be read by APIError_read */ -struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_ok(struct LDKChannelId o); +struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); /** - * Creates a new CResult_ChannelIdDecodeErrorZ in the error state. + * Read a APIError from a byte array, created by APIError_write */ -struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Creates a digital signature of a message given a SecretKey, like the node's secret. + * 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. */ -bool CResult_ChannelIdDecodeErrorZ_is_ok(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR o); +struct LDKStr sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); /** - * Frees any resources used by the CResult_ChannelIdDecodeErrorZ. + * Recovers the PublicKey of the signer of the message given the message and the signature. */ -void CResult_ChannelIdDecodeErrorZ_free(struct LDKCResult_ChannelIdDecodeErrorZ _res); +struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); /** - * Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, + * and the PublicKey. */ -struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_clone(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR orig); +bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Creates a copy of a KVStoreSync */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +struct LDKKVStoreSync KVStoreSync_clone(const struct LDKKVStoreSync *NONNULL_PTR orig); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +void KVStoreSync_free(struct LDKKVStoreSync this_ptr); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the KVStoreSyncWrapper, if is_owned is set and inner is non-NULL. */ -bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); +void KVStoreSyncWrapper_free(struct LDKKVStoreSyncWrapper this_obj); + +const struct LDKKVStoreSync *KVStoreSyncWrapper_get_a(const struct LDKKVStoreSyncWrapper *NONNULL_PTR this_ptr); + +void KVStoreSyncWrapper_set_a(struct LDKKVStoreSyncWrapper *NONNULL_PTR this_ptr, struct LDKKVStoreSync val); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Constructs a new KVStoreSyncWrapper given each field */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +MUST_USE_RES struct LDKKVStoreSyncWrapper KVStoreSyncWrapper_new(struct LDKKVStoreSync a_arg); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the KVStoreSyncWrapper */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKKVStoreSyncWrapper KVStoreSyncWrapper_clone(const struct LDKKVStoreSyncWrapper *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + * Creates a copy of a MigratableKVStore */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); +struct LDKMigratableKVStore MigratableKVStore_clone(const struct LDKMigratableKVStore *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Calls the free function if one is set */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +void MigratableKVStore_free(struct LDKMigratableKVStore this_ptr); /** - * Checks if the given object is currently in the success state + * Migrates all data from one store to another. + * + * This operation assumes that `target_store` is empty, i.e., any data present under copied keys + * might get overriden. User must ensure `source_store` is not modified during operation, + * otherwise no consistency guarantees can be given. + * + * Will abort and return an error if any IO operation fails. Note that in this case the + * `target_store` might get left in an intermediate state. */ -bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NoneIOErrorZ migrate_kv_store_data(struct LDKMigratableKVStore *NONNULL_PTR source_store, struct LDKMigratableKVStore *NONNULL_PTR target_store); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Read previously persisted [`ChannelMonitor`]s from the store. */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStoreSync kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); +void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + * 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`]. + * + * Note that you can disable the update-writing entirely by setting `maximum_pending_updates` + * to zero, causing this [`Persist`] implementation to behave like the blanket [`Persist`] + * implementation for all [`KVStoreSync`]s. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); +MUST_USE_RES struct LDKMonitorUpdatingPersister MonitorUpdatingPersister_new(struct LDKKVStoreSync kv_store, struct LDKLogger logger, uint64_t maximum_pending_updates, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + * Reads all stored channel monitors, along with any stored updates for them. + * + * It is extremely important that your [`KVStoreSync::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Read a single channel monitor, along with any stored updates for it. + * + * It is extremely important that your [`KVStoreSync::read`] implementation uses the + * [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the + * documentation for [`MonitorUpdatingPersister`]. + * + * For `monitor_key`, channel storage keys can be the channel's funding [`OutPoint`], with an + * underscore `_` between txid and index for v1 channels. For example, given: + * + * - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` + * - Index: `1` + * + * The correct `monitor_key` would be: + * `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` + * + * For v2 channels, the hex-encoded [`ChannelId`] is used directly for `monitor_key` instead. + * + * 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. */ -bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, struct LDKStr monitor_key); /** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + * 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 [`KVStoreSync::remove`]. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * 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 LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. + * Frees any resources used by the MonitorName */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); +void MonitorName_free(struct LDKMonitorName this_ptr); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a copy of the MonitorName */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKMonitorName MonitorName_clone(const struct LDKMonitorName *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new V1Channel-variant MonitorName */ -bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKMonitorName MonitorName_v1_channel(struct LDKOutPoint a); /** - * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. + * Utility method to constructs a new V2Channel-variant MonitorName */ -void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); +struct LDKMonitorName MonitorName_v2_channel(struct LDKChannelId a); /** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two MonitorNames contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +bool MonitorName_eq(const struct LDKMonitorName *NONNULL_PTR a, const struct LDKMonitorName *NONNULL_PTR b); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the MonitorName. */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); +uint64_t MonitorName_hash(const struct LDKMonitorName *NONNULL_PTR o); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. + * Get the string representation of a MonitorName object */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKStr MonitorName_to_str(const struct LDKMonitorName *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the UpdateName, if is_owned is set and inner is non-NULL. */ -bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +void UpdateName_free(struct LDKUpdateName this_obj); + +uint64_t UpdateName_get_a(const struct LDKUpdateName *NONNULL_PTR this_ptr); + +void UpdateName_set_a(struct LDKUpdateName *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. + * Constructs an [`UpdateName`], after verifying that an update sequence ID + * can be derived from the given `name`. */ -void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_UpdateNameIOErrorZ UpdateName_new(struct LDKStr name); /** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Convert this update name to a string slice. + * + * This method is particularly useful when you need to use the update name + * as part of a key in a key-value store or when logging. + * + * # Examples + * + * ``` + * use lightning::util::persist::UpdateName; + * + * let update_name = UpdateName::from(42); + * assert_eq!(update_name.as_str(), \"42\"); + * ``` */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKStr UpdateName_as_str(const struct LDKUpdateName *NONNULL_PTR this_arg); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. + * Build a UpdateName from a u64 */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); +struct LDKUpdateName UpdateName_from_u64(uint64_t f); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. + * Creates a copy of the ShortChannelIdError */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +enum LDKShortChannelIdError ShortChannelIdError_clone(const enum LDKShortChannelIdError *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new BlockOverflow-variant ShortChannelIdError */ -bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); +enum LDKShortChannelIdError ShortChannelIdError_block_overflow(void); /** - * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. + * Utility method to constructs a new TxIndexOverflow-variant ShortChannelIdError */ -void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); +enum LDKShortChannelIdError ShortChannelIdError_tx_index_overflow(void); /** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new VoutIndexOverflow-variant ShortChannelIdError */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); +enum LDKShortChannelIdError ShortChannelIdError_vout_index_overflow(void); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + * Checks if two ShortChannelIdErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); +bool ShortChannelIdError_eq(const enum LDKShortChannelIdError *NONNULL_PTR a, const enum LDKShortChannelIdError *NONNULL_PTR b); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + * Extracts the block height (most significant 3-bytes) from the `short_channel_id` */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +uint32_t block_from_scid(uint64_t short_channel_id); /** - * Checks if the given object is currently in the success state + * Extracts the tx index (bytes [2..4]) from the `short_channel_id` */ -bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); +uint32_t tx_index_from_scid(uint64_t short_channel_id); /** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + * Extracts the vout (bytes [0..2]) from the `short_channel_id` */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +uint16_t vout_from_scid(uint64_t short_channel_id); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a `short_channel_id` using the components pieces. Results in an error + * if the block height, tx index, or vout index overflow the maximum sizes. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_u64ShortChannelIdErrorZ scid_from_parts(uint64_t block, uint64_t tx_index, uint64_t vout_index); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. */ -struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_clone(const struct LDKC2Tuple__u832u16Z *NONNULL_PTR orig); +void BigSize_free(struct LDKBigSize this_obj); + +uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); + +void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new C2Tuple__u832u16Z from the contained elements. + * Constructs a new BigSize given each field */ -struct LDKC2Tuple__u832u16Z C2Tuple__u832u16Z_new(struct LDKThirtyTwoBytes a, uint16_t b); +MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); /** - * Frees any resources used by the C2Tuple__u832u16Z. + * Creates a copy of the BigSize */ -void C2Tuple__u832u16Z_free(struct LDKC2Tuple__u832u16Z _res); +struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. + * Generates a non-cryptographic 64-bit hash of the BigSize. */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o); +uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o); /** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state. + * Checks if two BigSizes 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. */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e); +bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Serialize the BigSize object into a byte array which can be read by BigSize_read */ -bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ. + * Read a BigSize from a byte array, created by BigSize_write */ -void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res); +struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser); /** - * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CollectionLength, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig); +void CollectionLength_free(struct LDKCollectionLength this_obj); + +uint64_t CollectionLength_get_a(const struct LDKCollectionLength *NONNULL_PTR this_ptr); + +void CollectionLength_set_a(struct LDKCollectionLength *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_BlindedPaymentPathNoneZ in the success state. + * Constructs a new CollectionLength given each field */ -struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_ok(struct LDKBlindedPaymentPath o); +MUST_USE_RES struct LDKCollectionLength CollectionLength_new(uint64_t a_arg); /** - * Creates a new CResult_BlindedPaymentPathNoneZ in the error state. + * Serialize the CollectionLength object into a byte array which can be read by CollectionLength_read */ -struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_err(void); +struct LDKCVec_u8Z CollectionLength_write(const struct LDKCollectionLength *NONNULL_PTR obj); /** - * Checks if the given object is currently in the success state + * Read a CollectionLength from a byte array, created by CollectionLength_write */ -bool CResult_BlindedPaymentPathNoneZ_is_ok(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR o); +struct LDKCResult_CollectionLengthDecodeErrorZ CollectionLength_read(struct LDKu8slice ser); /** - * Frees any resources used by the CResult_BlindedPaymentPathNoneZ. + * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read */ -void CResult_BlindedPaymentPathNoneZ_free(struct LDKCResult_BlindedPaymentPathNoneZ _res); +struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj); /** - * Creates a new CResult_BlindedPaymentPathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a UntrustedString from a byte array, created by UntrustedString_write */ -struct LDKCResult_BlindedPaymentPathNoneZ CResult_BlindedPaymentPathNoneZ_clone(const struct LDKCResult_BlindedPaymentPathNoneZ *NONNULL_PTR orig); +struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. */ -void CVec_PaymentForwardNodeZ_free(struct LDKCVec_PaymentForwardNodeZ _res); +void Hostname_free(struct LDKHostname this_obj); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ in the success state. + * Creates a copy of the Hostname */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_ok(struct LDKPaymentRelay o); +struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ in the error state. + * Generates a non-cryptographic 64-bit hash of the Hostname. */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t Hostname_hash(const struct LDKHostname *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Checks if two Hostnames 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 CResult_PaymentRelayDecodeErrorZ_is_ok(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR o); +bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); /** - * Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. + * Returns the length of the hostname. */ -void CResult_PaymentRelayDecodeErrorZ_free(struct LDKCResult_PaymentRelayDecodeErrorZ _res); +MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); /** - * Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Get the string representation of a Hostname object */ -struct LDKCResult_PaymentRelayDecodeErrorZ CResult_PaymentRelayDecodeErrorZ_clone(const struct LDKCResult_PaymentRelayDecodeErrorZ *NONNULL_PTR orig); +struct LDKStr Hostname_to_str(const struct LDKHostname *NONNULL_PTR o); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the success state. + * Serialize the Hostname object into a byte array which can be read by Hostname_read */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_ok(struct LDKPaymentConstraints o); +struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ in the error state. + * Read a Hostname from a byte array, created by Hostname_write */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the TrackedSpendableOutput, if is_owned is set and inner is non-NULL. */ -bool CResult_PaymentConstraintsDecodeErrorZ_is_ok(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR o); +void TrackedSpendableOutput_free(struct LDKTrackedSpendableOutput this_obj); /** - * Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. + * The tracked output descriptor. */ -void CResult_PaymentConstraintsDecodeErrorZ_free(struct LDKCResult_PaymentConstraintsDecodeErrorZ _res); +struct LDKSpendableOutputDescriptor TrackedSpendableOutput_get_descriptor(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The tracked output descriptor. */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ CResult_PaymentConstraintsDecodeErrorZ_clone(const struct LDKCResult_PaymentConstraintsDecodeErrorZ *NONNULL_PTR orig); +void TrackedSpendableOutput_set_descriptor(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKSpendableOutputDescriptor val); /** - * Creates a new CResult_PaymentContextDecodeErrorZ in the success state. + * The channel this output belongs to. + * + * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_ok(struct LDKPaymentContext o); +struct LDKChannelId TrackedSpendableOutput_get_channel_id(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PaymentContextDecodeErrorZ in the error state. + * The channel this output belongs to. + * + * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_err(struct LDKDecodeError e); +void TrackedSpendableOutput_set_channel_id(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); + +/** + * The current status of the output spend. + */ +struct LDKOutputSpendStatus TrackedSpendableOutput_get_status(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The current status of the output spend. */ -bool CResult_PaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR o); +void TrackedSpendableOutput_set_status(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKOutputSpendStatus val); /** - * Frees any resources used by the CResult_PaymentContextDecodeErrorZ. + * Constructs a new TrackedSpendableOutput given each field + * + * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_PaymentContextDecodeErrorZ_free(struct LDKCResult_PaymentContextDecodeErrorZ _res); +MUST_USE_RES struct LDKTrackedSpendableOutput TrackedSpendableOutput_new(struct LDKSpendableOutputDescriptor descriptor_arg, struct LDKChannelId channel_id_arg, struct LDKOutputSpendStatus status_arg); /** - * Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the TrackedSpendableOutput */ -struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_clone(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR orig); +struct LDKTrackedSpendableOutput TrackedSpendableOutput_clone(const struct LDKTrackedSpendableOutput *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. + * Checks if two TrackedSpendableOutputs 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. */ -struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_ok(struct LDKBolt12OfferContext o); +bool TrackedSpendableOutput_eq(const struct LDKTrackedSpendableOutput *NONNULL_PTR a, const struct LDKTrackedSpendableOutput *NONNULL_PTR b); /** - * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state. + * Returns whether the output is spent in the given transaction. */ -struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES bool TrackedSpendableOutput_is_spent_in(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_arg, struct LDKTransaction tx); /** - * Checks if the given object is currently in the success state + * Serialize the TrackedSpendableOutput object into a byte array which can be read by TrackedSpendableOutput_read */ -bool CResult_Bolt12OfferContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR o); +struct LDKCVec_u8Z TrackedSpendableOutput_write(const struct LDKTrackedSpendableOutput *NONNULL_PTR obj); /** - * Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ. + * Read a TrackedSpendableOutput from a byte array, created by TrackedSpendableOutput_write */ -void CResult_Bolt12OfferContextDecodeErrorZ_free(struct LDKCResult_Bolt12OfferContextDecodeErrorZ _res); +struct LDKCResult_TrackedSpendableOutputDecodeErrorZ TrackedSpendableOutput_read(struct LDKu8slice ser); /** - * Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the OutputSpendStatus */ -struct LDKCResult_Bolt12OfferContextDecodeErrorZ CResult_Bolt12OfferContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12OfferContextDecodeErrorZ *NONNULL_PTR orig); +void OutputSpendStatus_free(struct LDKOutputSpendStatus this_ptr); /** - * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state. + * Creates a copy of the OutputSpendStatus */ -struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_ok(struct LDKBolt12RefundContext o); +struct LDKOutputSpendStatus OutputSpendStatus_clone(const struct LDKOutputSpendStatus *NONNULL_PTR orig); /** - * Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state. + * Utility method to constructs a new PendingInitialBroadcast-variant OutputSpendStatus */ -struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKOutputSpendStatus OutputSpendStatus_pending_initial_broadcast(struct LDKCOption_u32Z delayed_until_height); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new PendingFirstConfirmation-variant OutputSpendStatus */ -bool CResult_Bolt12RefundContextDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR o); +struct LDKOutputSpendStatus OutputSpendStatus_pending_first_confirmation(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx); /** - * Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ. + * Utility method to constructs a new PendingThresholdConfirmations-variant OutputSpendStatus */ -void CResult_Bolt12RefundContextDecodeErrorZ_free(struct LDKCResult_Bolt12RefundContextDecodeErrorZ _res); +struct LDKOutputSpendStatus OutputSpendStatus_pending_threshold_confirmations(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx, uint32_t confirmation_height, struct LDKThirtyTwoBytes confirmation_hash); /** - * Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if two OutputSpendStatuss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_Bolt12RefundContextDecodeErrorZ CResult_Bolt12RefundContextDecodeErrorZ_clone(const struct LDKCResult_Bolt12RefundContextDecodeErrorZ *NONNULL_PTR orig); +bool OutputSpendStatus_eq(const struct LDKOutputSpendStatus *NONNULL_PTR a, const struct LDKOutputSpendStatus *NONNULL_PTR b); /** - * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. + * Serialize the OutputSpendStatus object into a byte array which can be read by OutputSpendStatus_read */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o); +struct LDKCVec_u8Z OutputSpendStatus_write(const struct LDKOutputSpendStatus *NONNULL_PTR obj); /** - * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. + * Read a OutputSpendStatus from a byte array, created by OutputSpendStatus_write */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e); +struct LDKCResult_OutputSpendStatusDecodeErrorZ OutputSpendStatus_read(struct LDKu8slice ser); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the SpendingDelay */ -bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o); +void SpendingDelay_free(struct LDKSpendingDelay this_ptr); /** - * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. + * Creates a copy of the SpendingDelay */ -void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res); +struct LDKSpendingDelay SpendingDelay_clone(const struct LDKSpendingDelay *NONNULL_PTR orig); /** - * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Utility method to constructs a new Relative-variant SpendingDelay */ -struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig); +struct LDKSpendingDelay SpendingDelay_relative(uint32_t num_blocks); /** - * Creates a new CResult_ResponderDecodeErrorZ in the success state. + * Utility method to constructs a new Absolute-variant SpendingDelay */ -struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_ok(struct LDKResponder o); +struct LDKSpendingDelay SpendingDelay_absolute(uint32_t height); /** - * Creates a new CResult_ResponderDecodeErrorZ in the error state. + * Frees any resources used by the OutputSweeperSync, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_err(struct LDKDecodeError e); +void OutputSweeperSync_free(struct LDKOutputSweeperSync this_obj); /** - * Checks if the given object is currently in the success state + * Constructs a new [`OutputSweeperSync`] instance. + * + * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users also + * need to register their [`Filter`] implementation via the given `chain_data_source`. */ -bool CResult_ResponderDecodeErrorZ_is_ok(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKOutputSweeperSync OutputSweeperSync_new(struct LDKBestBlock best_block, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKCOption_FilterZ chain_data_source, struct LDKOutputSpender output_spender, struct LDKChangeDestinationSourceSync change_destination_source, struct LDKKVStoreSync kv_store, struct LDKLogger logger); /** - * Frees any resources used by the CResult_ResponderDecodeErrorZ. + * Tells the sweeper to track the given outputs descriptors. + * + * Usually, this should be called based on the values emitted by the + * [`Event::SpendableOutputs`]. + * + * The given `exclude_static_outputs` flag controls whether the sweeper will filter out + * [`SpendableOutputDescriptor::StaticOutput`]s, which may be handled directly by the on-chain + * wallet implementation. + * + * If `delay_until_height` is set, we will delay the spending until the respective block + * height is reached. This can be used to batch spends, e.g., to reduce on-chain fees. + * + * Returns `Err` on persistence failure, in which case the call may be safely retried. + * + * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs + * + * Note that channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_ResponderDecodeErrorZ_free(struct LDKCResult_ResponderDecodeErrorZ _res); +MUST_USE_RES struct LDKCResult_NoneNoneZ OutputSweeperSync_track_spendable_outputs(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ output_descriptors, struct LDKChannelId channel_id, bool exclude_static_outputs, struct LDKCOption_u32Z delay_until_height); /** - * Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Returns a list of the currently tracked spendable outputs. + * + * Wraps [`OutputSweeper::tracked_spendable_outputs`]. */ -struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_clone(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_TrackedSpendableOutputZ OutputSweeperSync_tracked_spendable_outputs(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg); /** - * Creates a new CResult_OnionMessagePathNoneZ in the success state. + * Gets the latest best block which was connected either via [`Listen`] or [`Confirm`] + * interfaces. */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); +MUST_USE_RES struct LDKBestBlock OutputSweeperSync_current_best_block(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg); /** - * Creates a new CResult_OnionMessagePathNoneZ in the error state. + * Regenerates and broadcasts the spending transaction for any outputs that are pending. This method will be a + * no-op if a sweep is already pending. + * + * Wraps [`OutputSweeper::regenerate_and_broadcast_spend_if_necessary`]. */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); +MUST_USE_RES struct LDKCResult_NoneNoneZ OutputSweeperSync_regenerate_and_broadcast_spend_if_necessary(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg); /** - * Checks if the given object is currently in the success state + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); +struct LDKListen OutputSweeperSync_as_Listen(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_OnionMessagePathNoneZ. + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); +struct LDKConfirm OutputSweeperSync_as_Confirm(const struct LDKOutputSweeperSync *NONNULL_PTR this_arg); /** - * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Read a C2Tuple_BestBlockOutputSweeperSyncZ from a byte array, created by C2Tuple_BestBlockOutputSweeperSyncZ_write */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ C2Tuple_BestBlockOutputSweeperSyncZ_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSourceSync arg_e, struct LDKKVStoreSync arg_f, struct LDKLogger arg_g); /** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. + * Frees any resources used by the Notifier, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_ok(struct LDKCVec_BlindedMessagePathZ o); +void Notifier_free(struct LDKNotifier this_obj); /** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. + * Constructs a new notifier. */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_err(void); +MUST_USE_RES struct LDKNotifier Notifier_new(void); /** - * Checks if the given object is currently in the success state + * Wake waiters, tracking that wake needs to occur even if there are currently no waiters. + * + * We deem the notification successful either directly after any callbacks were made, or after + * the user [`poll`]ed a previously-generated [`Future`]. + * + * [`poll`]: core::future::Future::poll */ -bool CResult_CVec_BlindedMessagePathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR o); +void Notifier_notify(const struct LDKNotifier *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. + * Gets a [`Future`] that will get woken up with any waiters */ -void CResult_CVec_BlindedMessagePathZNoneZ_free(struct LDKCResult_CVec_BlindedMessagePathZNoneZ _res); +MUST_USE_RES struct LDKFuture Notifier_get_future(const struct LDKNotifier *NONNULL_PTR this_arg); /** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Calls the free function if one is set */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_clone(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR orig); +void FutureCallback_free(struct LDKFutureCallback this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. */ -void CVec_MessageForwardNodeZ_free(struct LDKCVec_MessageForwardNodeZ _res); +void Future_free(struct LDKFuture this_obj); /** - * Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext + * Registers a callback to be called upon completion of this future. If the future has already + * completed, the callback will be called immediately. */ -struct LDKCOption_MessageContextZ COption_MessageContextZ_some(struct LDKMessageContext o); +void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); /** - * Constructs a new COption_MessageContextZ containing nothing + * Waits until this [`Future`] completes. */ -struct LDKCOption_MessageContextZ COption_MessageContextZ_none(void); +void Future_wait(const struct LDKFuture *NONNULL_PTR this_arg); /** - * Frees any resources associated with the crate::lightning::blinded_path::message::MessageContext, if we are in the Some state + * Waits until this [`Future`] completes or the given amount of time has elapsed. + * + * Returns true if the [`Future`] completed, false if the time elapsed. */ -void COption_MessageContextZ_free(struct LDKCOption_MessageContextZ _res); +MUST_USE_RES bool Future_wait_timeout(const struct LDKFuture *NONNULL_PTR this_arg, uint64_t max_wait); /** - * Creates a new COption_MessageContextZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_MessageContextZ COption_MessageContextZ_clone(const struct LDKCOption_MessageContextZ *NONNULL_PTR orig); +void Sleeper_free(struct LDKSleeper this_obj); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new sleeper from one future, allowing blocking on it. */ -struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(const struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(const struct LDKFuture *NONNULL_PTR future); /** - * Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements. + * Constructs a new sleeper from two futures, allowing blocking on both at once. */ -struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(struct LDKPublicKey a, struct LDKOnionMessage b, struct LDKCOption_CVec_SocketAddressZZ c); +MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b); /** - * Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ. + * Constructs a new sleeper from three futures, allowing blocking on all three at once. + * */ -void C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ _res); +MUST_USE_RES struct LDKSleeper Sleeper_from_three_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b, const struct LDKFuture *NONNULL_PTR fut_c); /** - * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state. + * Constructs a new sleeper from four futures, allowing blocking on all four at once. + * */ -struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(struct LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ o); +MUST_USE_RES struct LDKSleeper Sleeper_from_four_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b, const struct LDKFuture *NONNULL_PTR fut_c, const struct LDKFuture *NONNULL_PTR fut_d); /** - * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state. + * Constructs a new sleeper on many futures, allowing blocking on all at once. */ -struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(struct LDKSendError e); +MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures); /** - * Checks if the given object is currently in the success state + * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed. */ -bool CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR o); +void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg); /** - * Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ. + * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the + * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time + * elapsed. */ -void CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ _res); +MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait); /** - * Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(const struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); /** - * Creates a new CResult_PeeledOnionNoneZ in the success state. + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the + * equivalent limit applied to outbound channels). + * + * Also used when splicing the channel for the number of confirmations needed before sending a + * `splice_locked` message to the counterparty. The spliced funds are considered locked in when + * both parties have exchanged `splice_locked`. + * + * A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * + * Default value: `6` + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ -struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_ok(struct LDKPeeledOnion o); +uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_PeeledOnionNoneZ in the error state. + * Confirmations we will wait for before considering the channel locked in. + * Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the + * equivalent limit applied to outbound channels). + * + * Also used when splicing the channel for the number of confirmations needed before sending a + * `splice_locked` message to the counterparty. The spliced funds are considered locked in when + * both parties have exchanged `splice_locked`. + * + * A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * + * Default value: `6` + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ -struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_err(void); +void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if the given object is currently in the success state + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`] (We enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less.) */ -bool CResult_PeeledOnionNoneZ_is_ok(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR o); +uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_PeeledOnionNoneZ. + * Set to the number of blocks we require our counterparty to wait to claim their money (ie + * the number of blocks we have to punish our counterparty if they broadcast a revoked + * transaction). + * + * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST + * be online to check for revoked transactions on-chain at least once every our_to_self_delay + * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, + * possibly with time in between to RBF the spending transaction). + * + * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in + * case of an honest unilateral channel close, which implicitly decrease the economic value of + * our channel. + * + * Default value: [`BREAKDOWN_TIMEOUT`] (We enforce it as a minimum at channel opening so you + * can tweak config to ask for more security, not less.) */ -void CResult_PeeledOnionNoneZ_free(struct LDKCResult_PeeledOnionNoneZ _res); +void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: `1` (If the value is less than `1`, it is ignored and set to `1`, as is + * required by the protocol. */ -struct LDKCResult_PeeledOnionNoneZ CResult_PeeledOnionNoneZ_clone(const struct LDKCResult_PeeledOnionNoneZ *NONNULL_PTR orig); +uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_SendSuccessSendErrorZ in the success state. + * Set to the smallest value HTLC we will accept to process. + * + * This value is sent to our counterparty on channel-open and we close the channel any time + * our counterparty misbehaves by sending us an HTLC with a value smaller than this. + * + * Default value: `1` (If the value is less than `1`, it is ignored and set to `1`, as is + * required by the protocol. */ -struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_ok(struct LDKSendSuccess o); +void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_SendSuccessSendErrorZ in the error state. + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value `10`, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: `10` + * + * Minimum value: `1` (Any values less will be treated as `1` instead.) + * + * Maximum value: `100` (Any values larger will be treated as `100` instead.) */ -struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_err(struct LDKSendError e); +uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value `10`, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: `10` + * + * Minimum value: `1` (Any values less will be treated as `1` instead.) + * + * Maximum value: `100` (Any values larger will be treated as `100` instead.) */ -bool CResult_SendSuccessSendErrorZ_is_ok(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR o); +void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); /** - * Frees any resources used by the CResult_SendSuccessSendErrorZ. + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelHandshakeConfig::announce_for_forwarding`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -void CResult_SendSuccessSendErrorZ_free(struct LDKCResult_SendSuccessSendErrorZ _res); +bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the + * BOLTs) option for outbound private channels. This provides better privacy by not including + * our real on-chain channel UTXO in each invoice and requiring that our counterparty only + * relay HTLCs to us using the channel's SCID alias. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `scid_alias` option; we will simply fall back to a + * private channel without that option. + * + * Ignored if the channel is negotiated to be announced, see + * [`ChannelHandshakeConfig::announce_for_forwarding`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -struct LDKCResult_SendSuccessSendErrorZ CResult_SendSuccessSendErrorZ_clone(const struct LDKCResult_SendSuccessSendErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: `false` */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +bool ChannelHandshakeConfig_get_announce_for_forwarding(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: `false` */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +void ChannelHandshakeConfig_set_announce_for_forwarding(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. + * + * Default value: `true` + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey */ -bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); +bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. + * + * Default value: `true` + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_NoneSendErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: `10_000` millionths (i.e., 1% of channel value) + * + * Minimum value: If the calculated proportional value is less than `1000` sats, it will be + * treated as `1000` sats instead, which is a safe implementation-specific lower + * bound. + * + * Maximum value: `1_000_000` (i.e., 100% of channel value. Any values larger than one million + * will be treated as one million instead, although channel negotiations will + * fail in that case.) */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_clone(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR orig); +uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: `10_000` millionths (i.e., 1% of channel value) + * + * Minimum value: If the calculated proportional value is less than `1000` sats, it will be + * treated as `1000` sats instead, which is a safe implementation-specific lower + * bound. + * + * Maximum value: `1_000_000` (i.e., 100% of channel value. Any values larger than one million + * will be treated as one million instead, although channel negotiations will + * fail in that case.) */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); +void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future + * channels. This feature requires having a reserve of onchain funds readily available to bump + * transactions in the event of a channel force close to avoid the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply + * fall back to a `static_remote_key` channel. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); +bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future + * channels. This feature requires having a reserve of onchain funds readily available to bump + * transactions in the event of a channel force close to avoid the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply + * fall back to a `static_remote_key` channel. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + * If set, we attempt to negotiate the `zero_fee_commitments` option for all future channels. + * + * These channels operate very similarly to the `anchors_zero_fee_htlc` channels but rely on + * [TRUC] to assign zero fee to the commitment transactions themselves, avoiding many protocol + * edge-cases involving fee updates and greatly simplifying the concept of your \"balance\" in + * lightning. + * + * Like `anchors_zero_fee_htlc` channels, this feature requires having a reserve of onchain + * funds readily available to bump transactions in the event of a channel force close to avoid + * the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.2, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `zero_fee_commitments` option; we will simply fall + * back to a `anchors_zero_fee_htlc` (if [`Self::negotiate_anchors_zero_fee_htlc_tx`] + * is set) or `static_remote_key` channel. + * + * For a force-close transaction to reach miners and get confirmed, + * zero-fee commitment channels require a path from your Bitcoin node to miners that + * relays TRUC transactions (BIP 431), P2A outputs, and Ephemeral Dust. Currently, only + * nodes running Bitcoin Core v29 and above relay transactions with these features. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/) + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); +bool ChannelHandshakeConfig_get_negotiate_anchor_zero_fee_commitments(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If set, we attempt to negotiate the `zero_fee_commitments` option for all future channels. + * + * These channels operate very similarly to the `anchors_zero_fee_htlc` channels but rely on + * [TRUC] to assign zero fee to the commitment transactions themselves, avoiding many protocol + * edge-cases involving fee updates and greatly simplifying the concept of your \"balance\" in + * lightning. + * + * Like `anchors_zero_fee_htlc` channels, this feature requires having a reserve of onchain + * funds readily available to bump transactions in the event of a channel force close to avoid + * the possibility of losing funds. + * + * Note that if you wish accept inbound channels with anchor outputs, you must enable + * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with + * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check + * whether your reserve of onchain funds is enough to cover the fees for all existing and new + * channels featuring anchor outputs in the event of a force close. + * + * If this option is set, channels may be created that will not be readable by LDK versions + * prior to 0.2, causing [`ChannelManager`]'s read method to return a + * [`DecodeError::InvalidValue`]. + * + * Note that setting this to true does *not* prevent us from opening channels with + * counterparties that do not support the `zero_fee_commitments` option; we will simply fall + * back to a `anchors_zero_fee_htlc` (if [`Self::negotiate_anchors_zero_fee_htlc_tx`] + * is set) or `static_remote_key` channel. + * + * For a force-close transaction to reach miners and get confirmed, + * zero-fee commitment channels require a path from your Bitcoin node to miners that + * relays TRUC transactions (BIP 431), P2A outputs, and Ephemeral Dust. Currently, only + * nodes running Bitcoin Core v29 and above relay transactions with these features. + * + * Default value: `false` (This value is likely to change to `true` in the future.) + * + * [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/) + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeConfig_set_negotiate_anchor_zero_fee_commitments(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. + * + * Increasing the value can help improve liquidity and stability in + * routing at the cost of higher long term disk / DB usage. + * + * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration + * other than the default value. + * + * Default value: `50` + * + * Maximum value: depends on channel type, see docs on [`max_htlcs`] (any values over the + * maximum will be silently reduced to the maximum). + * + * [`max_htlcs`]: crate::ln::chan_utils::max_htlcs */ -void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); +uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state. + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. + * + * Increasing the value can help improve liquidity and stability in + * routing at the cost of higher long term disk / DB usage. + * + * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration + * other than the default value. + * + * Default value: `50` + * + * Maximum value: depends on channel type, see docs on [`max_htlcs`] (any values over the + * maximum will be silently reduced to the maximum). + * + * [`max_htlcs`]: crate::ln::chan_utils::max_htlcs */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_ok(struct LDKInvoiceError o); +void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ in the error state. + * Constructs a new ChannelHandshakeConfig given each field */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_err(struct LDKDecodeError e); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announce_for_forwarding_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, bool negotiate_anchors_zero_fee_htlc_tx_arg, bool negotiate_anchor_zero_fee_commitments_arg, uint16_t our_max_accepted_htlcs_arg); /** - * Checks if the given object is currently in the success state + * Creates a copy of the ChannelHandshakeConfig */ -bool CResult_InvoiceErrorDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR o); +struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InvoiceErrorDecodeErrorZ. + * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. */ -void CResult_InvoiceErrorDecodeErrorZ_free(struct LDKCResult_InvoiceErrorDecodeErrorZ _res); +MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); /** - * Creates a new CResult_InvoiceErrorDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_InvoiceErrorDecodeErrorZ CResult_InvoiceErrorDecodeErrorZ_clone(const struct LDKCResult_InvoiceErrorDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); /** - * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the success state. + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: `1000` + * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) */ -struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_ok(struct LDKTrackedSpendableOutput o); +uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ in the error state. + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: `1000` + * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) */ -struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: `2^24 - 1` */ -bool CResult_TrackedSpendableOutputDecodeErrorZ_is_ok(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR o); +uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_TrackedSpendableOutputDecodeErrorZ. + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: `2^24 - 1` */ -void CResult_TrackedSpendableOutputDecodeErrorZ_free(struct LDKCResult_TrackedSpendableOutputDecodeErrorZ _res); +void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_TrackedSpendableOutputDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: `u64::max_value` */ -struct LDKCResult_TrackedSpendableOutputDecodeErrorZ CResult_TrackedSpendableOutputDecodeErrorZ_clone(const struct LDKCResult_TrackedSpendableOutputDecodeErrorZ *NONNULL_PTR orig); +uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the success state. + * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows + * you to limit the maximum minimum-size they can require. + * + * Default value: `u64::max_value` */ -struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_ok(struct LDKOutputSpendStatus o); +void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a new CResult_OutputSpendStatusDecodeErrorZ in the error state. + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: `0` */ -struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_err(struct LDKDecodeError e); +uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The remote node sets a limit on the maximum value of pending HTLCs to them at any given + * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * + * Default value: `0` */ -bool CResult_OutputSpendStatusDecodeErrorZ_is_ok(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR o); +void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the CResult_OutputSpendStatusDecodeErrorZ. + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: `u64::max_value`. */ -void CResult_OutputSpendStatusDecodeErrorZ_free(struct LDKCResult_OutputSpendStatusDecodeErrorZ _res); +uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OutputSpendStatusDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The remote node will require we keep a certain amount in direct payment to ourselves at all + * time, ensuring that we are able to be punished if we broadcast an old state. This allows to + * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * + * Default value: `u64::max_value`. */ -struct LDKCResult_OutputSpendStatusDecodeErrorZ CResult_OutputSpendStatusDecodeErrorZ_clone(const struct LDKCResult_OutputSpendStatusDecodeErrorZ *NONNULL_PTR orig); +void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: `0` */ -struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o); +uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Constructs a new COption_FilterZ containing nothing + * The remote node sets a limit on the maximum number of pending HTLCs to them at any given + * time. This allows you to set a minimum such value. + * + * Default value: `0` */ -struct LDKCOption_FilterZ COption_FilterZ_none(void); +void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: `144`, or roughly one day and only applies to outbound channels */ -void COption_FilterZ_free(struct LDKCOption_FilterZ _res); +uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Before a channel is usable the funding transaction will need to be confirmed by at least a + * certain number of blocks, specified by the node which is not the funder (as the funder can + * assume they aren't going to double-spend themselves). + * This config allows you to set a limit on the maximum amount of time to wait. + * + * Default value: `144`, or roughly one day and only applies to outbound channels */ -void CVec_TrackedSpendableOutputZ_free(struct LDKCVec_TrackedSpendableOutputZ _res); +void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_OutputSweeperDecodeErrorZ in the success state. + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to `0`, and we + * always trust our own funding transaction at `1` confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (`0`) and `false` (`1`). + * + * Default value: `true` */ -struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_ok(struct LDKOutputSweeper o); +bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OutputSweeperDecodeErrorZ in the error state. + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to `0`, and we + * always trust our own funding transaction at `1` confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (`0`) and `false` (`1`). + * + * Default value: `true` */ -struct LDKCResult_OutputSweeperDecodeErrorZ CResult_OutputSweeperDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announce_for_forwarding`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: `true` */ -bool CResult_OutputSweeperDecodeErrorZ_is_ok(const struct LDKCResult_OutputSweeperDecodeErrorZ *NONNULL_PTR o); +bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_OutputSweeperDecodeErrorZ. + * Set to force an incoming channel to match our announced channel preference in + * [`ChannelHandshakeConfig::announce_for_forwarding`]. + * + * For a node which is not online reliably, this should be set to true and + * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) + * channels will ever be opened. + * + * Default value: `true` */ -void CResult_OutputSweeperDecodeErrorZ_free(struct LDKCResult_OutputSweeperDecodeErrorZ _res); +void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); /** - * Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements. + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: `2016`, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) */ -struct LDKC2Tuple_BestBlockOutputSweeperZ C2Tuple_BestBlockOutputSweeperZ_new(struct LDKBestBlock a, struct LDKOutputSweeper b); +uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ. + * Set to the amount of time we're willing to wait to claim money back to us. + * + * Not checking this value would be a security issue, as our peer would be able to set it to + * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. + * + * Default value: `2016`, which we also enforce as a maximum value so you can tweak config to + * reduce the loss of having useless locked funds (if your peer accepts) */ -void C2Tuple_BestBlockOutputSweeperZ_free(struct LDKC2Tuple_BestBlockOutputSweeperZ _res); +void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state. + * Constructs a new ChannelHandshakeLimits given each field */ -struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(struct LDKC2Tuple_BestBlockOutputSweeperZ o); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); /** - * Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state. + * Creates a copy of the ChannelHandshakeLimits */ -struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. */ -bool CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ *NONNULL_PTR o); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); /** - * Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ. + * Frees any resources used by the MaxDustHTLCExposure */ -void CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ _res); +void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr); /** - * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the success state. + * Creates a copy of the MaxDustHTLCExposure */ -struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_ok(struct LDKDelayedPaymentBasepoint o); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig); /** - * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ in the error state. + * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure */ -struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a); /** - * Checks if the given object is currently in the success state + * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure */ -bool CResult_DelayedPaymentBasepointDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR o); +struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a); /** - * Frees any resources used by the CResult_DelayedPaymentBasepointDecodeErrorZ. + * Checks if two MaxDustHTLCExposures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void CResult_DelayedPaymentBasepointDecodeErrorZ_free(struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ _res); +bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b); /** - * Creates a new CResult_DelayedPaymentBasepointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read */ -struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ CResult_DelayedPaymentBasepointDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj); /** - * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the success state. + * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write */ -struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_ok(struct LDKDelayedPaymentKey o); +struct LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser); /** - * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ in the error state. + * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelConfig_free(struct LDKChannelConfig this_obj); /** - * Checks if the given object is currently in the success state + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: `0` */ -bool CResult_DelayedPaymentKeyDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR o); +uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_DelayedPaymentKeyDecodeErrorZ. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound + * over the channel. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * Default value: `0` */ -void CResult_DelayedPaymentKeyDecodeErrorZ_free(struct LDKCResult_DelayedPaymentKeyDecodeErrorZ _res); +void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_DelayedPaymentKeyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: `1000` + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths */ -struct LDKCResult_DelayedPaymentKeyDecodeErrorZ CResult_DelayedPaymentKeyDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentKeyDecodeErrorZ *NONNULL_PTR orig); +uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_HtlcBasepointDecodeErrorZ in the success state. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in + * excess of [`forwarding_fee_proportional_millionths`]. + * This may be allowed to change at runtime in a later update, however doing so must result in + * update messages sent to notify all nodes of our updated relay fee. + * + * The default value of a single satoshi roughly matches the market rate on many routing nodes + * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through + * this node. + * + * Default value: `1000` + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths */ -struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_ok(struct LDKHtlcBasepoint o); +void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a new CResult_HtlcBasepointDecodeErrorZ in the error state. + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: `72` (12 hours at an average of 6 blocks/hour) + * + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`] (Any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead.) + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA */ -struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_err(struct LDKDecodeError e); +uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over + * the channel this config applies to. + * + * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight + * HTLC balance when a channel appears on-chain whereas + * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining + * (non-HTLC-encumbered) balance. + * + * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, + * we (or one of our watchtowers) MUST be online to check for broadcast of the current + * commitment transaction at least once per this many blocks (minus some margin to allow us + * enough time to broadcast and confirm a transaction, possibly with time in between to RBF + * the spending transaction). + * + * Default value: `72` (12 hours at an average of 6 blocks/hour) + * + * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`] (Any values less than this will be treated as + * [`MIN_CLTV_EXPIRY_DELTA`] instead.) + * + * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA */ -bool CResult_HtlcBasepointDecodeErrorZ_is_ok(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR o); +void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the CResult_HtlcBasepointDecodeErrorZ. + * Limit our total exposure to potential loss to on-chain fees on close, including in-flight + * HTLCs which are burned to fees as they are too small to claim on-chain and fees on + * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. + * + * # HTLC-based Dust Exposure + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be substantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a + * channel negotiated throughout the channel open process, along with the fees required to have + * a broadcastable HTLC spending transaction. When a channel supports anchor outputs + * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into + * account the HTLC transaction fee as it is zero. Because of this, you may want to set this + * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier + * variant is primarily intended for use with pre-anchor channels. + * + * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. + * + * # Transaction Fee Dust Exposure + * + * Further, counterparties broadcasting a commitment transaction in a force-close may result + * in other balance being burned to fees, and thus all fees on commitment and HTLC + * transactions in excess of our local fee estimates are included in the dust calculation. + * + * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 + * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per + * non-dust HTLC we're allowed to have with our peers before risking a force-closure for + * inbound channels. + * + * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 + * sat/KW), we risk force-closure if we disagree with our peer by: + * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in + * both directions (the maximum), + * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both + * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs + * in both directions (the maximum), + * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs + * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * + * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement + * will scale linearly with increases (or decreases) in the our feerate estimates. Further, + * for anchor channels we expect our counterparty to use a relatively low feerate estimate + * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) + * and feerate disagreement force-closures should only occur when theirs is higher than ours. + * + * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` + * + * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate */ -void CResult_HtlcBasepointDecodeErrorZ_free(struct LDKCResult_HtlcBasepointDecodeErrorZ _res); +struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_HtlcBasepointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Limit our total exposure to potential loss to on-chain fees on close, including in-flight + * HTLCs which are burned to fees as they are too small to claim on-chain and fees on + * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. + * + * # HTLC-based Dust Exposure + * + * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will + * not be claimable on-chain, instead being turned into additional miner fees if either + * party force-closes the channel. Because the threshold is per-HTLC, our total exposure + * to such payments may be substantial if there are many dust HTLCs present when the + * channel is force-closed. + * + * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a + * channel negotiated throughout the channel open process, along with the fees required to have + * a broadcastable HTLC spending transaction. When a channel supports anchor outputs + * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into + * account the HTLC transaction fee as it is zero. Because of this, you may want to set this + * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier + * variant is primarily intended for use with pre-anchor channels. + * + * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total + * exposure across all three types per-channel. + * + * # Transaction Fee Dust Exposure + * + * Further, counterparties broadcasting a commitment transaction in a force-close may result + * in other balance being burned to fees, and thus all fees on commitment and HTLC + * transactions in excess of our local fee estimates are included in the dust calculation. + * + * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 + * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per + * non-dust HTLC we're allowed to have with our peers before risking a force-closure for + * inbound channels. + * + * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 + * sat/KW), we risk force-closure if we disagree with our peer by: + * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in + * both directions (the maximum), + * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both + * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs + * in both directions (the maximum), + * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs + * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) + * + * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement + * will scale linearly with increases (or decreases) in the our feerate estimates. Further, + * for anchor channels we expect our counterparty to use a relatively low feerate estimate + * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) + * and feerate disagreement force-closures should only occur when theirs is higher than ours. + * + * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` + * + * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate */ -struct LDKCResult_HtlcBasepointDecodeErrorZ CResult_HtlcBasepointDecodeErrorZ_clone(const struct LDKCResult_HtlcBasepointDecodeErrorZ *NONNULL_PTR orig); +void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val); /** - * Creates a new CResult_HtlcKeyDecodeErrorZ in the success state. + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: `1000` + * + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ -struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_ok(struct LDKHtlcKey o); +uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_HtlcKeyDecodeErrorZ in the error state. + * The additional fee we're willing to pay to avoid waiting for the counterparty's + * `to_self_delay` to reclaim funds. + * + * When we close a channel cooperatively with our counterparty, we negotiate a fee for the + * closing transaction which both sides find acceptable, ultimately paid by the channel + * funder/initiator. + * + * When we are the funder, because we have to pay the channel closing fee, we bound the + * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by + * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our + * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're + * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our + * funds. + * + * When we are not the funder, we require the closing transaction fee pay at least our + * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. + * Thus, this value is ignored when we are not the funder. + * + * Default value: `1000` + * + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum */ -struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if the given object is currently in the success state + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound + * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. + * + * Usage: + * - The payee will set this option and set its invoice route hints to use [intercept scids] + * generated by this channel's counterparty. + * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call + * [`forward_intercepted_htlc`] with less than the amount provided in + * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. + * + * # Note + * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is + * as-expected if this feature is activated, otherwise they may lose money! + * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the + * counterparty. + * + * # Note + * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. + * Unsetting this flag between restarts may lead to payment receive failures. + * + * Default value: `false` + * + * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat + * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat */ -bool CResult_HtlcKeyDecodeErrorZ_is_ok(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR o); +bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_HtlcKeyDecodeErrorZ. + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound + * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. + * + * Usage: + * - The payee will set this option and set its invoice route hints to use [intercept scids] + * generated by this channel's counterparty. + * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call + * [`forward_intercepted_htlc`] with less than the amount provided in + * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and + * actual forward amounts is their fee. See + * + * for how this feature may be used in the LSP use case. + * + * # Note + * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is + * as-expected if this feature is activated, otherwise they may lose money! + * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the + * counterparty. + * + * # Note + * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. + * Unsetting this flag between restarts may lead to payment receive failures. + * + * Default value: `false` + * + * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat + * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat */ -void CResult_HtlcKeyDecodeErrorZ_free(struct LDKCResult_HtlcKeyDecodeErrorZ _res); +void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_HtlcKeyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new ChannelConfig given each field */ -struct LDKCResult_HtlcKeyDecodeErrorZ CResult_HtlcKeyDecodeErrorZ_clone(const struct LDKCResult_HtlcKeyDecodeErrorZ *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, struct LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg); /** - * Creates a new CResult_RevocationBasepointDecodeErrorZ in the success state. + * Creates a copy of the ChannelConfig */ -struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_ok(struct LDKRevocationBasepoint o); +struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); /** - * Creates a new CResult_RevocationBasepointDecodeErrorZ in the error state. + * Checks if two ChannelConfigs 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. */ -struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_err(struct LDKDecodeError e); +bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); /** - * Checks if the given object is currently in the success state + * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`]. */ -bool CResult_RevocationBasepointDecodeErrorZ_is_ok(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR o); +void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update); /** - * Frees any resources used by the CResult_RevocationBasepointDecodeErrorZ. + * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. */ -void CResult_RevocationBasepointDecodeErrorZ_free(struct LDKCResult_RevocationBasepointDecodeErrorZ _res); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); /** - * Creates a new CResult_RevocationBasepointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read */ -struct LDKCResult_RevocationBasepointDecodeErrorZ CResult_RevocationBasepointDecodeErrorZ_clone(const struct LDKCResult_RevocationBasepointDecodeErrorZ *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); /** - * Creates a new CResult_RevocationKeyDecodeErrorZ in the success state. + * Read a ChannelConfig from a byte array, created by ChannelConfig_write */ -struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_ok(struct LDKRevocationKey o); +struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); /** - * Creates a new CResult_RevocationKeyDecodeErrorZ in the error state. + * Frees any resources used by the ChannelConfigUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj); /** - * Checks if the given object is currently in the success state + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. See + * [`ChannelConfig::forwarding_fee_proportional_millionths`]. */ -bool CResult_RevocationKeyDecodeErrorZ_is_ok(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_RevocationKeyDecodeErrorZ. + * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. See + * [`ChannelConfig::forwarding_fee_proportional_millionths`]. */ -void CResult_RevocationKeyDecodeErrorZ_free(struct LDKCResult_RevocationKeyDecodeErrorZ _res); +void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a new CResult_RevocationKeyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel. See + * [`ChannelConfig::forwarding_fee_base_msat`]. */ -struct LDKCResult_RevocationKeyDecodeErrorZ CResult_RevocationKeyDecodeErrorZ_clone(const struct LDKCResult_RevocationKeyDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the success state. + * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel. See + * [`ChannelConfig::forwarding_fee_base_msat`]. */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o); +void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Creates a new CResult_LockedChannelMonitorNoneZ in the error state. + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this + * config applies to. See [`ChannelConfig::cltv_expiry_delta`]. */ -struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void); +struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this + * config applies to. See [`ChannelConfig::cltv_expiry_delta`]. */ -bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o); +void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Frees any resources used by the CResult_LockedChannelMonitorNoneZ. + * The total exposure we are willing to allow to dust HTLCs. See [`ChannelConfig::max_dust_htlc_exposure`]. + * + * Returns a copy of the field. */ -void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res); +struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * The total exposure we are willing to allow to dust HTLCs. See [`ChannelConfig::max_dust_htlc_exposure`]. */ -struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_clone(const struct LDKC2Tuple_OutPointChannelIdZ *NONNULL_PTR orig); +void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val); /** - * Creates a new C2Tuple_OutPointChannelIdZ from the contained elements. + * The additional fee we're willing to pay to avoid waiting for the counterparty's `to_self_delay` to reclaim + * funds. See [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]. */ -struct LDKC2Tuple_OutPointChannelIdZ C2Tuple_OutPointChannelIdZ_new(struct LDKOutPoint a, struct LDKChannelId b); +struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the C2Tuple_OutPointChannelIdZ. + * The additional fee we're willing to pay to avoid waiting for the counterparty's `to_self_delay` to reclaim + * funds. See [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]. */ -void C2Tuple_OutPointChannelIdZ_free(struct LDKC2Tuple_OutPointChannelIdZ _res); +void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound HTLCs. See + * [`ChannelConfig::accept_underpaying_htlcs`]. */ -void CVec_C2Tuple_OutPointChannelIdZZ_free(struct LDKCVec_C2Tuple_OutPointChannelIdZZ _res); +struct LDKCOption_boolZ ChannelConfigUpdate_get_accept_underpaying_htlcs(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If set, allows this channel's counterparty to skim an additional fee off this node's inbound HTLCs. See + * [`ChannelConfig::accept_underpaying_htlcs`]. */ -struct LDKC2Tuple_OutPointCVec_u64ZZ C2Tuple_OutPointCVec_u64ZZ_clone(const struct LDKC2Tuple_OutPointCVec_u64ZZ *NONNULL_PTR orig); +void ChannelConfigUpdate_set_accept_underpaying_htlcs(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_boolZ val); /** - * Creates a new C2Tuple_OutPointCVec_u64ZZ from the contained elements. + * Constructs a new ChannelConfigUpdate given each field */ -struct LDKC2Tuple_OutPointCVec_u64ZZ C2Tuple_OutPointCVec_u64ZZ_new(struct LDKOutPoint a, struct LDKCVec_u64Z b); +MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_new(struct LDKCOption_u32Z forwarding_fee_proportional_millionths_arg, struct LDKCOption_u32Z forwarding_fee_base_msat_arg, struct LDKCOption_u16Z cltv_expiry_delta_arg, struct LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, struct LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg, struct LDKCOption_boolZ accept_underpaying_htlcs_arg); /** - * Frees any resources used by the C2Tuple_OutPointCVec_u64ZZ. + * Creates a copy of the ChannelConfigUpdate */ -void C2Tuple_OutPointCVec_u64ZZ_free(struct LDKC2Tuple_OutPointCVec_u64ZZ _res); +struct LDKChannelConfigUpdate ChannelConfigUpdate_clone(const struct LDKChannelConfigUpdate *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Build a ChannelConfigUpdate from a ChannelConfig */ -void CVec_C2Tuple_OutPointCVec_u64ZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ _res); +struct LDKChannelConfigUpdate ChannelConfigUpdate_from_ChannelConfig(struct LDKChannelConfig f); /** - * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the success state. + * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_ok(struct LDKBlindedMessagePath o); +void UserConfig_free(struct LDKUserConfig this_obj); /** - * Creates a new CResult_BlindedMessagePathDecodeErrorZ in the error state. + * Channel handshake config that we propose to our counterparty. */ -struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * Channel handshake config that we propose to our counterparty. */ -bool CResult_BlindedMessagePathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR o); +void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** - * Frees any resources used by the CResult_BlindedMessagePathDecodeErrorZ. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -void CResult_BlindedMessagePathDecodeErrorZ_free(struct LDKCResult_BlindedMessagePathDecodeErrorZ _res); +struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedMessagePathDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -struct LDKCResult_BlindedMessagePathDecodeErrorZ CResult_BlindedMessagePathDecodeErrorZ_clone(const struct LDKCResult_BlindedMessagePathDecodeErrorZ *NONNULL_PTR orig); +void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** - * Creates a new CResult_BlindedMessagePathNoneZ in the success state. + * Channel config which affects behavior during channel lifetime. */ -struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_ok(struct LDKBlindedMessagePath o); +struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_BlindedMessagePathNoneZ in the error state. + * Channel config which affects behavior during channel lifetime. */ -struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_err(void); +void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * Checks if the given object is currently in the success state + * If this is set to `false`, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelHandshakeConfig::announce_for_forwarding`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to `false` to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Note that this setting does not apply for intercepted payments that are surfaced via + * [`Event::HTLCIntercepted`] and manually forwarded. + * + * Default value: `false` + * + * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted */ -bool CResult_BlindedMessagePathNoneZ_is_ok(const struct LDKCResult_BlindedMessagePathNoneZ *NONNULL_PTR o); +bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_BlindedMessagePathNoneZ. + * If this is set to `false`, we will reject any HTLCs which were to be forwarded over private + * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a + * node which is not online reliably. + * + * For nodes which are not online reliably, you should set all channels to *not* be announced + * (using [`ChannelHandshakeConfig::announce_for_forwarding`] and + * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to `false` to + * ensure you are not exposed to any forwarding risk. + * + * Note that because you cannot change a channel's announced state after creation, there is no + * way to disable forwarding on public channels retroactively. Thus, in order to change a node + * from a publicly-announced forwarding node to a private non-forwarding node you must close + * all your channels and open new ones. For privacy, you should also change your node_id + * (swapping all private and public key material for new ones) at that time. + * + * Note that this setting does not apply for intercepted payments that are surfaced via + * [`Event::HTLCIntercepted`] and manually forwarded. + * + * Default value: `false` + * + * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted */ -void CResult_BlindedMessagePathNoneZ_free(struct LDKCResult_BlindedMessagePathNoneZ _res); +void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_BlindedMessagePathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If this is set to `false`, we do not accept inbound requests to open a new channel. + * + * Default value: `true` */ -struct LDKCResult_BlindedMessagePathNoneZ CResult_BlindedMessagePathNoneZ_clone(const struct LDKCResult_BlindedMessagePathNoneZ *NONNULL_PTR orig); +bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_MessageContextDecodeErrorZ in the success state. + * If this is set to `false`, we do not accept inbound requests to open a new channel. + * + * Default value: `true` */ -struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_ok(struct LDKMessageContext o); +void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_MessageContextDecodeErrorZ in the error state. + * If this is set to `true`, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to `true`, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: `false` + * + * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel */ -struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_err(struct LDKDecodeError e); +bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * If this is set to `true`, the user needs to manually accept inbound requests to open a new + * channel. + * + * When set to `true`, [`Event::OpenChannelRequest`] will be triggered once a request to open a + * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a + * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the + * user explicitly chooses to accept the request. + * + * Default value: `false` + * + * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest + * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel + * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel */ -bool CResult_MessageContextDecodeErrorZ_is_ok(const struct LDKCResult_MessageContextDecodeErrorZ *NONNULL_PTR o); +void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the CResult_MessageContextDecodeErrorZ. + * If this is set to `true`, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to `true` may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: `false` + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted */ -void CResult_MessageContextDecodeErrorZ_free(struct LDKCResult_MessageContextDecodeErrorZ _res); +bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_MessageContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If this is set to `true`, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to `true` may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: `false` + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted */ -struct LDKCResult_MessageContextDecodeErrorZ CResult_MessageContextDecodeErrorZ_clone(const struct LDKCResult_MessageContextDecodeErrorZ *NONNULL_PTR orig); +void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_OffersContextDecodeErrorZ in the success state. + * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * + * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received + * [`Bolt12Invoice`] instead of being automatically paid after verification. Use + * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or + * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * + * Default value: `false` + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ -struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_ok(struct LDKOffersContext o); +bool UserConfig_get_manually_handle_bolt12_invoices(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_OffersContextDecodeErrorZ in the error state. + * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * + * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received + * [`Bolt12Invoice`] instead of being automatically paid after verification. Use + * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or + * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * + * Default value: `false` + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived + * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ -struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_err(struct LDKDecodeError e); +void UserConfig_set_manually_handle_bolt12_invoices(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Checks if the given object is currently in the success state + * LDK supports a feature for always-online nodes such that these nodes can hold onto an HTLC + * from an often-offline channel peer until the often-offline payment recipient sends an onion + * message telling the always-online node to release the HTLC. If this is set to `true`, our node + * will carry out this feature for channel peers that request it. + * + * This should only be set to `true` for nodes which expect to be online reliably. + * + * Setting this to `true` may break backwards compatibility with LDK versions < 0.2. + * + * Default value: `false` */ -bool CResult_OffersContextDecodeErrorZ_is_ok(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR o); +bool UserConfig_get_enable_htlc_hold(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_OffersContextDecodeErrorZ. + * LDK supports a feature for always-online nodes such that these nodes can hold onto an HTLC + * from an often-offline channel peer until the often-offline payment recipient sends an onion + * message telling the always-online node to release the HTLC. If this is set to `true`, our node + * will carry out this feature for channel peers that request it. + * + * This should only be set to `true` for nodes which expect to be online reliably. + * + * Setting this to `true` may break backwards compatibility with LDK versions < 0.2. + * + * Default value: `false` */ -void CResult_OffersContextDecodeErrorZ_free(struct LDKCResult_OffersContextDecodeErrorZ _res); +void UserConfig_set_enable_htlc_hold(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_OffersContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to + * pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel + * counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once + * the HTLCs are locked in even though the recipient may not yet be online to receive them. + * + * This option is intended for usage by private nodes, and should NOT be set if we are an + * announced node that is expected to be online at all times. + * + * Setting this to `true` may lead to HTLC failures if downgrading to LDK versions < 0.2. + * + * Default value: `false` + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice */ -struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_clone(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR orig); +bool UserConfig_get_hold_outbound_htlcs_at_next_hop(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the success state. + * If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to + * pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel + * counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once + * the HTLCs are locked in even though the recipient may not yet be online to receive them. + * + * This option is intended for usage by private nodes, and should NOT be set if we are an + * announced node that is expected to be online at all times. + * + * Setting this to `true` may lead to HTLC failures if downgrading to LDK versions < 0.2. + * + * Default value: `false` + * + * [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice */ -struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_ok(struct LDKAsyncPaymentsContext o); +void UserConfig_set_hold_outbound_htlcs_at_next_hop(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the error state. + * If this is set to `true`, then inbound channel splice requests will be rejected. This + * ensures backwards compatibility is not broken with LDK versions < 0.2 while a splice is + * pending. + * + * Outbound channel splice requests (via [`ChannelManager::splice_channel`], an opt-in API) are + * still allowed as users should be aware of the backwards compatibility risk prior to using + * the functionality. + * + * Default value: `true` + * + * [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel */ -struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_err(struct LDKDecodeError e); +bool UserConfig_get_reject_inbound_splices(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Checks if the given object is currently in the success state + * If this is set to `true`, then inbound channel splice requests will be rejected. This + * ensures backwards compatibility is not broken with LDK versions < 0.2 while a splice is + * pending. + * + * Outbound channel splice requests (via [`ChannelManager::splice_channel`], an opt-in API) are + * still allowed as users should be aware of the backwards compatibility risk prior to using + * the functionality. + * + * Default value: `true` + * + * [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel */ -bool CResult_AsyncPaymentsContextDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR o); +void UserConfig_set_reject_inbound_splices(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the CResult_AsyncPaymentsContextDecodeErrorZ. + * Constructs a new UserConfig given each field */ -void CResult_AsyncPaymentsContextDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsContextDecodeErrorZ _res); +MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg, bool manually_handle_bolt12_invoices_arg, bool enable_htlc_hold_arg, bool hold_outbound_htlcs_at_next_hop_arg, bool reject_inbound_splices_arg); /** - * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a copy of the UserConfig */ -struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR orig); +struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); /** - * Creates a new CResult_DNSResolverContextDecodeErrorZ in the success state. + * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_ok(struct LDKDNSResolverContext o); +MUST_USE_RES struct LDKUserConfig UserConfig_default(void); /** - * Creates a new CResult_DNSResolverContextDecodeErrorZ in the error state. + * Frees any resources used by the ChannelConfigOverrides, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_err(struct LDKDecodeError e); +void ChannelConfigOverrides_free(struct LDKChannelConfigOverrides this_obj); /** - * Checks if the given object is currently in the success state + * Overrides for channel handshake parameters. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool CResult_DNSResolverContextDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR o); +struct LDKChannelHandshakeConfigUpdate ChannelConfigOverrides_get_handshake_overrides(const struct LDKChannelConfigOverrides *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CResult_DNSResolverContextDecodeErrorZ. + * Overrides for channel handshake parameters. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CResult_DNSResolverContextDecodeErrorZ_free(struct LDKCResult_DNSResolverContextDecodeErrorZ _res); +void ChannelConfigOverrides_set_handshake_overrides(struct LDKChannelConfigOverrides *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfigUpdate val); /** - * Creates a new CResult_DNSResolverContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Overrides for channel update parameters. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_clone(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR orig); +struct LDKChannelConfigUpdate ChannelConfigOverrides_get_update_overrides(const struct LDKChannelConfigOverrides *NONNULL_PTR this_ptr); /** - * Frees any resources used by the APIError + * Overrides for channel update parameters. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void APIError_free(struct LDKAPIError this_ptr); +void ChannelConfigOverrides_set_update_overrides(struct LDKChannelConfigOverrides *NONNULL_PTR this_ptr, struct LDKChannelConfigUpdate val); /** - * Creates a copy of the APIError + * Constructs a new ChannelConfigOverrides given each field + * + * Note that handshake_overrides_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that update_overrides_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelConfigOverrides ChannelConfigOverrides_new(struct LDKChannelHandshakeConfigUpdate handshake_overrides_arg, struct LDKChannelConfigUpdate update_overrides_arg); /** - * Utility method to constructs a new APIMisuseError-variant APIError + * Creates a copy of the ChannelConfigOverrides */ -struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); +struct LDKChannelConfigOverrides ChannelConfigOverrides_clone(const struct LDKChannelConfigOverrides *NONNULL_PTR orig); /** - * Utility method to constructs a new FeeRateTooHigh-variant APIError + * Applies given channel config overrides to the user config. */ -struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); +void UserConfig_apply(struct LDKUserConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigOverrides *NONNULL_PTR config); /** - * Utility method to constructs a new InvalidRoute-variant APIError + * Frees any resources used by the ChannelHandshakeConfigUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKAPIError APIError_invalid_route(struct LDKStr err); +void ChannelHandshakeConfigUpdate_free(struct LDKChannelHandshakeConfigUpdate this_obj); /** - * Utility method to constructs a new ChannelUnavailable-variant APIError + * Overrides the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. See + * [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]. */ -struct LDKAPIError APIError_channel_unavailable(struct LDKStr err); +struct LDKCOption_u8Z ChannelHandshakeConfigUpdate_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new MonitorUpdateInProgress-variant APIError + * Overrides the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. See + * [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]. */ -struct LDKAPIError APIError_monitor_update_in_progress(void); +void ChannelHandshakeConfigUpdate_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u8Z val); /** - * Utility method to constructs a new IncompatibleShutdownScript-variant APIError + * Overrides the smallest value HTLC we will accept to process. See [`ChannelHandshakeConfig::our_htlc_minimum_msat`]. */ -struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); +struct LDKCOption_u64Z ChannelHandshakeConfigUpdate_get_htlc_minimum_msat(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Checks if two APIErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Overrides the smallest value HTLC we will accept to process. See [`ChannelHandshakeConfig::our_htlc_minimum_msat`]. */ -bool APIError_eq(const struct LDKAPIError *NONNULL_PTR a, const struct LDKAPIError *NONNULL_PTR b); +void ChannelHandshakeConfigUpdate_set_htlc_minimum_msat(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Serialize the APIError object into a byte array which can be read by APIError_read + * Overrides confirmations we will wait for before considering the channel locked in. See + * [`ChannelHandshakeConfig::minimum_depth`]. */ -struct LDKCVec_u8Z APIError_write(const struct LDKAPIError *NONNULL_PTR obj); +struct LDKCOption_u32Z ChannelHandshakeConfigUpdate_get_minimum_depth(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Read a APIError from a byte array, created by APIError_write + * Overrides confirmations we will wait for before considering the channel locked in. See + * [`ChannelHandshakeConfig::minimum_depth`]. */ -struct LDKCResult_COption_APIErrorZDecodeErrorZ APIError_read(struct LDKu8slice ser); +void ChannelHandshakeConfigUpdate_set_minimum_depth(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. + * Overrides the number of blocks we require our counterparty to wait to claim their money. See + * [`ChannelHandshakeConfig::our_to_self_delay`]. */ -void BigSize_free(struct LDKBigSize this_obj); - -uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); - -void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCOption_u16Z ChannelHandshakeConfigUpdate_get_to_self_delay(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Constructs a new BigSize given each field + * Overrides the number of blocks we require our counterparty to wait to claim their money. See + * [`ChannelHandshakeConfig::our_to_self_delay`]. */ -MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); +void ChannelHandshakeConfigUpdate_set_to_self_delay(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Creates a copy of the BigSize + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. See + * [`ChannelHandshakeConfig::our_max_accepted_htlcs`]. */ -struct LDKBigSize BigSize_clone(const struct LDKBigSize *NONNULL_PTR orig); +struct LDKCOption_u16Z ChannelHandshakeConfigUpdate_get_max_accepted_htlcs(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the BigSize. + * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. See + * [`ChannelHandshakeConfig::our_max_accepted_htlcs`]. */ -uint64_t BigSize_hash(const struct LDKBigSize *NONNULL_PTR o); +void ChannelHandshakeConfigUpdate_set_max_accepted_htlcs(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Checks if two BigSizes 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. + * The Proportion of the channel value to configure as counterparty's channel reserve. See + * [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]. */ -bool BigSize_eq(const struct LDKBigSize *NONNULL_PTR a, const struct LDKBigSize *NONNULL_PTR b); +struct LDKCOption_u32Z ChannelHandshakeConfigUpdate_get_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr); /** - * Serialize the BigSize object into a byte array which can be read by BigSize_read + * The Proportion of the channel value to configure as counterparty's channel reserve. See + * [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]. */ -struct LDKCVec_u8Z BigSize_write(const struct LDKBigSize *NONNULL_PTR obj); +void ChannelHandshakeConfigUpdate_set_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Read a BigSize from a byte array, created by BigSize_write + * Constructs a new ChannelHandshakeConfigUpdate given each field */ -struct LDKCResult_BigSizeDecodeErrorZ BigSize_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKChannelHandshakeConfigUpdate ChannelHandshakeConfigUpdate_new(struct LDKCOption_u8Z max_inbound_htlc_value_in_flight_percent_of_channel_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u32Z minimum_depth_arg, struct LDKCOption_u16Z to_self_delay_arg, struct LDKCOption_u16Z max_accepted_htlcs_arg, struct LDKCOption_u32Z channel_reserve_proportional_millionths_arg); /** - * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read + * Creates a copy of the ChannelHandshakeConfigUpdate */ -struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj); +struct LDKChannelHandshakeConfigUpdate ChannelHandshakeConfigUpdate_clone(const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR orig); /** - * Read a UntrustedString from a byte array, created by UntrustedString_write + * Applies the provided handshake config update. */ -struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser); +void ChannelHandshakeConfig_apply(struct LDKChannelHandshakeConfig *NONNULL_PTR this_arg, const struct LDKChannelHandshakeConfigUpdate *NONNULL_PTR config); /** - * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. + * Creates a copy of the Level */ -void Hostname_free(struct LDKHostname this_obj); +enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); /** - * Creates a copy of the Hostname + * Utility method to constructs a new Gossip-variant Level */ -struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); +enum LDKLevel Level_gossip(void); /** - * Generates a non-cryptographic 64-bit hash of the Hostname. + * Utility method to constructs a new Trace-variant Level */ -uint64_t Hostname_hash(const struct LDKHostname *NONNULL_PTR o); +enum LDKLevel Level_trace(void); /** - * Checks if two Hostnames 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. + * Utility method to constructs a new Debug-variant Level */ -bool Hostname_eq(const struct LDKHostname *NONNULL_PTR a, const struct LDKHostname *NONNULL_PTR b); +enum LDKLevel Level_debug(void); /** - * Returns the length of the hostname. + * Utility method to constructs a new Info-variant Level */ -MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); +enum LDKLevel Level_info(void); /** - * Get the string representation of a Hostname object + * Utility method to constructs a new Warn-variant Level */ -struct LDKStr Hostname_to_str(const struct LDKHostname *NONNULL_PTR o); +enum LDKLevel Level_warn(void); /** - * Serialize the Hostname object into a byte array which can be read by Hostname_read + * Utility method to constructs a new Error-variant Level */ -struct LDKCVec_u8Z Hostname_write(const struct LDKHostname *NONNULL_PTR obj); +enum LDKLevel Level_error(void); /** - * Read a Hostname from a byte array, created by Hostname_write + * Checks if two Levels contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_HostnameDecodeErrorZ Hostname_read(struct LDKu8slice ser); +bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); /** - * Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the Level. */ -void TransactionU16LenLimited_free(struct LDKTransactionU16LenLimited this_obj); +uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); /** - * Creates a copy of the TransactionU16LenLimited + * Get the string representation of a Level object */ -struct LDKTransactionU16LenLimited TransactionU16LenLimited_clone(const struct LDKTransactionU16LenLimited *NONNULL_PTR orig); +struct LDKStr Level_to_str(const enum LDKLevel *NONNULL_PTR o); /** - * Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited. + * Returns the most verbose logging level. */ -uint64_t TransactionU16LenLimited_hash(const struct LDKTransactionU16LenLimited *NONNULL_PTR o); +MUST_USE_RES enum LDKLevel Level_max(void); /** - * Checks if two TransactionU16LenLimiteds 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. + * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. */ -bool TransactionU16LenLimited_eq(const struct LDKTransactionU16LenLimited *NONNULL_PTR a, const struct LDKTransactionU16LenLimited *NONNULL_PTR b); +void Record_free(struct LDKRecord this_obj); /** - * Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus- - * serialized length is <= u16::MAX. + * The verbosity level of the message. */ -MUST_USE_RES struct LDKCResult_TransactionU16LenLimitedNoneZ TransactionU16LenLimited_new(struct LDKTransaction transaction); +enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. + * The verbosity level of the message. */ -MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_into_transaction(struct LDKTransactionU16LenLimited this_arg); +void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); /** - * Returns a reference to the contained `Transaction` + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKTransaction TransactionU16LenLimited_as_transaction(const struct LDKTransactionU16LenLimited *NONNULL_PTR this_arg); +struct LDKPublicKey Record_get_peer_id(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read + * The node id of the peer pertaining to the logged record. + * + * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be + * `None`, depending on if the peer information is readily available in LDK when the log is + * generated. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z TransactionU16LenLimited_write(const struct LDKTransactionU16LenLimited *NONNULL_PTR obj); +void Record_set_peer_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_TransactionU16LenLimitedDecodeErrorZ TransactionU16LenLimited_read(struct LDKu8slice ser); +struct LDKChannelId Record_get_channel_id(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Creates a digital signature of a message given a SecretKey, like the node's secret. - * 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. + * The channel id of the channel pertaining to the logged record. May be a temporary id before + * the channel has been funded. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKStr sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +void Record_set_channel_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Recovers the PublicKey of the signer of the message given the message and the signature. + * The message body. */ -struct LDKCResult_PublicKeySecp256k1ErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, - * and the PublicKey. + * The message body. */ -bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); +void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Calls the free function if one is set + * The module path of the message. */ -void KVStore_free(struct LDKKVStore this_ptr); +struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The module path of the message. */ -void MigratableKVStore_free(struct LDKMigratableKVStore this_ptr); +void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Migrates all data from one store to another. - * - * This operation assumes that `target_store` is empty, i.e., any data present under copied keys - * might get overriden. User must ensure `source_store` is not modified during operation, - * otherwise no consistency guarantees can be given. - * - * Will abort and return an error if any IO operation fails. Note that in this case the - * `target_store` might get left in an intermediate state. + * The source file containing the message. */ -struct LDKCResult_NoneIOErrorZ migrate_kv_store_data(struct LDKMigratableKVStore *NONNULL_PTR source_store, struct LDKMigratableKVStore *NONNULL_PTR target_store); +struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The source file containing the message. */ -void Persister_free(struct LDKPersister this_ptr); +void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Read previously persisted [`ChannelMonitor`]s from the store. + * The line containing the message. */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(struct LDKKVStore kv_store, struct LDKEntropySource entropy_source, struct LDKSignerProvider signer_provider); +uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Frees any resources used by the MonitorUpdatingPersister, if is_owned is set and inner is non-NULL. + * The line containing the message. */ -void MonitorUpdatingPersister_free(struct LDKMonitorUpdatingPersister this_obj); +void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); /** - * 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`: + * The payment hash. * - * - [`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`]. + * Note that this is only filled in for logs pertaining to a specific payment, and will be + * `None` for logs which are not directly related to a payment. */ -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, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator); +struct LDKCOption_ThirtyTwoBytesZ Record_get_payment_hash(const struct LDKRecord *NONNULL_PTR this_ptr); /** - * Reads all stored channel monitors, along with any stored updates for them. + * The payment hash. * - * 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`]. + * Note that this is only filled in for logs pertaining to a specific payment, and will be + * `None` for logs which are not directly related to a payment. */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ MonitorUpdatingPersister_read_all_channel_monitors_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); +void Record_set_payment_hash(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * 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` + * Constructs a new Record given each field * - * 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. + * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ MonitorUpdatingPersister_read_channel_monitor_with_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, struct LDKStr monitor_key); +MUST_USE_RES struct LDKRecord Record_new(enum LDKLevel level_arg, struct LDKPublicKey peer_id_arg, struct LDKChannelId channel_id_arg, struct LDKStr args_arg, struct LDKStr module_path_arg, struct LDKStr file_arg, uint32_t line_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); /** - * 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`]. + * Creates a copy of the Record */ -MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_stale_updates(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg, bool lazy); +struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); /** - * 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 + * Creates a copy of a Logger */ -struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); +struct LDKLogger Logger_clone(const struct LDKLogger *NONNULL_PTR orig); /** - * Frees any resources used by the MonitorName, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void MonitorName_free(struct LDKMonitorName this_obj); +void Logger_free(struct LDKLogger this_ptr); /** - * Constructs a [`MonitorName`], after verifying that an [`OutPoint`] can - * be formed from the given `name`. - * This method is useful if you have a String and you want to verify that - * it's a valid storage key for a channel monitor. + * Frees any resources used by the IntroductionNode */ -MUST_USE_RES struct LDKCResult_MonitorNameIOErrorZ MonitorName_new(struct LDKStr name); +void IntroductionNode_free(struct LDKIntroductionNode this_ptr); /** - * Convert this monitor name to a str. - * This method is particularly useful when you need to use the monitor name - * as a key in a key-value store or when logging. + * Creates a copy of the IntroductionNode */ -MUST_USE_RES struct LDKStr MonitorName_as_str(const struct LDKMonitorName *NONNULL_PTR this_arg); +struct LDKIntroductionNode IntroductionNode_clone(const struct LDKIntroductionNode *NONNULL_PTR orig); /** - * Frees any resources used by the UpdateName, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new NodeId-variant IntroductionNode */ -void UpdateName_free(struct LDKUpdateName this_obj); - -uint64_t UpdateName_get_a(const struct LDKUpdateName *NONNULL_PTR this_ptr); - -void UpdateName_set_a(struct LDKUpdateName *NONNULL_PTR this_ptr, uint64_t val); +struct LDKIntroductionNode IntroductionNode_node_id(struct LDKPublicKey a); /** - * Constructs an [`UpdateName`], after verifying that an update sequence ID - * can be derived from the given `name`. + * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode */ -MUST_USE_RES struct LDKCResult_UpdateNameIOErrorZ UpdateName_new(struct LDKStr name); +struct LDKIntroductionNode IntroductionNode_directed_short_channel_id(enum LDKDirection a, uint64_t b); /** - * Convert this update name to a string slice. - * - * This method is particularly useful when you need to use the update name - * as part of a key in a key-value store or when logging. - * - * # Examples - * - * ``` - * use lightning::util::persist::UpdateName; - * - * let update_name = UpdateName::from(42); - * assert_eq!(update_name.as_str(), \"42\"); - * ``` + * Generates a non-cryptographic 64-bit hash of the IntroductionNode. */ -MUST_USE_RES struct LDKStr UpdateName_as_str(const struct LDKUpdateName *NONNULL_PTR this_arg); +uint64_t IntroductionNode_hash(const struct LDKIntroductionNode *NONNULL_PTR o); /** - * Creates a copy of the ShortChannelIdError + * Checks if two IntroductionNodes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -enum LDKShortChannelIdError ShortChannelIdError_clone(const enum LDKShortChannelIdError *NONNULL_PTR orig); +bool IntroductionNode_eq(const struct LDKIntroductionNode *NONNULL_PTR a, const struct LDKIntroductionNode *NONNULL_PTR b); /** - * Utility method to constructs a new BlockOverflow-variant ShortChannelIdError + * Creates a copy of the Direction */ -enum LDKShortChannelIdError ShortChannelIdError_block_overflow(void); +enum LDKDirection Direction_clone(const enum LDKDirection *NONNULL_PTR orig); /** - * Utility method to constructs a new TxIndexOverflow-variant ShortChannelIdError + * Utility method to constructs a new NodeOne-variant Direction */ -enum LDKShortChannelIdError ShortChannelIdError_tx_index_overflow(void); +enum LDKDirection Direction_node_one(void); /** - * Utility method to constructs a new VoutIndexOverflow-variant ShortChannelIdError + * Utility method to constructs a new NodeTwo-variant Direction */ -enum LDKShortChannelIdError ShortChannelIdError_vout_index_overflow(void); +enum LDKDirection Direction_node_two(void); /** - * Checks if two ShortChannelIdErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Generates a non-cryptographic 64-bit hash of the Direction. */ -bool ShortChannelIdError_eq(const enum LDKShortChannelIdError *NONNULL_PTR a, const enum LDKShortChannelIdError *NONNULL_PTR b); +uint64_t Direction_hash(const enum LDKDirection *NONNULL_PTR o); /** - * Extracts the block height (most significant 3-bytes) from the `short_channel_id` + * Checks if two Directions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint32_t block_from_scid(uint64_t short_channel_id); +bool Direction_eq(const enum LDKDirection *NONNULL_PTR a, const enum LDKDirection *NONNULL_PTR b); /** - * Extracts the tx index (bytes [2..4]) from the `short_channel_id` + * Calls the free function if one is set */ -uint32_t tx_index_from_scid(uint64_t short_channel_id); +void NodeIdLookUp_free(struct LDKNodeIdLookUp this_ptr); /** - * Extracts the vout (bytes [0..2]) from the `short_channel_id` + * Frees any resources used by the EmptyNodeIdLookUp, if is_owned is set and inner is non-NULL. */ -uint16_t vout_from_scid(uint64_t short_channel_id); +void EmptyNodeIdLookUp_free(struct LDKEmptyNodeIdLookUp this_obj); /** - * Constructs a `short_channel_id` using the components pieces. Results in an error - * if the block height, tx index, or vout index overflow the maximum sizes. + * Constructs a new EmptyNodeIdLookUp given each field */ -struct LDKCResult_u64ShortChannelIdErrorZ scid_from_parts(uint64_t block, uint64_t tx_index, uint64_t vout_index); +MUST_USE_RES struct LDKEmptyNodeIdLookUp EmptyNodeIdLookUp_new(void); /** - * Frees any resources used by the TrackedSpendableOutput, if is_owned is set and inner is non-NULL. + * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is */ -void TrackedSpendableOutput_free(struct LDKTrackedSpendableOutput this_obj); +struct LDKNodeIdLookUp EmptyNodeIdLookUp_as_NodeIdLookUp(const struct LDKEmptyNodeIdLookUp *NONNULL_PTR this_arg); /** - * The tracked output descriptor. + * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. */ -struct LDKSpendableOutputDescriptor TrackedSpendableOutput_get_descriptor(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); +void BlindedHop_free(struct LDKBlindedHop this_obj); /** - * The tracked output descriptor. + * The blinded node id of this hop in a blinded path. */ -void TrackedSpendableOutput_set_descriptor(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKSpendableOutputDescriptor val); +struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); /** - * The channel this output belongs to. - * - * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The blinded node id of this hop in a blinded path. */ -struct LDKChannelId TrackedSpendableOutput_get_channel_id(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); +void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The channel this output belongs to. - * - * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`] + * The encrypted payload intended for this hop in a blinded path. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns a copy of the field. */ -void TrackedSpendableOutput_set_channel_id(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKCVec_u8Z BlindedHop_get_encrypted_payload(const struct LDKBlindedHop *NONNULL_PTR this_ptr); /** - * The current status of the output spend. + * The encrypted payload intended for this hop in a blinded path. */ -struct LDKOutputSpendStatus TrackedSpendableOutput_get_status(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr); +void BlindedHop_set_encrypted_payload(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The current status of the output spend. + * Constructs a new BlindedHop given each field */ -void TrackedSpendableOutput_set_status(struct LDKTrackedSpendableOutput *NONNULL_PTR this_ptr, struct LDKOutputSpendStatus val); +MUST_USE_RES struct LDKBlindedHop BlindedHop_new(struct LDKPublicKey blinded_node_id_arg, struct LDKCVec_u8Z encrypted_payload_arg); /** - * Constructs a new TrackedSpendableOutput given each field - * - * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the BlindedHop */ -MUST_USE_RES struct LDKTrackedSpendableOutput TrackedSpendableOutput_new(struct LDKSpendableOutputDescriptor descriptor_arg, struct LDKChannelId channel_id_arg, struct LDKOutputSpendStatus status_arg); +struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); /** - * Creates a copy of the TrackedSpendableOutput + * Generates a non-cryptographic 64-bit hash of the BlindedHop. */ -struct LDKTrackedSpendableOutput TrackedSpendableOutput_clone(const struct LDKTrackedSpendableOutput *NONNULL_PTR orig); +uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); /** - * Checks if two TrackedSpendableOutputs contain equal inner contents. + * Checks if two BlindedHops 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 TrackedSpendableOutput_eq(const struct LDKTrackedSpendableOutput *NONNULL_PTR a, const struct LDKTrackedSpendableOutput *NONNULL_PTR b); - -/** - * Returns whether the output is spent in the given transaction. - */ -MUST_USE_RES bool TrackedSpendableOutput_is_spent_in(const struct LDKTrackedSpendableOutput *NONNULL_PTR this_arg, struct LDKTransaction tx); +bool BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); /** - * Serialize the TrackedSpendableOutput object into a byte array which can be read by TrackedSpendableOutput_read + * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read */ -struct LDKCVec_u8Z TrackedSpendableOutput_write(const struct LDKTrackedSpendableOutput *NONNULL_PTR obj); +struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); /** - * Read a TrackedSpendableOutput from a byte array, created by TrackedSpendableOutput_write + * Read a BlindedHop from a byte array, created by BlindedHop_write */ -struct LDKCResult_TrackedSpendableOutputDecodeErrorZ TrackedSpendableOutput_read(struct LDKu8slice ser); +struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); /** - * Frees any resources used by the OutputSpendStatus + * Frees any resources used by the BlindedMessagePath, if is_owned is set and inner is non-NULL. */ -void OutputSpendStatus_free(struct LDKOutputSpendStatus this_ptr); +void BlindedMessagePath_free(struct LDKBlindedMessagePath this_obj); /** - * Creates a copy of the OutputSpendStatus + * Creates a copy of the BlindedMessagePath */ -struct LDKOutputSpendStatus OutputSpendStatus_clone(const struct LDKOutputSpendStatus *NONNULL_PTR orig); +struct LDKBlindedMessagePath BlindedMessagePath_clone(const struct LDKBlindedMessagePath *NONNULL_PTR orig); /** - * Utility method to constructs a new PendingInitialBroadcast-variant OutputSpendStatus + * Generates a non-cryptographic 64-bit hash of the BlindedMessagePath. */ -struct LDKOutputSpendStatus OutputSpendStatus_pending_initial_broadcast(struct LDKCOption_u32Z delayed_until_height); +uint64_t BlindedMessagePath_hash(const struct LDKBlindedMessagePath *NONNULL_PTR o); /** - * Utility method to constructs a new PendingFirstConfirmation-variant OutputSpendStatus + * Checks if two BlindedMessagePaths 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. */ -struct LDKOutputSpendStatus OutputSpendStatus_pending_first_confirmation(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx); +bool BlindedMessagePath_eq(const struct LDKBlindedMessagePath *NONNULL_PTR a, const struct LDKBlindedMessagePath *NONNULL_PTR b); /** - * Utility method to constructs a new PendingThresholdConfirmations-variant OutputSpendStatus + * Serialize the BlindedMessagePath object into a byte array which can be read by BlindedMessagePath_read */ -struct LDKOutputSpendStatus OutputSpendStatus_pending_threshold_confirmations(struct LDKThirtyTwoBytes first_broadcast_hash, uint32_t latest_broadcast_height, struct LDKTransaction latest_spending_tx, uint32_t confirmation_height, struct LDKThirtyTwoBytes confirmation_hash); +struct LDKCVec_u8Z BlindedMessagePath_write(const struct LDKBlindedMessagePath *NONNULL_PTR obj); /** - * Checks if two OutputSpendStatuss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Read a BlindedMessagePath from a byte array, created by BlindedMessagePath_write */ -bool OutputSpendStatus_eq(const struct LDKOutputSpendStatus *NONNULL_PTR a, const struct LDKOutputSpendStatus *NONNULL_PTR b); +struct LDKCResult_BlindedMessagePathDecodeErrorZ BlindedMessagePath_read(struct LDKu8slice ser); /** - * Serialize the OutputSpendStatus object into a byte array which can be read by OutputSpendStatus_read + * Create a one-hop blinded path for a message. */ -struct LDKCVec_u8Z OutputSpendStatus_write(const struct LDKOutputSpendStatus *NONNULL_PTR obj); +MUST_USE_RES struct LDKBlindedMessagePath BlindedMessagePath_one_hop(struct LDKPublicKey recipient_node_id, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKEntropySource entropy_source); /** - * Read a OutputSpendStatus from a byte array, created by OutputSpendStatus_write + * Create a path for an onion message, to be forwarded along `node_pks`. */ -struct LDKCResult_OutputSpendStatusDecodeErrorZ OutputSpendStatus_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKBlindedMessagePath BlindedMessagePath_new(struct LDKCVec_MessageForwardNodeZ intermediate_nodes, struct LDKPublicKey recipient_node_id, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKEntropySource entropy_source); /** - * Frees any resources used by the OutputSweeper, if is_owned is set and inner is non-NULL. + * Same as [`BlindedMessagePath::new`], but allows specifying a number of dummy hops. + * + * Note: + * At most [`MAX_DUMMY_HOPS_COUNT`] dummy hops can be added to the blinded path. */ -void OutputSweeper_free(struct LDKOutputSweeper this_obj); +MUST_USE_RES struct LDKBlindedMessagePath BlindedMessagePath_new_with_dummy_hops(struct LDKCVec_MessageForwardNodeZ intermediate_nodes, struct LDKPublicKey recipient_node_id, uintptr_t dummy_hop_count, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKEntropySource entropy_source); /** - * Constructs a new [`OutputSweeper`]. + * Attempts to a use a compact representation for the [`IntroductionNode`] by using a directed + * short channel id from a channel in `network_graph` leading to the introduction node. * - * If chain data is provided via the [`Confirm`] interface or via filtered blocks, users also - * need to register their [`Filter`] implementation via the given `chain_data_source`. + * While this may result in a smaller encoding, there is a trade off in that the path may + * become invalid if the channel is closed or hasn't been propagated via gossip. Therefore, + * calling this may not be suitable for long-lived blinded paths. */ -MUST_USE_RES struct LDKOutputSweeper OutputSweeper_new(struct LDKBestBlock best_block, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKCOption_FilterZ chain_data_source, struct LDKOutputSpender output_spender, struct LDKChangeDestinationSource change_destination_source, struct LDKKVStore kv_store, struct LDKLogger logger); +void BlindedMessagePath_use_compact_introduction_node(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * Tells the sweeper to track the given outputs descriptors. - * - * Usually, this should be called based on the values emitted by the - * [`Event::SpendableOutputs`]. - * - * The given `exclude_static_outputs` flag controls whether the sweeper will filter out - * [`SpendableOutputDescriptor::StaticOutput`]s, which may be handled directly by the on-chain - * wallet implementation. - * - * If `delay_until_height` is set, we will delay the spending until the respective block - * height is reached. This can be used to batch spends, e.g., to reduce on-chain fees. - * - * Returns `Err` on persistence failure, in which case the call may be safely retried. - * - * [`Event::SpendableOutputs`]: crate::events::Event::SpendableOutputs + * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., + * it is found in the network graph). * - * Note that channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OutputSweeper_track_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ output_descriptors, struct LDKChannelId channel_id, bool exclude_static_outputs, struct LDKCOption_u32Z delay_until_height); +MUST_USE_RES struct LDKNodeId BlindedMessagePath_public_introduction_node_id(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * Returns a list of the currently tracked spendable outputs. + * The [`IntroductionNode`] of the blinded path. */ -MUST_USE_RES struct LDKCVec_TrackedSpendableOutputZ OutputSweeper_tracked_spendable_outputs(const struct LDKOutputSweeper *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKIntroductionNode BlindedMessagePath_introduction_node(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * Gets the latest best block which was connected either via the [`Listen`] or - * [`Confirm`] interfaces. + * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the message. + * + * [`encrypted_payload`]: BlindedHop::encrypted_payload */ -MUST_USE_RES struct LDKBestBlock OutputSweeper_current_best_block(const struct LDKOutputSweeper *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey BlindedMessagePath_blinding_point(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * The [`BlindedHop`]s within the blinded path. */ -struct LDKListen OutputSweeper_as_Listen(const struct LDKOutputSweeper *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedMessagePath_blinded_hops(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * Advance the blinded onion message path by one hop, making the second hop into the new + * introduction node. + * + * Will only modify `self` when returning `Ok`. */ -struct LDKConfirm OutputSweeper_as_Confirm(const struct LDKOutputSweeper *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedMessagePath_advance_path_by_one(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); /** - * Frees any resources used by the SpendingDelay + * Creates a new [`BlindedMessagePath`] from its constituent parts. + * + * Useful when you need to reconstruct a blinded path from previously serialized components. + * + * Parameters: + * * `introduction_node_id`: The public key of the introduction node in the path + * * `blinding_point`: The public key used for blinding the path + * * `blinded_hops`: The encrypted routing information for each hop in the path */ -void SpendingDelay_free(struct LDKSpendingDelay this_ptr); +MUST_USE_RES struct LDKBlindedMessagePath BlindedMessagePath_from_blinded_path(struct LDKPublicKey introduction_node_id, struct LDKPublicKey blinding_point, struct LDKCVec_BlindedHopZ blinded_hops); /** - * Creates a copy of the SpendingDelay + * Frees any resources used by the NextMessageHop */ -struct LDKSpendingDelay SpendingDelay_clone(const struct LDKSpendingDelay *NONNULL_PTR orig); +void NextMessageHop_free(struct LDKNextMessageHop this_ptr); /** - * Utility method to constructs a new Relative-variant SpendingDelay + * Creates a copy of the NextMessageHop */ -struct LDKSpendingDelay SpendingDelay_relative(uint32_t num_blocks); +struct LDKNextMessageHop NextMessageHop_clone(const struct LDKNextMessageHop *NONNULL_PTR orig); /** - * Utility method to constructs a new Absolute-variant SpendingDelay + * Utility method to constructs a new NodeId-variant NextMessageHop */ -struct LDKSpendingDelay SpendingDelay_absolute(uint32_t height); +struct LDKNextMessageHop NextMessageHop_node_id(struct LDKPublicKey a); /** - * Read a OutputSweeper from a byte array, created by OutputSweeper_write + * Utility method to constructs a new ShortChannelId-variant NextMessageHop */ -struct LDKCResult_OutputSweeperDecodeErrorZ OutputSweeper_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g); +struct LDKNextMessageHop NextMessageHop_short_channel_id(uint64_t a); /** - * Read a C2Tuple_BestBlockOutputSweeperZ from a byte array, created by C2Tuple_BestBlockOutputSweeperZ_write + * Generates a non-cryptographic 64-bit hash of the NextMessageHop. */ -struct LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ C2Tuple_BestBlockOutputSweeperZ_read(struct LDKu8slice ser, struct LDKBroadcasterInterface arg_a, struct LDKFeeEstimator arg_b, struct LDKCOption_FilterZ arg_c, struct LDKOutputSpender arg_d, struct LDKChangeDestinationSource arg_e, struct LDKKVStore arg_f, struct LDKLogger arg_g); +uint64_t NextMessageHop_hash(const struct LDKNextMessageHop *NONNULL_PTR o); /** - * Calls the free function if one is set + * Checks if two NextMessageHops contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void FutureCallback_free(struct LDKFutureCallback this_ptr); +bool NextMessageHop_eq(const struct LDKNextMessageHop *NONNULL_PTR a, const struct LDKNextMessageHop *NONNULL_PTR b); /** - * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. + * Frees any resources used by the MessageForwardNode, if is_owned is set and inner is non-NULL. */ -void Future_free(struct LDKFuture this_obj); +void MessageForwardNode_free(struct LDKMessageForwardNode this_obj); /** - * Registers a callback to be called upon completion of this future. If the future has already - * completed, the callback will be called immediately. + * This node's pubkey. */ -void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); +struct LDKPublicKey MessageForwardNode_get_node_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); /** - * Waits until this [`Future`] completes. + * This node's pubkey. */ -void Future_wait(const struct LDKFuture *NONNULL_PTR this_arg); +void MessageForwardNode_set_node_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Waits until this [`Future`] completes or the given amount of time has elapsed. - * - * Returns true if the [`Future`] completed, false if the time elapsed. + * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s + * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a + * more compact representation. */ -MUST_USE_RES bool Future_wait_timeout(const struct LDKFuture *NONNULL_PTR this_arg, uint64_t max_wait); +struct LDKCOption_u64Z MessageForwardNode_get_short_channel_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL. + * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s + * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a + * more compact representation. */ -void Sleeper_free(struct LDKSleeper this_obj); +void MessageForwardNode_set_short_channel_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new sleeper from one future, allowing blocking on it. + * Constructs a new MessageForwardNode given each field */ -MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(const struct LDKFuture *NONNULL_PTR future); +MUST_USE_RES struct LDKMessageForwardNode MessageForwardNode_new(struct LDKPublicKey node_id_arg, struct LDKCOption_u64Z short_channel_id_arg); /** - * Constructs a new sleeper from two futures, allowing blocking on both at once. + * Creates a copy of the MessageForwardNode */ -MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b); +struct LDKMessageForwardNode MessageForwardNode_clone(const struct LDKMessageForwardNode *NONNULL_PTR orig); /** - * Constructs a new sleeper from three futures, allowing blocking on all three at once. - * + * Generates a non-cryptographic 64-bit hash of the MessageForwardNode. */ -MUST_USE_RES struct LDKSleeper Sleeper_from_three_futures(const struct LDKFuture *NONNULL_PTR fut_a, const struct LDKFuture *NONNULL_PTR fut_b, const struct LDKFuture *NONNULL_PTR fut_c); +uint64_t MessageForwardNode_hash(const struct LDKMessageForwardNode *NONNULL_PTR o); /** - * Constructs a new sleeper on many futures, allowing blocking on all at once. + * Checks if two MessageForwardNodes 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. */ -MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures); +bool MessageForwardNode_eq(const struct LDKMessageForwardNode *NONNULL_PTR a, const struct LDKMessageForwardNode *NONNULL_PTR b); /** - * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed. + * Frees any resources used by the MessageContext */ -void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg); +void MessageContext_free(struct LDKMessageContext this_ptr); /** - * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the - * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time - * elapsed. + * Creates a copy of the MessageContext */ -MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait); +struct LDKMessageContext MessageContext_clone(const struct LDKMessageContext *NONNULL_PTR orig); /** - * Creates a copy of the Level + * Utility method to constructs a new Offers-variant MessageContext */ -enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig); +struct LDKMessageContext MessageContext_offers(struct LDKOffersContext a); /** - * Utility method to constructs a new Gossip-variant Level + * Utility method to constructs a new AsyncPayments-variant MessageContext */ -enum LDKLevel Level_gossip(void); +struct LDKMessageContext MessageContext_async_payments(struct LDKAsyncPaymentsContext a); /** - * Utility method to constructs a new Trace-variant Level + * Utility method to constructs a new DNSResolver-variant MessageContext */ -enum LDKLevel Level_trace(void); +struct LDKMessageContext MessageContext_dnsresolver(struct LDKDNSResolverContext a); /** - * Utility method to constructs a new Debug-variant Level + * Utility method to constructs a new Custom-variant MessageContext */ -enum LDKLevel Level_debug(void); +struct LDKMessageContext MessageContext_custom(struct LDKCVec_u8Z a); /** - * Utility method to constructs a new Info-variant Level + * Frees any resources used by the OffersContext */ -enum LDKLevel Level_info(void); +void OffersContext_free(struct LDKOffersContext this_ptr); /** - * Utility method to constructs a new Warn-variant Level + * Creates a copy of the OffersContext */ -enum LDKLevel Level_warn(void); +struct LDKOffersContext OffersContext_clone(const struct LDKOffersContext *NONNULL_PTR orig); /** - * Utility method to constructs a new Error-variant Level + * Utility method to constructs a new InvoiceRequest-variant OffersContext */ -enum LDKLevel Level_error(void); +struct LDKOffersContext OffersContext_invoice_request(struct LDKNonce nonce); /** - * Checks if two Levels contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new StaticInvoiceRequested-variant OffersContext */ -bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b); +struct LDKOffersContext OffersContext_static_invoice_requested(struct LDKCVec_u8Z recipient_id, uint16_t invoice_slot, uint64_t path_absolute_expiry); /** - * Generates a non-cryptographic 64-bit hash of the Level. + * Utility method to constructs a new OutboundPayment-variant OffersContext */ -uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o); +struct LDKOffersContext OffersContext_outbound_payment(struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce); /** - * Get the string representation of a Level object + * Utility method to constructs a new InboundPayment-variant OffersContext */ -struct LDKStr Level_to_str(const enum LDKLevel *NONNULL_PTR o); +struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes payment_hash); /** - * Returns the most verbose logging level. + * Checks if two OffersContexts contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES enum LDKLevel Level_max(void); +bool OffersContext_eq(const struct LDKOffersContext *NONNULL_PTR a, const struct LDKOffersContext *NONNULL_PTR b); /** - * Frees any resources used by the Record, if is_owned is set and inner is non-NULL. + * Frees any resources used by the AsyncPaymentsContext */ -void Record_free(struct LDKRecord this_obj); +void AsyncPaymentsContext_free(struct LDKAsyncPaymentsContext this_ptr); /** - * The verbosity level of the message. + * Creates a copy of the AsyncPaymentsContext */ -enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_clone(const struct LDKAsyncPaymentsContext *NONNULL_PTR orig); /** - * The verbosity level of the message. + * Utility method to constructs a new OfferPathsRequest-variant AsyncPaymentsContext */ -void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_offer_paths_request(struct LDKCVec_u8Z recipient_id, struct LDKCOption_u64Z path_absolute_expiry); /** - * The node id of the peer pertaining to the logged record. - * - * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be - * `None`, depending on if the peer information is readily available in LDK when the log is - * generated. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new OfferPaths-variant AsyncPaymentsContext */ -struct LDKPublicKey Record_get_peer_id(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_offer_paths(uint16_t invoice_slot, uint64_t path_absolute_expiry); /** - * The node id of the peer pertaining to the logged record. - * - * Note that in some cases a [`Self::channel_id`] may be filled in but this may still be - * `None`, depending on if the peer information is readily available in LDK when the log is - * generated. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new ServeStaticInvoice-variant AsyncPaymentsContext */ -void Record_set_peer_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_serve_static_invoice(struct LDKCVec_u8Z recipient_id, uint16_t invoice_slot, uint64_t path_absolute_expiry); /** - * The channel id of the channel pertaining to the logged record. May be a temporary id before - * the channel has been funded. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new StaticInvoicePersisted-variant AsyncPaymentsContext */ -struct LDKChannelId Record_get_channel_id(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_static_invoice_persisted(struct LDKOfferId offer_id, uint64_t invoice_created_at); /** - * The channel id of the channel pertaining to the logged record. May be a temporary id before - * the channel has been funded. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new OutboundPayment-variant AsyncPaymentsContext */ -void Record_set_channel_id(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_outbound_payment(struct LDKThirtyTwoBytes payment_id); /** - * The message body. + * Utility method to constructs a new InboundPayment-variant AsyncPaymentsContext */ -struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_inbound_payment(uint64_t path_absolute_expiry); /** - * The message body. + * Utility method to constructs a new ReleaseHeldHtlc-variant AsyncPaymentsContext */ -void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKAsyncPaymentsContext AsyncPaymentsContext_release_held_htlc(struct LDKThirtyTwoBytes intercept_id, uint64_t prev_outbound_scid_alias, uint64_t htlc_id); /** - * The module path of the message. + * Serialize the MessageContext object into a byte array which can be read by MessageContext_read */ -struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z MessageContext_write(const struct LDKMessageContext *NONNULL_PTR obj); /** - * The module path of the message. + * Read a MessageContext from a byte array, created by MessageContext_write */ -void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKCResult_MessageContextDecodeErrorZ MessageContext_read(struct LDKu8slice ser); /** - * The source file containing the message. + * Serialize the OffersContext object into a byte array which can be read by OffersContext_read */ -struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z OffersContext_write(const struct LDKOffersContext *NONNULL_PTR obj); /** - * The source file containing the message. + * Read a OffersContext from a byte array, created by OffersContext_write */ -void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKCResult_OffersContextDecodeErrorZ OffersContext_read(struct LDKu8slice ser); /** - * The line containing the message. + * Serialize the AsyncPaymentsContext object into a byte array which can be read by AsyncPaymentsContext_read */ -uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z AsyncPaymentsContext_write(const struct LDKAsyncPaymentsContext *NONNULL_PTR obj); /** - * The line containing the message. + * Read a AsyncPaymentsContext from a byte array, created by AsyncPaymentsContext_write */ -void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ AsyncPaymentsContext_read(struct LDKu8slice ser); /** - * The payment hash. - * - * Note that this is only filled in for logs pertaining to a specific payment, and will be - * `None` for logs which are not directly related to a payment. + * Frees any resources used by the DNSResolverContext, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_ThirtyTwoBytesZ Record_get_payment_hash(const struct LDKRecord *NONNULL_PTR this_ptr); +void DNSResolverContext_free(struct LDKDNSResolverContext this_obj); /** - * The payment hash. - * - * Note that this is only filled in for logs pertaining to a specific payment, and will be - * `None` for logs which are not directly related to a payment. + * A nonce which uniquely describes a DNS resolution, useful for looking up metadata about the + * request. */ -void Record_set_payment_hash(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +const uint8_t (*DNSResolverContext_get_nonce(const struct LDKDNSResolverContext *NONNULL_PTR this_ptr))[16]; /** - * Constructs a new Record given each field - * - * Note that peer_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * A nonce which uniquely describes a DNS resolution, useful for looking up metadata about the + * request. */ -MUST_USE_RES struct LDKRecord Record_new(enum LDKLevel level_arg, struct LDKPublicKey peer_id_arg, struct LDKChannelId channel_id_arg, struct LDKStr args_arg, struct LDKStr module_path_arg, struct LDKStr file_arg, uint32_t line_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); +void DNSResolverContext_set_nonce(struct LDKDNSResolverContext *NONNULL_PTR this_ptr, struct LDKSixteenBytes val); /** - * Creates a copy of the Record + * Constructs a new DNSResolverContext given each field */ -struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig); +MUST_USE_RES struct LDKDNSResolverContext DNSResolverContext_new(struct LDKSixteenBytes nonce_arg); /** - * Calls the free function if one is set + * Creates a copy of the DNSResolverContext */ -void Logger_free(struct LDKLogger this_ptr); +struct LDKDNSResolverContext DNSResolverContext_clone(const struct LDKDNSResolverContext *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the DNSResolverContext. */ -void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); +uint64_t DNSResolverContext_hash(const struct LDKDNSResolverContext *NONNULL_PTR o); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the - * equivalent limit applied to outbound channels). - * - * A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment - * transaction before operation. If you wish to accept channels with zero confirmations, see - * [`UserConfig::manually_accept_inbound_channels`] and - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. - * - * Default value: `6` - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf + * Checks if two DNSResolverContexts 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. */ -uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +bool DNSResolverContext_eq(const struct LDKDNSResolverContext *NONNULL_PTR a, const struct LDKDNSResolverContext *NONNULL_PTR b); /** - * Confirmations we will wait for before considering the channel locked in. - * Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the - * equivalent limit applied to outbound channels). - * - * A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment - * transaction before operation. If you wish to accept channels with zero confirmations, see - * [`UserConfig::manually_accept_inbound_channels`] and - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. - * - * Default value: `6` - * - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf + * Serialize the DNSResolverContext object into a byte array which can be read by DNSResolverContext_read */ -void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z DNSResolverContext_write(const struct LDKDNSResolverContext *NONNULL_PTR obj); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`] (We enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less.) + * Read a DNSResolverContext from a byte array, created by DNSResolverContext_write */ -uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKCResult_DNSResolverContextDecodeErrorZ DNSResolverContext_read(struct LDKu8slice ser); /** - * Set to the number of blocks we require our counterparty to wait to claim their money (ie - * the number of blocks we have to punish our counterparty if they broadcast a revoked - * transaction). - * - * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST - * be online to check for revoked transactions on-chain at least once every our_to_self_delay - * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, - * possibly with time in between to RBF the spending transaction). - * - * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in - * case of an honest unilateral channel close, which implicitly decrease the economic value of - * our channel. - * - * Default value: [`BREAKDOWN_TIMEOUT`] (We enforce it as a minimum at channel opening so you - * can tweak config to ask for more security, not less.) + * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL. */ -void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: `1` (If the value is less than `1`, it is ignored and set to `1`, as is - * required by the protocol. + * Base fee charged (in millisatoshi) for the entire blinded path. */ -uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Set to the smallest value HTLC we will accept to process. - * - * This value is sent to our counterparty on channel-open and we close the channel any time - * our counterparty misbehaves by sending us an HTLC with a value smaller than this. - * - * Default value: `1` (If the value is less than `1`, it is ignored and set to `1`, as is - * required by the protocol. + * Base fee charged (in millisatoshi) for the entire blinded path. */ -void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); +void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Sets the percentage of the channel value we will cap the total value of outstanding inbound - * HTLCs to. - * - * This can be set to a value between 1-100, where the value corresponds to the percent of the - * channel value in whole percentages. - * - * Note that: - * * If configured to another value than the default value `10`, any new channels created with - * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the - * `ChannelManager`. - * - * * This caps the total value for inbound HTLCs in-flight only, and there's currently - * no way to configure the cap for the total value of outbound HTLCs in-flight. - * - * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds - * are different from the non-HTLC-encumbered funds. This makes this an important knob to - * restrict exposure to loss due to being offline for too long. - * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] - * for more information. - * - * Default value: `10` - * - * Minimum value: `1` (Any values less will be treated as `1` instead.) - * - * Maximum value: `100` (Any values larger will be treated as `100` instead.) + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Sets the percentage of the channel value we will cap the total value of outstanding inbound - * HTLCs to. - * - * This can be set to a value between 1-100, where the value corresponds to the percent of the - * channel value in whole percentages. - * - * Note that: - * * If configured to another value than the default value `10`, any new channels created with - * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the - * `ChannelManager`. - * - * * This caps the total value for inbound HTLCs in-flight only, and there's currently - * no way to configure the cap for the total value of outbound HTLCs in-flight. - * - * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds - * are different from the non-HTLC-encumbered funds. This makes this an important knob to - * restrict exposure to loss due to being offline for too long. - * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] - * for more information. - * - * Default value: `10` - * - * Minimum value: `1` (Any values less will be treated as `1` instead.) - * - * Maximum value: `100` (Any values larger will be treated as `100` instead.) + * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path + * (i.e., 10,000 is 1%). */ -void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); +void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the - * BOLTs) option for outbound private channels. This provides better privacy by not including - * our real on-chain channel UTXO in each invoice and requiring that our counterparty only - * relay HTLCs to us using the channel's SCID alias. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `scid_alias` option; we will simply fall back to a - * private channel without that option. - * - * Ignored if the channel is negotiated to be announced, see - * [`ChannelHandshakeConfig::announce_for_forwarding`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. - * - * Default value: `false` (This value is likely to change to `true` in the future.) - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the - * BOLTs) option for outbound private channels. This provides better privacy by not including - * our real on-chain channel UTXO in each invoice and requiring that our counterparty only - * relay HTLCs to us using the channel's SCID alias. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `scid_alias` option; we will simply fall back to a - * private channel without that option. - * - * Ignored if the channel is negotiated to be announced, see - * [`ChannelHandshakeConfig::announce_for_forwarding`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. - * - * Default value: `false` (This value is likely to change to `true` in the future.) - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded + * path. */ -void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: `false` + * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool ChannelHandshakeConfig_get_announce_for_forwarding(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * Default value: `false` + * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -void ChannelHandshakeConfig_set_announce_for_forwarding(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. - * - * Default value: `true` - * - * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey + * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * The upfront key committed is provided from [`SignerProvider::get_shutdown_scriptpubkey`]. - * - * Default value: `true` - * - * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey + * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the + * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as + * seen by the recipient. */ -void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * The Proportion of the channel value to configure as counterparty's channel reserve, - * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. - * - * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain - * on their side, at all times. - * This ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * Channel reserve values greater than 30% could be considered highly unreasonable, since that - * amount can never be used for payments. - * Also, if our selected channel reserve for counterparty and counterparty's selected - * channel reserve for us sum up to equal or greater than channel value, channel negotiations - * will fail. - * - * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve - * other than the default value. - * - * Default value: `10_000` millionths (i.e., 1% of channel value) - * - * Minimum value: If the calculated proportional value is less than `1000` sats, it will be - * treated as `1000` sats instead, which is a safe implementation-specific lower - * bound. - * - * Maximum value: `1_000_000` (i.e., 100% of channel value. Any values larger than one million - * will be treated as one million instead, although channel negotiations will - * fail in that case.) + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); /** - * The Proportion of the channel value to configure as counterparty's channel reserve, - * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. - * - * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain - * on their side, at all times. - * This ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. - * - * Channel reserve values greater than 30% could be considered highly unreasonable, since that - * amount can never be used for payments. - * Also, if our selected channel reserve for counterparty and counterparty's selected - * channel reserve for us sum up to equal or greater than channel value, channel negotiations - * will fail. - * - * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve - * other than the default value. - * - * Default value: `10_000` millionths (i.e., 1% of channel value) - * - * Minimum value: If the calculated proportional value is less than `1000` sats, it will be - * treated as `1000` sats instead, which is a safe implementation-specific lower - * bound. - * - * Maximum value: `1_000_000` (i.e., 100% of channel value. Any values larger than one million - * will be treated as one million instead, although channel negotiations will - * fail in that case.) + * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an + * onion payload. */ -void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); +void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future - * channels. This feature requires having a reserve of onchain funds readily available to bump - * transactions in the event of a channel force close to avoid the possibility of losing funds. - * - * Note that if you wish accept inbound channels with anchor outputs, you must enable - * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with - * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check - * whether your reserve of onchain funds is enough to cover the fees for all existing and new - * channels featuring anchor outputs in the event of a force close. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply - * fall back to a `static_remote_key` channel. - * - * LDK will not support the legacy `option_anchors` commitment version due to a discovered - * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee - * Considered Harmful`] mailing list post. - * - * Default value: `false` (This value is likely to change to `true` in the future.) - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue - * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html + * Constructs a new BlindedPayInfo given each field */ -bool ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBlindedPayInfo BlindedPayInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKBlindedHopFeatures features_arg); /** - * If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future - * channels. This feature requires having a reserve of onchain funds readily available to bump - * transactions in the event of a channel force close to avoid the possibility of losing funds. - * - * Note that if you wish accept inbound channels with anchor outputs, you must enable - * [`UserConfig::manually_accept_inbound_channels`] and manually accept them with - * [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check - * whether your reserve of onchain funds is enough to cover the fees for all existing and new - * channels featuring anchor outputs in the event of a force close. - * - * If this option is set, channels may be created that will not be readable by LDK versions - * prior to 0.0.116, causing [`ChannelManager`]'s read method to return a - * [`DecodeError::InvalidValue`]. - * - * Note that setting this to true does *not* prevent us from opening channels with - * counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply - * fall back to a `static_remote_key` channel. - * - * LDK will not support the legacy `option_anchors` commitment version due to a discovered - * vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee - * Considered Harmful`] mailing list post. - * - * Default value: `false` (This value is likely to change to `true` in the future.) - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue - * [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html + * Creates a copy of the BlindedPayInfo */ -void ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig); /** - * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. - * - * Increasing the value can help improve liquidity and stability in - * routing at the cost of higher long term disk / DB usage. - * - * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration - * other than the default value. - * - * Default value: `50` - * - * Maximum value: `483` (Any values larger will be treated as `483`. This is the BOLT #2 spec - * limit on `max_accepted_htlcs`.) + * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. */ -uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); +uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o); /** - * The maximum number of HTLCs in-flight from our counterparty towards us at the same time. - * - * Increasing the value can help improve liquidity and stability in - * routing at the cost of higher long term disk / DB usage. - * - * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration - * other than the default value. - * - * Default value: `50` - * - * Maximum value: `483` (Any values larger will be treated as `483`. This is the BOLT #2 spec - * limit on `max_accepted_htlcs`.) + * Checks if two BlindedPayInfos 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. */ -void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val); +bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b); /** - * Constructs a new ChannelHandshakeConfig given each field + * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announce_for_forwarding_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, bool negotiate_anchors_zero_fee_htlc_tx_arg, uint16_t our_max_accepted_htlcs_arg); +struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj); /** - * Creates a copy of the ChannelHandshakeConfig + * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write */ -struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig); +struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser); /** - * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used. + * Frees any resources used by the BlindedPaymentPath, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void); +void BlindedPaymentPath_free(struct LDKBlindedPaymentPath this_obj); /** - * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL. + * The [`BlindedPayInfo`] used to pay this blinded path. */ -void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); +struct LDKBlindedPayInfo BlindedPaymentPath_get_payinfo(const struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr); /** - * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: `1000` - * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) + * The [`BlindedPayInfo`] used to pay this blinded path. */ -uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void BlindedPaymentPath_set_payinfo(struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr, struct LDKBlindedPayInfo val); /** - * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: `1000` - * (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) + * Creates a copy of the BlindedPaymentPath */ -void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +struct LDKBlindedPaymentPath BlindedPaymentPath_clone(const struct LDKBlindedPaymentPath *NONNULL_PTR orig); /** - * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: `2^24 - 1` + * Generates a non-cryptographic 64-bit hash of the BlindedPaymentPath. */ -uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +uint64_t BlindedPaymentPath_hash(const struct LDKBlindedPaymentPath *NONNULL_PTR o); /** - * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so - * only applies to inbound channels. - * - * Default value: `2^24 - 1` + * Checks if two BlindedPaymentPaths 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. */ -void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +bool BlindedPaymentPath_eq(const struct LDKBlindedPaymentPath *NONNULL_PTR a, const struct LDKBlindedPaymentPath *NONNULL_PTR b); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. - * - * Default value: `u64::max_value` + * Create a one-hop blinded path for a payment. */ -uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_one_hop(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); /** - * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows - * you to limit the maximum minimum-size they can require. + * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. * - * Default value: `u64::max_value` + * Errors if: + * * [`BlindedPayInfo`] calculation results in an integer overflow + * * any unknown features are required in the provided [`ForwardTlvs`] */ -void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_new(struct LDKCVec_PaymentForwardNodeZ intermediate_nodes, struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint64_t htlc_maximum_msat, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. + * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., + * it is found in the network graph). * - * Default value: `0` + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKNodeId BlindedPaymentPath_public_introduction_node_id(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); /** - * The remote node sets a limit on the maximum value of pending HTLCs to them at any given - * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value. - * - * Default value: `0` + * The [`IntroductionNode`] of the blinded path. */ -void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKIntroductionNode BlindedPaymentPath_introduction_node(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). + * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the payment. * - * Default value: `u64::max_value`. + * [`encrypted_payload`]: BlindedHop::encrypted_payload */ -uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey BlindedPaymentPath_blinding_point(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); /** - * The remote node will require we keep a certain amount in direct payment to ourselves at all - * time, ensuring that we are able to be punished if we broadcast an old state. This allows to - * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs). - * - * Default value: `u64::max_value`. + * The [`BlindedHop`]s within the blinded path. */ -void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedPaymentPath_blinded_hops(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. + * Advance the blinded onion payment path by one hop, making the second hop into the new + * introduction node. * - * Default value: `0` + * Will only modify `self` when returning `Ok`. */ -uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedPaymentPath_advance_path_by_one(struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); /** - * The remote node sets a limit on the maximum number of pending HTLCs to them at any given - * time. This allows you to set a minimum such value. + * Builds a new [`BlindedPaymentPath`] from its constituent parts. * - * Default value: `0` + * Useful when reconstructing a blinded path from previously serialized components. + * + * Parameters: + * * `introduction_node_id`: The public key of the introduction node in the path. + * * `blinding_point`: The public key used for blinding the path. + * * `blinded_hops`: The encrypted routing information for each hop in the path. + * * `payinfo`: The [`BlindedPayInfo`] for the blinded path. */ -void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKBlindedPaymentPath BlindedPaymentPath_from_blinded_path_and_payinfo(struct LDKPublicKey introduction_node_id, struct LDKPublicKey blinding_point, struct LDKCVec_BlindedHopZ blinded_hops, struct LDKBlindedPayInfo payinfo); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: `144`, or roughly one day and only applies to outbound channels + * Frees any resources used by the PaymentForwardNode, if is_owned is set and inner is non-NULL. */ -uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void PaymentForwardNode_free(struct LDKPaymentForwardNode this_obj); /** - * Before a channel is usable the funding transaction will need to be confirmed by at least a - * certain number of blocks, specified by the node which is not the funder (as the funder can - * assume they aren't going to double-spend themselves). - * This config allows you to set a limit on the maximum amount of time to wait. - * - * Default value: `144`, or roughly one day and only applies to outbound channels + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. */ -void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); +struct LDKForwardTlvs PaymentForwardNode_get_tlvs(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Whether we implicitly trust funding transactions generated by us for our own outbound - * channels to not be double-spent. - * - * If this is set, we assume that our own funding transactions are *never* double-spent, and - * thus we can trust them without any confirmations. This is generally a reasonable - * assumption, given we're the only ones who could ever double-spend it (assuming we have sole - * control of the signing keys). - * - * You may wish to un-set this if you allow the user to (or do in an automated fashion) - * double-spend the funding transaction to RBF with an alternative channel open. - * - * This only applies if our counterparty set their confirmations-required value to `0`, and we - * always trust our own funding transaction at `1` confirmation irrespective of this value. - * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being - * `true` (`0`) and `false` (`1`). - * - * Default value: `true` + * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also + * used for [`BlindedPayInfo`] construction. */ -bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void PaymentForwardNode_set_tlvs(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); /** - * Whether we implicitly trust funding transactions generated by us for our own outbound - * channels to not be double-spent. - * - * If this is set, we assume that our own funding transactions are *never* double-spent, and - * thus we can trust them without any confirmations. This is generally a reasonable - * assumption, given we're the only ones who could ever double-spend it (assuming we have sole - * control of the signing keys). - * - * You may wish to un-set this if you allow the user to (or do in an automated fashion) - * double-spend the funding transaction to RBF with an alternative channel open. - * - * This only applies if our counterparty set their confirmations-required value to `0`, and we - * always trust our own funding transaction at `1` confirmation irrespective of this value. - * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being - * `true` (`0`) and `false` (`1`). - * - * Default value: `true` + * This node's pubkey. */ -void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +struct LDKPublicKey PaymentForwardNode_get_node_id(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelHandshakeConfig::announce_for_forwarding`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. - * - * Default value: `true` + * This node's pubkey. */ -bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void PaymentForwardNode_set_node_id(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Set to force an incoming channel to match our announced channel preference in - * [`ChannelHandshakeConfig::announce_for_forwarding`]. - * - * For a node which is not online reliably, this should be set to true and - * [`ChannelHandshakeConfig::announce_for_forwarding`] set to false, ensuring that no announced (aka public) - * channels will ever be opened. - * - * Default value: `true` + * The maximum value, in msat, that may be accepted by this node. */ -void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); +uint64_t PaymentForwardNode_get_htlc_maximum_msat(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: `2016`, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * The maximum value, in msat, that may be accepted by this node. */ -uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); +void PaymentForwardNode_set_htlc_maximum_msat(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, uint64_t val); /** - * Set to the amount of time we're willing to wait to claim money back to us. - * - * Not checking this value would be a security issue, as our peer would be able to set it to - * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time. - * - * Default value: `2016`, which we also enforce as a maximum value so you can tweak config to - * reduce the loss of having useless locked funds (if your peer accepts) + * Constructs a new PaymentForwardNode given each field */ -void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKPaymentForwardNode PaymentForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); /** - * Constructs a new ChannelHandshakeLimits given each field + * Creates a copy of the PaymentForwardNode */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); +struct LDKPaymentForwardNode PaymentForwardNode_clone(const struct LDKPaymentForwardNode *NONNULL_PTR orig); /** - * Creates a copy of the ChannelHandshakeLimits + * Frees any resources used by the ForwardTlvs, if is_owned is set and inner is non-NULL. */ -struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig); +void ForwardTlvs_free(struct LDKForwardTlvs this_obj); /** - * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used. + * The short channel id this payment should be forwarded out over. */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void); +uint64_t ForwardTlvs_get_short_channel_id(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * Frees any resources used by the MaxDustHTLCExposure + * The short channel id this payment should be forwarded out over. */ -void MaxDustHTLCExposure_free(struct LDKMaxDustHTLCExposure this_ptr); +void ForwardTlvs_set_short_channel_id(struct LDKForwardTlvs *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the MaxDustHTLCExposure + * Payment parameters for relaying over [`Self::short_channel_id`]. */ -struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_clone(const struct LDKMaxDustHTLCExposure *NONNULL_PTR orig); +struct LDKPaymentRelay ForwardTlvs_get_payment_relay(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure + * Payment parameters for relaying over [`Self::short_channel_id`]. */ -struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fixed_limit_msat(uint64_t a); +void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); /** - * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure + * Payment constraints for relaying over [`Self::short_channel_id`]. */ -struct LDKMaxDustHTLCExposure MaxDustHTLCExposure_fee_rate_multiplier(uint64_t a); +struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * Checks if two MaxDustHTLCExposures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Payment constraints for relaying over [`Self::short_channel_id`]. */ -bool MaxDustHTLCExposure_eq(const struct LDKMaxDustHTLCExposure *NONNULL_PTR a, const struct LDKMaxDustHTLCExposure *NONNULL_PTR b); +void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); /** - * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read + * 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 LDKCVec_u8Z MaxDustHTLCExposure_write(const struct LDKMaxDustHTLCExposure *NONNULL_PTR obj); +struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write + * 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 LDKCResult_MaxDustHTLCExposureDecodeErrorZ MaxDustHTLCExposure_read(struct LDKu8slice ser); +void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL. + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelConfig_free(struct LDKChannelConfig this_obj); +struct LDKPublicKey ForwardTlvs_get_next_blinding_override(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * - * Default value: `0` + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +void ForwardTlvs_set_next_blinding_override(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound - * over the channel. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. + * Constructs a new ForwardTlvs given each field * - * Default value: `0` + * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +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, struct LDKPublicKey next_blinding_override_arg); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: `1000` - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Creates a copy of the ForwardTlvs */ -uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR orig); /** - * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in - * excess of [`forwarding_fee_proportional_millionths`]. - * This may be allowed to change at runtime in a later update, however doing so must result in - * update messages sent to notify all nodes of our updated relay fee. - * - * The default value of a single satoshi roughly matches the market rate on many routing nodes - * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through - * this node. - * - * Default value: `1000` - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * Frees any resources used by the TrampolineForwardTlvs, if is_owned is set and inner is non-NULL. */ -void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val); +void TrampolineForwardTlvs_free(struct LDKTrampolineForwardTlvs this_obj); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: `72` (12 hours at an average of 6 blocks/hour) - * - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`] (Any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead.) - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * The node id to which the trampoline node must find a route. */ -uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKPublicKey TrampolineForwardTlvs_get_next_trampoline(const struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr); /** - * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over - * the channel this config applies to. - * - * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight - * HTLC balance when a channel appears on-chain whereas - * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining - * (non-HTLC-encumbered) balance. - * - * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, - * we (or one of our watchtowers) MUST be online to check for broadcast of the current - * commitment transaction at least once per this many blocks (minus some margin to allow us - * enough time to broadcast and confirm a transaction, possibly with time in between to RBF - * the spending transaction). - * - * Default value: `72` (12 hours at an average of 6 blocks/hour) - * - * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`] (Any values less than this will be treated as - * [`MIN_CLTV_EXPIRY_DELTA`] instead.) - * - * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA + * The node id to which the trampoline node must find a route. */ -void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); +void TrampolineForwardTlvs_set_next_trampoline(struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Limit our total exposure to potential loss to on-chain fees on close, including in-flight - * HTLCs which are burned to fees as they are too small to claim on-chain and fees on - * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. - * - * # HTLC-based Dust Exposure - * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be substantial if there are many dust HTLCs present when the - * channel is force-closed. - * - * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a - * channel negotiated throughout the channel open process, along with the fees required to have - * a broadcastable HTLC spending transaction. When a channel supports anchor outputs - * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into - * account the HTLC transaction fee as it is zero. Because of this, you may want to set this - * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier - * variant is primarily intended for use with pre-anchor channels. - * - * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. - * - * # Transaction Fee Dust Exposure - * - * Further, counterparties broadcasting a commitment transaction in a force-close may result - * in other balance being burned to fees, and thus all fees on commitment and HTLC - * transactions in excess of our local fee estimates are included in the dust calculation. - * - * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 - * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per - * non-dust HTLC we're allowed to have with our peers before risking a force-closure for - * inbound channels. - * - * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 - * sat/KW), we risk force-closure if we disagree with our peer by: - * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in - * both directions (the maximum), - * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both - * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) - * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs - * in both directions (the maximum), - * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs - * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) - * - * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement - * will scale linearly with increases (or decreases) in the our feerate estimates. Further, - * for anchor channels we expect our counterparty to use a relatively low feerate estimate - * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) - * and feerate disagreement force-closures should only occur when theirs is higher than ours. - * - * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` - * - * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate + * Payment parameters for relaying over [`Self::next_trampoline`]. */ -struct LDKMaxDustHTLCExposure ChannelConfig_get_max_dust_htlc_exposure(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKPaymentRelay TrampolineForwardTlvs_get_payment_relay(const struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr); /** - * Limit our total exposure to potential loss to on-chain fees on close, including in-flight - * HTLCs which are burned to fees as they are too small to claim on-chain and fees on - * commitment transaction(s) broadcasted by our counterparty in excess of our own fee estimate. - * - * # HTLC-based Dust Exposure - * - * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will - * not be claimable on-chain, instead being turned into additional miner fees if either - * party force-closes the channel. Because the threshold is per-HTLC, our total exposure - * to such payments may be substantial if there are many dust HTLCs present when the - * channel is force-closed. - * - * The dust threshold for each HTLC is based on the `dust_limit_satoshis` for each party in a - * channel negotiated throughout the channel open process, along with the fees required to have - * a broadcastable HTLC spending transaction. When a channel supports anchor outputs - * (specifically the zero fee HTLC transaction variant), this threshold no longer takes into - * account the HTLC transaction fee as it is zero. Because of this, you may want to set this - * value to a fixed limit for channels using anchor outputs, while the fee rate multiplier - * variant is primarily intended for use with pre-anchor channels. - * - * The selected limit is applied for sent, forwarded, and received HTLCs and limits the total - * exposure across all three types per-channel. - * - * # Transaction Fee Dust Exposure - * - * Further, counterparties broadcasting a commitment transaction in a force-close may result - * in other balance being burned to fees, and thus all fees on commitment and HTLC - * transactions in excess of our local fee estimates are included in the dust calculation. - * - * Because of this, another way to look at this limit is to divide it by 43,000 (or 218,750 - * for non-anchor channels) and see it as the maximum feerate disagreement (in sats/vB) per - * non-dust HTLC we're allowed to have with our peers before risking a force-closure for - * inbound channels. - * - * Thus, for the default value of 10_000 * a current feerate estimate of 10 sat/vB (or 2,500 - * sat/KW), we risk force-closure if we disagree with our peer by: - * * `10_000 * 2_500 / 43_000 / (483*2)` = 0.6 sat/vB for anchor channels with 483 HTLCs in - * both directions (the maximum), - * * `10_000 * 2_500 / 43_000 / (50*2)` = 5.8 sat/vB for anchor channels with 50 HTLCs in both - * directions (the LDK default max from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) - * * `10_000 * 2_500 / 218_750 / (483*2)` = 0.1 sat/vB for non-anchor channels with 483 HTLCs - * in both directions (the maximum), - * * `10_000 * 2_500 / 218_750 / (50*2)` = 1.1 sat/vB for non-anchor channels with 50 HTLCs - * in both (the LDK default maximum from [`ChannelHandshakeConfig::our_max_accepted_htlcs`]) - * - * Note that when using [`MaxDustHTLCExposure::FeeRateMultiplier`] this maximum disagreement - * will scale linearly with increases (or decreases) in the our feerate estimates. Further, - * for anchor channels we expect our counterparty to use a relatively low feerate estimate - * while we use [`ConfirmationTarget::MaximumFeeEstimate`] (which should be relatively high) - * and feerate disagreement force-closures should only occur when theirs is higher than ours. - * - * Default value: [`MaxDustHTLCExposure::FeeRateMultiplier`] with a multiplier of `10_000` - * - * [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate + * Payment parameters for relaying over [`Self::next_trampoline`]. */ -void ChannelConfig_set_max_dust_htlc_exposure(struct LDKChannelConfig *NONNULL_PTR this_ptr, struct LDKMaxDustHTLCExposure val); +void TrampolineForwardTlvs_set_payment_relay(struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. - * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. - * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. - * - * Default value: `1000` - * - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * Payment constraints for relaying over [`Self::next_trampoline`]. */ -uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +struct LDKPaymentConstraints TrampolineForwardTlvs_get_payment_constraints(const struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr); /** - * The additional fee we're willing to pay to avoid waiting for the counterparty's - * `to_self_delay` to reclaim funds. - * - * When we close a channel cooperatively with our counterparty, we negotiate a fee for the - * closing transaction which both sides find acceptable, ultimately paid by the channel - * funder/initiator. - * - * When we are the funder, because we have to pay the channel closing fee, we bound the - * acceptable fee by our [`ChannelCloseMinimum`] and [`NonAnchorChannelFee`] fees, with the upper bound increased by - * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our - * [`NonAnchorChannelFee`] feerate during normal operation, this value represents the additional fee we're - * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our - * funds. - * - * When we are not the funder, we require the closing transaction fee pay at least our - * [`ChannelCloseMinimum`] fee estimate, but allow our counterparty to pay as much fee as they like. - * Thus, this value is ignored when we are not the funder. - * - * Default value: `1000` + * Payment constraints for relaying over [`Self::next_trampoline`]. + */ +void TrampolineForwardTlvs_set_payment_constraints(struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); + +/** + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. * - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ -void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val); +struct LDKBlindedHopFeatures TrampolineForwardTlvs_get_features(const struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr); /** - * If set, allows this channel's counterparty to skim an additional fee off this node's inbound - * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. - * - * Usage: - * - The payee will set this option and set its invoice route hints to use [intercept scids] - * generated by this channel's counterparty. - * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call - * [`forward_intercepted_htlc`] with less than the amount provided in - * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. See - * - * for how this feature may be used in the LSP use case. - * - * # Note - * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is - * as-expected if this feature is activated, otherwise they may lose money! - * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the - * counterparty. - * - * # Note - * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. - * Unsetting this flag between restarts may lead to payment receive failures. - * - * Default value: `false` + * Supported and required features when relaying a payment onion containing this object's + * corresponding [`BlindedHop::encrypted_payload`]. * - * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc - * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat - * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat + * [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload */ -bool ChannelConfig_get_accept_underpaying_htlcs(const struct LDKChannelConfig *NONNULL_PTR this_ptr); +void TrampolineForwardTlvs_set_features(struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); /** - * If set, allows this channel's counterparty to skim an additional fee off this node's inbound - * HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users. - * - * Usage: - * - The payee will set this option and set its invoice route hints to use [intercept scids] - * generated by this channel's counterparty. - * - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call - * [`forward_intercepted_htlc`] with less than the amount provided in - * [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and - * actual forward amounts is their fee. See - * - * for how this feature may be used in the LSP use case. - * - * # Note - * It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is - * as-expected if this feature is activated, otherwise they may lose money! - * [`PaymentClaimable::counterparty_skimmed_fee_msat`] provides the fee taken by the - * counterparty. + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * - * # Note - * Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. - * Unsetting this flag between restarts may lead to payment receive failures. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKPublicKey TrampolineForwardTlvs_get_next_blinding_override(const struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr); + +/** + * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the + * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. * - * Default value: `false` + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void TrampolineForwardTlvs_set_next_blinding_override(struct LDKTrampolineForwardTlvs *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Constructs a new TrampolineForwardTlvs given each field * - * [intercept scids]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc - * [`HTLCIntercepted`]: crate::events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: crate::events::Event::HTLCIntercepted::expected_outbound_amount_msat - * [`PaymentClaimable::amount_msat`]: crate::events::Event::PaymentClaimable::amount_msat - * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat + * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelConfig_set_accept_underpaying_htlcs(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKTrampolineForwardTlvs TrampolineForwardTlvs_new(struct LDKPublicKey next_trampoline_arg, struct LDKPaymentRelay payment_relay_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKBlindedHopFeatures features_arg, struct LDKPublicKey next_blinding_override_arg); /** - * Constructs a new ChannelConfig given each field + * Creates a copy of the TrampolineForwardTlvs */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, struct LDKMaxDustHTLCExposure max_dust_htlc_exposure_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg, bool accept_underpaying_htlcs_arg); +struct LDKTrampolineForwardTlvs TrampolineForwardTlvs_clone(const struct LDKTrampolineForwardTlvs *NONNULL_PTR orig); /** - * Creates a copy of the ChannelConfig + * Frees any resources used by the ReceiveTlvs, if is_owned is set and inner is non-NULL. */ -struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig); +void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj); /** - * Checks if two ChannelConfigs 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. + * Creates a copy of the ReceiveTlvs */ -bool ChannelConfig_eq(const struct LDKChannelConfig *NONNULL_PTR a, const struct LDKChannelConfig *NONNULL_PTR b); +struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); /** - * Applies the given [`ChannelConfigUpdate`] as a partial update to the [`ChannelConfig`]. + * Returns the underlying TLVs. */ -void ChannelConfig_apply(struct LDKChannelConfig *NONNULL_PTR this_arg, const struct LDKChannelConfigUpdate *NONNULL_PTR update); +MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs ReceiveTlvs_tlvs(const struct LDKReceiveTlvs *NONNULL_PTR this_arg); /** - * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used. + * Frees any resources used by the UnauthenticatedReceiveTlvs, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void); +void UnauthenticatedReceiveTlvs_free(struct LDKUnauthenticatedReceiveTlvs this_obj); /** - * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj); +const uint8_t (*UnauthenticatedReceiveTlvs_get_payment_secret(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr))[32]; /** - * Read a ChannelConfig from a byte array, created by ChannelConfig_write + * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser); +void UnauthenticatedReceiveTlvs_set_payment_secret(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the ChannelConfigUpdate, if is_owned is set and inner is non-NULL. + * Constraints for the receiver of this payment. */ -void ChannelConfigUpdate_free(struct LDKChannelConfigUpdate this_obj); +struct LDKPaymentConstraints UnauthenticatedReceiveTlvs_get_payment_constraints(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); -struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +/** + * Constraints for the receiver of this payment. + */ +void UnauthenticatedReceiveTlvs_set_payment_constraints(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); -void ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +/** + * Context for the receiver of this payment. + */ +struct LDKPaymentContext UnauthenticatedReceiveTlvs_get_payment_context(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); -struct LDKCOption_u32Z ChannelConfigUpdate_get_forwarding_fee_base_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +/** + * Context for the receiver of this payment. + */ +void UnauthenticatedReceiveTlvs_set_payment_context(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext val); -void ChannelConfigUpdate_set_forwarding_fee_base_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +/** + * Constructs a new UnauthenticatedReceiveTlvs given each field + */ +MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg); -struct LDKCOption_u16Z ChannelConfigUpdate_get_cltv_expiry_delta(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +/** + * Creates a copy of the UnauthenticatedReceiveTlvs + */ +struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_clone(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR orig); -void ChannelConfigUpdate_set_cltv_expiry_delta(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +/** + * Creates an authenticated [`ReceiveTlvs`], which includes an HMAC and the provide [`Nonce`] + * that can be use later to verify it authenticity. + */ +MUST_USE_RES struct LDKReceiveTlvs UnauthenticatedReceiveTlvs_authenticate(struct LDKUnauthenticatedReceiveTlvs this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); /** - * - * Returns a copy of the field. + * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_MaxDustHTLCExposureZ ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr); +void PaymentRelay_free(struct LDKPaymentRelay this_obj); -void ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_MaxDustHTLCExposureZ val); +/** + * 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); -struct LDKCOption_u64Z ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfigUpdate *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); -void ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfigUpdate *NONNULL_PTR this_ptr, struct LDKCOption_u64Z 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); /** - * Constructs a new ChannelConfigUpdate given each field + * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over + * this [`BlindedHop`], (i.e., 10,000 is 1%). */ -MUST_USE_RES struct LDKChannelConfigUpdate ChannelConfigUpdate_new(struct LDKCOption_u32Z forwarding_fee_proportional_millionths_arg, struct LDKCOption_u32Z forwarding_fee_base_msat_arg, struct LDKCOption_u16Z cltv_expiry_delta_arg, struct LDKCOption_MaxDustHTLCExposureZ max_dust_htlc_exposure_msat_arg, struct LDKCOption_u64Z force_close_avoidance_max_fee_satoshis_arg); +void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL. + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. */ -void UserConfig_free(struct LDKUserConfig this_obj); +uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); /** - * Channel handshake config that we propose to our counterparty. + * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. */ -struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); /** - * Channel handshake config that we propose to our counterparty. + * Constructs a new PaymentRelay given each field */ -void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +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); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * Creates a copy of the PaymentRelay */ -struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); /** - * Limits applied to our counterparty's proposed channel handshake config settings. + * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. */ -void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); /** - * Channel config which affects behavior during channel lifetime. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ -struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); /** - * Channel config which affects behavior during channel lifetime. + * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. */ -void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); /** - * If this is set to `false`, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelHandshakeConfig::announce_for_forwarding`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to `false` to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. - * - * Default value: `false` + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. */ -bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); /** - * If this is set to `false`, we will reject any HTLCs which were to be forwarded over private - * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a - * node which is not online reliably. - * - * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelHandshakeConfig::announce_for_forwarding`] and - * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to `false` to - * ensure you are not exposed to any forwarding risk. - * - * Note that because you cannot change a channel's announced state after creation, there is no - * way to disable forwarding on public channels retroactively. Thus, in order to change a node - * from a publicly-announced forwarding node to a private non-forwarding node you must close - * all your channels and open new ones. For privacy, you should also change your node_id - * (swapping all private and public key material for new ones) at that time. - * - * Default value: `false` + * The minimum value, in msat, that may be accepted by the node corresponding to this + * [`BlindedHop`]. */ -void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); /** - * If this is set to `false`, we do not accept inbound requests to open a new channel. - * - * Default value: `true` + * Constructs a new PaymentConstraints given each field */ -bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); /** - * If this is set to `false`, we do not accept inbound requests to open a new channel. - * - * Default value: `true` + * Creates a copy of the PaymentConstraints */ -void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); /** - * If this is set to `true`, the user needs to manually accept inbound requests to open a new - * channel. - * - * When set to `true`, [`Event::OpenChannelRequest`] will be triggered once a request to open a - * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a - * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the - * user explicitly chooses to accept the request. - * - * Default value: `false` - * - * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * Frees any resources used by the PaymentContext */ -bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr); +void PaymentContext_free(struct LDKPaymentContext this_ptr); /** - * If this is set to `true`, the user needs to manually accept inbound requests to open a new - * channel. - * - * When set to `true`, [`Event::OpenChannelRequest`] will be triggered once a request to open a - * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a - * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the - * user explicitly chooses to accept the request. - * - * Default value: `false` - * - * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest - * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel - * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel + * Creates a copy of the PaymentContext */ -void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +struct LDKPaymentContext PaymentContext_clone(const struct LDKPaymentContext *NONNULL_PTR orig); /** - * If this is set to `true`, LDK will intercept HTLCs that are attempting to be forwarded over - * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC - * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. - * - * Setting this to `true` may break backwards compatibility with LDK versions < 0.0.113. - * - * Default value: `false` - * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * Utility method to constructs a new Bolt12Offer-variant PaymentContext */ -bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKPaymentContext PaymentContext_bolt12_offer(struct LDKBolt12OfferContext a); /** - * If this is set to `true`, LDK will intercept HTLCs that are attempting to be forwarded over - * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC - * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. - * - * Setting this to `true` may break backwards compatibility with LDK versions < 0.0.113. - * - * Default value: `false` - * - * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid - * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted + * Utility method to constructs a new AsyncBolt12Offer-variant PaymentContext */ -void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +struct LDKPaymentContext PaymentContext_async_bolt12_offer(struct LDKAsyncBolt12OfferContext a); /** - * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * Utility method to constructs a new Bolt12Refund-variant PaymentContext + */ +struct LDKPaymentContext PaymentContext_bolt12_refund(struct LDKBolt12RefundContext a); + +/** + * Checks if two PaymentContexts contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool PaymentContext_eq(const struct LDKPaymentContext *NONNULL_PTR a, const struct LDKPaymentContext *NONNULL_PTR b); + +/** + * Frees any resources used by the Bolt12OfferContext, if is_owned is set and inner is non-NULL. + */ +void Bolt12OfferContext_free(struct LDKBolt12OfferContext this_obj); + +/** + * The identifier of the [`Offer`]. * - * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received - * [`Bolt12Invoice`] instead of being automatically paid after verification. Use - * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or - * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * [`Offer`]: crate::offers::offer::Offer + */ +struct LDKOfferId Bolt12OfferContext_get_offer_id(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); + +/** + * The identifier of the [`Offer`]. * - * Default value: `false` + * [`Offer`]: crate::offers::offer::Offer + */ +void Bolt12OfferContext_set_offer_id(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKOfferId val); + +/** + * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived - * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ -bool UserConfig_get_manually_handle_bolt12_invoices(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKInvoiceRequestFields Bolt12OfferContext_get_invoice_request(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); /** - * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. + * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. * - * When set to `true`, [`Event::InvoiceReceived`] will be generated for each received - * [`Bolt12Invoice`] instead of being automatically paid after verification. Use - * [`ChannelManager::send_payment_for_bolt12_invoice`] to pay the invoice or - * [`ChannelManager::abandon_payment`] to abandon the associated payment. + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +void Bolt12OfferContext_set_invoice_request(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKInvoiceRequestFields val); + +/** + * Constructs a new Bolt12OfferContext given each field + */ +MUST_USE_RES struct LDKBolt12OfferContext Bolt12OfferContext_new(struct LDKOfferId offer_id_arg, struct LDKInvoiceRequestFields invoice_request_arg); + +/** + * Creates a copy of the Bolt12OfferContext + */ +struct LDKBolt12OfferContext Bolt12OfferContext_clone(const struct LDKBolt12OfferContext *NONNULL_PTR orig); + +/** + * Checks if two Bolt12OfferContexts 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 Bolt12OfferContext_eq(const struct LDKBolt12OfferContext *NONNULL_PTR a, const struct LDKBolt12OfferContext *NONNULL_PTR b); + +/** + * Frees any resources used by the AsyncBolt12OfferContext, if is_owned is set and inner is non-NULL. + */ +void AsyncBolt12OfferContext_free(struct LDKAsyncBolt12OfferContext this_obj); + +/** + * The [`Nonce`] used to verify that an inbound [`InvoiceRequest`] corresponds to this static + * invoice's offer. * - * Default value: `false` + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +struct LDKNonce AsyncBolt12OfferContext_get_offer_nonce(const struct LDKAsyncBolt12OfferContext *NONNULL_PTR this_ptr); + +/** + * The [`Nonce`] used to verify that an inbound [`InvoiceRequest`] corresponds to this static + * invoice's offer. * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Event::InvoiceReceived`]: crate::events::Event::InvoiceReceived - * [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -void UserConfig_set_manually_handle_bolt12_invoices(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +void AsyncBolt12OfferContext_set_offer_nonce(struct LDKAsyncBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKNonce val); /** - * Constructs a new UserConfig given each field + * Constructs a new AsyncBolt12OfferContext given each field */ -MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg, bool accept_intercept_htlcs_arg, bool manually_handle_bolt12_invoices_arg); +MUST_USE_RES struct LDKAsyncBolt12OfferContext AsyncBolt12OfferContext_new(struct LDKNonce offer_nonce_arg); /** - * Creates a copy of the UserConfig + * Creates a copy of the AsyncBolt12OfferContext */ -struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig); +struct LDKAsyncBolt12OfferContext AsyncBolt12OfferContext_clone(const struct LDKAsyncBolt12OfferContext *NONNULL_PTR orig); /** - * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used. + * Checks if two AsyncBolt12OfferContexts 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. */ -MUST_USE_RES struct LDKUserConfig UserConfig_default(void); +bool AsyncBolt12OfferContext_eq(const struct LDKAsyncBolt12OfferContext *NONNULL_PTR a, const struct LDKAsyncBolt12OfferContext *NONNULL_PTR b); + +/** + * Frees any resources used by the Bolt12RefundContext, if is_owned is set and inner is non-NULL. + */ +void Bolt12RefundContext_free(struct LDKBolt12RefundContext this_obj); + +/** + * Constructs a new Bolt12RefundContext given each field + */ +MUST_USE_RES struct LDKBolt12RefundContext Bolt12RefundContext_new(void); + +/** + * Creates a copy of the Bolt12RefundContext + */ +struct LDKBolt12RefundContext Bolt12RefundContext_clone(const struct LDKBolt12RefundContext *NONNULL_PTR orig); + +/** + * Checks if two Bolt12RefundContexts 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 Bolt12RefundContext_eq(const struct LDKBolt12RefundContext *NONNULL_PTR a, const struct LDKBolt12RefundContext *NONNULL_PTR b); + +/** + * 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 TrampolineForwardTlvs object into a byte array which can be read by TrampolineForwardTlvs_read + */ +struct LDKCVec_u8Z TrampolineForwardTlvs_write(const struct LDKTrampolineForwardTlvs *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); + +/** + * Serialize the UnauthenticatedReceiveTlvs object into a byte array which can be read by UnauthenticatedReceiveTlvs_read + */ +struct LDKCVec_u8Z UnauthenticatedReceiveTlvs_write(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR obj); + +/** + * 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); + +/** + * Serialize the PaymentContext object into a byte array which can be read by PaymentContext_read + */ +struct LDKCVec_u8Z PaymentContext_write(const struct LDKPaymentContext *NONNULL_PTR obj); + +/** + * Read a PaymentContext from a byte array, created by PaymentContext_write + */ +struct LDKCResult_PaymentContextDecodeErrorZ PaymentContext_read(struct LDKu8slice ser); + +/** + * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read + */ +struct LDKCVec_u8Z Bolt12OfferContext_write(const struct LDKBolt12OfferContext *NONNULL_PTR obj); + +/** + * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write + */ +struct LDKCResult_Bolt12OfferContextDecodeErrorZ Bolt12OfferContext_read(struct LDKu8slice ser); + +/** + * Serialize the AsyncBolt12OfferContext object into a byte array which can be read by AsyncBolt12OfferContext_read + */ +struct LDKCVec_u8Z AsyncBolt12OfferContext_write(const struct LDKAsyncBolt12OfferContext *NONNULL_PTR obj); + +/** + * Read a AsyncBolt12OfferContext from a byte array, created by AsyncBolt12OfferContext_write + */ +struct LDKCResult_AsyncBolt12OfferContextDecodeErrorZ AsyncBolt12OfferContext_read(struct LDKu8slice ser); + +/** + * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read + */ +struct LDKCVec_u8Z Bolt12RefundContext_write(const struct LDKBolt12RefundContext *NONNULL_PTR obj); + +/** + * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write + */ +struct LDKCResult_Bolt12RefundContextDecodeErrorZ Bolt12RefundContext_read(struct LDKu8slice ser); /** * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL. @@ -41321,6 +46495,11 @@ bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct */ uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o); +/** + * Creates a copy of a BroadcasterInterface + */ +struct LDKBroadcasterInterface BroadcasterInterface_clone(const struct LDKBroadcasterInterface *NONNULL_PTR orig); + /** * Calls the free function if one is set */ @@ -41410,8 +46589,20 @@ void ChainMonitor_free(struct LDKChainMonitor this_obj); * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may * always need to fetch full blocks absent another means for determining which blocks contain * transactions relevant to the watched channels. + * + * # Note + * `our_peerstorage_encryption_key` must be obtained from [`NodeSigner::get_peer_storage_key`]. + * This key is used to encrypt peer storage backups. + * + * **Important**: This key should not be set arbitrarily or changed after initialization. The same key + * is obtained by the [`ChannelManager`] through [`NodeSigner`] to decrypt peer backups. + * Using an inconsistent or incorrect key will result in the inability to decrypt previously encrypted backups. + * + * [`NodeSigner`]: crate::sign::NodeSigner + * [`NodeSigner::get_peer_storage_key`]: crate::sign::NodeSigner::get_peer_storage_key + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister); +MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister, struct LDKEntropySource _entropy_source, struct LDKPeerStorageKey _our_peerstorage_encryption_key); /** * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or @@ -41432,7 +46623,7 @@ MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const s * Note that the result holds a mutex over our monitor set, and should not be held * indefinitely. */ -MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo); +MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKChannelId channel_id); /** * Lists the funding outpoint and channel ID of each [`ChannelMonitor`] being monitored. @@ -41440,15 +46631,15 @@ MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monito * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always * monitoring for on-chain state resolutions. */ -MUST_USE_RES struct LDKCVec_C2Tuple_OutPointChannelIdZZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ChannelIdZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** - * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + * Lists the pending updates for each [`ChannelMonitor`] (by `ChannelId` being monitored). * Each `Vec` contains `update_id`s from [`ChannelMonitor::get_latest_update_id`] for updates * that have not yet been fully persisted. Note that if a full monitor is persisted all the pending * monitor updates must be individually marked completed by calling [`ChainMonitor::channel_monitor_updated`]. */ -MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); /** * Indicates the persistence of a [`ChannelMonitor`] has completed after @@ -41472,7 +46663,7 @@ MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_u64ZZZ ChainMonitor_list_pendin * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently * registered [`ChannelMonitor`]s. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, uint64_t completed_update_id); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKChannelId channel_id, uint64_t completed_update_id); /** * Gets a [`Future`] that completes when an event is available either via @@ -41503,7 +46694,7 @@ void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNU * * Note that monitor_opt (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChainMonitor_signer_unblocked(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint monitor_opt); +void ChainMonitor_signer_unblocked(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKChannelId monitor_opt); /** * Archives fully resolved channel monitors by calling [`Persist::archive_persisted_channel`]. @@ -41518,6 +46709,40 @@ void ChainMonitor_signer_unblocked(const struct LDKChainMonitor *NONNULL_PTR thi */ void ChainMonitor_archive_fully_resolved_channel_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +/** + * Loads a [`ChannelMonitor`] which already exists on disk after startup. + * + * Using this over [`chain::Watch::watch_channel`] avoids re-persisting a [`ChannelMonitor`] + * that hasn't changed, slowing down startup. + * + * Note that this method *can* be used if additional blocks were replayed against the + * [`ChannelMonitor`] or if a [`ChannelMonitorUpdate`] loaded from disk was replayed such that + * it will replayed on startup, and in general can only *not* be used if you directly accessed + * the [`ChannelMonitor`] and changed its state in some way that will not be replayed again on + * a restart. Such direct access should generally never occur for most LDK-based nodes. + * + * For [`ChannelMonitor`]s which were last serialized by an LDK version prior to 0.1 this will + * fall back to calling [`chain::Watch::watch_channel`] and persisting the [`ChannelMonitor`]. + * See the release notes for LDK 0.1 for more information on this requirement. + * + * [`ChannelMonitor`]s which do not need to be persisted (i.e. were last written by LDK 0.1 or + * later) will be loaded without persistence and this method will return + * [`ChannelMonitorUpdateStatus::Completed`]. + */ +MUST_USE_RES struct LDKCResult_ChannelMonitorUpdateStatusNoneZ ChainMonitor_load_existing_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKChannelId channel_id, struct LDKChannelMonitor monitor); + +/** + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is + */ +struct LDKBaseMessageHandler ChainMonitor_as_BaseMessageHandler(const struct LDKChainMonitor *NONNULL_PTR this_arg); + +/** + * Constructs a new SendOnlyMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SendOnlyMessageHandler must be freed before this_arg is + */ +struct LDKSendOnlyMessageHandler ChainMonitor_as_SendOnlyMessageHandler(const struct LDKChainMonitor *NONNULL_PTR this_arg); + /** * Constructs a new Listen which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is @@ -41613,6 +46838,12 @@ struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChanne */ bool ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b); +/** + * Returns a `Vec` of new (funding outpoint, funding script) to monitor the chain for as a + * result of a renegotiated funding transaction. + */ +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_u8ZZZ ChannelMonitorUpdate_renegotiated_funding_data(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_arg); + /** * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read */ @@ -41648,6 +46879,11 @@ struct LDKMonitorEvent MonitorEvent_holder_force_closed_with_info(struct LDKClos */ struct LDKMonitorEvent MonitorEvent_holder_force_closed(struct LDKOutPoint a); +/** + * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent + */ +struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(void); + /** * Utility method to constructs a new Completed-variant MonitorEvent */ @@ -41727,6 +46963,64 @@ enum LDKBalanceSource BalanceSource_htlc(void); */ bool BalanceSource_eq(const enum LDKBalanceSource *NONNULL_PTR a, const enum LDKBalanceSource *NONNULL_PTR b); +/** + * Frees any resources used by the HolderCommitmentTransactionBalance, if is_owned is set and inner is non-NULL. + */ +void HolderCommitmentTransactionBalance_free(struct LDKHolderCommitmentTransactionBalance this_obj); + +/** + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. + */ +uint64_t HolderCommitmentTransactionBalance_get_amount_satoshis(const struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR this_ptr); + +/** + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. + */ +void HolderCommitmentTransactionBalance_set_amount_satoshis(struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The transaction fee we pay for the closing commitment transaction. This amount is not + * included in the [`HolderCommitmentTransactionBalance::amount_satoshis`] value. + * This amount includes the sum of dust HTLCs on the commitment transaction, any elided anchors, + * as well as the sum of msat amounts rounded down from non-dust HTLCs. + * + * Note that if this channel is inbound (and thus our counterparty pays the commitment + * transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK + * 0.0.124, the channel is always treated as outbound (and thus this value is never zero). + */ +uint64_t HolderCommitmentTransactionBalance_get_transaction_fee_satoshis(const struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR this_ptr); + +/** + * The transaction fee we pay for the closing commitment transaction. This amount is not + * included in the [`HolderCommitmentTransactionBalance::amount_satoshis`] value. + * This amount includes the sum of dust HTLCs on the commitment transaction, any elided anchors, + * as well as the sum of msat amounts rounded down from non-dust HTLCs. + * + * Note that if this channel is inbound (and thus our counterparty pays the commitment + * transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK + * 0.0.124, the channel is always treated as outbound (and thus this value is never zero). + */ +void HolderCommitmentTransactionBalance_set_transaction_fee_satoshis(struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new HolderCommitmentTransactionBalance given each field + */ +MUST_USE_RES struct LDKHolderCommitmentTransactionBalance HolderCommitmentTransactionBalance_new(uint64_t amount_satoshis_arg, uint64_t transaction_fee_satoshis_arg); + +/** + * Creates a copy of the HolderCommitmentTransactionBalance + */ +struct LDKHolderCommitmentTransactionBalance HolderCommitmentTransactionBalance_clone(const struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR orig); + +/** + * Checks if two HolderCommitmentTransactionBalances 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 HolderCommitmentTransactionBalance_eq(const struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR a, const struct LDKHolderCommitmentTransactionBalance *NONNULL_PTR b); + /** * Frees any resources used by the Balance */ @@ -41740,7 +47034,7 @@ 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 amount_satoshis, uint64_t transaction_fee_satoshis, uint64_t outbound_payment_htlc_rounded_msat, uint64_t outbound_forwarded_htlc_rounded_msat, uint64_t inbound_claiming_htlc_rounded_msat, uint64_t inbound_htlc_rounded_msat); +struct LDKBalance Balance_claimable_on_channel_close(struct LDKCVec_HolderCommitmentTransactionBalanceZ balance_candidates, uintptr_t confirmed_balance_candidate_index, uint64_t outbound_payment_htlc_rounded_msat, uint64_t outbound_forwarded_htlc_rounded_msat, uint64_t inbound_claiming_htlc_rounded_msat, uint64_t inbound_htlc_rounded_msat); /** * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance @@ -41776,6 +47070,13 @@ bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance /** * The amount claimable, in satoshis. * + * When the channel has yet to close, this returns the balance we expect to claim from the + * channel. This may change throughout the lifetime of the channel due to payments, but also + * due to splicing. If there's a pending splice, this will return the balance we expect to have + * assuming the latest negotiated splice confirms. However, if one of the negotiated splice + * transactions has already confirmed but is not yet locked, this reports the corresponding + * balance for said splice transaction instead. + * * For outbound payments, this excludes the balance from the possible HTLC timeout. * * For forwarded payments, this includes the balance from the possible HTLC timeout as @@ -41804,6 +47105,19 @@ struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NO */ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj); +/** + * Returns a unique id for persisting the [`ChannelMonitor`], which is used as a key in a + * key-value store. + * + * Note: Previously, the funding outpoint was used in the [`Persist`] trait. However, since the + * outpoint may change during splicing, this method is used to obtain a unique key instead. For + * v1 channels, the funding outpoint is still used for backwards compatibility, whereas v2 + * channels use the channel id since it is fixed. + * + * [`Persist`]: crate::chain::chainmonitor::Persist + */ +MUST_USE_RES struct LDKMonitorName ChannelMonitor_persistence_key(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + /** * Updates a ChannelMonitor on the basis of some new information provided by the Channel * itself. @@ -41823,13 +47137,23 @@ 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_OutPointCVec_u8ZZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + +/** + * Gets the funding script of the channel this ChannelMonitor is monitoring for. + */ +MUST_USE_RES struct LDKCVec_u8Z ChannelMonitor_get_funding_script(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the channel_id of the channel this ChannelMonitor is monitoring for. */ MUST_USE_RES struct LDKChannelId ChannelMonitor_channel_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +/** + * Gets the channel type of the corresponding channel. + */ +MUST_USE_RES struct LDKChannelTypeFeatures ChannelMonitor_channel_type_features(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(). @@ -41926,6 +47250,10 @@ MUST_USE_RES struct LDKCVec_CommitmentTransactionZ ChannelMonitor_counterparty_c * to the commitment transaction being revoked, this will return a signed transaction, but * the signature will not be valid. * + * Note that due to splicing, this can also return an `Err` when the counterparty commitment + * this transaction is attempting to claim is no longer valid because the corresponding funding + * transaction was spliced. + * * [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output * [`Persist`]: crate::chain::chainmonitor::Persist */ @@ -41933,11 +47261,6 @@ MUST_USE_RES struct LDKCResult_TransactionNoneZ ChannelMonitor_sign_to_local_jus /** * 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` - * otherwise. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); @@ -41951,6 +47274,16 @@ MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const s * 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. + * + * Note: For channels using manual funding broadcast (see + * [`crate::ln::channelmanager::ChannelManager::funding_transaction_generated_manual_broadcast`]), + * automatic broadcasts are suppressed until the funding transaction has been observed on-chain. + * Calling this method overrides that suppression and queues the latest holder commitment + * transaction for broadcast even if the funding has not yet been seen on-chain. This may result + * in unconfirmable transactions being broadcast or [`Event::BumpTransaction`] notifications for + * transactions that cannot be confirmed until the funding transaction is visible. + * + * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction */ void ChannelMonitor_broadcast_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); @@ -41973,7 +47306,7 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(c * Determines if the disconnected block contained any transactions of interest and updates * appropriately. */ -void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +void ChannelMonitor_blocks_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBestBlock fork_point, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Processes transactions confirmed in a block with the given header and height, returning new @@ -41989,10 +47322,10 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_conf /** * Processes a transaction that was reorganized out of the chain. * - * Used instead of [`block_disconnected`] by clients that are notified of transactions rather + * Used instead of [`blocks_disconnected`] by clients that are notified of transactions rather * than blocks. See [`chain::Confirm`] for calling expectations. * - * [`block_disconnected`]: Self::block_disconnected + * [`blocks_disconnected`]: Self::blocks_disconnected */ void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); @@ -42164,16738 +47497,16868 @@ 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 InboundHTLCErr, if is_owned is set and inner is non-NULL. + * Frees any resources used by the FundingInfo */ -void InboundHTLCErr_free(struct LDKInboundHTLCErr this_obj); +void FundingInfo_free(struct LDKFundingInfo this_ptr); /** - * BOLT 4 error code. + * Creates a copy of the FundingInfo */ -uint16_t InboundHTLCErr_get_err_code(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); +struct LDKFundingInfo FundingInfo_clone(const struct LDKFundingInfo *NONNULL_PTR orig); /** - * BOLT 4 error code. + * Utility method to constructs a new Tx-variant FundingInfo */ -void InboundHTLCErr_set_err_code(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, uint16_t val); +struct LDKFundingInfo FundingInfo_tx(struct LDKTransaction transaction); /** - * Data attached to this error. - * - * Returns a copy of the field. + * Utility method to constructs a new OutPoint-variant FundingInfo */ -struct LDKCVec_u8Z InboundHTLCErr_get_err_data(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); +struct LDKFundingInfo FundingInfo_out_point(struct LDKOutPoint outpoint); /** - * Data attached to this error. + * Checks if two FundingInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void InboundHTLCErr_set_err_data(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +bool FundingInfo_eq(const struct LDKFundingInfo *NONNULL_PTR a, const struct LDKFundingInfo *NONNULL_PTR b); /** - * Error message text. + * Serialize the FundingInfo object into a byte array which can be read by FundingInfo_read */ -struct LDKStr InboundHTLCErr_get_msg(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z FundingInfo_write(const struct LDKFundingInfo *NONNULL_PTR obj); /** - * Error message text. + * Read a FundingInfo from a byte array, created by FundingInfo_write */ -void InboundHTLCErr_set_msg(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKCResult_FundingInfoDecodeErrorZ FundingInfo_read(struct LDKu8slice ser); /** - * Constructs a new InboundHTLCErr given each field + * Frees any resources used by the PaymentPurpose */ -MUST_USE_RES struct LDKInboundHTLCErr InboundHTLCErr_new(uint16_t err_code_arg, struct LDKCVec_u8Z err_data_arg, struct LDKStr msg_arg); +void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); /** - * Creates a copy of the InboundHTLCErr + * Creates a copy of the PaymentPurpose */ -struct LDKInboundHTLCErr InboundHTLCErr_clone(const struct LDKInboundHTLCErr *NONNULL_PTR orig); +struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr. + * Utility method to constructs a new Bolt11InvoicePayment-variant PaymentPurpose */ -uint64_t InboundHTLCErr_hash(const struct LDKInboundHTLCErr *NONNULL_PTR o); +struct LDKPaymentPurpose PaymentPurpose_bolt11_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); /** - * Checks if two InboundHTLCErrs contain equal inner contents. + * Utility method to constructs a new Bolt12OfferPayment-variant PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_bolt12_offer_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12OfferContext payment_context); + +/** + * Utility method to constructs a new Bolt12RefundPayment-variant PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_bolt12_refund_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12RefundContext payment_context); + +/** + * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + */ +struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); + +/** + * Checks if two PaymentPurposes 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 InboundHTLCErr_eq(const struct LDKInboundHTLCErr *NONNULL_PTR a, const struct LDKInboundHTLCErr *NONNULL_PTR b); +bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); /** - * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information - * about the intended next-hop for the HTLC. + * Returns the preimage for this payment, if it is known. + */ +MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ PaymentPurpose_preimage(const struct LDKPaymentPurpose *NONNULL_PTR this_arg); + +/** + * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read + */ +struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); + +/** + * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write + */ +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 counterparty of the channel. * - * This does all the relevant context-free checks that LDK requires for payment relay or - * acceptance. If the payment is to be received, and the amount matches the expected amount for - * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the - * channel, will generate an [`Event::PaymentClaimable`]. + * This value will always be `None` for objects serialized with LDK versions prior to 0.2 and + * `Some` otherwise. * - * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, uint32_t cur_height, bool allow_skimmed_fees); +struct LDKPublicKey ClaimedHTLC_get_counterparty_node_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Frees any resources used by the PendingHTLCRouting + * The counterparty of the channel. + * + * This value will always be `None` for objects serialized with LDK versions prior to 0.2 and + * `Some` otherwise. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PendingHTLCRouting_free(struct LDKPendingHTLCRouting this_ptr); +void ClaimedHTLC_set_counterparty_node_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the PendingHTLCRouting + * The `channel_id` of the channel over which the HTLC was received. */ -struct LDKPendingHTLCRouting PendingHTLCRouting_clone(const struct LDKPendingHTLCRouting *NONNULL_PTR orig); +struct LDKChannelId ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Forward-variant PendingHTLCRouting + * The `channel_id` of the channel over which the HTLC was received. */ -struct LDKPendingHTLCRouting PendingHTLCRouting_forward(struct LDKOnionPacket onion_packet, uint64_t short_channel_id, struct LDKBlindedForward blinded, struct LDKCOption_u32Z incoming_cltv_expiry); +void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Utility method to constructs a new Receive-variant PendingHTLCRouting + * 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 LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopData payment_data, struct LDKCOption_CVec_u8ZZ payment_metadata, struct LDKCOption_PaymentContextZ payment_context, uint32_t incoming_cltv_expiry, struct LDKThirtyTwoBytes phantom_shared_secret, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); +struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting + * 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 LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error, bool has_recipient_created_payment_secret); +void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); /** - * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL. + * The block height at which this HTLC expires. */ -void BlindedForward_free(struct LDKBlindedForward this_obj); +uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound - * onion payload if we're the introduction node. Useful for calculating the next hop's - * [`msgs::UpdateAddHTLC::blinding_point`]. + * The block height at which this HTLC expires. */ -struct LDKPublicKey BlindedForward_get_inbound_blinding_point(const struct LDKBlindedForward *NONNULL_PTR this_ptr); +void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); /** - * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound - * onion payload if we're the introduction node. Useful for calculating the next hop's - * [`msgs::UpdateAddHTLC::blinding_point`]. + * The amount (in msats) of this part of an MPP. */ -void BlindedForward_set_inbound_blinding_point(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * If needed, this determines how this HTLC should be failed backwards, based on whether we are - * the introduction node. + * The amount (in msats) of this part of an MPP. */ -enum LDKBlindedFailure BlindedForward_get_failure(const struct LDKBlindedForward *NONNULL_PTR this_ptr); +void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * If needed, this determines how this HTLC should be failed backwards, based on whether we are - * the introduction node. + * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. */ -void BlindedForward_set_failure(struct LDKBlindedForward *NONNULL_PTR this_ptr, enum LDKBlindedFailure val); +uint64_t ClaimedHTLC_get_counterparty_skimmed_fee_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); /** - * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being - * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that - * starts at the next hop. + * The extra fee our counterparty skimmed off the top of this HTLC, if any. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to + * 0.0.119. */ -struct LDKPublicKey BlindedForward_get_next_blinding_override(const struct LDKBlindedForward *NONNULL_PTR this_ptr); +void ClaimedHTLC_set_counterparty_skimmed_fee_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being - * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that - * starts at the next hop. + * Constructs a new ClaimedHTLC given each field * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that counterparty_node_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void BlindedForward_set_next_blinding_override(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKPublicKey counterparty_node_id_arg, struct LDKChannelId channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg, uint64_t counterparty_skimmed_fee_msat_arg); /** - * Constructs a new BlindedForward given each field - * - * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the ClaimedHTLC */ -MUST_USE_RES struct LDKBlindedForward BlindedForward_new(struct LDKPublicKey inbound_blinding_point_arg, enum LDKBlindedFailure failure_arg, struct LDKPublicKey next_blinding_override_arg); +struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); /** - * Creates a copy of the BlindedForward + * 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. */ -struct LDKBlindedForward BlindedForward_clone(const struct LDKBlindedForward *NONNULL_PTR orig); +bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the BlindedForward. + * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read */ -uint64_t BlindedForward_hash(const struct LDKBlindedForward *NONNULL_PTR o); +struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); /** - * Checks if two BlindedForwards contain equal inner contents. + * 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 + */ +void PathFailure_free(struct LDKPathFailure this_ptr); + +/** + * Creates a copy of the PathFailure + */ +struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); + +/** + * Utility method to constructs a new InitialSend-variant PathFailure + */ +struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); + +/** + * Utility method to constructs a new OnPath-variant PathFailure + */ +struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); + +/** + * Checks if two PathFailures 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 BlindedForward_eq(const struct LDKBlindedForward *NONNULL_PTR a, const struct LDKBlindedForward *NONNULL_PTR b); +bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); /** - * Frees any resources used by the PendingHTLCInfo, if is_owned is set and inner is non-NULL. + * Serialize the PathFailure object into a byte array which can be read by PathFailure_read */ -void PendingHTLCInfo_free(struct LDKPendingHTLCInfo this_obj); +struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); /** - * Further routing details based on whether the HTLC is being forwarded or received. + * Read a PathFailure from a byte array, created by PathFailure_write */ -struct LDKPendingHTLCRouting PendingHTLCInfo_get_routing(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); +struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); /** - * Further routing details based on whether the HTLC is being forwarded or received. + * Frees any resources used by the ClosureReason */ -void PendingHTLCInfo_set_routing(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKPendingHTLCRouting val); +void ClosureReason_free(struct LDKClosureReason this_ptr); /** - * The onion shared secret we build with the sender used to decrypt the onion. - * - * This is later used to encrypt failure packets in the event that the HTLC is failed. + * Creates a copy of the ClosureReason */ -const uint8_t (*PendingHTLCInfo_get_incoming_shared_secret(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; +struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); /** - * The onion shared secret we build with the sender used to decrypt the onion. - * - * This is later used to encrypt failure packets in the event that the HTLC is failed. + * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason */ -void PendingHTLCInfo_set_incoming_shared_secret(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg); /** - * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. + * Utility method to constructs a new HolderForceClosed-variant ClosureReason */ -const uint8_t (*PendingHTLCInfo_get_payment_hash(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; +struct LDKClosureReason ClosureReason_holder_force_closed(struct LDKCOption_boolZ broadcasted_latest_txn, struct LDKStr message); /** - * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. + * Utility method to constructs a new LegacyCooperativeClosure-variant ClosureReason */ -void PendingHTLCInfo_set_payment_hash(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKClosureReason ClosureReason_legacy_cooperative_closure(void); /** - * Amount received in the incoming HTLC. - * - * This field was added in LDK 0.0.113 and will be `None` for objects written by prior - * versions. + * Utility method to constructs a new CounterpartyInitiatedCooperativeClosure-variant ClosureReason */ -struct LDKCOption_u64Z PendingHTLCInfo_get_incoming_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_counterparty_initiated_cooperative_closure(void); /** - * Amount received in the incoming HTLC. - * - * This field was added in LDK 0.0.113 and will be `None` for objects written by prior - * versions. + * Utility method to constructs a new LocallyInitiatedCooperativeClosure-variant ClosureReason */ -void PendingHTLCInfo_set_incoming_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKClosureReason ClosureReason_locally_initiated_cooperative_closure(void); /** - * The amount the sender indicated should be forwarded on to the next hop or amount the sender - * intended for us to receive for received payments. - * - * If the received amount is less than this for received payments, an intermediary hop has - * attempted to steal some of our funds and we should fail the HTLC (the sender should retry - * it along another path). - * - * Because nodes can take less than their required fees, and because senders may wish to - * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for - * received payments. In such cases, recipients must handle this HTLC as if it had received - * [`Self::outgoing_amt_msat`]. + * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason */ -uint64_t PendingHTLCInfo_get_outgoing_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); /** - * The amount the sender indicated should be forwarded on to the next hop or amount the sender - * intended for us to receive for received payments. - * - * If the received amount is less than this for received payments, an intermediary hop has - * attempted to steal some of our funds and we should fail the HTLC (the sender should retry - * it along another path). - * - * Because nodes can take less than their required fees, and because senders may wish to - * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for - * received payments. In such cases, recipients must handle this HTLC as if it had received - * [`Self::outgoing_amt_msat`]. + * Utility method to constructs a new FundingTimedOut-variant ClosureReason */ -void PendingHTLCInfo_set_outgoing_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKClosureReason ClosureReason_funding_timed_out(void); /** - * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated - * should have been set on the received HTLC for received payments). + * Utility method to constructs a new ProcessingError-variant ClosureReason */ -uint32_t PendingHTLCInfo_get_outgoing_cltv_value(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); /** - * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated - * should have been set on the received HTLC for received payments). + * Utility method to constructs a new DisconnectedPeer-variant ClosureReason */ -void PendingHTLCInfo_set_outgoing_cltv_value(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint32_t val); +struct LDKClosureReason ClosureReason_disconnected_peer(void); /** - * The fee taken for this HTLC in addition to the standard protocol HTLC fees. - * - * If this is a payment for forwarding, this is the fee we are taking before forwarding the - * HTLC. - * - * If this is a received payment, this is the fee that our counterparty took. - * - * This is used to allow LSPs to take fees as a part of payments, without the sender having to - * shoulder them. + * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason */ -struct LDKCOption_u64Z PendingHTLCInfo_get_skimmed_fee_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); +struct LDKClosureReason ClosureReason_outdated_channel_manager(void); /** - * The fee taken for this HTLC in addition to the standard protocol HTLC fees. - * - * If this is a payment for forwarding, this is the fee we are taking before forwarding the - * HTLC. - * - * If this is a received payment, this is the fee that our counterparty took. - * - * This is used to allow LSPs to take fees as a part of payments, without the sender having to - * shoulder them. + * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); + +/** + * Utility method to constructs a new LocallyCoopClosedUnfundedChannel-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_locally_coop_closed_unfunded_channel(void); + +/** + * Utility method to constructs a new FundingBatchClosure-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_funding_batch_closure(void); + +/** + * Utility method to constructs a new HTLCsTimedOut-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_htlcs_timed_out(struct LDKCOption_ThirtyTwoBytesZ payment_hash); + +/** + * Utility method to constructs a new PeerFeerateTooLow-variant ClosureReason + */ +struct LDKClosureReason ClosureReason_peer_feerate_too_low(uint32_t peer_feerate_sat_per_kw, uint32_t required_feerate_sat_per_kw); + +/** + * Checks if two ClosureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); + +/** + * Get the string representation of a ClosureReason object + */ +struct LDKStr ClosureReason_to_str(const struct LDKClosureReason *NONNULL_PTR o); + +/** + * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + */ +struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); + +/** + * Read a ClosureReason from a byte array, created by ClosureReason_write + */ +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the HTLCHandlingFailureType + */ +void HTLCHandlingFailureType_free(struct LDKHTLCHandlingFailureType this_ptr); + +/** + * Creates a copy of the HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_clone(const struct LDKHTLCHandlingFailureType *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Forward-variant HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_forward(struct LDKPublicKey node_id, struct LDKChannelId channel_id); + +/** + * Utility method to constructs a new UnknownNextHop-variant HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_unknown_next_hop(uint64_t requested_forward_scid); + +/** + * Utility method to constructs a new InvalidForward-variant HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_invalid_forward(uint64_t requested_forward_scid); + +/** + * Utility method to constructs a new InvalidOnion-variant HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_invalid_onion(void); + +/** + * Utility method to constructs a new Receive-variant HTLCHandlingFailureType + */ +struct LDKHTLCHandlingFailureType HTLCHandlingFailureType_receive(struct LDKThirtyTwoBytes payment_hash); + +/** + * Checks if two HTLCHandlingFailureTypes contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool HTLCHandlingFailureType_eq(const struct LDKHTLCHandlingFailureType *NONNULL_PTR a, const struct LDKHTLCHandlingFailureType *NONNULL_PTR b); + +/** + * Serialize the HTLCHandlingFailureType object into a byte array which can be read by HTLCHandlingFailureType_read + */ +struct LDKCVec_u8Z HTLCHandlingFailureType_write(const struct LDKHTLCHandlingFailureType *NONNULL_PTR obj); + +/** + * Read a HTLCHandlingFailureType from a byte array, created by HTLCHandlingFailureType_write + */ +struct LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ HTLCHandlingFailureType_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the HTLCHandlingFailureReason */ -void PendingHTLCInfo_set_skimmed_fee_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void HTLCHandlingFailureReason_free(struct LDKHTLCHandlingFailureReason this_ptr); /** - * Constructs a new PendingHTLCInfo given each field + * Creates a copy of the HTLCHandlingFailureReason */ -MUST_USE_RES struct LDKPendingHTLCInfo PendingHTLCInfo_new(struct LDKPendingHTLCRouting routing_arg, struct LDKThirtyTwoBytes incoming_shared_secret_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u64Z incoming_amt_msat_arg, uint64_t outgoing_amt_msat_arg, uint32_t outgoing_cltv_value_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg); +struct LDKHTLCHandlingFailureReason HTLCHandlingFailureReason_clone(const struct LDKHTLCHandlingFailureReason *NONNULL_PTR orig); /** - * Creates a copy of the PendingHTLCInfo + * Utility method to constructs a new Downstream-variant HTLCHandlingFailureReason */ -struct LDKPendingHTLCInfo PendingHTLCInfo_clone(const struct LDKPendingHTLCInfo *NONNULL_PTR orig); +struct LDKHTLCHandlingFailureReason HTLCHandlingFailureReason_downstream(void); /** - * Creates a copy of the BlindedFailure + * Utility method to constructs a new Local-variant HTLCHandlingFailureReason */ -enum LDKBlindedFailure BlindedFailure_clone(const enum LDKBlindedFailure *NONNULL_PTR orig); +struct LDKHTLCHandlingFailureReason HTLCHandlingFailureReason_local(struct LDKLocalHTLCFailureReason reason); /** - * Utility method to constructs a new FromIntroductionNode-variant BlindedFailure + * Checks if two HTLCHandlingFailureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -enum LDKBlindedFailure BlindedFailure_from_introduction_node(void); +bool HTLCHandlingFailureReason_eq(const struct LDKHTLCHandlingFailureReason *NONNULL_PTR a, const struct LDKHTLCHandlingFailureReason *NONNULL_PTR b); /** - * Utility method to constructs a new FromBlindedNode-variant BlindedFailure + * Serialize the HTLCHandlingFailureReason object into a byte array which can be read by HTLCHandlingFailureReason_read */ -enum LDKBlindedFailure BlindedFailure_from_blinded_node(void); +struct LDKCVec_u8Z HTLCHandlingFailureReason_write(const struct LDKHTLCHandlingFailureReason *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the BlindedFailure. + * Read a HTLCHandlingFailureReason from a byte array, created by HTLCHandlingFailureReason_write */ -uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o); +struct LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ HTLCHandlingFailureReason_read(struct LDKu8slice ser); /** - * Checks if two BlindedFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Build a HTLCHandlingFailureReason from a LocalHTLCFailureReason */ -bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b); +struct LDKHTLCHandlingFailureReason HTLCHandlingFailureReason_from_LocalHTLCFailureReason(struct LDKLocalHTLCFailureReason f); /** - * Calls the free function if one is set + * Creates a copy of the PaymentFailureReason */ -void Verification_free(struct LDKVerification this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig); /** - * Constructs a new Verification which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Verification must be freed before this_arg is + * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason */ -struct LDKVerification UnauthenticatedReceiveTlvs_as_Verification(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_arg); +enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void); /** - * Frees any resources used by the FailureCode + * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason */ -void FailureCode_free(struct LDKFailureCode this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void); /** - * Creates a copy of the FailureCode + * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason */ -struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); +enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void); /** - * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode + * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason */ -struct LDKFailureCode FailureCode_temporary_node_failure(void); +enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void); /** - * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode + * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason */ -struct LDKFailureCode FailureCode_required_node_feature_missing(void); +enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void); /** - * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode + * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason */ -struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); +enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void); /** - * Utility method to constructs a new InvalidOnionPayload-variant FailureCode + * Utility method to constructs a new UnknownRequiredFeatures-variant PaymentFailureReason */ -struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); +enum LDKPaymentFailureReason PaymentFailureReason_unknown_required_features(void); /** - * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvoiceRequestExpired-variant PaymentFailureReason */ -void ChannelManager_free(struct LDKChannelManager this_obj); +enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_expired(void); /** - * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvoiceRequestRejected-variant PaymentFailureReason */ -void ChainParameters_free(struct LDKChainParameters this_obj); +enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_rejected(void); /** - * The network for determining the `chain_hash` in Lightning messages. + * Utility method to constructs a new BlindedPathCreationFailed-variant PaymentFailureReason */ -enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); +enum LDKPaymentFailureReason PaymentFailureReason_blinded_path_creation_failed(void); /** - * The network for determining the `chain_hash` in Lightning messages. + * Checks if two PaymentFailureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); +bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read */ -struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj); /** - * The hash and height of the latest block successfully connected. - * - * Used to track on-chain channel funding outputs and send payments with reliable timelocks. + * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write */ -void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); +struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser); /** - * Constructs a new ChainParameters given each field + * Frees any resources used by the InboundChannelFunds */ -MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); +void InboundChannelFunds_free(struct LDKInboundChannelFunds this_ptr); /** - * Creates a copy of the ChainParameters + * Creates a copy of the InboundChannelFunds */ -struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); +struct LDKInboundChannelFunds InboundChannelFunds_clone(const struct LDKInboundChannelFunds *NONNULL_PTR orig); /** - * Frees any resources used by the RecentPaymentDetails + * Utility method to constructs a new PushMsat-variant InboundChannelFunds */ -void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); +struct LDKInboundChannelFunds InboundChannelFunds_push_msat(uint64_t a); /** - * Creates a copy of the RecentPaymentDetails + * Utility method to constructs a new DualFunded-variant InboundChannelFunds */ -struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); +struct LDKInboundChannelFunds InboundChannelFunds_dual_funded(void); /** - * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails + * Checks if two InboundChannelFundss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); +bool InboundChannelFunds_eq(const struct LDKInboundChannelFunds *NONNULL_PTR a, const struct LDKInboundChannelFunds *NONNULL_PTR b); /** - * Utility method to constructs a new Pending-variant RecentPaymentDetails + * Frees any resources used by the Event */ -struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); +void Event_free(struct LDKEvent this_ptr); /** - * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails + * Creates a copy of the Event */ -struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); +struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** - * Utility method to constructs a new Abandoned-variant RecentPaymentDetails + * Utility method to constructs a new FundingGenerationReady-variant Event */ -struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); +struct LDKEvent Event_funding_generation_ready(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id); /** - * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new FundingTxBroadcastSafe-variant Event */ -void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); +struct LDKEvent Event_funding_tx_broadcast_safe(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKOutPoint funding_txo, struct LDKPublicKey counterparty_node_id, struct LDKChannelId former_temporary_channel_id); /** - * The list of channels to be included in the invoice route hints. + * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +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 LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ receiving_channel_ids, struct LDKCOption_u32Z claim_deadline, struct LDKCOption_ThirtyTwoBytesZ payment_id); /** - * The list of channels to be included in the invoice route hints. + * Utility method to constructs a new PaymentClaimed-variant Event */ -void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); +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, struct LDKRecipientOnionFields onion_fields, struct LDKCOption_ThirtyTwoBytesZ payment_id); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Utility method to constructs a new ConnectionNeeded-variant Event */ -uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +struct LDKEvent Event_connection_needed(struct LDKPublicKey node_id, struct LDKCVec_SocketAddressZ addresses); /** - * A fake scid used for representing the phantom node's fake channel in generating the invoice - * route hints. + * Utility method to constructs a new InvoiceReceived-variant Event */ -void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); +struct LDKEvent Event_invoice_received(struct LDKThirtyTwoBytes payment_id, struct LDKBolt12Invoice invoice, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Utility method to constructs a new PaymentSent-variant Event */ -struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); +struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z amount_msat, struct LDKCOption_u64Z fee_paid_msat, struct LDKCOption_PaidBolt12InvoiceZ bolt12_invoice); /** - * The pubkey of the real backing node that would ultimately receive the payment. + * Utility method to constructs a new PaymentFailed-variant Event */ -void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); /** - * Constructs a new PhantomRouteHints given each field + * Utility method to constructs a new PaymentPathSuccessful-variant Event */ -MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path, struct LDKCVec_u32Z hold_times); /** - * Creates a copy of the PhantomRouteHints + * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); +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, struct LDKCVec_u32Z hold_times); /** - * Constructs a new `ChannelManager` to hold several channels and route between them. - * - * The current time or latest block header time can be provided as the `current_timestamp`. - * - * This is the main \"logic hub\" for all channel-related actions, and implements - * [`ChannelMessageHandler`]. - * - * Non-proportional fees are fixed according to our risk using the provided fee estimator. - * - * Users need to notify the new `ChannelManager` when a new block is connected or - * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting - * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for - * more details. - * - * [`block_connected`]: chain::Listen::block_connected - * [`block_disconnected`]: chain::Listen::block_disconnected - * [`params.best_block.block_hash`]: chain::BestBlock::block_hash + * Utility method to constructs a new ProbeSuccessful-variant Event */ -MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKMessageRouter message_router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params, uint32_t current_timestamp); +struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); /** - * Gets the current configuration applied to all new channels. + * Utility method to constructs a new ProbeFailed-variant Event */ -MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); /** - * Creates a new outbound channel to the given remote node and with the given value. - * - * `user_channel_id` will be provided back as in - * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events - * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a - * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it - * is simply copied to events and otherwise ignored. - * - * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is - * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. - * - * Note that we do not check if you are currently connected to the given peer. If no - * connection is available, the outbound `open_channel` message may fail to send, resulting in - * the channel eventually being silently forgotten (dropped on reload). - * - * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the - * channel. Otherwise, a random one will be generated for you. - * - * Returns the new Channel's temporary `channel_id`. This ID will appear as - * [`Event::FundingGenerationReady::temporary_channel_id`] and in - * [`ChannelDetails::channel_id`] until after - * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for - * one derived from the funding transaction's TXID. If the counterparty rejects the channel - * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. - * - * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id - * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id - * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id - * - * Note that temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new HTLCIntercepted-variant Event */ -MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ 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 LDKChannelId temporary_channel_id, struct LDKUserConfig override_config); +struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat); /** - * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for - * more information. + * Utility method to constructs a new SpendableOutputs-variant Event */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKChannelId channel_id); /** - * Gets the list of usable channels, in random order. Useful as an argument to - * [`Router::find_route`] to ensure non-announced channels are used. - * - * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the - * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria - * are. + * Utility method to constructs a new PaymentForwarded-variant Event */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKPublicKey prev_node_id, struct LDKPublicKey next_node_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** - * Gets the list of channels we have with a given counterparty, in random order. + * Utility method to constructs a new ChannelPending-variant Event */ -MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); +struct LDKEvent Event_channel_pending(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKChannelId former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo, struct LDKChannelTypeFeatures channel_type, struct LDKCOption_CVec_u8ZZ funding_redeem_script); /** - * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a - * successful path, or have unresolved HTLCs. - * - * This can be useful for payments that may have been prepared, but ultimately not sent, as a - * result of a crash. If such a payment exists, is not listed here, and an - * [`Event::PaymentSent`] has not been received, you may consider resending the payment. - * - * [`Event::PaymentSent`]: events::Event::PaymentSent + * Utility method to constructs a new ChannelReady-variant Event */ -MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKEvent Event_channel_ready(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_OutPointZ funding_txo, struct LDKChannelTypeFeatures channel_type); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] - * fee estimate. - * * If our counterparty is the channel initiator, we will require a channel closing - * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which - * would appear on a force-closure transaction, whichever is lower. We will allow our - * counterparty to pay as much fee as they'd like, however. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown + * Utility method to constructs a new ChannelClosed-variant Event */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); +struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo, struct LDKCOption_u64Z last_local_balance_msat); /** - * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs - * will be accepted on the given channel, and after additional timeout/the closing of all - * pending HTLCs, the channel will be closed on chain. - * - * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated - * the channel being closed or not: - * * If we are the channel initiator, we will pay at least this feerate on the closing - * transaction. The upper-bound is set by - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] - * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). - * * If our counterparty is the channel initiator, we will refuse to accept a channel closure - * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which - * will appear on a force-closure transaction, whichever is lower). - * - * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. - * Will fail if a shutdown script has already been set for this channel by - * ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must - * also be compatible with our and the counterparty's features. - * - * May generate a [`SendShutdown`] message event on success, which should be relayed. - * - * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to - * generate a shutdown scriptpubkey or destination script set by - * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the - * channel. - * - * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis - * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee - * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown - * - * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new SplicePending-variant Event */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); +struct LDKEvent Event_splice_pending(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint new_funding_txo, struct LDKChannelTypeFeatures channel_type, struct LDKCVec_u8Z new_funding_redeem_script); /** - * Force closes a channel, immediately broadcasting the latest local transaction(s), - * rejecting new HTLCs. - * - * The provided `error_message` is sent to connected peers for closing - * channels and should be a human-readable description of what went wrong. - * - * Fails if `channel_id` is unknown to the manager, or if the `counterparty_node_id` - * isn't the counterparty of the corresponding channel. + * Utility method to constructs a new SpliceFailed-variant Event */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKStr error_message); +struct LDKEvent Event_splice_failed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_OutPointZ abandoned_funding_txo, struct LDKChannelTypeFeatures channel_type, struct LDKCVec_OutPointZ contributed_inputs, struct LDKCVec_TxOutZ contributed_outputs); /** - * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting - * the latest local transaction(s). - * - * The provided `error_message` is sent to connected peers for closing channels and should - * be a human-readable description of what went wrong. - * - * Fails if `channel_id` is unknown to the manager, or if the - * `counterparty_node_id` isn't the counterparty of the corresponding channel. - * You can always broadcast the latest local transaction(s) via - * [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. + * Utility method to constructs a new DiscardFunding-variant Event */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKStr error_message); +struct LDKEvent Event_discard_funding(struct LDKChannelId channel_id, struct LDKFundingInfo funding_info); /** - * Force close all channels, immediately broadcasting the latest local commitment transaction - * for each to the chain and rejecting new HTLCs on each. - * - * The provided `error_message` is sent to connected peers for closing channels and should - * be a human-readable description of what went wrong. + * Utility method to constructs a new OpenChannelRequest-variant Event */ -void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); +struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, struct LDKInboundChannelFunds channel_negotiation_type, struct LDKChannelTypeFeatures channel_type, bool is_announced, struct LDKChannelParameters params); /** - * Force close all channels rejecting new HTLCs on each but without broadcasting the latest - * local transaction(s). - * - * The provided `error_message` is sent to connected peers for closing channels and - * should be a human-readable description of what went wrong. + * Utility method to constructs a new HTLCHandlingFailed-variant Event */ -void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); +struct LDKEvent Event_htlchandling_failed(struct LDKChannelId prev_channel_id, struct LDKHTLCHandlingFailureType failure_type, struct LDKCOption_HTLCHandlingFailureReasonZ failure_reason); /** - * Sends a payment along a given route. See [`Self::send_payment`] for more info. - * - * LDK will not automatically retry this payment, though it may be manually re-sent after an - * [`Event::PaymentFailed`] is generated. + * Utility method to constructs a new BumpTransaction-variant Event */ -MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRoute route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a); /** - * Sends a payment to the route found using the provided [`RouteParameters`], retrying failed - * payment paths based on the provided `Retry`. - * - * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via - * [`PeerManager::process_events`]). - * - * # Avoiding Duplicate Payments - * - * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this - * method will error with [`RetryableSendFailure::DuplicatePayment`]. Note, however, that once a - * payment is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of - * an [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a - * second payment with the same [`PaymentId`]. - * - * Thus, in order to ensure duplicate payments are not sent, you should implement your own - * tracking of payments, including state to indicate once a payment has completed. Because you - * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should - * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the - * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. - * - * Additionally, in the scenario where we begin the process of sending a payment, but crash - * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're - * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See - * [`ChannelManager::list_recent_payments`] for more information. - * - * Routes are automatically found using the [`Router] provided on startup. To fix a route for a - * particular payment, use [`Self::send_payment_with_route`] or match the [`PaymentId`] passed to - * [`Router::find_route_with_id`]. - * - * [`Event::PaymentSent`]: events::Event::PaymentSent - * [`Event::PaymentFailed`]: events::Event::PaymentFailed - * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs - * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events - * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress + * Utility method to constructs a new OnionMessageIntercepted-variant Event */ -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); +struct LDKEvent Event_onion_message_intercepted(struct LDKPublicKey peer_node_id, struct LDKOnionMessage message); /** - * Pays the [`Bolt12Invoice`] associated with the `payment_id` encoded in its `payer_metadata`. - * - * The invoice's `payer_metadata` is used to authenticate that the invoice was indeed requested - * before attempting a payment. [`Bolt12PaymentError::UnexpectedInvoice`] is returned if this - * fails or if the encoded `payment_id` is not recognized. The latter may happen once the - * payment is no longer tracked because the payment was attempted after: - * - an invoice for the `payment_id` was already paid, - * - one full [timer tick] has elapsed since initially requesting the invoice when paying an - * offer, or - * - the refund corresponding to the invoice has already expired. - * - * To retry the payment, request another invoice using a new `payment_id`. - * - * Attempting to pay the same invoice twice while the first payment is still pending will - * result in a [`Bolt12PaymentError::DuplicateInvoice`]. - * - * Otherwise, either [`Event::PaymentSent`] or [`Event::PaymentFailed`] are used to indicate - * whether or not the payment was successful. - * - * [timer tick]: Self::timer_tick_occurred + * Utility method to constructs a new OnionMessagePeerConnected-variant Event */ -MUST_USE_RES struct LDKCResult_NoneBolt12PaymentErrorZ ChannelManager_send_payment_for_bolt12_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKBolt12Invoice *NONNULL_PTR invoice, struct LDKCOption_OffersContextZ context); +struct LDKEvent Event_onion_message_peer_connected(struct LDKPublicKey peer_node_id); /** - * 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. - * - * Note that calling this method does *not* prevent a payment from succeeding. You must still - * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to - * determine the ultimate status of a payment. - * - * # Requested Invoices - * - * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning - * the payment prior to receiving the invoice will result in an [`Event::PaymentFailed`] and - * prevent any attempts at paying it once received. - * - * # Restart Behavior - * - * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the - * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Utility method to constructs a new PersistStaticInvoice-variant Event */ -void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); +struct LDKEvent Event_persist_static_invoice(struct LDKStaticInvoice invoice, struct LDKBlindedMessagePath invoice_request_path, uint16_t invoice_slot, struct LDKCVec_u8Z recipient_id, struct LDKResponder invoice_persisted_path); /** - * Send a spontaneous payment, which is a payment that does not require the recipient to have - * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify - * the preimage, it must be a cryptographically secure random value that no intermediate node - * would be able to guess -- otherwise, an intermediate node may claim the payment and it will - * never reach the recipient. - * - * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See - * [`send_payment`] for more information about the risks of duplicate preimage usage. - * - * See [`send_payment`] documentation for more details on the idempotency guarantees provided by - * the [`PaymentId`] key. - * - * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous - * payments. - * - * [`send_payment`]: Self::send_payment - * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend + * Utility method to constructs a new StaticInvoiceRequested-variant Event */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment(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); +struct LDKEvent Event_static_invoice_requested(struct LDKCVec_u8Z recipient_id, uint16_t invoice_slot, struct LDKResponder reply_path, struct LDKInvoiceRequest invoice_request); /** - * 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. + * Utility method to constructs a new FundingTransactionReadyForSigning-variant Event */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +struct LDKEvent Event_funding_transaction_ready_for_signing(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id, struct LDKTransaction unsigned_transaction); /** - * 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. + * Checks if two Events contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -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); +bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); /** - * 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`. + * Serialize the Event object into a byte array which can be read by Event_read */ -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); +struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); /** - * Call this upon creation of a funding transaction for the given channel. - * - * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs - * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. - * - * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation - * across the p2p network. - * - * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided - * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. - * - * May panic if the output found in the funding transaction is duplicative with some other - * channel (note that this should be trivially prevented by using unique funding transaction - * keys per-channel). - * - * Do NOT broadcast the funding transaction yourself. When we have safely received our - * counterparty's signature the funding transaction will automatically be broadcast via the - * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. - * - * Note that this includes RBF or similar transaction replacement strategies - lightning does - * not currently support replacing a funding transaction on an existing channel. Instead, - * create a new channel with a conflicting funding transaction. - * - * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend - * the wallet software generating the funding transaction to apply anti-fee sniping as - * implemented by Bitcoin Core wallet. See - * for more details. - * - * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady - * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed + * Read a Event from a byte array, created by Event_write */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); +struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); /** - * **Unsafe**: This method does not validate the spent output. It is the caller's - * responsibility to ensure the spent outputs are SegWit, as well as making sure the funding - * transaction has a final absolute locktime, i.e., its locktime is lower than the next block height. - * - * For a safer method, please refer to [`ChannelManager::funding_transaction_generated`]. - * - * Call this in response to a [`Event::FundingGenerationReady`] event. - * - * Note that if this method is called successfully, the funding transaction won't be - * broadcasted and you are expected to broadcast it manually when receiving the - * [`Event::FundingTxBroadcastSafe`] event. - * - * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided - * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. - * - * May panic if the funding output is duplicative with some other channel (note that this - * should be trivially prevented by using unique funding transaction keys per-channel). - * - * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend - * the wallet software generating the funding transaction to apply anti-fee sniping as - * implemented by Bitcoin Core wallet. See for - * more details. - * - * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady - * [`Event::FundingTxBroadcastSafe`]: crate::events::Event::FundingTxBroadcastSafe - * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed - * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * Calls the free function if one is set + */ +void EventsProvider_free(struct LDKEventsProvider this_ptr); + +/** + * Frees any resources used by the ReplayEvent, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_unsafe_manual_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding); +void ReplayEvent_free(struct LDKReplayEvent this_obj); /** - * 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 transaction - * 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. + * Constructs a new ReplayEvent given each field */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); +MUST_USE_RES struct LDKReplayEvent ReplayEvent_new(void); /** - * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. - * - * Once the updates are applied, each eligible channel (advertised with a known short channel - * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], - * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated - * containing the new [`ChannelUpdate`] message which should be broadcast to the network. - * - * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect - * `counterparty_node_id` is provided. - * - * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value - * below [`MIN_CLTV_EXPIRY_DELTA`]. - * - * If an error is returned, none of the updates should be considered applied. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths - * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat - * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta - * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelUnavailable`]: APIError::ChannelUnavailable - * [`APIMisuseError`]: APIError::APIMisuseError + * Creates a copy of the ReplayEvent */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); +struct LDKReplayEvent ReplayEvent_clone(const struct LDKReplayEvent *NONNULL_PTR orig); /** - * Atomically updates the [`ChannelConfig`] for the given channels. - * - * Once the updates are applied, each eligible channel (advertised with a known short channel - * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], - * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated - * containing the new [`ChannelUpdate`] message which should be broadcast to the network. - * - * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect - * `counterparty_node_id` is provided. - * - * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value - * below [`MIN_CLTV_EXPIRY_DELTA`]. - * - * If an error is returned, none of the updates should be considered applied. - * - * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths - * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat - * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta - * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelUnavailable`]: APIError::ChannelUnavailable - * [`APIMisuseError`]: APIError::APIMisuseError + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); +void EventHandler_free(struct LDKEventHandler this_ptr); /** - * Attempts to forward an intercepted HTLC over the provided channel id and with the provided - * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. - * - * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time - * channel to a receiving node if the node lacks sufficient inbound liquidity. - * - * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use - * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the - * receiver's invoice route hints. These route hints will signal to LDK to generate an - * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or - * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. - * - * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop - * you from forwarding more than you received. See - * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount - * than expected. - * - * Errors if the event was not handled in time, in which case the HTLC was automatically failed - * backwards. - * - * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs - * [`HTLCIntercepted`]: events::Event::HTLCIntercepted - * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat + * Frees any resources used by the PaidBolt12Invoice */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); +void PaidBolt12Invoice_free(struct LDKPaidBolt12Invoice this_ptr); /** - * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to - * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. - * - * Errors if the event was not handled in time, in which case the HTLC was automatically failed - * backwards. - * - * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + * Creates a copy of the PaidBolt12Invoice */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); +struct LDKPaidBolt12Invoice PaidBolt12Invoice_clone(const struct LDKPaidBolt12Invoice *NONNULL_PTR orig); /** - * Processes HTLCs which are pending waiting on random forward delay. - * - * Should only really ever be called in response to a PendingHTLCsForwardable event. - * Will likely generate further events. + * Utility method to constructs a new Bolt12Invoice-variant PaidBolt12Invoice */ -void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKPaidBolt12Invoice PaidBolt12Invoice_bolt12_invoice(struct LDKBolt12Invoice a); /** - * Performs actions which should happen on startup and roughly once per minute thereafter. - * - * This currently includes: - * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, - * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more - * than a minute, informing the network that they should no longer attempt to route over - * the channel. - * * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs - * with the current [`ChannelConfig`]. - * * Removing peers which have disconnected but and no longer have any channels. - * * Force-closing and removing channels which have not completed establishment in a timely manner. - * * Forgetting about stale outbound payments, either those that have already been fulfilled - * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. - * The latter is determined using the system clock in `std` and the highest seen block time - * minus two hours in non-`std`. - * - * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate - * estimate fetches. - * - * [`ChannelUpdate`]: msgs::ChannelUpdate - * [`ChannelConfig`]: crate::util::config::ChannelConfig + * Utility method to constructs a new StaticInvoice-variant PaidBolt12Invoice */ -void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKPaidBolt12Invoice PaidBolt12Invoice_static_invoice(struct LDKStaticInvoice a); /** - * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect - * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources - * along the path (including in our own channel on which we received it). - * - * Note that in some cases around unclean shutdown, it is possible the payment may have - * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a - * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment - * may have already been failed automatically by LDK if it was nearing its expiration time. - * - * While LDK will never claim a payment automatically on your behalf (i.e. without you calling - * [`ChannelManager::claim_funds`]), you should still monitor for - * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on - * startup during which time claims that were in-progress at shutdown may be replayed. + * Checks if two PaidBolt12Invoices contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +bool PaidBolt12Invoice_eq(const struct LDKPaidBolt12Invoice *NONNULL_PTR a, const struct LDKPaidBolt12Invoice *NONNULL_PTR b); /** - * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the - * reason for the failure. - * - * See [`FailureCode`] for valid failure codes. + * Generates a non-cryptographic 64-bit hash of the PaidBolt12Invoice. */ -void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); +uint64_t PaidBolt12Invoice_hash(const struct LDKPaidBolt12Invoice *NONNULL_PTR o); /** - * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any - * [`MessageSendEvent`]s needed to claim the payment. - * - * This method is guaranteed to ensure the payment has been claimed but only if the current - * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race - * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment - * successful. It will generally be available in the next [`process_pending_events`] call. - * - * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or - * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` - * 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 + * Serialize the PaidBolt12Invoice object into a byte array which can be read by PaidBolt12Invoice_read */ -void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +struct LDKCVec_u8Z PaidBolt12Invoice_write(const struct LDKPaidBolt12Invoice *NONNULL_PTR obj); /** - * 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 + * Read a PaidBolt12Invoice from a byte array, created by PaidBolt12Invoice_write */ -void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +struct LDKCResult_PaidBolt12InvoiceDecodeErrorZ PaidBolt12Invoice_read(struct LDKu8slice ser); /** - * Gets the node_id held by this ChannelManager + * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); +void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj); /** - * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. - * - * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, - * and the `counterparty_node_id` parameter is the id of the peer which has requested to open - * the channel. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Note that this method will return an error and reject the channel, if it requires support - * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be - * used to accept such channels. - * - * NOTE: LDK makes no attempt to prevent the counterparty from using non-standard inputs which - * will prevent the funding transaction from being relayed on the bitcoin network and hence being - * confirmed. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * The parameters required to derive the signer for the anchor input. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); +struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); /** - * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating - * it as confirmed immediately. - * - * The `user_channel_id` parameter will be provided back in - * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. - * - * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel - * and (if the counterparty agrees), enables forwarding of payments immediately. - * - * This fully trusts that the counterparty has honestly and correctly constructed the funding - * transaction and blindly assumes that it will eventually confirm. - * - * If it does not confirm before we decide to close the channel, or if the funding transaction - * does not pay to the correct script the correct amount, *you will lose funds*. - * - * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest - * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * The parameters required to derive the signer for the anchor input. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); +void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); /** - * When a call to a [`ChannelSigner`] method returns an error, this indicates that the signer - * is (temporarily) unavailable, and the operation should be retried later. - * - * This method allows for that retry - either checking for any signer-pending messages to be - * attempted in every channel, or in the specifically provided channel. - * - * [`ChannelSigner`]: crate::sign::ChannelSigner + * The transaction input's outpoint corresponding to the commitment transaction's anchor + * output. */ -void ChannelManager_signer_unblocked(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ channel_opt); +struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); /** - * Utility for creating a BOLT11 invoice that can be verified by [`ChannelManager`] without - * storing any additional state. It achieves this by including a [`PaymentSecret`] in the - * invoice which it uses to verify that the invoice has not expired and the payment amount is - * sufficient, reproducing the [`PaymentPreimage`] if applicable. + * The transaction input's outpoint corresponding to the commitment transaction's anchor + * output. */ -MUST_USE_RES struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ ChannelManager_create_bolt11_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKBolt11InvoiceParameters params); +void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Frees any resources used by the Bolt11InvoiceParameters, if is_owned is set and inner is non-NULL. + * Zero-fee-commitment anchors have variable value, which is tracked here. */ -void Bolt11InvoiceParameters_free(struct LDKBolt11InvoiceParameters this_obj); +uint64_t AnchorDescriptor_get_value(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); /** - * The amount for the invoice, if any. + * Zero-fee-commitment anchors have variable value, which is tracked here. */ -struct LDKCOption_u64Z Bolt11InvoiceParameters_get_amount_msats(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); +void AnchorDescriptor_set_value(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * The amount for the invoice, if any. + * Constructs a new AnchorDescriptor given each field */ -void Bolt11InvoiceParameters_set_amount_msats(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg, uint64_t value_arg); /** - * The description for what the invoice is for, or hash of such description. + * Creates a copy of the AnchorDescriptor */ -struct LDKBolt11InvoiceDescription Bolt11InvoiceParameters_get_description(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); +struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig); /** - * The description for what the invoice is for, or hash of such description. + * Checks if two AnchorDescriptors 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. */ -void Bolt11InvoiceParameters_set_description(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKBolt11InvoiceDescription val); +bool AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b); /** - * The invoice expiration relative to its creation time. If not set, the invoice will expire in - * [`DEFAULT_EXPIRY_TIME`] by default. - * - * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` - * builds, the highest block timestamp seen is used instead. In the latter case, use a long - * enough expiry to account for the average block time. + * Returns the UTXO to be spent by the anchor input, which can be obtained via + * [`Self::unsigned_tx_input`]. */ -struct LDKCOption_u32Z Bolt11InvoiceParameters_get_invoice_expiry_delta_secs(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); /** - * The invoice expiration relative to its creation time. If not set, the invoice will expire in - * [`DEFAULT_EXPIRY_TIME`] by default. - * - * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` - * builds, the highest block timestamp seen is used instead. In the latter case, use a long - * enough expiry to account for the average block time. + * Returns the unsigned transaction input spending the anchor output in the commitment + * transaction. */ -void Bolt11InvoiceParameters_set_invoice_expiry_delta_secs(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); /** - * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use - * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. - * - * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be - * added as well to allow for up to a few new block confirmations during routing. + * Returns the fully signed witness required to spend the anchor output in the commitment + * transaction. */ -struct LDKCOption_u16Z Bolt11InvoiceParameters_get_min_final_cltv_expiry_delta(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); /** - * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use - * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. - * - * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be - * added as well to allow for up to a few new block confirmations during routing. + * Frees any resources used by the BumpTransactionEvent */ -void Bolt11InvoiceParameters_set_min_final_cltv_expiry_delta(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr); /** - * The payment hash used in the invoice. If not set, a payment hash will be generated using a - * preimage that can be reproduced by [`ChannelManager`] without storing any state. - * - * Uses the payment hash if set. This may be useful if you're building an on-chain swap or - * involving another protocol where the payment hash is also involved outside the scope of - * lightning. + * Creates a copy of the BumpTransactionEvent */ -struct LDKCOption_ThirtyTwoBytesZ Bolt11InvoiceParameters_get_payment_hash(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); +struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig); /** - * The payment hash used in the invoice. If not set, a payment hash will be generated using a - * preimage that can be reproduced by [`ChannelManager`] without storing any state. - * - * Uses the payment hash if set. This may be useful if you're building an on-chain swap or - * involving another protocol where the payment hash is also involved outside the scope of - * lightning. + * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent */ -void Bolt11InvoiceParameters_set_payment_hash(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t package_target_feerate_sat_per_1000_weight, struct LDKTransaction commitment_tx, uint64_t commitment_tx_fee_satoshis, struct LDKAnchorDescriptor anchor_descriptor, struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs); /** - * Constructs a new Bolt11InvoiceParameters given each field + * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent */ -MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_new(struct LDKCOption_u64Z amount_msats_arg, struct LDKBolt11InvoiceDescription description_arg, struct LDKCOption_u32Z invoice_expiry_delta_secs_arg, struct LDKCOption_u16Z min_final_cltv_expiry_delta_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); +struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time); /** - * Creates a "default" Bolt11InvoiceParameters. See struct and individual field documentaiton for details on which values are used. + * Checks if two BumpTransactionEvents contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_default(void); +bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b); /** - * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the - * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer's - * expiration will be `absolute_expiry` if `Some`, otherwise it will not expire. - * - * # Privacy - * - * Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the offer based on the given - * `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for - * privacy implications as well as those of the parameterized [`Router`], which implements - * [`MessageRouter`]. - * - * Also, uses a derived signing pubkey in the offer for recipient privacy. - * - * # Limitations - * - * Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s - * reply path. - * - * # Errors - * - * Errors if the parameterized [`Router`] is unable to create a blinded path for the offer. - * - * [`Offer`]: crate::offers::offer::Offer - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * Frees any resources used by the Input, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z absolute_expiry); +void Input_free(struct LDKInput this_obj); /** - * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the - * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund. - * - * # Payment - * - * The provided `payment_id` is used to ensure that only one invoice is paid for the refund. - * See [Avoiding Duplicate Payments] for other requirements once the payment has been sent. - * - * The builder will have the provided expiration set. Any changes to the expiration on the - * returned builder will not be honored by [`ChannelManager`]. For non-`std`, the highest seen - * block time minus two hours is used for the current time when determining if the refund has - * expired. - * - * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the - * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail - * with an [`Event::PaymentFailed`]. - * - * If `max_total_routing_fee_msat` is not specified, The default from - * [`RouteParameters::from_payment_params_and_value`] is applied. - * - * # Privacy - * - * Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the refund based on the given - * `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for - * privacy implications as well as those of the parameterized [`Router`], which implements - * [`MessageRouter`]. - * - * Also, uses a derived payer id in the refund for payer privacy. - * - * # Limitations - * - * Requires a direct connection to an introduction node in the responding - * [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if: - * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, - * - `amount_msats` is invalid, or - * - the parameterized [`Router`] is unable to create a blinded path for the refund. - * - * [`Refund`]: crate::offers::refund::Refund - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * The unique identifier of the input. */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); +struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr); /** - * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and - * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual - * [`Bolt12Invoice`] once it is received. - * - * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by - * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. - * The optional parameters are used in the builder, if `Some`: - * - `quantity` for [`InvoiceRequest::quantity`] which must be set if - * [`Offer::expects_quantity`] is `true`. - * - `amount_msats` if overpaying what is required for the given `quantity` is desired, and - * - `payer_note` for [`InvoiceRequest::payer_note`]. - * - * If `max_total_routing_fee_msat` is not specified, The default from - * [`RouteParameters::from_payment_params_and_value`] is applied. - * - * # Payment - * - * The provided `payment_id` is used to ensure that only one invoice is paid for the request - * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has - * been sent. - * - * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the - * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the - * payment will fail with an [`Event::PaymentFailed`]. - * - * # Privacy - * - * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] - * to construct a [`BlindedMessagePath`] for the reply path. For further privacy implications, see the - * docs of the parameterized [`Router`], which implements [`MessageRouter`]. - * - * # Limitations - * - * Requires a direct connection to an introduction node in [`Offer::paths`] or to - * [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to the responding - * [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if: - * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, - * - the provided parameters are invalid for the offer, - * - the offer is for an unsupported chain, or - * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice - * request. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity - * [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note - * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * The unique identifier of the input. */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z quantity, struct LDKCOption_u64Z amount_msats, struct LDKCOption_StrZ payer_note, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat); +void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion - * message. - * - * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a - * [`BlindedPaymentPath`] containing the [`PaymentSecret`] needed to reconstruct the - * corresponding [`PaymentPreimage`]. It is returned purely for informational purposes. - * - * # Limitations - * - * Requires a direct connection to an introduction node in [`Refund::paths`] or to - * [`Refund::payer_signing_pubkey`], if empty. This request is best effort; an invoice will be - * sent to each node meeting the aforementioned criteria, but there's no guarantee that they - * will be received and no retries will be made. - * - * # Errors - * - * Errors if: - * - the refund is for an unsupported chain, or - * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for - * the invoice. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The UTXO being spent by the input. */ -MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); +struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr); /** - * Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS - * resolver(s) at `dns_resolvers` which resolve names according to bLIP 32. - * - * If the wallet supports paying on-chain schemes, you should instead use - * [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by - * implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to - * your normal URI handling. - * - * If `max_total_routing_fee_msat` is not specified, the default from - * [`RouteParameters::from_payment_params_and_value`] is applied. - * - * # Payment - * - * The provided `payment_id` is used to ensure that only one invoice is paid for the request - * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has - * been sent. - * - * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the - * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the - * payment will fail with an [`Event::InvoiceRequestFailed`]. - * - * # Privacy - * - * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] - * to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the - * docs of the parameterized [`Router`], which implements [`MessageRouter`]. - * - * # Limitations - * - * Requires a direct connection to the given [`Destination`] as well as an introduction node in - * [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to - * the responding [`Bolt12Invoice::payment_paths`]. - * - * # Errors - * - * Errors if: - * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, - * - * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths - * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * The UTXO being spent by the input. + */ +void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val); + +/** + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and + * [`TxIn::witness`], each with their lengths included, required to satisfy the output's + * script. + */ +uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr); + +/** + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and + * [`TxIn::witness`], each with their lengths included, required to satisfy the output's + * script. + */ +void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new Input given each field + */ +MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg); + +/** + * Creates a copy of the Input + */ +struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the Input. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelManager_pay_for_offer_from_human_readable_name(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKHumanReadableName name, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat, struct LDKCVec_DestinationZ dns_resolvers); +uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o); /** - * Gets a payment secret and payment hash for use in an invoice given to a third party wishing - * to pay us. - * - * This differs from [`create_inbound_payment_for_hash`] only in that it generates the - * [`PaymentHash`] and [`PaymentPreimage`] for you. - * - * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`] event, which - * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. That - * should then be passed directly to [`claim_funds`]. - * - * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. - * - * Note that a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. - * - * # Note - * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. - * - * Errors if `min_value_msat` is greater than total bitcoin supply. - * - * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. - * - * [`claim_funds`]: Self::claim_funds - * [`PaymentClaimable`]: events::Event::PaymentClaimable - * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose - * [`PaymentPurpose::preimage`]: events::PaymentPurpose::preimage - * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * Checks if two Inputs 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. */ -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); +bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b); /** - * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is - * stored external to LDK. - * - * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a - * payment secret fetched via this method or [`create_inbound_payment`], and which is at least - * the `min_value_msat` provided here, if one is provided. - * - * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though - * note that LDK will not stop you from registering duplicate payment hashes for inbound - * payments. - * - * `min_value_msat` should be set if the invoice being generated contains a value. Any payment - * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the - * sender \"proof-of-payment\" unless they have paid the required amount. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. This should roughly match the expiry time set in the invoice. - * After this many seconds, we will remove the inbound payment, resulting in any attempts to - * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for - * invoices when no timeout is set. - * - * Note that we use block header time to time-out pending inbound payments (with some margin - * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. - * If you need exact expiry semantics, you should enforce them upon receipt of - * [`PaymentClaimable`]. - * - * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` - * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. - * - * Note that a malicious eavesdropper can intuit whether an inbound payment was created by - * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. - * - * # Note - * - * If you register an inbound payment with this method, then serialize the `ChannelManager`, then - * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. - * - * Errors if `min_value_msat` is greater than total bitcoin supply. - * - * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. - * - * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentClaimable`]: events::Event::PaymentClaimable + * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL. */ -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); +void Utxo_free(struct LDKUtxo this_obj); /** - * Gets an LDK-generated payment preimage from a payment hash and payment secret that were - * previously returned from [`create_inbound_payment`]. - * - * [`create_inbound_payment`]: Self::create_inbound_payment + * The unique identifier of the output. */ -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); +struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids - * are used when constructing the phantom invoice's route hints. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * The unique identifier of the output. */ -MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Gets route hints for use in receiving [phantom node payments]. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * The output to spend. */ -MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are - * used when constructing the route hints for HTLCs intended to be intercepted. See - * [`ChannelManager::forward_intercepted_htlc`]. - * - * Note that this method is not guaranteed to return unique values, you may need to call it a few - * times to get a unique scid. + * The output to spend. */ -MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Gets inflight HTLC information by processing pending outbound payments that are in - * our channels. May be used during pathfinding to account for in-use channel liquidity. + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each + * with their lengths included, required to satisfy the output's script. The weight consumed by + * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. */ -MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each + * with their lengths included, required to satisfy the output's script. The weight consumed by + * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. */ -struct LDKMessageSendEventsProvider ChannelManager_as_MessageSendEventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new EventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is + * Constructs a new Utxo given each field */ -struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg); /** - * Constructs a new Listen which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is + * Creates a copy of the Utxo */ -struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig); /** - * Constructs a new Confirm which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is + * Generates a non-cryptographic 64-bit hash of the Utxo. */ -struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); +uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o); /** - * 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. + * Checks if two Utxos 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. */ -MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); +bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b); /** - * Returns true if this [`ChannelManager`] needs to be persisted. - * - * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that - * indicates this should be checked. + * Serialize the Utxo object into a byte array which can be read by Utxo_read */ -MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Utxo_write(const struct LDKUtxo *NONNULL_PTR obj); /** - * Gets the latest best block which was connected either via the [`chain::Listen`] or - * [`chain::Confirm`] interfaces. + * Read a Utxo from a byte array, created by Utxo_write */ -MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCResult_UtxoDecodeErrorZ Utxo_read(struct LDKu8slice ser); /** - * Fetches the set of [`NodeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output. */ -MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]); /** - * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +void CoinSelection_free(struct LDKCoinSelection this_obj); /** - * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction + * requiring additional fees. */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction + * requiring additional fees. */ -MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); +void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * An additional output tracking whether any change remained after coin selection. This output + * should always have a value above dust for its given `script_pubkey`. It should not be + * spent until the transaction it belongs to confirms to ensure mempool descendant limits are + * not met. This implies no other party should be able to spend it except us. */ -struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr); /** - * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + * An additional output tracking whether any change remained after coin selection. This output + * should always have a value above dust for its given `script_pubkey`. It should not be + * spent until the transaction it belongs to confirms to ensure mempool descendant limits are + * not met. This implies no other party should be able to spend it except us. */ -struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +void CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val); /** - * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is + * Constructs a new CoinSelection given each field */ -struct LDKAsyncPaymentsMessageHandler ChannelManager_as_AsyncPaymentsMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg); /** - * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is + * Creates a copy of the CoinSelection */ -struct LDKDNSResolverMessageHandler ChannelManager_as_DNSResolverMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig); /** - * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is + * Calls the free function if one is set */ -struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg); +void WalletSourceSync_free(struct LDKWalletSourceSync this_ptr); /** - * Fetches the set of [`InitFeatures`] flags that are provided by or required by - * [`ChannelManager`]. + * Frees any resources used by the WalletSync, if is_owned is set and inner is non-NULL. */ -struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); +void WalletSync_free(struct LDKWalletSync this_obj); /** - * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read + * Constructs a new [`WalletSync`] instance. */ -struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); +MUST_USE_RES struct LDKWalletSync WalletSync_new(struct LDKWalletSourceSync source, struct LDKLogger logger); /** - * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write + * Constructs a new CoinSelectionSourceSync which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSourceSync must be freed before this_arg is */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); +struct LDKCoinSelectionSourceSync WalletSync_as_CoinSelectionSourceSync(const struct LDKWalletSync *NONNULL_PTR this_arg); /** - * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read + * Calls the free function if one is set */ -struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); +void CoinSelectionSourceSync_free(struct LDKCoinSelectionSourceSync this_ptr); /** - * Read a BlindedForward from a byte array, created by BlindedForward_write + * Frees any resources used by the BumpTransactionEventHandlerSync, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); +void BumpTransactionEventHandlerSync_free(struct LDKBumpTransactionEventHandlerSync this_obj); /** - * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read + * Constructs a new instance of [`BumpTransactionEventHandlerSync`]. */ -struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); +MUST_USE_RES struct LDKBumpTransactionEventHandlerSync BumpTransactionEventHandlerSync_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSourceSync utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger); /** - * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write + * Handles all variants of [`BumpTransactionEvent`]. */ -struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); +void BumpTransactionEventHandlerSync_handle_event(const struct LDKBumpTransactionEventHandlerSync *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); /** - * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read + * Maximum number of in-flight HTLCs in each direction allowed by the lightning protocol. + * + * 483 for non-zero-fee-commitment channels and 114 for zero-fee-commitment channels. + * + * Actual maximums can be set equal to or below this value by each channel participant. */ -struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); +uint16_t max_htlcs(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type); /** - * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write + * Gets the weight for an HTLC-Success transaction. */ -struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); +uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read + * Gets the weight of a single input-output pair in externally funded HTLC-success transactions */ -struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); +uint64_t aggregated_htlc_success_input_output_pair_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * Read a BlindedFailure from a byte array, created by BlindedFailure_write + * Gets the weight for an HTLC-Timeout transaction. */ -struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); +uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read + * Gets the weight of a single input-output pair in externally funded HTLC-timeout transactions */ -struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); +uint64_t aggregated_htlc_timeout_input_output_pair_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); /** - * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. + * Creates a copy of the HTLCClaim */ -void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); +enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); /** - * A cryptographically secure source of entropy. + * Utility method to constructs a new OfferedTimeout-variant HTLCClaim */ -const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_offered_timeout(void); /** - * A cryptographically secure source of entropy. + * Utility method to constructs a new OfferedPreimage-variant HTLCClaim */ -void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); +enum LDKHTLCClaim HTLCClaim_offered_preimage(void); /** - * A signer that is able to perform node-scoped cryptographic operations. + * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim */ -const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); /** - * A signer that is able to perform node-scoped cryptographic operations. + * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim */ -void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); +enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * Utility method to constructs a new Revocation-variant HTLCClaim */ -const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +enum LDKHTLCClaim HTLCClaim_revocation(void); /** - * The keys provider which will give us relevant keys. Some keys will be loaded during - * deserialization and KeysInterface::read_chan_signer will be used to read per-Channel - * signing data. + * Checks if two HTLCClaims contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); +bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * Check if a given input witness attempts to claim a HTLC. */ -const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); /** - * The fee_estimator for use in the ChannelManager in the future. - * - * No calls to the FeeEstimator will be made during deserialization. + * Build the commitment secret from the seed and the commitment number */ -void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); +struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * Build a closing transaction */ -const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * The chain::Watch for use in the ChannelManager in the future. - * - * No calls to the chain::Watch will be made during deserialization. It is assumed that - * you have deserialized ChannelMonitors separately and will add them to your - * chain::Watch after deserializing this ChannelManager. + * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. */ -void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); +void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Creates a copy of the CounterpartyCommitmentSecrets */ -const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); /** - * The BroadcasterInterface which will be used in the ChannelManager in the future and may be - * used to broadcast the latest local commitment transactions of channels which must be - * force-closed during deserialization. + * Creates a new empty `CounterpartyCommitmentSecrets` structure. */ -void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); +MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. - * - * No calls to the router will be made during deserialization. + * Returns the minimum index of all stored secrets. Note that indexes start + * at 1 << 48 and get decremented by one for each new secret. */ -const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); /** - * The router which will be used in the ChannelManager in the future for finding routes - * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret + * was generated in accordance with BOLT 3 and is consistent with previous secrets. + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); + +/** + * Returns the secret at `idx`. + * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. * - * No calls to the router will be made during deserialization. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); +MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); /** - * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, - * [`Refund`]s, and any reply paths. + * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read */ -const struct LDKMessageRouter *ChannelManagerReadArgs_get_message_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); /** - * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, - * [`Refund`]s, and any reply paths. + * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write */ -void ChannelManagerReadArgs_set_message_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKMessageRouter val); +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) + * from the base secret and the per_commitment_point. */ -const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** - * The Logger for use in the ChannelManager and which may be used to log information during - * deserialization. + * Derives a per-commitment-transaction revocation key from its constituent parts. + * + * Only the cheating participant owns a valid witness to propagate a revoked + * commitment transaction, thus per_commitment_secret always come from cheater + * and revocation_base_secret always come from punisher, which is the broadcaster + * of the transaction spending with this key knowledge. */ -void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); +struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. */ -struct LDKUserConfig ChannelManagerReadArgs_get_default_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); +void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); /** - * Default settings used for new channels. Any existing channels will continue to use the - * runtime settings which were stored when the ChannelManager was serialized. + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); +struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Simple utility function to create a ChannelManagerReadArgs which creates the monitor - * HashMap for you. This is primarily useful for C bindings where it is not practical to - * populate a HashMap directly from C. + * The broadcaster's per-commitment public key which was used to derive the other keys. */ -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 LDKMessageRouter message_router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); +void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +struct LDKRevocationKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. + * The revocation key which is used to allow the broadcaster of the commitment + * transaction to provide their counterparty the ability to punish them if they broadcast + * an old state. */ -void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); +void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKRevocationKey val); -struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); +/** + * Broadcaster's HTLC Key + */ +struct LDKHtlcKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); -void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * Broadcaster's HTLC Key + */ +void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** - * Constructs a new DelayedPaymentBasepoint given each field + * Countersignatory's HTLC Key */ -MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); +struct LDKHtlcKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Checks if two DelayedPaymentBasepoints 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. + * Countersignatory's HTLC Key */ -bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); +void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); /** - * Creates a copy of the DelayedPaymentBasepoint + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); +struct LDKDelayedPaymentKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. + * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) */ -uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); +void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentKey val); /** - * Get inner Public Key + * Constructs a new TxCreationKeys given each field */ -MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKRevocationKey revocation_key_arg, struct LDKHtlcKey broadcaster_htlc_key_arg, struct LDKHtlcKey countersignatory_htlc_key_arg, struct LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg); /** - *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. + * Checks if two TxCreationKeyss 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. */ -MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); +bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); /** - * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read + * Creates a copy of the TxCreationKeys */ -struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); +struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); /** - * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write + * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read */ -struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); +struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); /** - * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. + * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write */ -void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); +struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); -struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); +/** + * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. + */ +void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); -void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. + */ +struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Constructs a new DelayedPaymentKey given each field + * The public key which is used to sign all commitment transactions, as it appears in the + * on-chain channel lock-in 2-of-2 multisig output. */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); +void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if two DelayedPaymentKeys 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. + * The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); +struct LDKRevocationBasepoint ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Creates a copy of the DelayedPaymentKey + * The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment + * revocation keys. This is combined with the per-commitment-secret generated by the + * counterparty to create a secret which the counterparty can reveal to revoke previous + * states. */ -struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); +void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKRevocationBasepoint val); /** - *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - *Build a delayedpubkey directly from an already-derived private key + * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately + * spendable primary channel balance on the broadcaster's commitment transaction. This key is + * static across every commitment transaction. */ -MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); +void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Get inner Public Key + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); +struct LDKDelayedPaymentBasepoint ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read + * The base point which is used (with derive_public_key) to derive a per-commitment payment + * public key which receives non-HTLC-encumbered funds which are only available for spending + * after some delay (or can be claimed via the revocation path). */ -struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); +void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentBasepoint val); /** - * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); +struct LDKHtlcBasepoint ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); /** - * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. + * The base point which is used (with derive_public_key) to derive a per-commitment public key + * which is used to encumber HTLC-in-flight outputs. */ -void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); +void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKHtlcBasepoint val); -struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); +/** + * Constructs a new ChannelPublicKeys given each field + */ +MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKRevocationBasepoint revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg, struct LDKHtlcBasepoint htlc_basepoint_arg); -void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * Creates a copy of the ChannelPublicKeys + */ +struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); /** - * Constructs a new HtlcBasepoint given each field + * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. */ -MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); +uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); /** - * Checks if two HtlcBasepoints contain equal inner contents. + * 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. */ -bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); +bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); /** - * Creates a copy of the HtlcBasepoint + * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read */ -struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); +struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. + * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write */ -uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); +struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); /** - * Get inner Public Key + * Create per-state keys from channel base points and the per-commitment point. + * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR broadcaster_delayed_payment_base, const struct LDKHtlcBasepoint *NONNULL_PTR broadcaster_htlc_base, const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_revocation_base, const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_htlc_base); /** - *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. + * Generate per-state keys from channel static keys. + * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** - * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read + * A script either spendable by the revocation + * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. + * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. */ -struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); +struct LDKCVec_u8Z get_revokeable_redeemscript(const struct LDKRevocationKey *NONNULL_PTR revocation_key, uint16_t contest_delay, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key); /** - * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write + * Returns the script for the countersigner's (i.e. non-broadcaster's) output on a commitment + * transaction based on the channel type. */ -struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); +struct LDKCVec_u8Z get_countersigner_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); /** - * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. + * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. */ -void HtlcKey_free(struct LDKHtlcKey this_obj); - -struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); - -void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); /** - * Constructs a new HtlcKey given each field + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); +bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Checks if two HtlcKeys 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. + * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). + * Note that this is not the same as whether it is ountbound *from us*. To determine that you + * need to compare this value to whether the commitment transaction in question is that of + * the counterparty or our own. */ -bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); +void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); /** - * Creates a copy of the HtlcKey + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); +uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` + * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is + * this divided by 1000. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); /** - *Build a htlcpubkey directly from an already-derived private key + * The CLTV lock-time at which this HTLC expires. */ -MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); +uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Get inner Public Key + * The CLTV lock-time at which this HTLC expires. */ -MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); +void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read + * The hash of the preimage which unlocks this HTLC. */ -struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); +const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; /** - * Read a HtlcKey from a byte array, created by HtlcKey_write + * The hash of the preimage which unlocks this HTLC. */ -struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); +void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Adds a tweak to a public key to derive a new public key. - * - * May panic if `tweak` is not the output of a SHA-256 hash. + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]); +struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); /** - * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. + * The position within the commitment transactions' outputs. This may be None if the value is + * below the dust limit (in which case no output appears in the commitment transaction and the + * value is spent to additional transaction fees). */ -void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); - -struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); +void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); -void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * Constructs a new HTLCOutputInCommitment given each field + */ +MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); /** - * Constructs a new RevocationBasepoint given each field + * Creates a copy of the HTLCOutputInCommitment */ -MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); +struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); /** - * Checks if two RevocationBasepoints contain equal inner contents. + * Checks if two HTLCOutputInCommitments 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 RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); +bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); /** - * Creates a copy of the RevocationBasepoint + * Converts HTLC's value with millisatoshi precision into [bitcoin::Amount] with satoshi precision. + * Typically this conversion is needed when transitioning from LN into base-layer Bitcoin, + * e. g. in commitment transactions. */ -struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); +MUST_USE_RES uint64_t HTLCOutputInCommitment_to_bitcoin_amount(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. + * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read */ -uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); +struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); /** - * Get inner Public Key + * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write */ -MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); /** - * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read + * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc + * does not need to have its previous_output_index filled. */ -struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); +struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKTxCreationKeys *NONNULL_PTR keys); /** - * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write + * Gets the redeemscript for a funding output from the two funding public keys. + * Note that the order of funding public keys does not matter. */ -struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); +struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); /** - * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. + * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC + * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the + * transaction which needs signing, and can be used to construct an HTLC transaction which is + * broadcastable given a counterparty HTLC signature. + * + * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the + * commitment transaction). */ -void RevocationKey_free(struct LDKRevocationKey this_obj); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key, const struct LDKRevocationKey *NONNULL_PTR revocation_key); -struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); +/** + * Returns the witness required to satisfy and spend a HTLC input. + */ +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); -void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +/** + * Gets the witnessScript for the to_remote output when anchors are enabled. + */ +struct LDKCVec_u8Z get_to_countersigner_keyed_anchor_redeemscript(struct LDKPublicKey payment_point); /** - * Constructs a new RevocationKey given each field + * Gets the script_pubkey for a shared anchor */ -MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); +struct LDKCVec_u8Z shared_anchor_script_pubkey(void); /** - * Checks if two RevocationKeys 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. + * Gets the witnessScript for a keyed anchor (non-zero-fee-commitments) output from the funding + * public key. + * + * The witness in the spending input must be: + * + * After 16 blocks of confirmation, an alternative satisfying witness could be: + * <> + * (empty vector required to satisfy compliance with MINIMALIF-standard rule) */ -bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); +struct LDKCVec_u8Z get_keyed_anchor_redeemscript(struct LDKPublicKey funding_pubkey); /** - * Creates a copy of the RevocationKey + * Returns the witness required to satisfy and spend a keyed anchor (non-zero-fee-commitments) + * input. */ -struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); +struct LDKWitness build_keyed_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); /** - * Generates a non-cryptographic 64-bit hash of the RevocationKey. + * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); +void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); /** - * Derives a per-commitment-transaction revocation public key from one party's per-commitment - * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of - * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public - * key instead of private keys. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). - * - * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key + * Holder public keys */ -MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); +struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Get inner Public Key + * Holder public keys */ -MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); +void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); +uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Read a RevocationKey from a byte array, created by RevocationKey_write + * The contest delay selected by the holder, which applies to counterparty-broadcast transactions */ -struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); +void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a copy of the InboundHTLCStateDetails + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_clone(const enum LDKInboundHTLCStateDetails *NONNULL_PTR orig); +bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant InboundHTLCStateDetails + * Whether the holder is the initiator of this channel. + * This is an input to the commitment number obscure factor computation. */ -enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); +void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); /** - * Utility method to constructs a new Committed-variant InboundHTLCStateDetails + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_committed(void); +struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFulfill-variant InboundHTLCStateDetails + * The late-bound counterparty channel transaction parameters. + * These parameters are populated at the point in the protocol where the counterparty provides them. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill(void); +void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); /** - * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFail-variant InboundHTLCStateDetails + * The late-bound funding outpoint + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail(void); +struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Serialize the InboundHTLCStateDetails object into a byte array which can be read by InboundHTLCStateDetails_read + * The late-bound funding outpoint + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z InboundHTLCStateDetails_write(const enum LDKInboundHTLCStateDetails *NONNULL_PTR obj); +void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Read a InboundHTLCStateDetails from a byte array, created by InboundHTLCStateDetails_write + * The parent funding txid for a channel that has been spliced. + * + * If a channel was funded with transaction A, and later spliced with transaction B, this field + * tracks the txid of transaction A. + * + * See [`compute_funding_key_tweak`] and [`ChannelSigner::new_funding_pubkey`] for more context + * on how this may be used. + * + * [`compute_funding_key_tweak`]: crate::sign::compute_funding_key_tweak + * [`ChannelSigner::new_funding_pubkey`]: crate::sign::ChannelSigner::new_funding_pubkey */ -struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ InboundHTLCStateDetails_read(struct LDKu8slice ser); +struct LDKCOption_ThirtyTwoBytesZ ChannelTransactionParameters_get_splice_parent_funding_txid(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the InboundHTLCDetails, if is_owned is set and inner is non-NULL. + * The parent funding txid for a channel that has been spliced. + * + * If a channel was funded with transaction A, and later spliced with transaction B, this field + * tracks the txid of transaction A. + * + * See [`compute_funding_key_tweak`] and [`ChannelSigner::new_funding_pubkey`] for more context + * on how this may be used. + * + * [`compute_funding_key_tweak`]: crate::sign::compute_funding_key_tweak + * [`ChannelSigner::new_funding_pubkey`]: crate::sign::ChannelSigner::new_funding_pubkey */ -void InboundHTLCDetails_free(struct LDKInboundHTLCDetails this_obj); +void ChannelTransactionParameters_set_splice_parent_funding_txid(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * The HTLC ID. - * The IDs are incremented by 1 starting from 0 for each offered HTLC. - * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced - * and not part of any commitment transaction. + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. */ -uint64_t InboundHTLCDetails_get_htlc_id(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); +struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The HTLC ID. - * The IDs are incremented by 1 starting from 0 for each offered HTLC. - * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced - * and not part of any commitment transaction. + * This channel's type, as negotiated during channel open. For old objects where this field + * wasn't serialized, it will default to static_remote_key at deserialization. */ -void InboundHTLCDetails_set_htlc_id(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The amount in msat. + * The value locked in the channel, denominated in satoshis. */ -uint64_t InboundHTLCDetails_get_amount_msat(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); +uint64_t ChannelTransactionParameters_get_channel_value_satoshis(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * The amount in msat. + * The value locked in the channel, denominated in satoshis. */ -void InboundHTLCDetails_set_amount_msat(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelTransactionParameters_set_channel_value_satoshis(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The block height at which this HTLC expires. + * 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 */ -uint32_t InboundHTLCDetails_get_cltv_expiry(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); +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 LDKCOption_ThirtyTwoBytesZ splice_parent_funding_txid_arg, struct LDKChannelTypeFeatures channel_type_features_arg, uint64_t channel_value_satoshis_arg); /** - * The block height at which this HTLC expires. + * Creates a copy of the ChannelTransactionParameters */ -void InboundHTLCDetails_set_cltv_expiry(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); +struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); /** - * The payment hash. + * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. */ -const uint8_t (*InboundHTLCDetails_get_payment_hash(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr))[32]; +uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); /** - * The payment hash. + * 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. */ -void InboundHTLCDetails_set_payment_hash(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b); /** - * The state of the HTLC in the state machine. - * - * Determines on which commitment transactions the HTLC is included and what message the HTLC is - * waiting for to advance to the next state. - * - * See [`InboundHTLCStateDetails`] for information on the specific states. - * - * LDK will always fill this field in, but when downgrading to prior versions of LDK, new - * states may result in `None` here. + * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_InboundHTLCStateDetailsZ InboundHTLCDetails_get_state(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); +void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); /** - * The state of the HTLC in the state machine. - * - * Determines on which commitment transactions the HTLC is included and what message the HTLC is - * waiting for to advance to the next state. - * - * See [`InboundHTLCStateDetails`] for information on the specific states. - * - * LDK will always fill this field in, but when downgrading to prior versions of LDK, new - * states may result in `None` here. + * Counter-party public keys */ -void InboundHTLCDetails_set_state(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_InboundHTLCStateDetailsZ val); +struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed - * from the local commitment transaction and added to the commitment transaction fee. - * For non-anchor channels, this takes into account the cost of the second-stage HTLC - * transactions as well. - * - * When the local commitment transaction is broadcasted as part of a unilateral closure, - * the value of this HTLC will therefore not be claimable but instead burned as a transaction - * fee. - * - * Note that dust limits are specific to each party. An HTLC can be dust for the local - * commitment transaction but not for the counterparty's commitment transaction and vice versa. + * Counter-party public keys */ -bool InboundHTLCDetails_get_is_dust(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); +void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); /** - * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed - * from the local commitment transaction and added to the commitment transaction fee. - * For non-anchor channels, this takes into account the cost of the second-stage HTLC - * transactions as well. - * - * When the local commitment transaction is broadcasted as part of a unilateral closure, - * the value of this HTLC will therefore not be claimable but instead burned as a transaction - * fee. - * - * Note that dust limits are specific to each party. An HTLC can be dust for the local - * commitment transaction but not for the counterparty's commitment transaction and vice versa. + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -void InboundHTLCDetails_set_is_dust(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, bool val); +uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); /** - * Constructs a new InboundHTLCDetails given each field + * The contest delay selected by the counterparty, which applies to holder-broadcast transactions */ -MUST_USE_RES struct LDKInboundHTLCDetails InboundHTLCDetails_new(uint64_t htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_InboundHTLCStateDetailsZ state_arg, bool is_dust_arg); +void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a copy of the InboundHTLCDetails + * Constructs a new CounterpartyChannelTransactionParameters given each field */ -struct LDKInboundHTLCDetails InboundHTLCDetails_clone(const struct LDKInboundHTLCDetails *NONNULL_PTR orig); +MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); /** - * Serialize the InboundHTLCDetails object into a byte array which can be read by InboundHTLCDetails_read + * Creates a copy of the CounterpartyChannelTransactionParameters */ -struct LDKCVec_u8Z InboundHTLCDetails_write(const struct LDKInboundHTLCDetails *NONNULL_PTR obj); +struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); /** - * Read a InboundHTLCDetails from a byte array, created by InboundHTLCDetails_write + * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. */ -struct LDKCResult_InboundHTLCDetailsDecodeErrorZ InboundHTLCDetails_read(struct LDKu8slice ser); +uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); /** - * Creates a copy of the OutboundHTLCStateDetails + * 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. */ -enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_clone(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR orig); +bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b); /** - * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant OutboundHTLCStateDetails + * Whether the late bound parameters are populated. */ -enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); +MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Committed-variant OutboundHTLCStateDetails + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the holder is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_committed(void); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AwaitingRemoteRevokeToRemoveSuccess-variant OutboundHTLCStateDetails + * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, + * given that the counterparty is the broadcaster. + * + * self.is_populated() must be true before calling this function. */ -enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success(void); +MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFailure-variant OutboundHTLCStateDetails + * Returns the counterparty's pubkeys. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure(void); +MUST_USE_RES struct LDKChannelPublicKeys ChannelTransactionParameters_counterparty_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); /** - * Serialize the OutboundHTLCStateDetails object into a byte array which can be read by OutboundHTLCStateDetails_read + * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read */ -struct LDKCVec_u8Z OutboundHTLCStateDetails_write(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR obj); +struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); /** - * Read a OutboundHTLCStateDetails from a byte array, created by OutboundHTLCStateDetails_write + * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write */ -struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ OutboundHTLCStateDetails_read(struct LDKu8slice ser); +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); /** - * Frees any resources used by the OutboundHTLCDetails, if is_owned is set and inner is non-NULL. + * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read */ -void OutboundHTLCDetails_free(struct LDKOutboundHTLCDetails this_obj); +struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); /** - * The HTLC ID. - * The IDs are incremented by 1 starting from 0 for each offered HTLC. - * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced - * and not part of any commitment transaction. - * - * Not present when we are awaiting a remote revocation and the HTLC is not added yet. + * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write */ -struct LDKCOption_u64Z OutboundHTLCDetails_get_htlc_id(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser, struct LDKCOption_u64Z arg); /** - * The HTLC ID. - * The IDs are incremented by 1 starting from 0 for each offered HTLC. - * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced - * and not part of any commitment transaction. - * - * Not present when we are awaiting a remote revocation and the HTLC is not added yet. + * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ -void OutboundHTLCDetails_set_htlc_id(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); /** - * The amount in msat. + * Get the channel pubkeys for the broadcaster */ -uint64_t OutboundHTLCDetails_get_amount_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The amount in msat. + * Get the channel pubkeys for the countersignatory */ -void OutboundHTLCDetails_set_amount_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The block height at which this HTLC expires. + * Get the contest delay applicable to the transactions. + * Note that the contest delay was selected by the countersignatory. */ -uint32_t OutboundHTLCDetails_get_cltv_expiry(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The block height at which this HTLC expires. + * Whether the channel is outbound from the broadcaster. + * + * The boolean representing the side that initiated the channel is + * an input to the commitment number obscure factor computation. */ -void OutboundHTLCDetails_set_cltv_expiry(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The payment hash. + * The funding outpoint */ -const uint8_t (*OutboundHTLCDetails_get_payment_hash(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The payment hash. + * The type of channel these parameters are for */ -void OutboundHTLCDetails_set_payment_hash(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The state of the HTLC in the state machine. - * - * Determines on which commitment transactions the HTLC is included and what message the HTLC is - * waiting for to advance to the next state. - * - * See [`OutboundHTLCStateDetails`] for information on the specific states. - * - * LDK will always fill this field in, but when downgrading to prior versions of LDK, new - * states may result in `None` here. + * The value locked in the channel, denominated in satoshis. */ -struct LDKCOption_OutboundHTLCStateDetailsZ OutboundHTLCDetails_get_state(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t DirectedChannelTransactionParameters_channel_value_satoshis(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); /** - * The state of the HTLC in the state machine. - * - * Determines on which commitment transactions the HTLC is included and what message the HTLC is - * waiting for to advance to the next state. - * - * See [`OutboundHTLCStateDetails`] for information on the specific states. - * - * LDK will always fill this field in, but when downgrading to prior versions of LDK, new - * states may result in `None` here. + * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void OutboundHTLCDetails_set_state(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_OutboundHTLCStateDetailsZ val); +void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); /** - * The extra fee being skimmed off the top of this HTLC. + * Our counterparty's signature for the transaction */ -struct LDKCOption_u64Z OutboundHTLCDetails_get_skimmed_fee_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * The extra fee being skimmed off the top of this HTLC. + * Our counterparty's signature for the transaction */ -void OutboundHTLCDetails_set_skimmed_fee_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed - * from the local commitment transaction and added to the commitment transaction fee. - * For non-anchor channels, this takes into account the cost of the second-stage HTLC - * transactions as well. - * - * When the local commitment transaction is broadcasted as part of a unilateral closure, - * the value of this HTLC will therefore not be claimable but instead burned as a transaction - * fee. + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction * - * Note that dust limits are specific to each party. An HTLC can be dust for the local - * commitment transaction but not for the counterparty's commitment transaction and vice versa. + * Returns a copy of the field. */ -bool OutboundHTLCDetails_get_is_dust(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed - * from the local commitment transaction and added to the commitment transaction fee. - * For non-anchor channels, this takes into account the cost of the second-stage HTLC - * transactions as well. - * - * When the local commitment transaction is broadcasted as part of a unilateral closure, - * the value of this HTLC will therefore not be claimable but instead burned as a transaction - * fee. - * - * Note that dust limits are specific to each party. An HTLC can be dust for the local - * commitment transaction but not for the counterparty's commitment transaction and vice versa. + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ -void OutboundHTLCDetails_set_is_dust(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, bool val); +void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** - * Constructs a new OutboundHTLCDetails given each field + * Creates a copy of the HolderCommitmentTransaction */ -MUST_USE_RES struct LDKOutboundHTLCDetails OutboundHTLCDetails_new(struct LDKCOption_u64Z htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_OutboundHTLCStateDetailsZ state_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, bool is_dust_arg); +struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); /** - * Creates a copy of the OutboundHTLCDetails + * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read */ -struct LDKOutboundHTLCDetails OutboundHTLCDetails_clone(const struct LDKOutboundHTLCDetails *NONNULL_PTR orig); +struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); /** - * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read + * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); + +/** + * 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. */ -struct LDKCVec_u8Z OutboundHTLCDetails_write(const struct LDKOutboundHTLCDetails *NONNULL_PTR obj); +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); /** - * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write + * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ OutboundHTLCDetails_read(struct LDKu8slice ser); +void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); /** - * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. + * The commitment transaction */ -void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); +struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); /** - * Base routing fee in millisatoshis. + * The commitment transaction */ -uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); /** - * Base routing fee in millisatoshis. + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * The txid for the commitment transaction. + * + * This is provided as a performance optimization, instead of calling transaction.txid() + * multiple times. */ -uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Amount in millionths of a satoshi the channel will charge per transferred satoshi. + * Constructs a new BuiltCommitmentTransaction given each field */ -void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * Creates a copy of the BuiltCommitmentTransaction */ -uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); +struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); /** - * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, - * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s - * `cltv_expiry_delta` for more details. + * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read */ -void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); /** - * Constructs a new CounterpartyForwardingInfo given each field + * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write */ -MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); /** - * Creates a copy of the CounterpartyForwardingInfo + * Get the SIGHASH_ALL sighash value of the transaction. + * + * This can be used to verify a signature. */ -struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); +MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read + * Signs the counterparty's commitment transaction. */ -struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); +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); /** - * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write + * Signs the holder commitment transaction because we are about to broadcast it. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); +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 ChannelCounterparty, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. */ -void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); +void ClosingTransaction_free(struct LDKClosingTransaction this_obj); /** - * The node_id of our counterparty + * Creates a copy of the ClosingTransaction */ -struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); /** - * The node_id of our counterparty + * Generates a non-cryptographic 64-bit hash of the ClosingTransaction. */ -void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * Checks if two ClosingTransactions 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. */ -struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); /** - * The Features the channel counterparty provided upon last connection. - * Useful for routing as it is the most up-to-date copy of the counterparty's features and - * many routing-relevant features are present in the init context. + * Construct an object of the class */ -void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. + * Trust our pre-built transaction. * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * Applies a wrapper which allows access to the transaction. * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The value, in satoshis, that must always be held in the channel for our counterparty. This - * value ensures that if our counterparty broadcasts a revoked state, we can punish them by - * claiming at least this value on chain. + * Verify our pre-built transaction. * - * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * Applies a wrapper which allows access to the transaction. * - * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat + * An external validating signer must call this method before signing + * or using the built transaction. */ -void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The value to be sent to the holder, or zero if the output will be omitted */ -struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * Information on the fees and requirements that the counterparty requires when forwarding - * payments to us through this channel. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The value to be sent to the counterparty, or zero if the output will be omitted */ -void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); +MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * The destination of the holder's output */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field - * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message - * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + * The destination of the counterparty's output */ -void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); +void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); /** - * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + * The pre-built Bitcoin commitment transaction */ -void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); /** - * Constructs a new ChannelCounterparty given each field + * Get the SIGHASH_ALL sighash value of the transaction. * - * Note that forwarding_info_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * This can be used to verify a signature. */ -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); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); /** - * Creates a copy of the ChannelCounterparty + * Sign a transaction, either because we are counter-signing the counterparty's transaction or + * because we are about to broadcast a holder transaction. */ -struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); +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); /** - * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read + * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); +void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); /** - * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write + * Creates a copy of the CommitmentTransaction */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); +struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. + * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read */ -void ChannelDetails_free(struct LDKChannelDetails this_obj); +struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); /** - * 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). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write */ -struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); /** - * 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). - * Note that this means this value is *not* persistent - it can change once during the - * lifetime of the channel. + * Constructs a new `CommitmentTransaction` from the list of HTLCs and the direct balances. + * + * All HTLCs MUST be above the dust limit for the channel. + * The broadcaster and countersignatory amounts MUST be either 0 or above dust. If the amount + * is 0, the corresponding output will be omitted from the transaction. */ -void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKCommitmentTransaction CommitmentTransaction_new(uint64_t commitment_number, struct LDKPublicKey per_commitment_point, uint64_t to_broadcaster_value_sat, uint64_t to_countersignatory_value_sat, uint32_t feerate_per_kw, struct LDKCVec_HTLCOutputInCommitmentZ nondust_htlcs, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * The backwards-counting commitment number */ -struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * Parameters which apply to our counterparty. See individual fields for more information. + * The per commitment point used by the broadcaster. */ -void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); +MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The value to be sent to the broadcaster */ -struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * The Channel's funding transaction output, if we've negotiated the funding transaction with - * our counterparty already. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The value to be sent to the counterparty */ -void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); +MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * The features which this channel operates with. See individual features for more info. - * - * `None` until negotiation completes and the channel type is finalized. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The feerate paid per 1000-weight-unit we negotiated with our + * peer for this commitment transaction. Note that the actual + * feerate of the commitment transaction may be higher than the + * negotiated feerate. */ -struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES uint32_t CommitmentTransaction_negotiated_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * The features which this channel operates with. See individual features for more info. + * Trust our pre-built transaction and derived transaction creation public keys. * - * `None` until negotiation completes and the channel type is finalized. + * Applies a wrapper which allows access to these fields. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * This should only be used if you fully trust the builder of this object. It should not + * be used by an external signer - instead use the verify function. */ -void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. + * Verify our pre-built transaction and derived transaction creation public keys. * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * Applies a wrapper which allows access to these fields. * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * An external validating signer must call this method before signing + * or using the built transaction. */ -struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters); /** - * The position of the funding transaction in the chain. None if the funding transaction has - * not yet been confirmed and the channel fully opened. - * - * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound - * payments instead of this. See [`get_inbound_payment_scid`]. - * - * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may - * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. - * - * [`inbound_scid_alias`]: Self::inbound_scid_alias - * [`outbound_scid_alias`]: Self::outbound_scid_alias - * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid - * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid - * [`confirmations_required`]: Self::confirmations_required + * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * The transaction ID of the built Bitcoin transaction */ -struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by us and - * usable in place of [`short_channel_id`] to reference the channel in outbound routes when - * the channel has not yet been confirmed (as long as [`confirmations_required`] is - * `Some(0)`). - * - * This will be `None` as long as the channel is not available for routing outbound payments. - * - * [`short_channel_id`]: Self::short_channel_id - * [`confirmations_required`]: Self::confirmations_required + * The pre-built Bitcoin commitment transaction */ -void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. - * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. - * - * [`short_channel_id`]: Self::short_channel_id + * The pre-calculated transaction creation public keys. */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * An optional [`short_channel_id`] alias for this channel, randomly generated by our - * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our - * counterparty will recognize the alias provided here in place of the [`short_channel_id`] - * when they see a payment to be routed to us. - * - * Our counterparty may choose to rotate this value at any time, though will always recognize - * previous values for inbound payment forwarding. - * - * [`short_channel_id`]: Self::short_channel_id + * Should anchors be used. */ -void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * The value, in satoshis, of this channel as appears in the funding output + * Get a signature for each HTLC which was included in the commitment transaction (ie for + * which HTLCOutputInCommitment::transaction_output_index.is_some()). + * + * The returned Vec has one entry for each HTLC, and in the same order. + * + * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. */ -uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +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); /** - * The value, in satoshis, of this channel as appears in the funding output + * 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. */ -void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * 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 value will be `None` for outbound channels until the counterparty accepts the channel. + * 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. * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * 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. */ -struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +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); /** - * The value, in satoshis, that must always be held in the channel for us. This value ensures - * that if we broadcast a revoked state, our counterparty can punish us by claiming at least - * this value on chain. - * - * This value is not included in [`outbound_capacity_msat`] as it can never be spent. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a + * shared secret first. This prevents on-chain observers from discovering how many commitment + * transactions occurred in a channel before it was closed. * - * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat + * This function gets the shared secret from relevant channel public keys and can be used to + * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. */ -void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); /** - * 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 + * Frees any resources used by the DelayedPaymentBasepoint, if is_owned is set and inner is non-NULL. */ -struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void DelayedPaymentBasepoint_free(struct LDKDelayedPaymentBasepoint this_obj); + +struct LDKPublicKey DelayedPaymentBasepoint_get_a(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr); + +void DelayedPaymentBasepoint_set_a(struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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 + * Constructs a new DelayedPaymentBasepoint given each field */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); +MUST_USE_RES struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_new(struct LDKPublicKey a_arg); /** - * The currently negotiated fee rate denominated in satoshi per 1000 weight units, - * which is applied to commitment and HTLC transactions. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. + * Checks if two DelayedPaymentBasepoints 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. */ -struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool DelayedPaymentBasepoint_eq(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR a, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR b); /** - * The currently negotiated fee rate denominated in satoshi per 1000 weight units, - * which is applied to commitment and HTLC transactions. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. + * Creates a copy of the DelayedPaymentBasepoint */ -void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_clone(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR orig); /** - * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new outbound HTLCs). This further does not include any pending - * outgoing HTLCs which are awaiting some other resolution to be sent. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we - * should be able to spend nearly this amount. + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint. */ -uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +uint64_t DelayedPaymentBasepoint_hash(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR o); /** - * The available outbound capacity for sending HTLCs to the remote peer. This does not include - * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new outbound HTLCs). This further does not include any pending - * outgoing HTLCs which are awaiting some other resolution to be sent. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we - * should be able to spend nearly this amount. + * Get inner Public Key */ -void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPublicKey DelayedPaymentBasepoint_to_public_key(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and - * [`ChannelDetails::outbound_capacity_msat`]. + *Derives the \"tweak\" used in calculate [`DelayedPaymentKey::from_basepoint`].\n\n[`DelayedPaymentKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes DelayedPaymentBasepoint_derive_add_tweak(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * The available outbound capacity for sending a single HTLC to the remote peer. This is - * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by - * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us - * to use a limit as close as possible to the HTLC limit we can currently send. - * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and - * [`ChannelDetails::outbound_capacity_msat`]. + * Build a DelayedPaymentBasepoint from a PublicKey */ -void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKDelayedPaymentBasepoint DelayedPaymentBasepoint_from_PublicKey(struct LDKPublicKey f); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read */ -uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z DelayedPaymentBasepoint_write(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR obj); /** - * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of - * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than - * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a - * route which is valid. + * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write */ -void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_DelayedPaymentBasepointDecodeErrorZ DelayedPaymentBasepoint_read(struct LDKu8slice ser); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * Frees any resources used by the DelayedPaymentKey, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +void DelayedPaymentKey_free(struct LDKDelayedPaymentKey this_obj); + +struct LDKPublicKey DelayedPaymentKey_get_a(const struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr); + +void DelayedPaymentKey_set_a(struct LDKDelayedPaymentKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The available inbound capacity for the remote peer to send HTLCs to us. This does not - * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not - * available for inclusion in new inbound HTLCs). - * Note that there are some corner cases not fully handled here, so the actual available - * inbound capacity may be slightly higher than this. - * - * This value is not exact. Due to various in-flight changes, feerate changes, and our - * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. - * However, our counterparty should be able to spend nearly this amount. + * Constructs a new DelayedPaymentKey given each field */ -void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_new(struct LDKPublicKey a_arg); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * Checks if two DelayedPaymentKeys 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. */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool DelayedPaymentKey_eq(const struct LDKDelayedPaymentKey *NONNULL_PTR a, const struct LDKDelayedPaymentKey *NONNULL_PTR b); /** - * The number of required confirmations on the funding transaction before the funding will be - * considered \"locked\". This number is selected by the channel fundee (i.e. us if - * [`is_outbound`] is *not* set), and can be selected for inbound channels with - * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with - * [`ChannelHandshakeLimits::max_minimum_depth`]. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. - * - * [`is_outbound`]: ChannelDetails::is_outbound - * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth - * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth + * Creates a copy of the DelayedPaymentKey */ -void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKDelayedPaymentKey DelayedPaymentKey_clone(const struct LDKDelayedPaymentKey *NONNULL_PTR orig); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + *Derive a public delayedpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_basepoint(const struct LDKDelayedPaymentBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * The current number of confirmations on the funding transaction. - * - * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + *Build a delayedpubkey directly from an already-derived private key */ -void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +MUST_USE_RES struct LDKDelayedPaymentKey DelayedPaymentKey_from_secret_key(const uint8_t (*sk)[32]); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * Get inner Public Key */ -struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey DelayedPaymentKey_to_public_key(const struct LDKDelayedPaymentKey *NONNULL_PTR this_arg); /** - * The number of blocks (after our commitment transaction confirms) that we will need to wait - * until we can claim our funds after we force-close the channel. During this time our - * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty - * force-closes the channel and broadcasts a commitment transaction we do not have to wait any - * time to claim our non-HTLC-encumbered funds. - * - * This value will be `None` for outbound channels until the counterparty accepts the channel. + * Serialize the DelayedPaymentKey object into a byte array which can be read by DelayedPaymentKey_read */ -void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +struct LDKCVec_u8Z DelayedPaymentKey_write(const struct LDKDelayedPaymentKey *NONNULL_PTR obj); /** - * True if the channel was initiated (and thus funded) by us. + * Read a DelayedPaymentKey from a byte array, created by DelayedPaymentKey_write */ -bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCResult_DelayedPaymentKeyDecodeErrorZ DelayedPaymentKey_read(struct LDKu8slice ser); /** - * True if the channel was initiated (and thus funded) by us. + * Frees any resources used by the HtlcBasepoint, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void HtlcBasepoint_free(struct LDKHtlcBasepoint this_obj); + +struct LDKPublicKey HtlcBasepoint_get_a(const struct LDKHtlcBasepoint *NONNULL_PTR this_ptr); + +void HtlcBasepoint_set_a(struct LDKHtlcBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * Constructs a new HtlcBasepoint given each field */ -bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKHtlcBasepoint HtlcBasepoint_new(struct LDKPublicKey a_arg); /** - * True if the channel is confirmed, channel_ready messages have been exchanged, and the - * channel is not currently being shut down. `channel_ready` message exchange implies the - * required confirmation count has been reached (and we were connected to the peer at some - * point after the funding transaction received enough confirmations). The required - * confirmation count is provided in [`confirmations_required`]. - * - * [`confirmations_required`]: ChannelDetails::confirmations_required + * Checks if two HtlcBasepoints 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. */ -void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +bool HtlcBasepoint_eq(const struct LDKHtlcBasepoint *NONNULL_PTR a, const struct LDKHtlcBasepoint *NONNULL_PTR b); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. - * - * Returns a copy of the field. + * Creates a copy of the HtlcBasepoint */ -struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKHtlcBasepoint HtlcBasepoint_clone(const struct LDKHtlcBasepoint *NONNULL_PTR orig); /** - * The stage of the channel's shutdown. - * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * Generates a non-cryptographic 64-bit hash of the HtlcBasepoint. */ -void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); +uint64_t HtlcBasepoint_hash(const struct LDKHtlcBasepoint *NONNULL_PTR o); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_channel_ready`. + * Get inner Public Key */ -bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey HtlcBasepoint_to_public_key(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg); /** - * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) - * the peer is connected, and (c) the channel is not currently negotiating a shutdown. - * - * This is a strict superset of `is_channel_ready`. + *Derives the \"tweak\" used in calculate [`HtlcKey::from_basepoint`].\n\n[`HtlcKey::from_basepoint`] calculates a private key as:\n`privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)`\n\nThis calculates the hash part in the tweak derivation process, which is used to\nensure that each key is unique and cannot be guessed by an external party. */ -void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKThirtyTwoBytes HtlcBasepoint_derive_add_tweak(const struct LDKHtlcBasepoint *NONNULL_PTR this_arg, struct LDKPublicKey per_commitment_point); /** - * True if this channel is (or will be) publicly-announced. + * Build a HtlcBasepoint from a PublicKey */ -bool ChannelDetails_get_is_announced(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKHtlcBasepoint HtlcBasepoint_from_PublicKey(struct LDKPublicKey f); /** - * True if this channel is (or will be) publicly-announced. + * Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read */ -void ChannelDetails_set_is_announced(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +struct LDKCVec_u8Z HtlcBasepoint_write(const struct LDKHtlcBasepoint *NONNULL_PTR obj); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * Read a HtlcBasepoint from a byte array, created by HtlcBasepoint_write */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCResult_HtlcBasepointDecodeErrorZ HtlcBasepoint_read(struct LDKu8slice ser); /** - * The smallest value HTLC (in msat) we will accept, for this channel. This field - * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + * Frees any resources used by the HtlcKey, if is_owned is set and inner is non-NULL. */ -void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void HtlcKey_free(struct LDKHtlcKey this_obj); + +struct LDKPublicKey HtlcKey_get_a(const struct LDKHtlcKey *NONNULL_PTR this_ptr); + +void HtlcKey_set_a(struct LDKHtlcKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * Constructs a new HtlcKey given each field */ -struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKHtlcKey HtlcKey_new(struct LDKPublicKey a_arg); /** - * The largest value HTLC (in msat) we currently will accept, for this channel. + * Checks if two HtlcKeys 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. */ -void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +bool HtlcKey_eq(const struct LDKHtlcKey *NONNULL_PTR a, const struct LDKHtlcKey *NONNULL_PTR b); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the HtlcKey */ -struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKHtlcKey HtlcKey_clone(const struct LDKHtlcKey *NONNULL_PTR orig); /** - * Set of configurable parameters that affect channel operation. - * - * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + *Derive a public htlcpubkey using one node\'s `per_commitment_point` and its countersignatory\'s `basepoint` */ -void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_basepoint(const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Pending inbound HTLCs. - * - * This field is empty for objects serialized with LDK versions prior to 0.0.122. + *Build a htlcpubkey directly from an already-derived private key */ -struct LDKCVec_InboundHTLCDetailsZ ChannelDetails_get_pending_inbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKHtlcKey HtlcKey_from_secret_key(const uint8_t (*sk)[32]); /** - * Pending inbound HTLCs. - * - * This field is empty for objects serialized with LDK versions prior to 0.0.122. + * Get inner Public Key */ -void ChannelDetails_set_pending_inbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_InboundHTLCDetailsZ val); +MUST_USE_RES struct LDKPublicKey HtlcKey_to_public_key(const struct LDKHtlcKey *NONNULL_PTR this_arg); /** - * Pending outbound HTLCs. - * - * This field is empty for objects serialized with LDK versions prior to 0.0.122. + * Serialize the HtlcKey object into a byte array which can be read by HtlcKey_read */ -struct LDKCVec_OutboundHTLCDetailsZ ChannelDetails_get_pending_outbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z HtlcKey_write(const struct LDKHtlcKey *NONNULL_PTR obj); /** - * Pending outbound HTLCs. - * - * This field is empty for objects serialized with LDK versions prior to 0.0.122. + * Read a HtlcKey from a byte array, created by HtlcKey_write */ -void ChannelDetails_set_pending_outbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_OutboundHTLCDetailsZ val); +struct LDKCResult_HtlcKeyDecodeErrorZ HtlcKey_read(struct LDKu8slice ser); /** - * Constructs a new ChannelDetails given each field + * Adds a tweak to a public key to derive a new public key. * - * 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 + * May panic if `tweak` is not the output of a SHA-256 hash. */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKChannelId 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 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_announced_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg, struct LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg, struct LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg); +struct LDKPublicKey add_public_key_tweak(struct LDKPublicKey base_point, const uint8_t (*tweak)[32]); /** - * Creates a copy of the ChannelDetails + * Frees any resources used by the RevocationBasepoint, if is_owned is set and inner is non-NULL. */ -struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); +void RevocationBasepoint_free(struct LDKRevocationBasepoint this_obj); + +struct LDKPublicKey RevocationBasepoint_get_a(const struct LDKRevocationBasepoint *NONNULL_PTR this_ptr); + +void RevocationBasepoint_set_a(struct LDKRevocationBasepoint *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Gets the current SCID which should be used to identify this channel for inbound payments. - * This should be used for providing invoice hints or in any other context where our - * counterparty will forward a payment to us. - * - * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the - * [`ChannelDetails::short_channel_id`]. See those for more information. + * Constructs a new RevocationBasepoint given each field */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRevocationBasepoint RevocationBasepoint_new(struct LDKPublicKey a_arg); /** - * Gets the current SCID which should be used to identify this channel for outbound payments. - * This should be used in [`Route`]s to describe the first hop or in other contexts where - * we're sending or forwarding a payment outbound over this channel. - * - * This is either the [`ChannelDetails::short_channel_id`], if set, or the - * [`ChannelDetails::outbound_scid_alias`]. See those for more information. - * - * [`Route`]: crate::routing::router::Route + * Checks if two RevocationBasepoints 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. */ -MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +bool RevocationBasepoint_eq(const struct LDKRevocationBasepoint *NONNULL_PTR a, const struct LDKRevocationBasepoint *NONNULL_PTR b); /** - * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read + * Creates a copy of the RevocationBasepoint */ -struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); +struct LDKRevocationBasepoint RevocationBasepoint_clone(const struct LDKRevocationBasepoint *NONNULL_PTR orig); /** - * Read a ChannelDetails from a byte array, created by ChannelDetails_write + * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); +uint64_t RevocationBasepoint_hash(const struct LDKRevocationBasepoint *NONNULL_PTR o); /** - * Creates a copy of the ChannelShutdownState + * Get inner Public Key */ -enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey RevocationBasepoint_to_public_key(const struct LDKRevocationBasepoint *NONNULL_PTR this_arg); /** - * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState + * Build a RevocationBasepoint from a PublicKey */ -enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); +struct LDKRevocationBasepoint RevocationBasepoint_from_PublicKey(struct LDKPublicKey f); /** - * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState + * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); +struct LDKCVec_u8Z RevocationBasepoint_write(const struct LDKRevocationBasepoint *NONNULL_PTR obj); /** - * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState + * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write */ -enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); +struct LDKCResult_RevocationBasepointDecodeErrorZ RevocationBasepoint_read(struct LDKu8slice ser); /** - * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState + * Frees any resources used by the RevocationKey, if is_owned is set and inner is non-NULL. */ -enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); +void RevocationKey_free(struct LDKRevocationKey this_obj); + +struct LDKPublicKey RevocationKey_get_a(const struct LDKRevocationKey *NONNULL_PTR this_ptr); + +void RevocationKey_set_a(struct LDKRevocationKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState + * Constructs a new RevocationKey given each field */ -enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); +MUST_USE_RES struct LDKRevocationKey RevocationKey_new(struct LDKPublicKey a_arg); /** - * Checks if two ChannelShutdownStates contain equal inner contents. + * Checks if two RevocationKeys 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 ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); +bool RevocationKey_eq(const struct LDKRevocationKey *NONNULL_PTR a, const struct LDKRevocationKey *NONNULL_PTR b); /** - * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read + * Creates a copy of the RevocationKey */ -struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); +struct LDKRevocationKey RevocationKey_clone(const struct LDKRevocationKey *NONNULL_PTR orig); /** - * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write + * Generates a non-cryptographic 64-bit hash of the RevocationKey. */ -struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); +uint64_t RevocationKey_hash(const struct LDKRevocationKey *NONNULL_PTR o); /** - * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. + * Derives a per-commitment-transaction revocation public key from one party's per-commitment + * point and the other party's [`RevocationBasepoint`]. This is the public equivalent of + * [`chan_utils::derive_private_revocation_key`] - using only public keys to derive a public + * key instead of private keys. + * + * Note that this is infallible iff we trust that at least one of the two input keys are randomly + * generated (ie our own). + * + * [`chan_utils::derive_private_revocation_key`]: crate::ln::chan_utils::derive_private_revocation_key */ -void ExpandedKey_free(struct LDKExpandedKey this_obj); +MUST_USE_RES struct LDKRevocationKey RevocationKey_from_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_basepoint, struct LDKPublicKey per_commitment_point); /** - * Generates a non-cryptographic 64-bit hash of the ExpandedKey. + * Get inner Public Key */ -uint64_t ExpandedKey_hash(const struct LDKExpandedKey *NONNULL_PTR o); +MUST_USE_RES struct LDKPublicKey RevocationKey_to_public_key(const struct LDKRevocationKey *NONNULL_PTR this_arg); /** - * Creates a copy of the ExpandedKey + * Serialize the RevocationKey object into a byte array which can be read by RevocationKey_read */ -struct LDKExpandedKey ExpandedKey_clone(const struct LDKExpandedKey *NONNULL_PTR orig); +struct LDKCVec_u8Z RevocationKey_write(const struct LDKRevocationKey *NONNULL_PTR obj); /** - * Checks if two ExpandedKeys 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. + * Read a RevocationKey from a byte array, created by RevocationKey_write */ -bool ExpandedKey_eq(const struct LDKExpandedKey *NONNULL_PTR a, const struct LDKExpandedKey *NONNULL_PTR b); +struct LDKCResult_RevocationKeyDecodeErrorZ RevocationKey_read(struct LDKu8slice ser); /** - * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. - * - * It is recommended to cache this value and not regenerate it for each new inbound payment. + * Creates a copy of the InboundHTLCStateDetails */ -MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(struct LDKThirtyTwoBytes key_material); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_clone(const enum LDKInboundHTLCStateDetails *NONNULL_PTR orig); /** - * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no - * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without - * a `ChannelManager`. - * - * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key`]. It is recommended to - * cache this value and not regenerate it for each new inbound payment. - * - * `current_time` is a Unix timestamp representing the current time. - * - * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. - * - * [phantom node payments]: crate::sign::PhantomKeysManager - * [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant InboundHTLCStateDetails */ -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); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); /** - * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], - * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments] - * without a `ChannelManager`. - * - * See [`create`] for information on the `keys` and `current_time` parameters. - * - * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable - * on versions of LDK prior to 0.0.114. - * - * [phantom node payments]: crate::sign::PhantomKeysManager + * Utility method to constructs a new Committed-variant InboundHTLCStateDetails */ -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); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_committed(void); /** - * Frees any resources used by the DecodeError + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFulfill-variant InboundHTLCStateDetails */ -void DecodeError_free(struct LDKDecodeError this_ptr); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fulfill(void); /** - * Creates a copy of the DecodeError + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFail-variant InboundHTLCStateDetails */ -struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); +enum LDKInboundHTLCStateDetails InboundHTLCStateDetails_awaiting_remote_revoke_to_remove_fail(void); /** - * Utility method to constructs a new UnknownVersion-variant DecodeError + * Serialize the InboundHTLCStateDetails object into a byte array which can be read by InboundHTLCStateDetails_read */ -struct LDKDecodeError DecodeError_unknown_version(void); +struct LDKCVec_u8Z InboundHTLCStateDetails_write(const enum LDKInboundHTLCStateDetails *NONNULL_PTR obj); /** - * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError + * Read a InboundHTLCStateDetails from a byte array, created by InboundHTLCStateDetails_write */ -struct LDKDecodeError DecodeError_unknown_required_feature(void); +struct LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ InboundHTLCStateDetails_read(struct LDKu8slice ser); /** - * Utility method to constructs a new InvalidValue-variant DecodeError + * Frees any resources used by the InboundHTLCDetails, if is_owned is set and inner is non-NULL. */ -struct LDKDecodeError DecodeError_invalid_value(void); +void InboundHTLCDetails_free(struct LDKInboundHTLCDetails this_obj); /** - * Utility method to constructs a new ShortRead-variant DecodeError + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. */ -struct LDKDecodeError DecodeError_short_read(void); +uint64_t InboundHTLCDetails_get_htlc_id(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BadLengthDescriptor-variant DecodeError + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. */ -struct LDKDecodeError DecodeError_bad_length_descriptor(void); +void InboundHTLCDetails_set_htlc_id(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new Io-variant DecodeError + * The amount in msat. */ -struct LDKDecodeError DecodeError_io(enum LDKIOError a); +uint64_t InboundHTLCDetails_get_amount_msat(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new UnsupportedCompression-variant DecodeError + * The amount in msat. */ -struct LDKDecodeError DecodeError_unsupported_compression(void); +void InboundHTLCDetails_set_amount_msat(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new DangerousValue-variant DecodeError + * The block height at which this HTLC expires. */ -struct LDKDecodeError DecodeError_dangerous_value(void); +uint32_t InboundHTLCDetails_get_cltv_expiry(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the DecodeError. + * The block height at which this HTLC expires. */ -uint64_t DecodeError_hash(const struct LDKDecodeError *NONNULL_PTR o); +void InboundHTLCDetails_set_cltv_expiry(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two DecodeErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The payment hash. */ -bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); +const uint8_t (*InboundHTLCDetails_get_payment_hash(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. + * The payment hash. */ -void Init_free(struct LDKInit this_obj); +void InboundHTLCDetails_set_payment_hash(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The relevant features which the sender supports. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`InboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); +struct LDKCOption_InboundHTLCStateDetailsZ InboundHTLCDetails_get_state(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * The relevant features which the sender supports. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`InboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +void InboundHTLCDetails_set_state(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_InboundHTLCStateDetailsZ val); /** - * Indicates chains the sender is interested in. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. * - * If there are no common chains, the connection will be closed. + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. * - * Returns a copy of the field. + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); +bool InboundHTLCDetails_get_is_dust(const struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Indicates chains the sender is interested in. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. * - * If there are no common chains, the connection will be closed. + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); +void InboundHTLCDetails_set_is_dust(struct LDKInboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * The receipient's network address. - * - * This adds the option to report a remote IP address back to a connecting peer using the init - * message. A node can decide to use that information to discover a potential update to its - * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing - * the new address. + * Constructs a new InboundHTLCDetails given each field */ -struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKInboundHTLCDetails InboundHTLCDetails_new(uint64_t htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_InboundHTLCStateDetailsZ state_arg, bool is_dust_arg); /** - * The receipient's network address. - * - * This adds the option to report a remote IP address back to a connecting peer using the init - * message. A node can decide to use that information to discover a potential update to its - * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing - * the new address. + * Creates a copy of the InboundHTLCDetails */ -void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); +struct LDKInboundHTLCDetails InboundHTLCDetails_clone(const struct LDKInboundHTLCDetails *NONNULL_PTR orig); /** - * Constructs a new Init given each field + * Serialize the InboundHTLCDetails object into a byte array which can be read by InboundHTLCDetails_read */ -MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); +struct LDKCVec_u8Z InboundHTLCDetails_write(const struct LDKInboundHTLCDetails *NONNULL_PTR obj); /** - * Creates a copy of the Init + * Read a InboundHTLCDetails from a byte array, created by InboundHTLCDetails_write */ -struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); +struct LDKCResult_InboundHTLCDetailsDecodeErrorZ InboundHTLCDetails_read(struct LDKu8slice ser); /** - * Generates a non-cryptographic 64-bit hash of the Init. + * Creates a copy of the OutboundHTLCStateDetails */ -uint64_t Init_hash(const struct LDKInit *NONNULL_PTR o); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_clone(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR orig); /** - * Checks if two Inits 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. + * Utility method to constructs a new AwaitingRemoteRevokeToAdd-variant OutboundHTLCStateDetails */ -bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_add(void); /** - * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Committed-variant OutboundHTLCStateDetails */ -void ErrorMessage_free(struct LDKErrorMessage this_obj); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_committed(void); /** - * The channel ID involved in the error. - * - * All-0s indicates a general error unrelated to a specific channel, after which all channels - * with the sending peer should be closed. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveSuccess-variant OutboundHTLCStateDetails */ -struct LDKChannelId ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_success(void); /** - * The channel ID involved in the error. - * - * All-0s indicates a general error unrelated to a specific channel, after which all channels - * with the sending peer should be closed. + * Utility method to constructs a new AwaitingRemoteRevokeToRemoveFailure-variant OutboundHTLCStateDetails */ -void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); +enum LDKOutboundHTLCStateDetails OutboundHTLCStateDetails_awaiting_remote_revoke_to_remove_failure(void); /** - * A possibly human-readable error description. + * Serialize the OutboundHTLCStateDetails object into a byte array which can be read by OutboundHTLCStateDetails_read + */ +struct LDKCVec_u8Z OutboundHTLCStateDetails_write(const enum LDKOutboundHTLCStateDetails *NONNULL_PTR obj); + +/** + * Read a OutboundHTLCStateDetails from a byte array, created by OutboundHTLCStateDetails_write + */ +struct LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ OutboundHTLCStateDetails_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the OutboundHTLCDetails, if is_owned is set and inner is non-NULL. + */ +void OutboundHTLCDetails_free(struct LDKOutboundHTLCDetails this_obj); + +/** + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. * - * The string should be sanitized before it is used (e.g., emitted to logs or printed to - * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in - * the terminal emulator or the logging subsystem. + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z OutboundHTLCDetails_get_htlc_id(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * A possibly human-readable error description. + * The HTLC ID. + * The IDs are incremented by 1 starting from 0 for each offered HTLC. + * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced + * and not part of any commitment transaction. * - * The string should be sanitized before it is used (e.g., emitted to logs or printed to - * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in - * the terminal emulator or the logging subsystem. + * Not present when we are awaiting a remote revocation and the HTLC is not added yet. */ -void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr val); +void OutboundHTLCDetails_set_htlc_id(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The amount in msat. + */ +uint64_t OutboundHTLCDetails_get_amount_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); + +/** + * The amount in msat. + */ +void OutboundHTLCDetails_set_amount_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new ErrorMessage given each field + * The block height at which this HTLC expires. */ -MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); +uint32_t OutboundHTLCDetails_get_cltv_expiry(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the ErrorMessage + * The block height at which this HTLC expires. */ -struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); +void OutboundHTLCDetails_set_cltv_expiry(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the ErrorMessage. + * The payment hash. */ -uint64_t ErrorMessage_hash(const struct LDKErrorMessage *NONNULL_PTR o); +const uint8_t (*OutboundHTLCDetails_get_payment_hash(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr))[32]; /** - * Checks if two ErrorMessages 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. + * The payment hash. */ -bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); +void OutboundHTLCDetails_set_payment_hash(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. + * The state of the HTLC in the state machine. + * + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -void WarningMessage_free(struct LDKWarningMessage this_obj); +struct LDKCOption_OutboundHTLCStateDetailsZ OutboundHTLCDetails_get_state(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * The channel ID involved in the warning. + * The state of the HTLC in the state machine. * - * All-0s indicates a warning unrelated to a specific channel. + * Determines on which commitment transactions the HTLC is included and what message the HTLC is + * waiting for to advance to the next state. + * + * See [`OutboundHTLCStateDetails`] for information on the specific states. + * + * LDK will always fill this field in, but when downgrading to prior versions of LDK, new + * states may result in `None` here. */ -struct LDKChannelId WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr); +void OutboundHTLCDetails_set_state(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_OutboundHTLCStateDetailsZ val); /** - * The channel ID involved in the warning. - * - * All-0s indicates a warning unrelated to a specific channel. + * The extra fee being skimmed off the top of this HTLC. */ -void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKCOption_u64Z OutboundHTLCDetails_get_skimmed_fee_msat(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * A possibly human-readable warning description. - * - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in - * the terminal emulator or the logging subsystem. + * The extra fee being skimmed off the top of this HTLC. */ -struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); +void OutboundHTLCDetails_set_skimmed_fee_msat(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * A possibly human-readable warning description. + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. * - * The string should be sanitized before it is used (e.g. emitted to logs or printed to - * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in - * the terminal emulator or the logging subsystem. + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); +bool OutboundHTLCDetails_get_is_dust(const struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr); /** - * Constructs a new WarningMessage given each field + * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed + * from the local commitment transaction and added to the commitment transaction fee. + * For non-anchor channels, this takes into account the cost of the second-stage HTLC + * transactions as well. + * + * When the local commitment transaction is broadcasted as part of a unilateral closure, + * the value of this HTLC will therefore not be claimable but instead burned as a transaction + * fee. + * + * Note that dust limits are specific to each party. An HTLC can be dust for the local + * commitment transaction but not for the counterparty's commitment transaction and vice versa. */ -MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); +void OutboundHTLCDetails_set_is_dust(struct LDKOutboundHTLCDetails *NONNULL_PTR this_ptr, bool val); /** - * Creates a copy of the WarningMessage + * Constructs a new OutboundHTLCDetails given each field */ -struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); +MUST_USE_RES struct LDKOutboundHTLCDetails OutboundHTLCDetails_new(struct LDKCOption_u64Z htlc_id_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_OutboundHTLCStateDetailsZ state_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, bool is_dust_arg); /** - * Generates a non-cryptographic 64-bit hash of the WarningMessage. + * Creates a copy of the OutboundHTLCDetails */ -uint64_t WarningMessage_hash(const struct LDKWarningMessage *NONNULL_PTR o); +struct LDKOutboundHTLCDetails OutboundHTLCDetails_clone(const struct LDKOutboundHTLCDetails *NONNULL_PTR orig); /** - * Checks if two WarningMessages 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. + * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read */ -bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b); +struct LDKCVec_u8Z OutboundHTLCDetails_write(const struct LDKOutboundHTLCDetails *NONNULL_PTR obj); /** - * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. + * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write */ -void Ping_free(struct LDKPing this_obj); +struct LDKCResult_OutboundHTLCDetailsDecodeErrorZ OutboundHTLCDetails_read(struct LDKu8slice ser); /** - * The desired response length. + * Frees any resources used by the CounterpartyForwardingInfo, if is_owned is set and inner is non-NULL. */ -uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj); /** - * The desired response length. + * Base routing fee in millisatoshis. */ -void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * The ping packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Base routing fee in millisatoshis. */ -uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); +void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * The ping packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); +uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Constructs a new Ping given each field + * Amount in millionths of a satoshi the channel will charge per transferred satoshi. */ -MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); +void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the Ping + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); +uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the Ping. + * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, + * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s + * `cltv_expiry_delta` for more details. */ -uint64_t Ping_hash(const struct LDKPing *NONNULL_PTR o); +void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Checks if two Pings 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. + * Constructs a new CounterpartyForwardingInfo given each field */ -bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); +MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg); /** - * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. + * Creates a copy of the CounterpartyForwardingInfo */ -void Pong_free(struct LDKPong this_obj); +struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig); /** - * The pong packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Serialize the CounterpartyForwardingInfo object into a byte array which can be read by CounterpartyForwardingInfo_read */ -uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z CounterpartyForwardingInfo_write(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR obj); /** - * The pong packet size. - * - * This field is not sent on the wire. byteslen zeros are sent. + * Read a CounterpartyForwardingInfo from a byte array, created by CounterpartyForwardingInfo_write */ -void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CounterpartyForwardingInfo_read(struct LDKu8slice ser); /** - * Constructs a new Pong given each field + * Frees any resources used by the ChannelCounterparty, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); +void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj); /** - * Creates a copy of the Pong + * The node_id of our counterparty */ -struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); +struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the Pong. + * The node_id of our counterparty */ -uint64_t Pong_hash(const struct LDKPong *NONNULL_PTR o); +void ChannelCounterparty_set_node_id(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if two Pongs 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. + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); +struct LDKInitFeatures ChannelCounterparty_get_features(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommonOpenChannelFields, if is_owned is set and inner is non-NULL. + * The Features the channel counterparty provided upon last connection. + * Useful for routing as it is the most up-to-date copy of the counterparty's features and + * many routing-relevant features are present in the init context. */ -void CommonOpenChannelFields_free(struct LDKCommonOpenChannelFields this_obj); +void ChannelCounterparty_set_features(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * The genesis hash of the blockchain where the channel is to be opened + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -const uint8_t (*CommonOpenChannelFields_get_chain_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr))[32]; +uint64_t ChannelCounterparty_get_unspendable_punishment_reserve(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * The value, in satoshis, that must always be held in the channel for our counterparty. This + * value ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * This value is not included in [`inbound_capacity_msat`] as it can never be spent. + * + * [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat */ -void CommonOpenChannelFields_set_chain_hash(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val); /** - * A temporary channel ID - * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint - * For V1 channels: a temporary channel ID, until the funding outpoint is announced + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKChannelId CommonOpenChannelFields_get_temporary_channel_id(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * A temporary channel ID - * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint - * For V1 channels: a temporary channel ID, until the funding outpoint is announced + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommonOpenChannelFields_set_temporary_channel_id(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); /** - * For V1 channels: The channel value - * For V2 channels: Part of the channel value contributed by the channel initiator + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -uint64_t CommonOpenChannelFields_get_funding_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * For V1 channels: The channel value - * For V2 channels: Part of the channel value contributed by the channel initiator + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. */ -void CommonOpenChannelFields_set_funding_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); +void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -uint64_t CommonOpenChannelFields_get_dust_limit_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. */ -void CommonOpenChannelFields_set_dust_limit_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); +void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * 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 */ -uint64_t CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +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); /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * Creates a copy of the ChannelCounterparty */ -void CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); +struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig); /** - * The minimum HTLC size incoming to channel initiator, in milli-satoshi + * Serialize the ChannelCounterparty object into a byte array which can be read by ChannelCounterparty_read */ -uint64_t CommonOpenChannelFields_get_htlc_minimum_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelCounterparty_write(const struct LDKChannelCounterparty *NONNULL_PTR obj); /** - * The minimum HTLC size incoming to channel initiator, in milli-satoshi + * Read a ChannelCounterparty from a byte array, created by ChannelCounterparty_write */ -void CommonOpenChannelFields_set_htlc_minimum_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ ChannelCounterparty_read(struct LDKu8slice ser); /** - * The feerate for the commitment transaction set by the channel initiator until updated by - * [`UpdateFee`] + * Frees any resources used by the ChannelDetails, if is_owned is set and inner is non-NULL. */ -uint32_t CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_free(struct LDKChannelDetails this_obj); /** - * The feerate for the commitment transaction set by the channel initiator until updated by - * [`UpdateFee`] + * The channel's ID (prior to initial channel setup this is a random 32 bytes, thereafter it is + * derived from channel funding or key material). + * + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -void CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint32_t val); +struct LDKChannelId ChannelDetails_get_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * The channel's ID (prior to initial channel setup this is a random 32 bytes, thereafter it is + * derived from channel funding or key material). + * + * Note that this means this value is *not* persistent - it can change once during the + * lifetime of the channel. */ -uint16_t CommonOpenChannelFields_get_to_self_delay(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * Parameters which apply to our counterparty. See individual fields for more information. */ -void CommonOpenChannelFields_set_to_self_delay(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); +struct LDKChannelCounterparty ChannelDetails_get_counterparty(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards channel initiator + * Parameters which apply to our counterparty. See individual fields for more information. */ -uint16_t CommonOpenChannelFields_get_max_accepted_htlcs(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_counterparty(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelCounterparty val); /** - * The maximum number of inbound HTLCs towards channel initiator + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommonOpenChannelFields_set_max_accepted_htlcs(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); +struct LDKOutPoint ChannelDetails_get_funding_txo(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The channel initiator's key controlling the funding transaction + * The Channel's funding transaction output, if we've negotiated the funding transaction with + * our counterparty already. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey CommonOpenChannelFields_get_funding_pubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_funding_txo(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The channel initiator's key controlling the funding transaction + * The features which this channel operates with. See individual features for more info. + * + * `None` until negotiation completes and the channel type is finalized. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommonOpenChannelFields_set_funding_pubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKChannelTypeFeatures ChannelDetails_get_channel_type(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * The features which this channel operates with. See individual features for more info. + * + * `None` until negotiation completes and the channel type is finalized. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey CommonOpenChannelFields_get_revocation_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. + * + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ -void CommonOpenChannelFields_set_revocation_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * A payment key to channel initiator for transactions broadcast by counterparty + * The position of the funding transaction in the chain. None if the funding transaction has + * not yet been confirmed and the channel fully opened. + * + * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound + * payments instead of this. See [`get_inbound_payment_scid`]. + * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias + * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ -struct LDKPublicKey CommonOpenChannelFields_get_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * A payment key to channel initiator for transactions broadcast by counterparty + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). + * + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required */ -void CommonOpenChannelFields_set_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to channel initiator for transactions broadcast by channel - * initiator + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). + * + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required */ -struct LDKPublicKey CommonOpenChannelFields_get_delayed_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Used to derive a payment key to channel initiator for transactions broadcast by channel - * initiator + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. + * + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id */ -void CommonOpenChannelFields_set_delayed_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCOption_u64Z ChannelDetails_get_inbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Used to derive an HTLC payment key to channel initiator + * An optional [`short_channel_id`] alias for this channel, randomly generated by our + * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our + * counterparty will recognize the alias provided here in place of the [`short_channel_id`] + * when they see a payment to be routed to us. + * + * Our counterparty may choose to rotate this value at any time, though will always recognize + * previous values for inbound payment forwarding. + * + * [`short_channel_id`]: Self::short_channel_id */ -struct LDKPublicKey CommonOpenChannelFields_get_htlc_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_inbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Used to derive an HTLC payment key to channel initiator + * The value, in satoshis, of this channel as appears in the funding output + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). */ -void CommonOpenChannelFields_set_htlc_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t ChannelDetails_get_channel_value_satoshis(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The first to-be-broadcast-by-channel-initiator transaction's per commitment point + * The value, in satoshis, of this channel as appears in the funding output + * + * When a channel is spliced, this continues to refer to the original pre-splice channel + * state until the splice transaction reaches sufficient confirmations to be locked (and we + * exchange `splice_locked` messages with our peer). */ -struct LDKPublicKey CommonOpenChannelFields_get_first_per_commitment_point(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_channel_value_satoshis(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * The first to-be-broadcast-by-channel-initiator transaction's per commitment point + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -void CommonOpenChannelFields_set_first_per_commitment_point(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The channel flags to be used + * The value, in satoshis, that must always be held in the channel for us. This value ensures + * that if we broadcast a revoked state, our counterparty can punish us by claiming at least + * this value on chain. + * + * This value is not included in [`outbound_capacity_msat`] as it can never be spent. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat */ -uint8_t CommonOpenChannelFields_get_channel_flags(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The channel flags to be used + * 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 CommonOpenChannelFields_set_channel_flags(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint8_t val); +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we - * collaboratively close + * 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 LDKCOption_CVec_u8ZZ CommonOpenChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); /** - * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we - * collaboratively close + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -void CommonOpenChannelFields_set_shutdown_scriptpubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent - * - * If this is `None`, we derive the channel type from the intersection of our - * feature bits with our counterparty's feature bits from the [`Init`] message. + * The currently negotiated fee rate denominated in satoshi per 1000 weight units, + * which is applied to commitment and HTLC transactions. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * This value will be `None` for objects serialized with LDK versions prior to 0.0.115. */ -struct LDKChannelTypeFeatures CommonOpenChannelFields_get_channel_type(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); +void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * The channel type that this channel will represent + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. * - * If this is `None`, we derive the channel type from the intersection of our - * feature bits with our counterparty's feature bits from the [`Init`] message. + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. + */ +uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The available outbound capacity for sending HTLCs to the remote peer. This does not include + * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new outbound HTLCs). This further does not include any pending + * outgoing HTLCs which are awaiting some other resolution to be sent. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we + * should be able to spend nearly this amount. */ -void CommonOpenChannelFields_set_channel_type(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new CommonOpenChannelFields given each field + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and + * [`ChannelDetails::outbound_capacity_msat`]. */ -MUST_USE_RES struct LDKCommonOpenChannelFields CommonOpenChannelFields_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKChannelId 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 commitment_feerate_sat_per_1000_weight_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, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the CommonOpenChannelFields + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and + * [`ChannelDetails::outbound_capacity_msat`]. */ -struct LDKCommonOpenChannelFields CommonOpenChannelFields_clone(const struct LDKCommonOpenChannelFields *NONNULL_PTR orig); +void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields. + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -uint64_t CommonOpenChannelFields_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR o); +uint64_t ChannelDetails_get_next_outbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two CommonOpenChannelFieldss 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. + * The minimum value for sending a single HTLC to the remote peer. This is the equivalent of + * [`ChannelDetails::next_outbound_htlc_limit_msat`] but represents a lower-bound, rather than + * an upper-bound. This is intended for use when routing, allowing us to ensure we pick a + * route which is valid. */ -bool CommonOpenChannelFields_eq(const struct LDKCommonOpenChannelFields *NONNULL_PTR a, const struct LDKCommonOpenChannelFields *NONNULL_PTR b); +void ChannelDetails_set_next_outbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * The [`ChannelParameters`] for this channel. + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -MUST_USE_RES struct LDKChannelParameters CommonOpenChannelFields_channel_parameters(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_arg); +uint64_t ChannelDetails_get_inbound_capacity_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelParameters, if is_owned is set and inner is non-NULL. + * The available inbound capacity for the remote peer to send HTLCs to us. This does not + * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not + * available for inclusion in new inbound HTLCs). + * Note that there are some corner cases not fully handled here, so the actual available + * inbound capacity may be slightly higher than this. + * + * This value is not exact. Due to various in-flight changes, feerate changes, and our + * counterparty's conflict-avoidance policy, exactly this amount is not likely to be spendable. + * However, our counterparty should be able to spend nearly this amount. */ -void ChannelParameters_free(struct LDKChannelParameters this_obj); +void ChannelDetails_set_inbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted. + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -uint64_t ChannelParameters_get_dust_limit_satoshis(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The threshold below which outputs on transactions broadcast by the channel initiator will be - * omitted. + * The number of required confirmations on the funding transaction before the funding will be + * considered \"locked\". This number is selected by the channel fundee (i.e. us if + * [`is_outbound`] is *not* set), and can be selected for inbound channels with + * [`ChannelHandshakeConfig::minimum_depth`] or limited for outbound channels with + * [`ChannelHandshakeLimits::max_minimum_depth`]. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. + * + * [`is_outbound`]: ChannelDetails::is_outbound + * [`ChannelHandshakeConfig::minimum_depth`]: crate::util::config::ChannelHandshakeConfig::minimum_depth + * [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth */ -void ChannelParameters_set_dust_limit_satoshis(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. */ -uint64_t ChannelParameters_get_max_htlc_value_in_flight_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. */ -void ChannelParameters_set_max_htlc_value_in_flight_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -uint64_t ChannelParameters_get_htlc_minimum_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +struct LDKCOption_u16Z ChannelDetails_get_force_close_spend_delay(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi + * The number of blocks (after our commitment transaction confirms) that we will need to wait + * until we can claim our funds after we force-close the channel. During this time our + * counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty + * force-closes the channel and broadcasts a commitment transaction we do not have to wait any + * time to claim our non-HTLC-encumbered funds. + * + * This value will be `None` for outbound channels until the counterparty accepts the channel. */ -void ChannelParameters_set_htlc_minimum_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_force_close_spend_delay(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * The feerate for the commitment transaction set by the channel initiator until updated by - * [`UpdateFee`] + * True if the channel was initiated (and thus funded) by us. */ -uint32_t ChannelParameters_get_commitment_feerate_sat_per_1000_weight(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The feerate for the commitment transaction set by the channel initiator until updated by - * [`UpdateFee`] + * True if the channel was initiated (and thus funded) by us. */ -void ChannelParameters_set_commitment_feerate_sat_per_1000_weight(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint32_t val); +void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * The number of blocks which the non-channel-initator will have to wait to claim on-chain - * funds if they broadcast a commitment transaction. + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -uint16_t ChannelParameters_get_to_self_delay(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The number of blocks which the non-channel-initator will have to wait to claim on-chain - * funds if they broadcast a commitment transaction. + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the + * required confirmation count has been reached (and we were connected to the peer at some + * point after the funding transaction received enough confirmations). The required + * confirmation count is provided in [`confirmations_required`]. + * + * [`confirmations_required`]: ChannelDetails::confirmations_required */ -void ChannelParameters_set_to_self_delay(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); +void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * The maximum number of pending HTLCs towards the channel initiator. + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. + * + * Returns a copy of the field. */ -uint16_t ChannelParameters_get_max_accepted_htlcs(const struct LDKChannelParameters *NONNULL_PTR this_ptr); +struct LDKCOption_ChannelShutdownStateZ ChannelDetails_get_channel_shutdown_state(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The maximum number of pending HTLCs towards the channel initiator. + * The stage of the channel's shutdown. + * `None` for `ChannelDetails` serialized on LDK versions prior to 0.0.116. */ -void ChannelParameters_set_max_accepted_htlcs(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); +void ChannelDetails_set_channel_shutdown_state(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_ChannelShutdownStateZ val); /** - * Constructs a new ChannelParameters given each field + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_channel_ready`. */ -MUST_USE_RES struct LDKChannelParameters ChannelParameters_new(uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg); +bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelParameters + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) + * the peer is connected, and (c) the channel is not currently negotiating a shutdown. + * + * This is a strict superset of `is_channel_ready`. */ -struct LDKChannelParameters ChannelParameters_clone(const struct LDKChannelParameters *NONNULL_PTR orig); +void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Generates a non-cryptographic 64-bit hash of the ChannelParameters. + * True if this channel is (or will be) publicly-announced. */ -uint64_t ChannelParameters_hash(const struct LDKChannelParameters *NONNULL_PTR o); +bool ChannelDetails_get_is_announced(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Checks if two ChannelParameterss 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. + * True if this channel is (or will be) publicly-announced. */ -bool ChannelParameters_eq(const struct LDKChannelParameters *NONNULL_PTR a, const struct LDKChannelParameters *NONNULL_PTR b); +void ChannelDetails_set_is_announced(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -void OpenChannel_free(struct LDKOpenChannel this_obj); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Common fields of `open_channel(2)`-like messages + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 */ -struct LDKCommonOpenChannelFields OpenChannel_get_common_fields(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Common fields of `open_channel(2)`-like messages + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -void OpenChannel_set_common_fields(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * The largest value HTLC (in msat) we currently will accept, for this channel. */ -uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The amount to push to the counterparty as part of the open, in milli-satoshi + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_InboundHTLCDetailsZ ChannelDetails_get_pending_inbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Constructs a new OpenChannel given each field + * Pending inbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKCommonOpenChannelFields common_fields_arg, uint64_t push_msat_arg, uint64_t channel_reserve_satoshis_arg); +void ChannelDetails_set_pending_inbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_InboundHTLCDetailsZ val); /** - * Creates a copy of the OpenChannel + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); +struct LDKCVec_OutboundHTLCDetailsZ ChannelDetails_get_pending_outbound_htlcs(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the OpenChannel. + * Pending outbound HTLCs. + * + * This field is empty for objects serialized with LDK versions prior to 0.0.122. */ -uint64_t OpenChannel_hash(const struct LDKOpenChannel *NONNULL_PTR o); +void ChannelDetails_set_pending_outbound_htlcs(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCVec_OutboundHTLCDetailsZ val); /** - * Checks if two OpenChannels 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. + * The witness script that is used to lock the channel's funding output to commitment + * transactions. + * + * When a channel is spliced, this continues to refer to the original funding output (which + * was spent by the splice transaction) until the splice transaction reached sufficient + * confirmations to be locked (and we exchange `splice_locked` messages with our peer). + * + * This field will be `None` for objects serialized with LDK versions prior to 0.2.0. */ -bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); +struct LDKCOption_CVec_u8ZZ ChannelDetails_get_funding_redeem_script(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL. + * The witness script that is used to lock the channel's funding output to commitment + * transactions. + * + * When a channel is spliced, this continues to refer to the original funding output (which + * was spent by the splice transaction) until the splice transaction reached sufficient + * confirmations to be locked (and we exchange `splice_locked` messages with our peer). + * + * This field will be `None` for objects serialized with LDK versions prior to 0.2.0. */ -void OpenChannelV2_free(struct LDKOpenChannelV2 this_obj); +void ChannelDetails_set_funding_redeem_script(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Common fields of `open_channel(2)`-like messages + * 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 */ -struct LDKCommonOpenChannelFields OpenChannelV2_get_common_fields(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKChannelId 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 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_announced_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg, struct LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg, struct LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg, struct LDKCOption_CVec_u8ZZ funding_redeem_script_arg); /** - * Common fields of `open_channel(2)`-like messages + * Creates a copy of the ChannelDetails */ -void OpenChannelV2_set_common_fields(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); +struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NONNULL_PTR orig); /** - * The feerate for the funding transaction set by the channel initiator + * Gets the current SCID which should be used to identify this channel for inbound payments. + * This should be used for providing invoice hints or in any other context where our + * counterparty will forward a payment to us. + * + * This is either the [`ChannelDetails::inbound_scid_alias`], if set, or the + * [`ChannelDetails::short_channel_id`]. See those for more information. */ -uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * The feerate for the funding transaction set by the channel initiator + * Gets the current SCID which should be used to identify this channel for outbound payments. + * This should be used in [`Route`]s to describe the first hop or in other contexts where + * we're sending or forwarding a payment outbound over this channel. + * + * This is either the [`ChannelDetails::short_channel_id`], if set, or the + * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + * + * [`Route`]: crate::routing::router::Route */ -void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * The locktime for the funding transaction + * Gets the funding output for this channel, if available. + * + * When a channel is spliced, this continues to refer to the original funding output (which + * was spent by the splice transaction) until the splice transaction reaches sufficient + * confirmations to be locked (and we exchange `splice_locked` messages with our peer). */ -uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_TxOutZ ChannelDetails_get_funding_output(const struct LDKChannelDetails *NONNULL_PTR this_arg); /** - * The locktime for the funding transaction + * Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read */ -void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCVec_u8Z ChannelDetails_write(const struct LDKChannelDetails *NONNULL_PTR obj); /** - * The second to-be-broadcast-by-channel-initiator transaction's per commitment point + * Read a ChannelDetails from a byte array, created by ChannelDetails_write */ -struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelDetailsDecodeErrorZ ChannelDetails_read(struct LDKu8slice ser); /** - * The second to-be-broadcast-by-channel-initiator transaction's per commitment point + * Creates a copy of the ChannelShutdownState */ -void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +enum LDKChannelShutdownState ChannelShutdownState_clone(const enum LDKChannelShutdownState *NONNULL_PTR orig); /** - * Optionally, a requirement that only confirmed inputs can be added + * Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState */ -enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); +enum LDKChannelShutdownState ChannelShutdownState_not_shutting_down(void); /** - * Optionally, a requirement that only confirmed inputs can be added + * Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState */ -void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_initiated(void); /** - * Constructs a new OpenChannelV2 given each field + * Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState */ -MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKCommonOpenChannelFields common_fields_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t locktime_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +enum LDKChannelShutdownState ChannelShutdownState_resolving_htlcs(void); /** - * Creates a copy of the OpenChannelV2 + * Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState */ -struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig); +enum LDKChannelShutdownState ChannelShutdownState_negotiating_closing_fee(void); /** - * Generates a non-cryptographic 64-bit hash of the OpenChannelV2. + * Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState */ -uint64_t OpenChannelV2_hash(const struct LDKOpenChannelV2 *NONNULL_PTR o); +enum LDKChannelShutdownState ChannelShutdownState_shutdown_complete(void); /** - * Checks if two OpenChannelV2s contain equal inner contents. + * Checks if two ChannelShutdownStates 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 OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b); - -/** - * Frees any resources used by the CommonAcceptChannelFields, if is_owned is set and inner is non-NULL. */ -void CommonAcceptChannelFields_free(struct LDKCommonAcceptChannelFields this_obj); +bool ChannelShutdownState_eq(const enum LDKChannelShutdownState *NONNULL_PTR a, const enum LDKChannelShutdownState *NONNULL_PTR b); /** - * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. + * Serialize the ChannelShutdownState object into a byte array which can be read by ChannelShutdownState_read */ -struct LDKChannelId CommonAcceptChannelFields_get_temporary_channel_id(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelShutdownState_write(const enum LDKChannelShutdownState *NONNULL_PTR obj); /** - * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. + * Read a ChannelShutdownState from a byte array, created by ChannelShutdownState_write */ -void CommonAcceptChannelFields_set_temporary_channel_id(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(struct LDKu8slice ser); /** - * The threshold below which outputs on transactions broadcast by the channel acceptor will be - * omitted + * Frees any resources used by the PendingHTLCRouting */ -uint64_t CommonAcceptChannelFields_get_dust_limit_satoshis(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +void PendingHTLCRouting_free(struct LDKPendingHTLCRouting this_ptr); /** - * The threshold below which outputs on transactions broadcast by the channel acceptor will be - * omitted + * Creates a copy of the PendingHTLCRouting */ -void CommonAcceptChannelFields_set_dust_limit_satoshis(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPendingHTLCRouting PendingHTLCRouting_clone(const struct LDKPendingHTLCRouting *NONNULL_PTR orig); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * Utility method to constructs a new Forward-variant PendingHTLCRouting */ -uint64_t CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKPendingHTLCRouting PendingHTLCRouting_forward(struct LDKOnionPacket onion_packet, uint64_t short_channel_id, struct LDKBlindedForward blinded, struct LDKCOption_u32Z incoming_cltv_expiry, enum LDKCOption_NoneZ hold_htlc); /** - * The maximum inbound HTLC value in flight towards sender, in milli-satoshi + * Utility method to constructs a new TrampolineForward-variant PendingHTLCRouting */ -void CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPendingHTLCRouting PendingHTLCRouting_trampoline_forward(struct LDKThirtyTwoBytes incoming_shared_secret, struct LDKTrampolineOnionPacket onion_packet, struct LDKPublicKey node_id, struct LDKBlindedForward blinded, uint32_t incoming_cltv_expiry); /** - * The minimum HTLC size incoming to channel acceptor, in milli-satoshi + * Utility method to constructs a new Receive-variant PendingHTLCRouting */ -uint64_t CommonAcceptChannelFields_get_htlc_minimum_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopData payment_data, struct LDKCOption_CVec_u8ZZ payment_metadata, struct LDKCOption_PaymentContextZ payment_context, uint32_t incoming_cltv_expiry, struct LDKThirtyTwoBytes phantom_shared_secret, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); /** - * The minimum HTLC size incoming to channel acceptor, in milli-satoshi + * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting */ -void CommonAcceptChannelFields_set_htlc_minimum_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error, bool has_recipient_created_payment_secret, struct LDKInvoiceRequest invoice_request, struct LDKCOption_PaymentContextZ payment_context); /** - * Minimum depth of the funding transaction before the channel is considered open + * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL. */ -uint32_t CommonAcceptChannelFields_get_minimum_depth(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +void BlindedForward_free(struct LDKBlindedForward this_obj); /** - * Minimum depth of the funding transaction before the channel is considered open + * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. */ -void CommonAcceptChannelFields_set_minimum_depth(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint32_t val); +struct LDKPublicKey BlindedForward_get_inbound_blinding_point(const struct LDKBlindedForward *NONNULL_PTR this_ptr); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound + * onion payload if we're the introduction node. Useful for calculating the next hop's + * [`msgs::UpdateAddHTLC::blinding_point`]. */ -uint16_t CommonAcceptChannelFields_get_to_self_delay(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +void BlindedForward_set_inbound_blinding_point(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The number of blocks which the counterparty will have to wait to claim on-chain funds if they - * broadcast a commitment transaction + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. */ -void CommonAcceptChannelFields_set_to_self_delay(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); +enum LDKBlindedFailure BlindedForward_get_failure(const struct LDKBlindedForward *NONNULL_PTR this_ptr); /** - * The maximum number of inbound HTLCs towards channel acceptor + * If needed, this determines how this HTLC should be failed backwards, based on whether we are + * the introduction node. */ -uint16_t CommonAcceptChannelFields_get_max_accepted_htlcs(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +void BlindedForward_set_failure(struct LDKBlindedForward *NONNULL_PTR this_ptr, enum LDKBlindedFailure val); /** - * The maximum number of inbound HTLCs towards channel acceptor + * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being + * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that + * starts at the next hop. + * + * [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommonAcceptChannelFields_set_max_accepted_htlcs(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); +struct LDKPublicKey BlindedForward_get_next_blinding_override(const struct LDKBlindedForward *NONNULL_PTR this_ptr); /** - * The channel acceptor's key controlling the funding transaction + * Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being + * forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that + * starts at the next hop. + * + * [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPublicKey CommonAcceptChannelFields_get_funding_pubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +void BlindedForward_set_next_blinding_override(struct LDKBlindedForward *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The channel acceptor's key controlling the funding transaction + * Constructs a new BlindedForward given each field + * + * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommonAcceptChannelFields_set_funding_pubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKBlindedForward BlindedForward_new(struct LDKPublicKey inbound_blinding_point_arg, enum LDKBlindedFailure failure_arg, struct LDKPublicKey next_blinding_override_arg); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Creates a copy of the BlindedForward */ -struct LDKPublicKey CommonAcceptChannelFields_get_revocation_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKBlindedForward BlindedForward_clone(const struct LDKBlindedForward *NONNULL_PTR orig); /** - * Used to derive a revocation key for transactions broadcast by counterparty + * Generates a non-cryptographic 64-bit hash of the BlindedForward. */ -void CommonAcceptChannelFields_set_revocation_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t BlindedForward_hash(const struct LDKBlindedForward *NONNULL_PTR o); /** - * A payment key to channel acceptor for transactions broadcast by counterparty + * Checks if two BlindedForwards 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. */ -struct LDKPublicKey CommonAcceptChannelFields_get_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +bool BlindedForward_eq(const struct LDKBlindedForward *NONNULL_PTR a, const struct LDKBlindedForward *NONNULL_PTR b); /** - * A payment key to channel acceptor for transactions broadcast by counterparty + * Frees any resources used by the PendingHTLCInfo, if is_owned is set and inner is non-NULL. */ -void CommonAcceptChannelFields_set_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void PendingHTLCInfo_free(struct LDKPendingHTLCInfo this_obj); /** - * Used to derive a payment key to channel acceptor for transactions broadcast by channel - * acceptor + * Further routing details based on whether the HTLC is being forwarded or received. */ -struct LDKPublicKey CommonAcceptChannelFields_get_delayed_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKPendingHTLCRouting PendingHTLCInfo_get_routing(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Used to derive a payment key to channel acceptor for transactions broadcast by channel - * acceptor + * Further routing details based on whether the HTLC is being forwarded or received. */ -void CommonAcceptChannelFields_set_delayed_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void PendingHTLCInfo_set_routing(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKPendingHTLCRouting val); /** - * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. */ -struct LDKPublicKey CommonAcceptChannelFields_get_htlc_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +const uint8_t (*PendingHTLCInfo_get_incoming_shared_secret(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; /** - * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty + * The onion shared secret we build with the sender used to decrypt the onion. + * + * This is later used to encrypt failure packets in the event that the HTLC is failed. */ -void CommonAcceptChannelFields_set_htlc_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void PendingHTLCInfo_set_incoming_shared_secret(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. */ -struct LDKPublicKey CommonAcceptChannelFields_get_first_per_commitment_point(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +const uint8_t (*PendingHTLCInfo_get_payment_hash(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr))[32]; /** - * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Hash of the payment preimage, to lock the payment until the receiver releases the preimage. */ -void CommonAcceptChannelFields_set_first_per_commitment_point(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void PendingHTLCInfo_set_payment_hash(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we - * collaboratively close + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. */ -struct LDKCOption_CVec_u8ZZ CommonAcceptChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z PendingHTLCInfo_get_incoming_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we - * collaboratively close + * Amount received in the incoming HTLC. + * + * This field was added in LDK 0.0.113 and will be `None` for objects written by prior + * versions. */ -void CommonAcceptChannelFields_set_shutdown_scriptpubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +void PendingHTLCInfo_set_incoming_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. * - * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s - * [`CommonOpenChannelFields::channel_type`]. + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. */ -struct LDKChannelTypeFeatures CommonAcceptChannelFields_get_channel_type(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); +uint64_t PendingHTLCInfo_get_outgoing_amt_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * The channel type that this channel will represent. If none is set, we derive the channel - * type from the intersection of our feature bits with our counterparty's feature bits from - * the Init message. + * The amount the sender indicated should be forwarded on to the next hop or amount the sender + * intended for us to receive for received payments. * - * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s - * [`CommonOpenChannelFields::channel_type`]. + * If the received amount is less than this for received payments, an intermediary hop has + * attempted to steal some of our funds and we should fail the HTLC (the sender should retry + * it along another path). * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Because nodes can take less than their required fees, and because senders may wish to + * improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for + * received payments. In such cases, recipients must handle this HTLC as if it had received + * [`Self::outgoing_amt_msat`]. + */ +void PendingHTLCInfo_set_outgoing_amt_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint64_t val); + +/** + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). */ -void CommonAcceptChannelFields_set_channel_type(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +uint32_t PendingHTLCInfo_get_outgoing_cltv_value(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Constructs a new CommonAcceptChannelFields given each field - * - * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated + * should have been set on the received HTLC for received payments). */ -MUST_USE_RES struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_new(struct LDKChannelId temporary_channel_id_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 LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); +void PendingHTLCInfo_set_outgoing_cltv_value(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the CommonAcceptChannelFields + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. */ -struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_clone(const struct LDKCommonAcceptChannelFields *NONNULL_PTR orig); +struct LDKCOption_u64Z PendingHTLCInfo_get_skimmed_fee_msat(const struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields. + * The fee taken for this HTLC in addition to the standard protocol HTLC fees. + * + * If this is a payment for forwarding, this is the fee we are taking before forwarding the + * HTLC. + * + * If this is a received payment, this is the fee that our counterparty took. + * + * This is used to allow LSPs to take fees as a part of payments, without the sender having to + * shoulder them. */ -uint64_t CommonAcceptChannelFields_hash(const struct LDKCommonAcceptChannelFields *NONNULL_PTR o); +void PendingHTLCInfo_set_skimmed_fee_msat(struct LDKPendingHTLCInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Checks if two CommonAcceptChannelFieldss 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. + * Constructs a new PendingHTLCInfo given each field */ -bool CommonAcceptChannelFields_eq(const struct LDKCommonAcceptChannelFields *NONNULL_PTR a, const struct LDKCommonAcceptChannelFields *NONNULL_PTR b); +MUST_USE_RES struct LDKPendingHTLCInfo PendingHTLCInfo_new(struct LDKPendingHTLCRouting routing_arg, struct LDKThirtyTwoBytes incoming_shared_secret_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u64Z incoming_amt_msat_arg, uint64_t outgoing_amt_msat_arg, uint32_t outgoing_cltv_value_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg); /** - * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. + * Creates a copy of the PendingHTLCInfo */ -void AcceptChannel_free(struct LDKAcceptChannel this_obj); +struct LDKPendingHTLCInfo PendingHTLCInfo_clone(const struct LDKPendingHTLCInfo *NONNULL_PTR orig); /** - * Common fields of `accept_channel(2)`-like messages + * Creates a copy of the BlindedFailure */ -struct LDKCommonAcceptChannelFields AcceptChannel_get_common_fields(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +enum LDKBlindedFailure BlindedFailure_clone(const enum LDKBlindedFailure *NONNULL_PTR orig); /** - * Common fields of `accept_channel(2)`-like messages + * Utility method to constructs a new FromIntroductionNode-variant BlindedFailure */ -void AcceptChannel_set_common_fields(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); +enum LDKBlindedFailure BlindedFailure_from_introduction_node(void); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Utility method to constructs a new FromBlindedNode-variant BlindedFailure */ -uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); +enum LDKBlindedFailure BlindedFailure_from_blinded_node(void); /** - * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel + * Generates a non-cryptographic 64-bit hash of the BlindedFailure. */ -void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); +uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o); /** - * Constructs a new AcceptChannel given each field + * Checks if two BlindedFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t channel_reserve_satoshis_arg); +bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b); /** - * Creates a copy of the AcceptChannel + * Calls the free function if one is set */ -struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); +void Verification_free(struct LDKVerification this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the AcceptChannel. + * Constructs a new Verification which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Verification must be freed before this_arg is */ -uint64_t AcceptChannel_hash(const struct LDKAcceptChannel *NONNULL_PTR o); +struct LDKVerification UnauthenticatedReceiveTlvs_as_Verification(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_arg); /** - * Checks if two AcceptChannels 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. + * Frees any resources used by the OptionalOfferPaymentParams, if is_owned is set and inner is non-NULL. */ -bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); +void OptionalOfferPaymentParams_free(struct LDKOptionalOfferPaymentParams this_obj); /** - * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL. + * A note that is communicated to the recipient about this payment via + * [`InvoiceRequest::payer_note`]. */ -void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj); +struct LDKCOption_StrZ OptionalOfferPaymentParams_get_payer_note(const struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr); /** - * Common fields of `accept_channel(2)`-like messages + * A note that is communicated to the recipient about this payment via + * [`InvoiceRequest::payer_note`]. */ -struct LDKCommonAcceptChannelFields AcceptChannelV2_get_common_fields(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +void OptionalOfferPaymentParams_set_payer_note(struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr, struct LDKCOption_StrZ val); /** - * Common fields of `accept_channel(2)`-like messages + * Pathfinding options which tweak how the path is constructed to the recipient. */ -void AcceptChannelV2_set_common_fields(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); +struct LDKRouteParametersConfig OptionalOfferPaymentParams_get_route_params_config(const struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr); /** - * Part of the channel value contributed by the channel acceptor + * Pathfinding options which tweak how the path is constructed to the recipient. */ -uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +void OptionalOfferPaymentParams_set_route_params_config(struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr, struct LDKRouteParametersConfig val); /** - * Part of the channel value contributed by the channel acceptor + * The number of tries or time during which we'll retry this payment if some paths to the + * recipient fail. + * + * Once the retry limit is reached, further path failures will not be retried and the payment + * will ultimately fail once all pending paths have failed (generating an + * [`Event::PaymentFailed`]). */ -void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); +struct LDKRetry OptionalOfferPaymentParams_get_retry_strategy(const struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr); /** - * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point + * The number of tries or time during which we'll retry this payment if some paths to the + * recipient fail. + * + * Once the retry limit is reached, further path failures will not be retried and the payment + * will ultimately fail once all pending paths have failed (generating an + * [`Event::PaymentFailed`]). */ -struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +void OptionalOfferPaymentParams_set_retry_strategy(struct LDKOptionalOfferPaymentParams *NONNULL_PTR this_ptr, struct LDKRetry val); /** - * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point + * Constructs a new OptionalOfferPaymentParams given each field */ -void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKOptionalOfferPaymentParams OptionalOfferPaymentParams_new(struct LDKCOption_StrZ payer_note_arg, struct LDKRouteParametersConfig route_params_config_arg, struct LDKRetry retry_strategy_arg); /** - * Optionally, a requirement that only confirmed inputs can be added + * Creates a "default" OptionalOfferPaymentParams. See struct and individual field documentaiton for details on which values are used. */ -enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKOptionalOfferPaymentParams OptionalOfferPaymentParams_default(void); /** - * Optionally, a requirement that only confirmed inputs can be added + * Frees any resources used by the FailureCode */ -void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +void FailureCode_free(struct LDKFailureCode this_ptr); /** - * Constructs a new AcceptChannelV2 given each field + * Creates a copy of the FailureCode */ -MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t funding_satoshis_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +struct LDKFailureCode FailureCode_clone(const struct LDKFailureCode *NONNULL_PTR orig); /** - * Creates a copy of the AcceptChannelV2 + * Utility method to constructs a new TemporaryNodeFailure-variant FailureCode */ -struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig); +struct LDKFailureCode FailureCode_temporary_node_failure(void); /** - * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2. + * Utility method to constructs a new RequiredNodeFeatureMissing-variant FailureCode */ -uint64_t AcceptChannelV2_hash(const struct LDKAcceptChannelV2 *NONNULL_PTR o); +struct LDKFailureCode FailureCode_required_node_feature_missing(void); /** - * Checks if two AcceptChannelV2s 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. + * Utility method to constructs a new IncorrectOrUnknownPaymentDetails-variant FailureCode */ -bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b); +struct LDKFailureCode FailureCode_incorrect_or_unknown_payment_details(void); /** - * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvalidOnionPayload-variant FailureCode */ -void FundingCreated_free(struct LDKFundingCreated this_obj); +struct LDKFailureCode FailureCode_invalid_onion_payload(struct LDKCOption_C2Tuple_u64u16ZZ a); /** - * A temporary channel ID, until the funding is established + * Frees any resources used by the ChannelManager, if is_owned is set and inner is non-NULL. */ -struct LDKChannelId FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +void ChannelManager_free(struct LDKChannelManager this_obj); /** - * A temporary channel ID, until the funding is established + * Frees any resources used by the ChainParameters, if is_owned is set and inner is non-NULL. */ -void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChainParameters_free(struct LDKChainParameters this_obj); /** - * The funding transaction ID + * The network for determining the `chain_hash` in Lightning messages. */ -const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; +enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * The funding transaction ID + * The network for determining the `chain_hash` in Lightning messages. */ -void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val); /** - * The specific output index funding this channel + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr); /** - * The specific output index funding this channel + * The hash and height of the latest block successfully connected. + * + * Used to track on-chain channel funding outputs and send payments with reliable timelocks. */ -void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t val); +void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * Constructs a new ChainParameters given each field */ -struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg); /** - * The signature of the channel initiator (funder) on the initial commitment transaction + * Creates a copy of the ChainParameters */ -void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig); /** - * Constructs a new FundingCreated given each field + * Frees any resources used by the RecentPaymentDetails */ -MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKChannelId temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_arg); +void RecentPaymentDetails_free(struct LDKRecentPaymentDetails this_ptr); /** - * Creates a copy of the FundingCreated + * Creates a copy of the RecentPaymentDetails */ -struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); +struct LDKRecentPaymentDetails RecentPaymentDetails_clone(const struct LDKRecentPaymentDetails *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the FundingCreated. + * Utility method to constructs a new AwaitingInvoice-variant RecentPaymentDetails */ -uint64_t FundingCreated_hash(const struct LDKFundingCreated *NONNULL_PTR o); +struct LDKRecentPaymentDetails RecentPaymentDetails_awaiting_invoice(struct LDKThirtyTwoBytes payment_id); /** - * Checks if two FundingCreateds 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. + * Utility method to constructs a new Pending-variant RecentPaymentDetails */ -bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); +struct LDKRecentPaymentDetails RecentPaymentDetails_pending(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, uint64_t total_msat); /** - * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails */ -void FundingSigned_free(struct LDKFundingSigned this_obj); +struct LDKRecentPaymentDetails RecentPaymentDetails_fulfilled(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash); /** - * The channel ID + * Utility method to constructs a new Abandoned-variant RecentPaymentDetails */ -struct LDKChannelId FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKRecentPaymentDetails RecentPaymentDetails_abandoned(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); /** - * The channel ID + * Frees any resources used by the PhantomRouteHints, if is_owned is set and inner is non-NULL. */ -void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); +void PhantomRouteHints_free(struct LDKPhantomRouteHints this_obj); /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * The list of channels to be included in the invoice route hints. */ -struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); +struct LDKCVec_ChannelDetailsZ PhantomRouteHints_get_channels(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * The signature of the channel acceptor (fundee) on the initial commitment transaction + * The list of channels to be included in the invoice route hints. */ -void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void PhantomRouteHints_set_channels(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKCVec_ChannelDetailsZ val); /** - * Constructs a new FundingSigned given each field + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg); +uint64_t PhantomRouteHints_get_phantom_scid(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Creates a copy of the FundingSigned + * A fake scid used for representing the phantom node's fake channel in generating the invoice + * route hints. */ -struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); +void PhantomRouteHints_set_phantom_scid(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, uint64_t val); /** - * Generates a non-cryptographic 64-bit hash of the FundingSigned. + * The pubkey of the real backing node that would ultimately receive the payment. */ -uint64_t FundingSigned_hash(const struct LDKFundingSigned *NONNULL_PTR o); +struct LDKPublicKey PhantomRouteHints_get_real_node_pubkey(const struct LDKPhantomRouteHints *NONNULL_PTR this_ptr); /** - * Checks if two FundingSigneds 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. + * The pubkey of the real backing node that would ultimately receive the payment. */ -bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); +void PhantomRouteHints_set_real_node_pubkey(struct LDKPhantomRouteHints *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. + * Constructs a new PhantomRouteHints given each field */ -void ChannelReady_free(struct LDKChannelReady this_obj); +MUST_USE_RES struct LDKPhantomRouteHints PhantomRouteHints_new(struct LDKCVec_ChannelDetailsZ channels_arg, uint64_t phantom_scid_arg, struct LDKPublicKey real_node_pubkey_arg); /** - * The channel ID + * Creates a copy of the PhantomRouteHints */ -struct LDKChannelId ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr); +struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig); /** - * The channel ID + * Constructs a new `ChannelManager` to hold several channels and route between them. + * + * The current time or latest block header time can be provided as the `current_timestamp`. + * + * This is the main \"logic hub\" for all channel-related actions, and implements + * [`ChannelMessageHandler`]. + * + * Non-proportional fees are fixed according to our risk using the provided fee estimator. + * + * Users need to notify the new `ChannelManager` when a new block is connected or + * disconnected using its [`block_connected`] and [`blocks_disconnected`] methods, starting + * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for + * more details. + * + * [`block_connected`]: chain::Listen::block_connected + * [`blocks_disconnected`]: chain::Listen::blocks_disconnected + * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ -void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKMessageRouter message_router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params, uint32_t current_timestamp); /** - * The per-commitment point of the second commitment transaction + * Gets the current [`UserConfig`] which controls some global behavior and includes the + * default configuration applied to all new channels. */ -struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_config(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The per-commitment point of the second commitment transaction + * Updates the current [`UserConfig`] which controls some global behavior and includes the + * default configuration applied to all new channels. */ -void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelManager_set_current_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKUserConfig new_config); /** - * If set, provides a `short_channel_id` alias for this channel. + * Creates a new outbound channel to the given remote node and with the given value. * - * The sender will accept payments to be forwarded over this SCID and forward them to this - * messages' recipient. + * `user_channel_id` will be provided back as in + * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a + * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it + * is simply copied to events and otherwise ignored. + * + * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is + * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be opened due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`] or [`SignerProvider::get_destination_script`]. + * + * Note that we do not check if you are currently connected to the given peer. If no + * connection is available, the outbound `open_channel` message may fail to send, resulting in + * the channel eventually being silently forgotten (dropped on reload). + * + * If `temporary_channel_id` is specified, it will be used as the temporary channel ID of the + * channel. Otherwise, a random one will be generated for you. + * + * Returns the new Channel's temporary `channel_id`. This ID will appear as + * [`Event::FundingGenerationReady::temporary_channel_id`] and in + * [`ChannelDetails::channel_id`] until after + * [`ChannelManager::funding_transaction_generated`] is called, swapping the Channel's ID for + * one derived from the funding transaction's TXID. If the counterparty rejects the channel + * immediately, this temporary ID will appear in [`Event::ChannelClosed::channel_id`]. + * + * [`Event::FundingGenerationReady::user_channel_id`]: events::Event::FundingGenerationReady::user_channel_id + * [`Event::FundingGenerationReady::temporary_channel_id`]: events::Event::FundingGenerationReady::temporary_channel_id + * [`Event::ChannelClosed::channel_id`]: events::Event::ChannelClosed::channel_id + * + * Note that temporary_channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_ChannelIdAPIErrorZ 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 LDKChannelId temporary_channel_id, struct LDKUserConfig override_config); /** - * If set, provides a `short_channel_id` alias for this channel. - * - * The sender will accept payments to be forwarded over this SCID and forward them to this - * messages' recipient. + * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for + * more information. */ -void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new ChannelReady given each field + * Gets the list of usable channels, in random order. Useful as an argument to + * [`Router::find_route`] to ensure non-announced channels are used. + * + * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the + * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria + * are. */ -MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKChannelId channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelReady + * Gets the list of channels we have with a given counterparty, in random order. */ -struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); /** - * Generates a non-cryptographic 64-bit hash of the ChannelReady. + * Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a + * successful path, or have unresolved HTLCs. + * + * This can be useful for payments that may have been prepared, but ultimately not sent, as a + * result of a crash. If such a payment exists, is not listed here, and an + * [`Event::PaymentSent`] has not been received, you may consider resending the payment. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent */ -uint64_t ChannelReady_hash(const struct LDKChannelReady *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_RecentPaymentDetailsZ ChannelManager_list_recent_payments(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two ChannelReadys 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. + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * * If we are the channel initiator, we will pay between our [`ChannelCloseMinimum`] and + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate. + * * If our counterparty is the channel initiator, we will require a channel closing + * transaction feerate of at least our [`ChannelCloseMinimum`] feerate or the feerate which + * would appear on a force-closure transaction, whichever is lower. We will allow our + * counterparty to pay as much fee as they'd like, however. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`SendShutdown`]: MessageSendEvent::SendShutdown */ -bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); /** - * Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL. + * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs + * will be accepted on the given channel, and after additional timeout/the closing of all + * pending HTLCs, the channel will be closed on chain. + * + * `target_feerate_sat_per_1000_weight` has different meanings depending on if we initiated + * the channel being closed or not: + * * If we are the channel initiator, we will pay at least this feerate on the closing + * transaction. The upper-bound is set by + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`] plus our [`NonAnchorChannelFee`] + * fee estimate (or `target_feerate_sat_per_1000_weight`, if it is greater). + * * If our counterparty is the channel initiator, we will refuse to accept a channel closure + * transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which + * will appear on a force-closure transaction, whichever is lower). + * + * The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. + * Will fail if a shutdown script has already been set for this channel by + * [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must + * also be compatible with our and the counterparty's features. + * + * May generate a [`SendShutdown`] message event on success, which should be relayed. + * + * Raises [`APIError::ChannelUnavailable`] if the channel cannot be closed due to failing to + * generate a shutdown scriptpubkey or destination script set by + * [`SignerProvider::get_shutdown_scriptpubkey`]. A force-closure may be needed to close the + * channel. + * + * [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis + * [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee + * [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]: crate::util::config::ChannelHandshakeConfig::commit_upfront_shutdown_pubkey + * [`SendShutdown`]: MessageSendEvent::SendShutdown + * + * Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void Stfu_free(struct LDKStfu this_obj); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_feerate_and_script(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u32Z target_feerate_sats_per_1000_weight, struct LDKShutdownScript shutdown_script); /** - * The channel ID where quiescence is intended + * Force closes a channel, immediately broadcasting the latest local transaction(s), + * rejecting new HTLCs. + * + * The provided `error_message` is sent to connected peers for closing + * channels and should be a human-readable description of what went wrong. + * + * Fails if `channel_id` is unknown to the manager, or if the `counterparty_node_id` + * isn't the counterparty of the corresponding channel. */ -struct LDKChannelId Stfu_get_channel_id(const struct LDKStfu *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKStr error_message); /** - * The channel ID where quiescence is intended + * Force close all channels, immediately broadcasting the latest local commitment transaction + * for each to the chain and rejecting new HTLCs on each. + * + * The provided `error_message` is sent to connected peers for closing channels and should + * be a human-readable description of what went wrong. */ -void Stfu_set_channel_id(struct LDKStfu *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); /** - * Initiator flag, 1 if initiating, 0 if replying to an stfu. + * Initiate a splice in order to add value to (splice-in) or remove value from (splice-out) + * the channel. This will spend the channel's funding transaction output, effectively replacing + * it with a new one. + * + * # Arguments + * + * Provide a `contribution` to determine if value is spliced in or out. The splice initiator is + * responsible for paying fees for common fields, shared inputs, and shared outputs along with + * any contributed inputs and outputs. Fees are determined using `funding_feerate_per_kw` and + * must be covered by the supplied inputs for splice-in or the channel balance for splice-out. + * + * An optional `locktime` for the funding transaction may be specified. If not given, the + * current best block height is used. + * + * # Events + * + * Once the funding transaction has been constructed, an [`Event::SplicePending`] will be + * emitted. At this point, any inputs contributed to the splice can only be re-spent if an + * [`Event::DiscardFunding`] is seen. + * + * After initial signatures have been exchanged, [`Event::FundingTransactionReadyForSigning`] + * will be generated and [`ChannelManager::funding_transaction_signed`] should be called. + * + * If any failures occur while negotiating the funding transaction, an [`Event::SpliceFailed`] + * will be emitted. Any contributed inputs no longer used will be included here and thus can + * be re-spent. + * + * Once the splice has been locked by both counterparties, an [`Event::ChannelReady`] will be + * emitted with the new funding output. At this point, a new splice can be negotiated by + * calling `splice_channel` again on this channel. */ -uint8_t Stfu_get_initiator(const struct LDKStfu *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_splice_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKSpliceContribution contribution, uint32_t funding_feerate_per_kw, struct LDKCOption_u32Z locktime); /** - * Initiator flag, 1 if initiating, 0 if replying to an stfu. + * Sends a payment along a given route. See [`Self::send_payment`] for more info. + * + * LDK will not automatically retry this payment, though it may be manually re-sent after an + * [`Event::PaymentFailed`] is generated. */ -void Stfu_set_initiator(struct LDKStfu *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRoute route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); /** - * Constructs a new Stfu given each field + * Sends a payment to the route found using the provided [`RouteParameters`], retrying failed + * payment paths based on the provided `Retry`. + * + * You should likely prefer [`Self::pay_for_bolt11_invoice`] or [`Self::pay_for_offer`] in + * general, however this method may allow for slightly more customization. + * + * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via + * [`PeerManager::process_events`]). + * + * # Avoiding Duplicate Payments + * + * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this + * method will error with [`RetryableSendFailure::DuplicatePayment`]. Note, however, that once a + * payment is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of + * an [`Event::PaymentSent`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a + * second payment with the same [`PaymentId`]. + * + * Thus, in order to ensure duplicate payments are not sent, you should implement your own + * tracking of payments, including state to indicate once a payment has completed. Because you + * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should + * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the + * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. + * + * Additionally, in the scenario where we begin the process of sending a payment, but crash + * before `send_payment` returns (or prior to [`ChannelMonitorUpdate`] persistence if you're + * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See + * [`ChannelManager::list_recent_payments`] for more information. + * + * Routes are automatically found using the [`Router] provided on startup. To fix a route for a + * particular payment, use [`Self::send_payment_with_route`] or match the [`PaymentId`] passed to + * [`Router::find_route_with_id`]. + * + * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`Event::PaymentFailed`]: events::Event::PaymentFailed + * [`UpdateHTLCs`]: MessageSendEvent::UpdateHTLCs + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress */ -MUST_USE_RES struct LDKStfu Stfu_new(struct LDKChannelId channel_id_arg, uint8_t initiator_arg); +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); /** - * Creates a copy of the Stfu + * Pays a [`Bolt11Invoice`] associated with the `payment_id`. See [`Self::send_payment`] for more info. + * + * # Payment Id + * The invoice's `payment_hash().0` serves as a reliable choice for the `payment_id`. + * + * # Handling Invoice Amounts + * Some invoices include a specific amount, while others require you to specify one. + * - If the invoice **includes** an amount, user may provide an amount greater or equal to it + * to allow for overpayments. + * - If the invoice **doesn't include** an amount, you'll need to specify `amount_msats`. + * + * If these conditions aren’t met, the function will return [`Bolt11PaymentError::InvalidAmount`]. + * + * # Custom Routing Parameters + * Users can customize routing parameters via [`RouteParametersConfig`]. + * To use default settings, call the function with [`RouteParametersConfig::default`]. */ -struct LDKStfu Stfu_clone(const struct LDKStfu *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneBolt11PaymentErrorZ ChannelManager_pay_for_bolt11_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKBolt11Invoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id, struct LDKCOption_u64Z amount_msats, struct LDKRouteParametersConfig route_params_config, struct LDKRetry retry_strategy); /** - * Checks if two Stfus 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. + * Pays the [`Bolt12Invoice`] associated with the `payment_id` encoded in its `payer_metadata`. + * + * The invoice's `payer_metadata` is used to authenticate that the invoice was indeed requested + * before attempting a payment. [`Bolt12PaymentError::UnexpectedInvoice`] is returned if this + * fails or if the encoded `payment_id` is not recognized. The latter may happen once the + * payment is no longer tracked because the payment was attempted after: + * - an invoice for the `payment_id` was already paid, + * - one full [timer tick] has elapsed since initially requesting the invoice when paying an + * offer, or + * - the refund corresponding to the invoice has already expired. + * + * To retry the payment, request another invoice using a new `payment_id`. + * + * Attempting to pay the same invoice twice while the first payment is still pending will + * result in a [`Bolt12PaymentError::DuplicateInvoice`]. + * + * Otherwise, either [`Event::PaymentSent`] or [`Event::PaymentFailed`] are used to indicate + * whether or not the payment was successful. + * + * [timer tick]: Self::timer_tick_occurred */ -bool Stfu_eq(const struct LDKStfu *NONNULL_PTR a, const struct LDKStfu *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneBolt12PaymentErrorZ ChannelManager_send_payment_for_bolt12_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKBolt12Invoice *NONNULL_PTR invoice, struct LDKCOption_OffersContextZ context); /** - * Frees any resources used by the SpliceInit, if is_owned is set and inner is non-NULL. + * Should be called after handling an [`Event::PersistStaticInvoice`], where the `Responder` + * comes from [`Event::PersistStaticInvoice::invoice_persisted_path`]. */ -void SpliceInit_free(struct LDKSpliceInit this_obj); +void ChannelManager_static_invoice_persisted(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKResponder invoice_persisted_path); /** - * The channel ID where splicing is intended + * Forwards a [`StaticInvoice`] to a payer in response to an + * [`Event::StaticInvoiceRequested`]. Also forwards the payer's [`InvoiceRequest`] to the + * async recipient, in case the recipient is online to provide the payer with a fresh + * [`Bolt12Invoice`]. */ -struct LDKChannelId SpliceInit_get_channel_id(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_respond_to_static_invoice_request(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStaticInvoice invoice, struct LDKResponder responder, struct LDKInvoiceRequest invoice_request, struct LDKBlindedMessagePath invoice_request_path); /** - * The channel ID where splicing is intended + * 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. + * + * Note that calling this method does *not* prevent a payment from succeeding. You must still + * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to + * determine the ultimate status of a payment. + * + * # Requested Invoices + * + * In the case of paying a [`Bolt12Invoice`] via [`ChannelManager::pay_for_offer`], abandoning + * the payment prior to receiving the invoice will result in an [`Event::PaymentFailed`] and + * prevent any attempts at paying it once received. + * + * # Restart Behavior + * + * If an [`Event::PaymentFailed`] is generated and we restart without first persisting the + * [`ChannelManager`], another [`Event::PaymentFailed`] may be generated. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void SpliceInit_set_channel_id(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id); /** - * The amount the splice initiator is intending to add to its channel balance (splice-in) - * or remove from its channel balance (splice-out). + * Send a spontaneous payment, which is a payment that does not require the recipient to have + * generated an invoice. Optionally, you may specify the preimage. If you do choose to specify + * the preimage, it must be a cryptographically secure random value that no intermediate node + * would be able to guess -- otherwise, an intermediate node may claim the payment and it will + * never reach the recipient. + * + * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See + * [`send_payment`] for more information about the risks of duplicate preimage usage. + * + * See [`send_payment`] documentation for more details on the idempotency guarantees provided by + * the [`PaymentId`] key. + * + * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous + * payments. + * + * [`send_payment`]: Self::send_payment + * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend */ -int64_t SpliceInit_get_funding_contribution_satoshis(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment(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); /** - * The amount the splice initiator is intending to add to its channel balance (splice-in) - * or remove from its channel balance (splice-out). + * 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. */ -void SpliceInit_set_funding_contribution_satoshis(struct LDKSpliceInit *NONNULL_PTR this_ptr, int64_t val); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); /** - * The feerate for the new funding transaction, set by the splice initiator + * 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. */ -uint32_t SpliceInit_get_funding_feerate_perkw(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +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); /** - * The feerate for the new funding transaction, set by the splice initiator + * 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`. */ -void SpliceInit_set_funding_feerate_perkw(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_t val); +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); /** - * The locktime for the new funding transaction + * Call this upon creation of a funding transaction for the given channel. + * + * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs + * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. + * + * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation + * across the p2p network. + * + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. + * + * May panic if the output found in the funding transaction is duplicative with some other + * channel (note that this should be trivially prevented by using unique funding transaction + * keys per-channel). + * + * Do NOT broadcast the funding transaction yourself. When we have safely received our + * counterparty's signature the funding transaction will automatically be broadcast via the + * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. + * + * Note that this includes RBF or similar transaction replacement strategies - lightning does + * not currently support replacing a funding transaction on an existing channel. Instead, + * create a new channel with a conflicting funding transaction. + * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See + * for more details. + * + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed */ -uint32_t SpliceInit_get_locktime(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); /** - * The locktime for the new funding transaction + * **Unsafe**: This method does not validate the spent output. It is the caller's + * responsibility to ensure the spent outputs are SegWit, as well as making sure the funding + * transaction has a final absolute locktime, i.e., its locktime is lower than the next block height. + * + * For a safer method, please refer to [`ChannelManager::funding_transaction_generated`]. + * + * Call this in response to a [`Event::FundingGenerationReady`] event. + * + * Note that if this method is called successfully, the funding transaction won't be + * broadcasted and you are expected to broadcast it manually when receiving the + * [`Event::FundingTxBroadcastSafe`] event. + * + * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided + * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. + * + * May panic if the funding output is duplicative with some other channel (note that this + * should be trivially prevented by using unique funding transaction keys per-channel). + * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See for + * more details. + * + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady + * [`Event::FundingTxBroadcastSafe`]: crate::events::Event::FundingTxBroadcastSafe + * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ -void SpliceInit_set_locktime(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_unsafe_manual_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding); /** - * The key of the sender (splice initiator) controlling the new funding transaction + * Call this upon creation of a funding transaction for the given channel. + * + * This method executes the same checks as [`ChannelManager::funding_transaction_generated`], + * but it does not automatically broadcast the funding transaction. + * + * Call this in response to a [`Event::FundingGenerationReady`] event, only in a context where you want to manually + * control the broadcast of the funding transaction. + * + * The associated [`ChannelMonitor`] likewise avoids broadcasting holder commitment or CPFP + * transactions until the funding has been observed on chain. This + * prevents attempting to broadcast unconfirmable commitment transactions before the channel's + * funding exists in a block. + * + * If HTLCs would otherwise approach timeout while the funding transaction has not yet appeared + * on chain, the monitor avoids broadcasting force-close transactions in manual-broadcast + * mode until the funding is seen. It may still close the channel off-chain (emitting a + * `ChannelClosed` event) to avoid accepting further updates. Ensure your application either + * broadcasts the funding transaction in a timely manner or avoids forwarding HTLCs that could + * approach timeout during this interim state. + * + * See also [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. For channels using + * manual-broadcast, calling that method has no effect until the funding has been observed + * on-chain. + * + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady */ -struct LDKPublicKey SpliceInit_get_funding_pubkey(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated_manual_broadcast(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction); /** - * The key of the sender (splice initiator) controlling the new 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 transaction + * 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. */ -void SpliceInit_set_funding_pubkey(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_batch_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ temporary_channels, struct LDKTransaction funding_transaction); /** - * If set, only confirmed inputs added (by the splice acceptor) will be accepted + * Handles a signed funding transaction generated by interactive transaction construction and + * provided by the client. Should only be called in response to a [`FundingTransactionReadyForSigning`] + * event. + * + * Do NOT broadcast the funding transaction yourself. When we have safely received our + * counterparty's signature(s) the funding transaction will automatically be broadcast via the + * [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. + * + * `SIGHASH_ALL` MUST be used for all signatures when providing signatures, otherwise your + * funds can be held hostage! + * + * LDK checks the following: + * * Each input spends an output that is one of P2WPKH, P2WSH, or P2TR. + * These were already checked by LDK when the inputs to be contributed were provided. + * * All signatures use the `SIGHASH_ALL` sighash type. + * * P2WPKH and P2TR key path spends are valid (verifies signatures) + * + * NOTE: + * * When checking P2WSH spends, LDK tries to decode 70-72 byte witness elements as ECDSA + * signatures with a sighash flag. If the internal DER-decoding fails, then LDK just + * assumes it wasn't a signature and carries with checks. If the element can be decoded + * as an ECDSA signature, the the sighash flag must be `SIGHASH_ALL`. + * * When checking P2TR script-path spends, LDK assumes all elements of exactly 65 bytes + * with the last byte matching any valid sighash flag byte are schnorr signatures and checks + * that the sighash type is `SIGHASH_ALL`. If the last byte is not any valid sighash flag, the + * element is assumed not to be a signature and is ignored. Elements of 64 bytes are not + * checked because if they were schnorr signatures then they would implicitly be `SIGHASH_DEFAULT` + * which is an alias of `SIGHASH_ALL`. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a channel is not in a state where it is expecting funding + * signatures or if any of the checks described above fail. + * + * [`FundingTransactionReadyForSigning`]: events::Event::FundingTransactionReadyForSigning + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -enum LDKCOption_NoneZ SpliceInit_get_require_confirmed_inputs(const struct LDKSpliceInit *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_signed(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id, struct LDKTransaction transaction); /** - * If set, only confirmed inputs added (by the splice acceptor) will be accepted + * Atomically applies partial updates to the [`ChannelConfig`] of the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -void SpliceInit_set_require_confirmed_inputs(struct LDKSpliceInit *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_partial_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfigUpdate *NONNULL_PTR config_update); /** - * Constructs a new SpliceInit given each field + * Atomically updates the [`ChannelConfig`] for the given channels. + * + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. + * + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. + * + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. + * + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -MUST_USE_RES struct LDKSpliceInit SpliceInit_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, uint32_t funding_feerate_perkw_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ChannelIdZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); /** - * Creates a copy of the SpliceInit + * Attempts to forward an intercepted HTLC over the provided channel id and with the provided + * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. + * + * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time + * channel to a receiving node if the node lacks sufficient inbound liquidity. + * + * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use + * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the + * receiver's invoice route hints. These route hints will signal to LDK to generate an + * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. + * + * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop + * you from forwarding more than you received. See + * [`HTLCIntercepted::expected_outbound_amount_msat`] for more on forwarding a different amount + * than expected. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + * [`HTLCIntercepted::expected_outbound_amount_msat`]: events::Event::HTLCIntercepted::expected_outbound_amount_msat */ -struct LDKSpliceInit SpliceInit_clone(const struct LDKSpliceInit *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const struct LDKChannelId *NONNULL_PTR next_hop_channel_id, struct LDKPublicKey next_node_id, uint64_t amt_to_forward_msat); /** - * Checks if two SpliceInits 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. + * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to + * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted */ -bool SpliceInit_eq(const struct LDKSpliceInit *NONNULL_PTR a, const struct LDKSpliceInit *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); /** - * Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL. + * Returns whether we have pending HTLC forwards that need to be processed via + * [`Self::process_pending_htlc_forwards`]. */ -void SpliceAck_free(struct LDKSpliceAck this_obj); +MUST_USE_RES bool ChannelManager_needs_pending_htlc_processing(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The channel ID where splicing is intended + * Processes HTLCs which are pending waiting on random forward delay. + * + * Will be regularly called by LDK's background processor. + * + * Users implementing their own background processing logic should call this in irregular, + * randomly-distributed intervals. */ -struct LDKChannelId SpliceAck_get_channel_id(const struct LDKSpliceAck *NONNULL_PTR this_ptr); +void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The channel ID where splicing is intended + * Performs actions which should happen on startup and roughly once per minute thereafter. + * + * This currently includes: + * * Increasing or decreasing the on-chain feerate estimates for our outbound channels, + * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more + * than a minute, informing the network that they should no longer attempt to route over + * the channel. + * * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs + * with the current [`ChannelConfig`]. + * * Removing peers which have disconnected but and no longer have any channels. + * * Force-closing and removing channels which have not completed establishment in a timely manner. + * * Forgetting about stale outbound payments, either those that have already been fulfilled + * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. + * The latter is determined using the system clock in `std` and the highest seen block time + * minus two hours in non-`std`. + * + * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate + * estimate fetches. + * + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelConfig`]: crate::util::config::ChannelConfig */ -void SpliceAck_set_channel_id(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The amount the splice acceptor is intending to add to its channel balance (splice-in) - * or remove from its channel balance (splice-out). + * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect + * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources + * along the path (including in our own channel on which we received it). + * + * Note that in some cases around unclean shutdown, it is possible the payment may have + * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a + * second copy of) the [`events::Event::PaymentClaimable`] event. Alternatively, the payment + * may have already been failed automatically by LDK if it was nearing its expiration time. + * + * While LDK will never claim a payment automatically on your behalf (i.e. without you calling + * [`ChannelManager::claim_funds`]), you should still monitor for + * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on + * startup during which time claims that were in-progress at shutdown may be replayed. */ -int64_t SpliceAck_get_funding_contribution_satoshis(const struct LDKSpliceAck *NONNULL_PTR this_ptr); +void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** - * The amount the splice acceptor is intending to add to its channel balance (splice-in) - * or remove from its channel balance (splice-out). + * This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the + * reason for the failure. + * + * See [`FailureCode`] for valid failure codes. */ -void SpliceAck_set_funding_contribution_satoshis(struct LDKSpliceAck *NONNULL_PTR this_ptr, int64_t val); +void ChannelManager_fail_htlc_backwards_with_reason(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32], struct LDKFailureCode failure_code); /** - * The key of the sender (splice acceptor) controlling the new funding transaction + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any + * [`MessageSendEvent`]s needed to claim the payment. + * + * This method is guaranteed to ensure the payment has been claimed but only if the current + * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race + * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment + * successful. It will generally be available in the next [`process_pending_events`] call. + * + * Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or + * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` + * 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 */ -struct LDKPublicKey SpliceAck_get_funding_pubkey(const struct LDKSpliceAck *NONNULL_PTR this_ptr); +void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * The key of the sender (splice acceptor) controlling the new funding transaction + * 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 SpliceAck_set_funding_pubkey(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelManager_claim_funds_with_known_custom_tlvs(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** - * If set, only confirmed inputs added (by the splice initiator) will be accepted + * Gets the node_id held by this ChannelManager */ -enum LDKCOption_NoneZ SpliceAck_get_require_confirmed_inputs(const struct LDKSpliceAck *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * If set, only confirmed inputs added (by the splice initiator) will be accepted + * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. + * + * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, + * and the `counterparty_node_id` parameter is the id of the peer which has requested to open + * the channel. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Note that this method will return an error and reject the channel, if it requires support + * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be + * used to accept such channels. + * + * NOTE: LDK makes no attempt to prevent the counterparty from using non-standard inputs which + * will prevent the funding transaction from being relayed on the bitcoin network and hence being + * confirmed. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * + * Note that config_overrides (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void SpliceAck_set_require_confirmed_inputs(struct LDKSpliceAck *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id, struct LDKChannelConfigOverrides config_overrides); /** - * Constructs a new SpliceAck given each field + * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating + * it as confirmed immediately. + * + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel + * and (if the counterparty agrees), enables forwarding of payments immediately. + * + * This fully trusts that the counterparty has honestly and correctly constructed the funding + * transaction and blindly assumes that it will eventually confirm. + * + * If it does not confirm before we decide to close the channel, or if the funding transaction + * does not pay to the correct script the correct amount, *you will lose funds*. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + * + * Note that config_overrides (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKSpliceAck SpliceAck_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id, struct LDKChannelConfigOverrides config_overrides); /** - * Creates a copy of the SpliceAck + * When a call to a [`ChannelSigner`] method returns an error, this indicates that the signer + * is (temporarily) unavailable, and the operation should be retried later. + * + * This method allows for that retry - either checking for any signer-pending messages to be + * attempted in every channel, or in the specifically provided channel. + * + * [`ChannelSigner`]: crate::sign::ChannelSigner */ -struct LDKSpliceAck SpliceAck_clone(const struct LDKSpliceAck *NONNULL_PTR orig); +void ChannelManager_signer_unblocked(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ channel_opt); /** - * Checks if two SpliceAcks 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. + * Utility for creating a BOLT11 invoice that can be verified by [`ChannelManager`] without + * storing any additional state. It achieves this by including a [`PaymentSecret`] in the + * invoice which it uses to verify that the invoice has not expired and the payment amount is + * sufficient, reproducing the [`PaymentPreimage`] if applicable. */ -bool SpliceAck_eq(const struct LDKSpliceAck *NONNULL_PTR a, const struct LDKSpliceAck *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ ChannelManager_create_bolt11_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKBolt11InvoiceParameters params); /** - * Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL. + * Frees any resources used by the Bolt11InvoiceParameters, if is_owned is set and inner is non-NULL. */ -void SpliceLocked_free(struct LDKSpliceLocked this_obj); +void Bolt11InvoiceParameters_free(struct LDKBolt11InvoiceParameters this_obj); /** - * The channel ID + * The amount for the invoice, if any. */ -struct LDKChannelId SpliceLocked_get_channel_id(const struct LDKSpliceLocked *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z Bolt11InvoiceParameters_get_amount_msats(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); /** - * The channel ID + * The amount for the invoice, if any. */ -void SpliceLocked_set_channel_id(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKChannelId val); +void Bolt11InvoiceParameters_set_amount_msats(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The ID of the new funding transaction that has been locked + * The description for what the invoice is for, or hash of such description. */ -const uint8_t (*SpliceLocked_get_splice_txid(const struct LDKSpliceLocked *NONNULL_PTR this_ptr))[32]; +struct LDKBolt11InvoiceDescription Bolt11InvoiceParameters_get_description(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); /** - * The ID of the new funding transaction that has been locked + * The description for what the invoice is for, or hash of such description. */ -void SpliceLocked_set_splice_txid(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void Bolt11InvoiceParameters_set_description(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKBolt11InvoiceDescription val); /** - * Constructs a new SpliceLocked given each field + * The invoice expiration relative to its creation time. If not set, the invoice will expire in + * [`DEFAULT_EXPIRY_TIME`] by default. + * + * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` + * builds, the highest block timestamp seen is used instead. In the latter case, use a long + * enough expiry to account for the average block time. */ -MUST_USE_RES struct LDKSpliceLocked SpliceLocked_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes splice_txid_arg); +struct LDKCOption_u32Z Bolt11InvoiceParameters_get_invoice_expiry_delta_secs(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); /** - * Creates a copy of the SpliceLocked + * The invoice expiration relative to its creation time. If not set, the invoice will expire in + * [`DEFAULT_EXPIRY_TIME`] by default. + * + * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` + * builds, the highest block timestamp seen is used instead. In the latter case, use a long + * enough expiry to account for the average block time. */ -struct LDKSpliceLocked SpliceLocked_clone(const struct LDKSpliceLocked *NONNULL_PTR orig); +void Bolt11InvoiceParameters_set_invoice_expiry_delta_secs(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); /** - * Checks if two SpliceLockeds 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. + * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be + * added as well to allow for up to a few new block confirmations during routing. */ -bool SpliceLocked_eq(const struct LDKSpliceLocked *NONNULL_PTR a, const struct LDKSpliceLocked *NONNULL_PTR b); +struct LDKCOption_u16Z Bolt11InvoiceParameters_get_min_final_cltv_expiry_delta(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); /** - * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL. + * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be + * added as well to allow for up to a few new block confirmations during routing. */ -void TxAddInput_free(struct LDKTxAddInput this_obj); +void Bolt11InvoiceParameters_set_min_final_cltv_expiry_delta(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * The channel ID + * The payment hash used in the invoice. If not set, a payment hash will be generated using a + * preimage that can be reproduced by [`ChannelManager`] without storing any state. + * + * Uses the payment hash if set. This may be useful if you're building an on-chain swap or + * involving another protocol where the payment hash is also involved outside the scope of + * lightning. */ -struct LDKChannelId TxAddInput_get_channel_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ Bolt11InvoiceParameters_get_payment_hash(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); /** - * The channel ID + * The payment hash used in the invoice. If not set, a payment hash will be generated using a + * preimage that can be reproduced by [`ChannelManager`] without storing any state. + * + * Uses the payment hash if set. This may be useful if you're building an on-chain swap or + * involving another protocol where the payment hash is also involved outside the scope of + * lightning. */ -void TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKChannelId val); +void Bolt11InvoiceParameters_set_payment_hash(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * A randomly chosen unique identifier for this input, which is even for initiators and odd for - * non-initiators. + * Constructs a new Bolt11InvoiceParameters given each field */ -uint64_t TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_new(struct LDKCOption_u64Z amount_msats_arg, struct LDKBolt11InvoiceDescription description_arg, struct LDKCOption_u32Z invoice_expiry_delta_secs_arg, struct LDKCOption_u16Z min_final_cltv_expiry_delta_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); /** - * A randomly chosen unique identifier for this input, which is even for initiators and odd for - * non-initiators. + * Creates a "default" Bolt11InvoiceParameters. See struct and individual field documentaiton for details on which values are used. */ -void TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_default(void); /** - * Serialized transaction that contains the output this input spends to verify that it is non - * malleable. + * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the + * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer's + * expiration will be `absolute_expiry` if `Some`, otherwise it will not expire. + * + * # Privacy + * + * Uses [`MessageRouter`] provided at construction to construct a [`BlindedMessagePath`] for + * the offer. See the documentation of the selected [`MessageRouter`] for details on how it + * selects blinded paths including privacy implications and reliability tradeoffs. + * + * Also, uses a derived signing pubkey in the offer for recipient privacy. + * + * # Limitations + * + * See [`OffersMessageFlow::create_offer_builder`] for limitations on the offer builder. + * + * # Errors + * + * Errors if the parameterized [`MessageRouter`] is unable to create a blinded path for the offer. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -struct LDKTransactionU16LenLimited TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Serialized transaction that contains the output this input spends to verify that it is non - * malleable. + * Same as [`Self::create_offer_builder`], but allows specifying a custom [`MessageRouter`] + * instead of using the [`MessageRouter`] provided to the [`ChannelManager`] at construction. + * + * This gives users full control over how the [`BlindedMessagePath`] is constructed, + * including the option to omit it entirely. + * + * See [`Self::create_offer_builder`] for more details on usage. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKTransactionU16LenLimited val); +MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_offer_builder_using_router(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKMessageRouter router); /** - * The index of the output being spent + * Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the + * [`ChannelManager`] when handling [`Bolt12Invoice`] messages for the refund. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the refund. + * See [Avoiding Duplicate Payments] for other requirements once the payment has been sent. + * + * The builder will have the provided expiration set. Any changes to the expiration on the + * returned builder will not be honored by [`ChannelManager`]. For non-`std`, the highest seen + * block time minus two hours is used for the current time when determining if the refund has + * expired. + * + * To revoke the refund, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received before expiration, the payment will fail + * with an [`Event::PaymentFailed`]. + * + * If `max_total_routing_fee_msat` is not specified, The default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Privacy + * + * Uses [`MessageRouter`] provided at construction to construct a [`BlindedMessagePath`] for + * the refund. See the documentation of the selected [`MessageRouter`] for details on how it + * selects blinded paths including privacy implications and reliability tradeoffs. + * + * Also, uses a derived payer id in the refund for payer privacy. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - `amount_msats` is invalid, or + * - the parameterized [`Router`] is unable to create a blinded path for the refund. + * + * [`Refund`]: crate::offers::refund::Refund + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKRouteParametersConfig route_params_config); /** - * The index of the output being spent + * Same as [`Self::create_refund_builder`], but allows specifying a custom [`MessageRouter`] + * instead of using the one provided during [`ChannelManager`] construction for + * [`BlindedMessagePath`] creation. + * + * This gives users full control over how the [`BlindedMessagePath`] is constructed for the + * refund, including the option to omit it entirely. This is useful for testing or when + * alternative privacy strategies are needed. + * + * See [`Self::create_refund_builder`] for more details on usage. + * + * # Errors + * + * In addition to the errors in [`Self::create_refund_builder`], this returns an error if + * the provided [`MessageRouter`] fails to construct a valid [`BlindedMessagePath`] for the refund. + * + * [`Refund`]: crate::offers::refund::Refund + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ ChannelManager_create_refund_builder_using_router(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKMessageRouter router, uint64_t amount_msats, uint64_t absolute_expiry, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKRouteParametersConfig route_params_config); /** - * The sequence number of this input + * Retrieve an [`Offer`] for receiving async payments as an often-offline recipient. Will only + * return an offer if [`Self::set_paths_to_static_invoice_server`] was called and we succeeded in + * interactively building a [`StaticInvoice`] with the static invoice server. + * + * Useful for posting offers to receive payments later, such as posting an offer on a website. */ -uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_OfferNoneZ ChannelManager_get_async_receive_offer(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The sequence number of this input + * Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build + * [`Offer`]s with a static invoice server, so the server can serve [`StaticInvoice`]s to payers + * on our behalf when we're offline. + * + * This method only needs to be called once when the server first takes on the recipient as a + * client, or when the paths change, e.g. if the paths are set to expire at a particular time. */ -void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelManager_set_paths_to_static_invoice_server(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_BlindedMessagePathZ paths_to_static_invoice_server); /** - * The ID of the previous funding transaction, when it is being added as an input during splicing + * Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and + * enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual + * [`Bolt12Invoice`] once it is received. + * + * Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by + * the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. + * + * `amount_msats` allows you to overpay what is required to satisfy the offer, or may be + * required if the offer does not require a specific amount. + * + * If the [`Offer`] was built from a human readable name resolved using BIP 353, you *must* + * instead call [`Self::pay_for_offer_from_hrn`]. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`Event::PaymentFailed`]. + * + * # Privacy + * + * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] + * to construct a [`BlindedMessagePath`] for the reply path. + * + * # Note + * + * If the offer resolves to an async payment, and the HTLC is neither claimed nor failed by + * our next-hop peer, we will not force-close the channel to resolve the payment for 4 + * weeks. This avoids an issue for often-offline nodes where channels are force-closed on + * startup during chain sync prior to connecting to peers. If you want to resolve such a + * timed-out payment more urgently, you can manually force-close the channel which will, + * after some transaction confirmation(s), result in an [`Event::PaymentFailed`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * - the provided parameters are invalid for the offer, + * - the offer is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded reply path for the invoice + * request. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments */ -struct LDKCOption_ThirtyTwoBytesZ TxAddInput_get_shared_input_txid(const struct LDKTxAddInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKOptionalOfferPaymentParams optional_params); /** - * The ID of the previous funding transaction, when it is being added as an input during splicing + * Pays for an [`Offer`] which was built by resolving a human readable name. It is otherwise + * identical to [`Self::pay_for_offer`]. */ -void TxAddInput_set_shared_input_txid(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer_from_hrn(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOfferFromHrn *NONNULL_PTR offer, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKOptionalOfferPaymentParams optional_params); /** - * Constructs a new TxAddInput given each field + * Pays for an [`Offer`] using the given parameters, including a `quantity`, by creating an + * [`InvoiceRequest`] and enqueuing it to be sent via an onion message. [`ChannelManager`] will + * pay the actual [`Bolt12Invoice`] once it is received. + * + * This method is identical to [`Self::pay_for_offer`] with the one exception that it allows + * you to specify the [`InvoiceRequest::quantity`]. We expect this to be rather seldomly used, + * as the \"quantity\" feature of offers doesn't line up with common payment flows today. + * + * This method is otherwise identical to [`Self::pay_for_offer`] but will additionally fail if + * the provided `quantity` does not meet the requirements described by + * [`Offer::supported_quantity`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity */ -MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, struct LDKTransactionU16LenLimited prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg, struct LDKCOption_ThirtyTwoBytesZ shared_input_txid_arg); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_offer_with_quantity(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKOffer *NONNULL_PTR offer, struct LDKCOption_u64Z amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKOptionalOfferPaymentParams optional_params, uint64_t quantity); /** - * Creates a copy of the TxAddInput + * Creates a [`Bolt12Invoice`] for a [`Refund`] and enqueues it to be sent via an onion + * message. + * + * The resulting invoice uses a [`PaymentHash`] recognized by the [`ChannelManager`] and a + * [`BlindedPaymentPath`] containing the [`PaymentSecret`] needed to reconstruct the + * corresponding [`PaymentPreimage`]. It is returned purely for informational purposes. + * + * # Limitations + * + * Requires a direct connection to an introduction node in [`Refund::paths`] or to + * [`Refund::payer_signing_pubkey`], if empty. This request is best effort; an invoice will be + * sent to each node meeting the aforementioned criteria, but there's no guarantee that they + * will be received and no retries will be made. + * + * # Errors + * + * Errors if: + * - the refund is for an unsupported chain, or + * - the parameterized [`Router`] is unable to create a blinded payment path or reply path for + * the invoice. + * + * [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); /** - * Generates a non-cryptographic 64-bit hash of the TxAddInput. + * Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS + * resolver(s) at `dns_resolvers` which resolve names according to [bLIP 32]. + * + * Because most wallets support on-chain or other payment schemes beyond only offers, this is + * deprecated in favor of the [`bitcoin-payment-instructions`] crate, which can be used to + * build an [`OfferFromHrn`] and call [`Self::pay_for_offer_from_hrn`]. Thus, this method is + * deprecated. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`PaymentFailureReason::UserAbandoned`] or + * [`PaymentFailureReason::InvoiceRequestExpired`], respectively. + * + * # Privacy + * + * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] + * to construct a [`BlindedMessagePath`] for the reply path. + * + * # Errors + * + * Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link. + * + * [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki + * [bLIP 32]: https://github.com/lightning/blips/blob/master/blip-0032.md + * [`OMNameResolver::resolve_name`]: crate::onion_message::dns_resolution::OMNameResolver::resolve_name + * [`OMNameResolver::handle_dnssec_proof_for_uri`]: crate::onion_message::dns_resolution::OMNameResolver::handle_dnssec_proof_for_uri + * [`bitcoin-payment-instructions`]: https://docs.rs/bitcoin-payment-instructions/ + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`PaymentFailureReason::UserAbandoned`]: crate::events::PaymentFailureReason::UserAbandoned + * [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected */ -uint64_t TxAddInput_hash(const struct LDKTxAddInput *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelManager_pay_for_offer_from_human_readable_name(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKHumanReadableName name, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKOptionalOfferPaymentParams optional_params, struct LDKCVec_DestinationZ dns_resolvers); /** - * Checks if two TxAddInputs 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. + * Gets a payment secret and payment hash for use in an invoice given to a third party wishing + * to pay us. + * + * This differs from [`create_inbound_payment_for_hash`] only in that it generates the + * [`PaymentHash`] and [`PaymentPreimage`] for you. + * + * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`] event, which + * will have the [`PaymentClaimable::purpose`] return `Some` for [`PaymentPurpose::preimage`]. That + * should then be passed directly to [`claim_funds`]. + * + * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [`claim_funds`]: Self::claim_funds + * [`PaymentClaimable`]: events::Event::PaymentClaimable + * [`PaymentClaimable::purpose`]: events::Event::PaymentClaimable::purpose + * [`PaymentPurpose::preimage`]: events::PaymentPurpose::preimage + * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ -bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b); +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); /** - * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL. + * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is + * stored external to LDK. + * + * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a + * payment secret fetched via this method or [`create_inbound_payment`], and which is at least + * the `min_value_msat` provided here, if one is provided. + * + * The [`PaymentHash`] (and corresponding [`PaymentPreimage`]) should be globally unique, though + * note that LDK will not stop you from registering duplicate payment hashes for inbound + * payments. + * + * `min_value_msat` should be set if the invoice being generated contains a value. Any payment + * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` + * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the + * sender \"proof-of-payment\" unless they have paid the required amount. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. This should roughly match the expiry time set in the invoice. + * After this many seconds, we will remove the inbound payment, resulting in any attempts to + * pay the invoice failing. The BOLT spec suggests 3,600 secs as a default validity time for + * invoices when no timeout is set. + * + * Note that we use block header time to time-out pending inbound payments (with some margin + * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will + * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. + * If you need exact expiry semantics, you should enforce them upon receipt of + * [`PaymentClaimable`]. + * + * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry_delta` + * set to at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * Note that a malicious eavesdropper can intuit whether an inbound payment was created by + * `create_inbound_payment` or `create_inbound_payment_for_hash` based on runtime. + * + * # Note + * + * If you register an inbound payment with this method, then serialize the `ChannelManager`, then + * deserialize it with a node running 0.0.103 and earlier, the payment will fail to be received. + * + * Errors if `min_value_msat` is greater than total bitcoin supply. + * + * If `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [`create_inbound_payment`]: Self::create_inbound_payment + * [`PaymentClaimable`]: events::Event::PaymentClaimable */ -void TxAddOutput_free(struct LDKTxAddOutput this_obj); +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); /** - * The channel ID + * Gets an LDK-generated payment preimage from a payment hash and payment secret that were + * previously returned from [`create_inbound_payment`]. + * + * [`create_inbound_payment`]: Self::create_inbound_payment */ -struct LDKChannelId TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +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); /** - * The channel ID + * [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively + * build [`Offer`]s and [`StaticInvoice`]s for receiving async payments. + * + * ## Usage + * 1. Static invoice server calls [`Self::blinded_paths_for_async_recipient`] + * 2. Static invoice server communicates the resulting paths out-of-band to the async recipient, + * who calls [`Self::set_paths_to_static_invoice_server`] to configure themselves with these + * paths + * 3. Async recipient automatically sends [`OfferPathsRequest`]s over the configured paths, and + * uses the resulting paths from the server's [`OfferPaths`] response to build their async + * receive offer + * + * If `relative_expiry` is unset, the [`BlindedMessagePath`]s will never expire. + * + * Returns the paths that the recipient should be configured with via + * [`Self::set_paths_to_static_invoice_server`]. + * + * The provided `recipient_id` must uniquely identify the recipient, and will be surfaced later + * when the recipient provides us with a static invoice to persist and serve to payers on their + * behalf. */ -void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKCResult_CVec_BlindedMessagePathZNoneZ ChannelManager_blinded_paths_for_async_recipient(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_u8Z recipient_id, struct LDKCOption_u64Z relative_expiry); /** - * A randomly chosen unique identifier for this output, which is even for initiators and odd for - * non-initiators. + * Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids + * are used when constructing the phantom invoice's route hints. + * + * [phantom node payments]: crate::sign::PhantomKeysManager */ -uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * A randomly chosen unique identifier for this output, which is even for initiators and odd for - * non-initiators. + * Gets route hints for use in receiving [phantom node payments]. + * + * [phantom node payments]: crate::sign::PhantomKeysManager */ -void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The satoshi value of the output + * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are + * used when constructing the route hints for HTLCs intended to be intercepted. See + * [`ChannelManager::forward_intercepted_htlc`]. + * + * Note that this method is not guaranteed to return unique values, you may need to call it a few + * times to get a unique scid. */ -uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The satoshi value of the output + * Gets inflight HTLC information by processing pending outbound payments that are in + * our channels. May be used during pathfinding to account for in-use channel liquidity. */ -void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The scriptPubKey for the output + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is */ -struct LDKCVec_u8Z TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); +struct LDKBaseMessageHandler ChannelManager_as_BaseMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The scriptPubKey for the output + * Constructs a new EventsProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is */ -void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKEventsProvider ChannelManager_as_EventsProvider(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new TxAddOutput given each field + * Constructs a new Listen which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is */ -MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg); +struct LDKListen ChannelManager_as_Listen(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the TxAddOutput + * Constructs a new Confirm which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is */ -struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig); +struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the TxAddOutput. + * 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. */ -uint64_t TxAddOutput_hash(const struct LDKTxAddOutput *NONNULL_PTR o); +MUST_USE_RES struct LDKFuture ChannelManager_get_event_or_persistence_needed_future(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two TxAddOutputs 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. + * Returns true if this [`ChannelManager`] needs to be persisted. + * + * See [`Self::get_event_or_persistence_needed_future`] for retrieving a [`Future`] that + * indicates this should be checked. */ -bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b); +MUST_USE_RES bool ChannelManager_get_and_clear_needs_persistence(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL. + * Gets the latest best block which was connected either via the [`chain::Listen`] or + * [`chain::Confirm`] interfaces. */ -void TxRemoveInput_free(struct LDKTxRemoveInput this_obj); +MUST_USE_RES struct LDKBestBlock ChannelManager_current_best_block(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The channel ID + * Fetches the set of [`NodeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKChannelId TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKNodeFeatures ChannelManager_node_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The channel ID + * Fetches the set of [`ChannelFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKChannelFeatures ChannelManager_channel_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The serial ID of the input to be removed + * Fetches the set of [`ChannelTypeFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelManager_channel_type_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The serial ID of the input to be removed + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKInitFeatures ChannelManager_init_features(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Constructs a new TxRemoveInput given each field + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); +struct LDKChannelMessageHandler ChannelManager_as_ChannelMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Creates a copy of the TxRemoveInput + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is */ -struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig); +struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the TxRemoveInput. + * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is */ -uint64_t TxRemoveInput_hash(const struct LDKTxRemoveInput *NONNULL_PTR o); +struct LDKAsyncPaymentsMessageHandler ChannelManager_as_AsyncPaymentsMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Checks if two TxRemoveInputs 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. + * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is */ -bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b); +struct LDKDNSResolverMessageHandler ChannelManager_as_DNSResolverMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL. + * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is */ -void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj); +struct LDKNodeIdLookUp ChannelManager_as_NodeIdLookUp(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * The channel ID + * Fetches the set of [`InitFeatures`] flags that are provided by or required by + * [`ChannelManager`]. */ -struct LDKChannelId TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); +struct LDKInitFeatures provided_init_features(const struct LDKUserConfig *NONNULL_PTR config); /** - * The channel ID + * Serialize the PhantomRouteHints object into a byte array which can be read by PhantomRouteHints_read */ -void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKCVec_u8Z PhantomRouteHints_write(const struct LDKPhantomRouteHints *NONNULL_PTR obj); /** - * The serial ID of the output to be removed + * Read a PhantomRouteHints from a byte array, created by PhantomRouteHints_write */ -uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ PhantomRouteHints_read(struct LDKu8slice ser); /** - * The serial ID of the output to be removed + * Serialize the BlindedForward object into a byte array which can be read by BlindedForward_read */ -void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z BlindedForward_write(const struct LDKBlindedForward *NONNULL_PTR obj); /** - * Constructs a new TxRemoveOutput given each field + * Read a BlindedForward from a byte array, created by BlindedForward_write */ -MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); +struct LDKCResult_BlindedForwardDecodeErrorZ BlindedForward_read(struct LDKu8slice ser); /** - * Creates a copy of the TxRemoveOutput + * Serialize the PendingHTLCRouting object into a byte array which can be read by PendingHTLCRouting_read */ -struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig); +struct LDKCVec_u8Z PendingHTLCRouting_write(const struct LDKPendingHTLCRouting *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the TxRemoveOutput. + * Read a PendingHTLCRouting from a byte array, created by PendingHTLCRouting_write */ -uint64_t TxRemoveOutput_hash(const struct LDKTxRemoveOutput *NONNULL_PTR o); +struct LDKCResult_PendingHTLCRoutingDecodeErrorZ PendingHTLCRouting_read(struct LDKu8slice ser); /** - * Checks if two TxRemoveOutputs 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. + * Serialize the PendingHTLCInfo object into a byte array which can be read by PendingHTLCInfo_read */ -bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b); +struct LDKCVec_u8Z PendingHTLCInfo_write(const struct LDKPendingHTLCInfo *NONNULL_PTR obj); /** - * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL. + * Read a PendingHTLCInfo from a byte array, created by PendingHTLCInfo_write */ -void TxComplete_free(struct LDKTxComplete this_obj); +struct LDKCResult_PendingHTLCInfoDecodeErrorZ PendingHTLCInfo_read(struct LDKu8slice ser); /** - * The channel ID + * Serialize the BlindedFailure object into a byte array which can be read by BlindedFailure_read */ -struct LDKChannelId TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z BlindedFailure_write(const enum LDKBlindedFailure *NONNULL_PTR obj); /** - * The channel ID + * Read a BlindedFailure from a byte array, created by BlindedFailure_write */ -void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKCResult_BlindedFailureDecodeErrorZ BlindedFailure_read(struct LDKu8slice ser); /** - * Constructs a new TxComplete given each field + * Serialize the ChannelManager object into a byte array which can be read by ChannelManager_read */ -MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKChannelId channel_id_arg); +struct LDKCVec_u8Z ChannelManager_write(const struct LDKChannelManager *NONNULL_PTR obj); /** - * Creates a copy of the TxComplete + * Frees any resources used by the ChannelManagerReadArgs, if is_owned is set and inner is non-NULL. */ -struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig); +void ChannelManagerReadArgs_free(struct LDKChannelManagerReadArgs this_obj); /** - * Generates a non-cryptographic 64-bit hash of the TxComplete. + * A cryptographically secure source of entropy. */ -uint64_t TxComplete_hash(const struct LDKTxComplete *NONNULL_PTR o); +const struct LDKEntropySource *ChannelManagerReadArgs_get_entropy_source(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Checks if two TxCompletes 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. + * A cryptographically secure source of entropy. */ -bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b); +void ChannelManagerReadArgs_set_entropy_source(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKEntropySource val); /** - * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL. + * A signer that is able to perform node-scoped cryptographic operations. */ -void TxSignatures_free(struct LDKTxSignatures this_obj); +const struct LDKNodeSigner *ChannelManagerReadArgs_get_node_signer(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The channel ID + * A signer that is able to perform node-scoped cryptographic operations. */ -struct LDKChannelId TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr); +void ChannelManagerReadArgs_set_node_signer(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKNodeSigner val); /** - * The channel ID + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and [`SignerProvider::derive_channel_signer`] will be used to derive + * per-Channel signing data. */ -void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); +const struct LDKSignerProvider *ChannelManagerReadArgs_get_signer_provider(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The TXID + * The keys provider which will give us relevant keys. Some keys will be loaded during + * deserialization and [`SignerProvider::derive_channel_signer`] will be used to derive + * per-Channel signing data. */ -const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32]; +void ChannelManagerReadArgs_set_signer_provider(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKSignerProvider val); /** - * The TXID + * The fee_estimator for use in the ChannelManager in the future. + * + * No calls to the FeeEstimator will be made during deserialization. */ -void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +const struct LDKFeeEstimator *ChannelManagerReadArgs_get_fee_estimator(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The list of witnesses + * The fee_estimator for use in the ChannelManager in the future. * - * Returns a copy of the field. + * No calls to the FeeEstimator will be made during deserialization. */ -struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr); +void ChannelManagerReadArgs_set_fee_estimator(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKFeeEstimator val); /** - * The list of witnesses + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val); +const struct LDKWatch *ChannelManagerReadArgs_get_chain_monitor(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers + * The chain::Watch for use in the ChannelManager in the future. + * + * No calls to the chain::Watch will be made during deserialization. It is assumed that + * you have deserialized ChannelMonitors separately and will add them to your + * chain::Watch after deserializing this ChannelManager. */ -struct LDKCOption_ECDSASignatureZ TxSignatures_get_shared_input_signature(const struct LDKTxSignatures *NONNULL_PTR this_ptr); +void ChannelManagerReadArgs_set_chain_monitor(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKWatch val); /** - * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -void TxSignatures_set_shared_input_signature(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); +const struct LDKBroadcasterInterface *ChannelManagerReadArgs_get_tx_broadcaster(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Constructs a new TxSignatures given each field + * The BroadcasterInterface which will be used in the ChannelManager in the future and may be + * used to broadcast the latest local commitment transactions of channels which must be + * force-closed during deserialization. */ -MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg, struct LDKCOption_ECDSASignatureZ shared_input_signature_arg); +void ChannelManagerReadArgs_set_tx_broadcaster(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKBroadcasterInterface val); /** - * Creates a copy of the TxSignatures + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig); +const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the TxSignatures. + * The router which will be used in the ChannelManager in the future for finding routes + * on-the-fly for trampoline payments. Absent in private nodes that don't support forwarding. + * + * No calls to the router will be made during deserialization. */ -uint64_t TxSignatures_hash(const struct LDKTxSignatures *NONNULL_PTR o); +void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); /** - * Checks if two TxSignaturess 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. + * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, + * [`Refund`]s, and any reply paths. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath */ -bool TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b); +const struct LDKMessageRouter *ChannelManagerReadArgs_get_message_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL. + * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, + * [`Refund`]s, and any reply paths. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath */ -void TxInitRbf_free(struct LDKTxInitRbf this_obj); +void ChannelManagerReadArgs_set_message_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKMessageRouter val); /** - * The channel ID + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -struct LDKChannelId TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +const struct LDKLogger *ChannelManagerReadArgs_get_logger(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The channel ID + * The Logger for use in the ChannelManager and which may be used to log information during + * deserialization. */ -void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); +void ChannelManagerReadArgs_set_logger(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKLogger val); /** - * The locktime of the transaction + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +struct LDKUserConfig ChannelManagerReadArgs_get_config(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); /** - * The locktime of the transaction + * Default settings used for new channels. Any existing channels will continue to use the + * runtime settings which were stored when the ChannelManager was serialized. */ -void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); +void ChannelManagerReadArgs_set_config(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKUserConfig val); /** - * The feerate of the transaction + * Simple utility function to create a ChannelManagerReadArgs which creates the monitor + * HashMap for you. This is primarily useful for C bindings where it is not practical to + * populate a HashMap directly from C. */ -uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +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 LDKMessageRouter message_router, struct LDKLogger logger, struct LDKUserConfig config, struct LDKCVec_ChannelMonitorZ channel_monitors); /** - * The feerate of the transaction + * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write */ -void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * Frees any resources used by the SpliceContribution */ -struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); +void SpliceContribution_free(struct LDKSpliceContribution this_ptr); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * Creates a copy of the SpliceContribution */ -void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); +struct LDKSpliceContribution SpliceContribution_clone(const struct LDKSpliceContribution *NONNULL_PTR orig); /** - * Constructs a new TxInitRbf given each field + * Utility method to constructs a new SpliceIn-variant SpliceContribution */ -MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKChannelId channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg); +struct LDKSpliceContribution SpliceContribution_splice_in(uint64_t value, struct LDKCVec_FundingTxInputZ inputs, struct LDKCOption_CVec_u8ZZ change_script); /** - * Creates a copy of the TxInitRbf + * Utility method to constructs a new SpliceOut-variant SpliceContribution */ -struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig); +struct LDKSpliceContribution SpliceContribution_splice_out(struct LDKCVec_TxOutZ outputs); /** - * Generates a non-cryptographic 64-bit hash of the TxInitRbf. + * Frees any resources used by the FundingTxInput, if is_owned is set and inner is non-NULL. */ -uint64_t TxInitRbf_hash(const struct LDKTxInitRbf *NONNULL_PTR o); +void FundingTxInput_free(struct LDKFundingTxInput this_obj); /** - * Checks if two TxInitRbfs 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. + * Creates a copy of the FundingTxInput */ -bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b); +struct LDKFundingTxInput FundingTxInput_clone(const struct LDKFundingTxInput *NONNULL_PTR orig); /** - * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL. + * Serialize the FundingTxInput object into a byte array which can be read by FundingTxInput_read */ -void TxAckRbf_free(struct LDKTxAckRbf this_obj); +struct LDKCVec_u8Z FundingTxInput_write(const struct LDKFundingTxInput *NONNULL_PTR obj); /** - * The channel ID + * Read a FundingTxInput from a byte array, created by FundingTxInput_write */ -struct LDKChannelId TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); +struct LDKCResult_FundingTxInputDecodeErrorZ FundingTxInput_read(struct LDKu8slice ser); /** - * The channel ID + * Creates an input spending a P2WPKH output from the given `prevtx` at index `vout`. + * + * Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden + * by [`set_sequence`]. + * + * Returns `Err` if no such output exists in `prevtx` at index `vout`. + * + * [`TxIn::sequence`]: bitcoin::TxIn::sequence + * [`set_sequence`]: Self::set_sequence */ -void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); +MUST_USE_RES struct LDKCResult_FundingTxInputNoneZ FundingTxInput_new_p2wpkh(struct LDKTransaction prevtx, uint32_t vout); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * Creates an input spending a P2WSH output from the given `prevtx` at index `vout`. + * + * Requires passing the weight of witness needed to satisfy the output's script. + * + * Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden + * by [`set_sequence`]. + * + * Returns `Err` if no such output exists in `prevtx` at index `vout`. + * + * [`TxIn::sequence`]: bitcoin::TxIn::sequence + * [`set_sequence`]: Self::set_sequence */ -struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_FundingTxInputNoneZ FundingTxInput_new_p2wsh(struct LDKTransaction prevtx, uint32_t vout, uint64_t witness_weight); /** - * The number of satoshis the sender will contribute to or, if negative, remove from - * (e.g. splice-out) the funding output of the transaction + * Creates an input spending a P2TR output from the given `prevtx` at index `vout`. + * + * This is meant for inputs spending a taproot output using the key path. See + * [`new_p2tr_script_spend`] for when spending using a script path. + * + * Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden + * by [`set_sequence`]. + * + * Returns `Err` if no such output exists in `prevtx` at index `vout`. + * + * [`new_p2tr_script_spend`]: Self::new_p2tr_script_spend + * + * [`TxIn::sequence`]: bitcoin::TxIn::sequence + * [`set_sequence`]: Self::set_sequence */ -void TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); +MUST_USE_RES struct LDKCResult_FundingTxInputNoneZ FundingTxInput_new_p2tr_key_spend(struct LDKTransaction prevtx, uint32_t vout); /** - * Constructs a new TxAckRbf given each field + * Creates an input spending a P2TR output from the given `prevtx` at index `vout`. + * + * Requires passing the weight of witness needed to satisfy a script path of the taproot + * output. See [`new_p2tr_key_spend`] for when spending using the key path. + * + * Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden + * by [`set_sequence`]. + * + * Returns `Err` if no such output exists in `prevtx` at index `vout`. + * + * [`new_p2tr_key_spend`]: Self::new_p2tr_key_spend + * + * [`TxIn::sequence`]: bitcoin::TxIn::sequence + * [`set_sequence`]: Self::set_sequence */ -MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKChannelId channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg); +MUST_USE_RES struct LDKCResult_FundingTxInputNoneZ FundingTxInput_new_p2tr_script_spend(struct LDKTransaction prevtx, uint32_t vout, uint64_t witness_weight); /** - * Creates a copy of the TxAckRbf + * The outpoint of the UTXO being spent. */ -struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig); +MUST_USE_RES struct LDKOutPoint FundingTxInput_outpoint(const struct LDKFundingTxInput *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the TxAckRbf. + * The sequence number to use in the [`TxIn`]. + * + * [`TxIn`]: bitcoin::TxIn */ -uint64_t TxAckRbf_hash(const struct LDKTxAckRbf *NONNULL_PTR o); +MUST_USE_RES uint32_t FundingTxInput_sequence(const struct LDKFundingTxInput *NONNULL_PTR this_arg); /** - * Checks if two TxAckRbfs 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. + * Sets the sequence number to use in the [`TxIn`]. + * + * [`TxIn`]: bitcoin::TxIn */ -bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b); +void FundingTxInput_set_sequence(struct LDKFundingTxInput *NONNULL_PTR this_arg, uint32_t sequence); /** - * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL. + * Converts the [`FundingTxInput`] into a [`Utxo`] for coin selection. */ -void TxAbort_free(struct LDKTxAbort this_obj); +MUST_USE_RES struct LDKUtxo FundingTxInput_into_utxo(struct LDKFundingTxInput this_arg); /** - * The channel ID + * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. */ -struct LDKChannelId TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr); +void ExpandedKey_free(struct LDKExpandedKey this_obj); /** - * The channel ID + * Generates a non-cryptographic 64-bit hash of the ExpandedKey. */ -void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKChannelId val); +uint64_t ExpandedKey_hash(const struct LDKExpandedKey *NONNULL_PTR o); /** - * Message data - * - * Returns a copy of the field. + * Creates a copy of the ExpandedKey */ -struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr); +struct LDKExpandedKey ExpandedKey_clone(const struct LDKExpandedKey *NONNULL_PTR orig); /** - * Message data + * Checks if two ExpandedKeys 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. */ -void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +bool ExpandedKey_eq(const struct LDKExpandedKey *NONNULL_PTR a, const struct LDKExpandedKey *NONNULL_PTR b); /** - * Constructs a new TxAbort given each field + * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. + * + * It is recommended to cache this value and not regenerate it for each new inbound payment. */ -MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z data_arg); +MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(struct LDKThirtyTwoBytes key_material); /** - * Creates a copy of the TxAbort + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no + * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without + * a `ChannelManager`. + * + * `keys` is generated by calling [`NodeSigner::get_expanded_key`]. It is recommended to + * cache this value and not regenerate it for each new inbound payment. + * + * `current_time` is a Unix timestamp representing the current time. + * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [phantom node payments]: crate::sign::PhantomKeysManager + * [`NodeSigner::get_expanded_key`]: crate::sign::NodeSigner::get_expanded_key */ -struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig); +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); /** - * Generates a non-cryptographic 64-bit hash of the TxAbort. + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], + * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments] + * without a `ChannelManager`. + * + * See [`create`] for information on the `keys` and `current_time` parameters. + * + * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable + * on versions of LDK prior to 0.0.114. + * + * [phantom node payments]: crate::sign::PhantomKeysManager */ -uint64_t TxAbort_hash(const struct LDKTxAbort *NONNULL_PTR o); +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); /** - * Checks if two TxAborts 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. + * Frees any resources used by the DecodeError */ -bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b); +void DecodeError_free(struct LDKDecodeError this_ptr); /** - * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. + * Creates a copy of the DecodeError */ -void Shutdown_free(struct LDKShutdown this_obj); +struct LDKDecodeError DecodeError_clone(const struct LDKDecodeError *NONNULL_PTR orig); /** - * The channel ID + * Utility method to constructs a new UnknownVersion-variant DecodeError */ -struct LDKChannelId Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr); +struct LDKDecodeError DecodeError_unknown_version(void); /** - * The channel ID + * Utility method to constructs a new UnknownRequiredFeature-variant DecodeError */ -void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKChannelId val); +struct LDKDecodeError DecodeError_unknown_required_feature(void); /** - * The destination of this peer's funds on closing. - * - * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. + * Utility method to constructs a new InvalidValue-variant DecodeError */ -struct LDKCVec_u8Z Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); +struct LDKDecodeError DecodeError_invalid_value(void); /** - * The destination of this peer's funds on closing. - * - * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. + * Utility method to constructs a new ShortRead-variant DecodeError */ -void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +struct LDKDecodeError DecodeError_short_read(void); /** - * Constructs a new Shutdown given each field + * Utility method to constructs a new BadLengthDescriptor-variant DecodeError */ -MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); +struct LDKDecodeError DecodeError_bad_length_descriptor(void); /** - * Creates a copy of the Shutdown + * Utility method to constructs a new Io-variant DecodeError */ -struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); +struct LDKDecodeError DecodeError_io(enum LDKIOError a); /** - * Generates a non-cryptographic 64-bit hash of the Shutdown. + * Utility method to constructs a new UnsupportedCompression-variant DecodeError */ -uint64_t Shutdown_hash(const struct LDKShutdown *NONNULL_PTR o); +struct LDKDecodeError DecodeError_unsupported_compression(void); /** - * Checks if two Shutdowns 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. + * Utility method to constructs a new DangerousValue-variant DecodeError */ -bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); +struct LDKDecodeError DecodeError_dangerous_value(void); /** - * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the DecodeError. */ -void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); +uint64_t DecodeError_hash(const struct LDKDecodeError *NONNULL_PTR o); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Checks if two DecodeErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +bool DecodeError_eq(const struct LDKDecodeError *NONNULL_PTR a, const struct LDKDecodeError *NONNULL_PTR b); /** - * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * Frees any resources used by the Init, if is_owned is set and inner is non-NULL. */ -void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +void Init_free(struct LDKInit this_obj); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * The relevant features which the sender supports. */ -uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); +struct LDKInitFeatures Init_get_features(const struct LDKInit *NONNULL_PTR this_ptr); /** - * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing - * transaction. + * The relevant features which the sender supports. */ -void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); +void Init_set_features(struct LDKInit *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Constructs a new ClosingSignedFeeRange given each field + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); +struct LDKCOption_CVec_ThirtyTwoBytesZZ Init_get_networks(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Creates a copy of the ClosingSignedFeeRange + * Indicates chains the sender is interested in. + * + * If there are no common chains, the connection will be closed. */ -struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); +void Init_set_networks(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_CVec_ThirtyTwoBytesZZ val); /** - * Generates a non-cryptographic 64-bit hash of the ClosingSignedFeeRange. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing + * the new address. */ -uint64_t ClosingSignedFeeRange_hash(const struct LDKClosingSignedFeeRange *NONNULL_PTR o); +struct LDKCOption_SocketAddressZ Init_get_remote_network_address(const struct LDKInit *NONNULL_PTR this_ptr); /** - * Checks if two ClosingSignedFeeRanges 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. + * The receipient's network address. + * + * This adds the option to report a remote IP address back to a connecting peer using the init + * message. A node can decide to use that information to discover a potential update to its + * public IPv4 address (NAT) and use that for a [`NodeAnnouncement`] update message containing + * the new address. */ -bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); +void Init_set_remote_network_address(struct LDKInit *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** - * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. + * Constructs a new Init given each field */ -void ClosingSigned_free(struct LDKClosingSigned this_obj); +MUST_USE_RES struct LDKInit Init_new(struct LDKInitFeatures features_arg, struct LDKCOption_CVec_ThirtyTwoBytesZZ networks_arg, struct LDKCOption_SocketAddressZ remote_network_address_arg); /** - * The channel ID + * Creates a copy of the Init */ -struct LDKChannelId ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKInit Init_clone(const struct LDKInit *NONNULL_PTR orig); /** - * The channel ID + * Generates a non-cryptographic 64-bit hash of the Init. */ -void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); +uint64_t Init_hash(const struct LDKInit *NONNULL_PTR o); /** - * The proposed total fee for the closing transaction + * Checks if two Inits 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. */ -uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +bool Init_eq(const struct LDKInit *NONNULL_PTR a, const struct LDKInit *NONNULL_PTR b); /** - * The proposed total fee for the closing transaction + * Frees any resources used by the ErrorMessage, if is_owned is set and inner is non-NULL. */ -void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); +void ErrorMessage_free(struct LDKErrorMessage this_obj); /** - * A signature on the closing transaction + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ -struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKChannelId ErrorMessage_get_channel_id(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * A signature on the closing transaction + * The channel ID involved in the error. + * + * All-0s indicates a general error unrelated to a specific channel, after which all channels + * with the sending peer should be closed. */ -void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void ErrorMessage_set_channel_id(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. + * A possibly human-readable error description. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); +struct LDKStr ErrorMessage_get_data(const struct LDKErrorMessage *NONNULL_PTR this_ptr); /** - * The minimum and maximum fees which the sender is willing to accept, provided only by new - * nodes. + * A possibly human-readable error description. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The string should be sanitized before it is used (e.g., emitted to logs or printed to + * `stdout`). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); +void ErrorMessage_set_data(struct LDKErrorMessage *NONNULL_PTR this_ptr, struct LDKStr 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 + * Constructs a new ErrorMessage given each field */ -MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKChannelId channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); +MUST_USE_RES struct LDKErrorMessage ErrorMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); /** - * Creates a copy of the ClosingSigned + * Creates a copy of the ErrorMessage */ -struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); +struct LDKErrorMessage ErrorMessage_clone(const struct LDKErrorMessage *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the ClosingSigned. + * Generates a non-cryptographic 64-bit hash of the ErrorMessage. */ -uint64_t ClosingSigned_hash(const struct LDKClosingSigned *NONNULL_PTR o); +uint64_t ErrorMessage_hash(const struct LDKErrorMessage *NONNULL_PTR o); /** - * Checks if two ClosingSigneds contain equal inner contents. + * Checks if two ErrorMessages 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 ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); +bool ErrorMessage_eq(const struct LDKErrorMessage *NONNULL_PTR a, const struct LDKErrorMessage *NONNULL_PTR b); /** - * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. + * Frees any resources used by the WarningMessage, if is_owned is set and inner is non-NULL. */ -void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); +void WarningMessage_free(struct LDKWarningMessage this_obj); /** - * The channel ID + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -struct LDKChannelId UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKChannelId WarningMessage_get_channel_id(const struct LDKWarningMessage *NONNULL_PTR this_ptr); /** - * The channel ID + * The channel ID involved in the warning. + * + * All-0s indicates a warning unrelated to a specific channel. */ -void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); +void WarningMessage_set_channel_id(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The HTLC ID + * A possibly human-readable warning description. + * + * The string should be sanitized before it is used (e.g. emitted to logs or printed to + * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKStr WarningMessage_get_data(const struct LDKWarningMessage *NONNULL_PTR this_ptr); /** - * The HTLC ID + * A possibly human-readable warning description. + * + * The string should be sanitized before it is used (e.g. emitted to logs or printed to + * stdout). Otherwise, a well crafted error message may trigger a security vulnerability in + * the terminal emulator or the logging subsystem. */ -void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +void WarningMessage_set_data(struct LDKWarningMessage *NONNULL_PTR this_ptr, struct LDKStr val); /** - * The HTLC value in milli-satoshi + * Constructs a new WarningMessage given each field */ -uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKWarningMessage WarningMessage_new(struct LDKChannelId channel_id_arg, struct LDKStr data_arg); /** - * The HTLC value in milli-satoshi + * Creates a copy of the WarningMessage */ -void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); +struct LDKWarningMessage WarningMessage_clone(const struct LDKWarningMessage *NONNULL_PTR orig); /** - * The payment hash, the pre-image of which controls HTLC redemption + * Generates a non-cryptographic 64-bit hash of the WarningMessage. */ -const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; +uint64_t WarningMessage_hash(const struct LDKWarningMessage *NONNULL_PTR o); /** - * The payment hash, the pre-image of which controls HTLC redemption + * Checks if two WarningMessages 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. */ -void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool WarningMessage_eq(const struct LDKWarningMessage *NONNULL_PTR a, const struct LDKWarningMessage *NONNULL_PTR b); /** - * The expiry height of the HTLC + * Frees any resources used by the Ping, if is_owned is set and inner is non-NULL. */ -uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void Ping_free(struct LDKPing this_obj); /** - * The expiry height of the HTLC + * The desired response length. */ -void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); +uint16_t Ping_get_ponglen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * The extra fee skimmed by the sender of this message. See - * [`ChannelConfig::accept_underpaying_htlcs`]. - * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * The desired response length. */ -struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void Ping_set_ponglen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * The extra fee skimmed by the sender of this message. See - * [`ChannelConfig::accept_underpaying_htlcs`]. + * The ping packet size. * - * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs + * This field is not sent on the wire. byteslen zeros are sent. */ -void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +uint16_t Ping_get_byteslen(const struct LDKPing *NONNULL_PTR this_ptr); /** - * The onion routing packet with encrypted data for the next hop. + * The ping packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -struct LDKOnionPacket UpdateAddHTLC_get_onion_routing_packet(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +void Ping_set_byteslen(struct LDKPing *NONNULL_PTR this_ptr, uint16_t val); /** - * The onion routing packet with encrypted data for the next hop. + * Constructs a new Ping given each field */ -void UpdateAddHTLC_set_onion_routing_packet(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKOnionPacket val); +MUST_USE_RES struct LDKPing Ping_new(uint16_t ponglen_arg, uint16_t byteslen_arg); /** - * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion - * routing packet and the recipient-provided encrypted payload within. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the Ping */ -struct LDKPublicKey UpdateAddHTLC_get_blinding_point(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); +struct LDKPing Ping_clone(const struct LDKPing *NONNULL_PTR orig); /** - * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion - * routing packet and the recipient-provided encrypted payload within. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the Ping. */ -void UpdateAddHTLC_set_blinding_point(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t Ping_hash(const struct LDKPing *NONNULL_PTR o); /** - * Constructs a new UpdateAddHTLC given each field - * - * Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two Pings 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. */ -MUST_USE_RES struct LDKUpdateAddHTLC UpdateAddHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, uint64_t amount_msat_arg, struct LDKThirtyTwoBytes payment_hash_arg, uint32_t cltv_expiry_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, struct LDKOnionPacket onion_routing_packet_arg, struct LDKPublicKey blinding_point_arg); +bool Ping_eq(const struct LDKPing *NONNULL_PTR a, const struct LDKPing *NONNULL_PTR b); /** - * Creates a copy of the UpdateAddHTLC + * Frees any resources used by the Pong, if is_owned is set and inner is non-NULL. */ -struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +void Pong_free(struct LDKPong this_obj); /** - * Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -uint64_t UpdateAddHTLC_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR o); +uint16_t Pong_get_byteslen(const struct LDKPong *NONNULL_PTR this_ptr); /** - * Checks if two UpdateAddHTLCs 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. + * The pong packet size. + * + * This field is not sent on the wire. byteslen zeros are sent. */ -bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); +void Pong_set_byteslen(struct LDKPong *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. + * Constructs a new Pong given each field */ -void OnionMessage_free(struct LDKOnionMessage this_obj); +MUST_USE_RES struct LDKPong Pong_new(uint16_t byteslen_arg); /** - * Used in decrypting the onion packet's payload. + * Creates a copy of the Pong */ -struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); +struct LDKPong Pong_clone(const struct LDKPong *NONNULL_PTR orig); /** - * Used in decrypting the onion packet's payload. + * Generates a non-cryptographic 64-bit hash of the Pong. */ -void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t Pong_hash(const struct LDKPong *NONNULL_PTR o); /** - * The full onion packet including hop data, pubkey, and hmac + * Checks if two Pongs 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. */ -struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); +bool Pong_eq(const struct LDKPong *NONNULL_PTR a, const struct LDKPong *NONNULL_PTR b); /** - * The full onion packet including hop data, pubkey, and hmac + * Frees any resources used by the CommonOpenChannelFields, if is_owned is set and inner is non-NULL. */ -void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); +void CommonOpenChannelFields_free(struct LDKCommonOpenChannelFields this_obj); /** - * Constructs a new OnionMessage given each field + * The genesis hash of the blockchain where the channel is to be opened */ -MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); +const uint8_t (*CommonOpenChannelFields_get_chain_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the OnionMessage + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); +void CommonOpenChannelFields_set_chain_hash(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Generates a non-cryptographic 64-bit hash of the OnionMessage. + * A temporary channel ID + * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint + * For V1 channels: a temporary channel ID, until the funding outpoint is announced */ -uint64_t OnionMessage_hash(const struct LDKOnionMessage *NONNULL_PTR o); +struct LDKChannelId CommonOpenChannelFields_get_temporary_channel_id(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Checks if two OnionMessages 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. + * A temporary channel ID + * For V2 channels: derived using a zeroed out value for the channel acceptor's revocation basepoint + * For V1 channels: a temporary channel ID, until the funding outpoint is announced */ -bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); +void CommonOpenChannelFields_set_temporary_channel_id(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. + * For V1 channels: The channel value + * For V2 channels: Part of the channel value contributed by the channel initiator */ -void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); +uint64_t CommonOpenChannelFields_get_funding_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The channel ID + * For V1 channels: The channel value + * For V2 channels: Part of the channel value contributed by the channel initiator */ -struct LDKChannelId UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); +void CommonOpenChannelFields_set_funding_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel ID + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted */ -void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); +uint64_t CommonOpenChannelFields_get_dust_limit_satoshis(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The HTLC ID + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted */ -uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); +void CommonOpenChannelFields_set_dust_limit_satoshis(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * The HTLC ID + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); +uint64_t CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The pre-image of the payment hash, allowing HTLC redemption + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; +void CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * The pre-image of the payment hash, allowing HTLC redemption + * The minimum HTLC size incoming to channel initiator, in milli-satoshi */ -void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t CommonOpenChannelFields_get_htlc_minimum_msat(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Constructs a new UpdateFulfillHTLC given each field + * The minimum HTLC size incoming to channel initiator, in milli-satoshi */ -MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg); +void CommonOpenChannelFields_set_htlc_minimum_msat(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the UpdateFulfillHTLC + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); +uint32_t CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -uint64_t UpdateFulfillHTLC_hash(const struct LDKUpdateFulfillHTLC *NONNULL_PTR o); +void CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_weight(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two UpdateFulfillHTLCs 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. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); +uint16_t CommonOpenChannelFields_get_to_self_delay(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); +void CommonOpenChannelFields_set_to_self_delay(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * The channel ID + * The maximum number of inbound HTLCs towards channel initiator */ -struct LDKChannelId UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); +uint16_t CommonOpenChannelFields_get_max_accepted_htlcs(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The channel ID + * The maximum number of inbound HTLCs towards channel initiator */ -void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); +void CommonOpenChannelFields_set_max_accepted_htlcs(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * The HTLC ID + * The channel initiator's key controlling the funding transaction */ -uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); +struct LDKPublicKey CommonOpenChannelFields_get_funding_pubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The HTLC ID + * The channel initiator's key controlling the funding transaction */ -void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); +void CommonOpenChannelFields_set_funding_pubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the UpdateFailHTLC + * Used to derive a revocation key for transactions broadcast by counterparty */ -struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); +struct LDKPublicKey CommonOpenChannelFields_get_revocation_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. + * Used to derive a revocation key for transactions broadcast by counterparty */ -uint64_t UpdateFailHTLC_hash(const struct LDKUpdateFailHTLC *NONNULL_PTR o); +void CommonOpenChannelFields_set_revocation_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if two UpdateFailHTLCs 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. + * A payment key to channel initiator for transactions broadcast by counterparty */ -bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); +struct LDKPublicKey CommonOpenChannelFields_get_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. + * A payment key to channel initiator for transactions broadcast by counterparty */ -void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); +void CommonOpenChannelFields_set_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The channel ID + * Used to derive a payment key to channel initiator for transactions broadcast by channel + * initiator */ -struct LDKChannelId UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKPublicKey CommonOpenChannelFields_get_delayed_payment_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The channel ID + * Used to derive a payment key to channel initiator for transactions broadcast by channel + * initiator */ -void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); +void CommonOpenChannelFields_set_delayed_payment_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The HTLC ID + * Used to derive an HTLC payment key to channel initiator */ -uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKPublicKey CommonOpenChannelFields_get_htlc_basepoint(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The HTLC ID + * Used to derive an HTLC payment key to channel initiator */ -void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); +void CommonOpenChannelFields_set_htlc_basepoint(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The failure code + * The first to-be-broadcast-by-channel-initiator transaction's per commitment point */ -uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); +struct LDKPublicKey CommonOpenChannelFields_get_first_per_commitment_point(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * The failure code + * The first to-be-broadcast-by-channel-initiator transaction's per commitment point */ -void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); +void CommonOpenChannelFields_set_first_per_commitment_point(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the UpdateFailMalformedHTLC + * The channel flags to be used */ -struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); +uint8_t CommonOpenChannelFields_get_channel_flags(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. + * The channel flags to be used */ -uint64_t UpdateFailMalformedHTLC_hash(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR o); +void CommonOpenChannelFields_set_channel_flags(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, uint8_t val); /** - * Checks if two UpdateFailMalformedHTLCs 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. + * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we + * collaboratively close */ -bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); +struct LDKCOption_CVec_u8ZZ CommonOpenChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentSignedBatch, if is_owned is set and inner is non-NULL. + * Optionally, a request to pre-set the to-channel-initiator output's scriptPubkey for when we + * collaboratively close */ -void CommitmentSignedBatch_free(struct LDKCommitmentSignedBatch this_obj); +void CommonOpenChannelFields_set_shutdown_scriptpubkey(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Batch size N: all N `commitment_signed` messages must be received before being processed + * The channel type that this channel will represent. As defined in the latest + * specification, this field is required. However, it is an `Option` for legacy reasons. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint16_t CommitmentSignedBatch_get_batch_size(const struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr); +struct LDKChannelTypeFeatures CommonOpenChannelFields_get_channel_type(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr); /** - * Batch size N: all N `commitment_signed` messages must be received before being processed + * The channel type that this channel will represent. As defined in the latest + * specification, this field is required. However, it is an `Option` for legacy reasons. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void CommitmentSignedBatch_set_batch_size(struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr, uint16_t val); +void CommonOpenChannelFields_set_channel_type(struct LDKCommonOpenChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) + * Constructs a new CommonOpenChannelFields given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const uint8_t (*CommitmentSignedBatch_get_funding_txid(const struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCommonOpenChannelFields CommonOpenChannelFields_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKChannelId 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 commitment_feerate_sat_per_1000_weight_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, uint8_t channel_flags_arg, struct LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** - * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) + * Creates a copy of the CommonOpenChannelFields */ -void CommitmentSignedBatch_set_funding_txid(struct LDKCommitmentSignedBatch *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCommonOpenChannelFields CommonOpenChannelFields_clone(const struct LDKCommonOpenChannelFields *NONNULL_PTR orig); /** - * Constructs a new CommitmentSignedBatch given each field + * Generates a non-cryptographic 64-bit hash of the CommonOpenChannelFields. */ -MUST_USE_RES struct LDKCommitmentSignedBatch CommitmentSignedBatch_new(uint16_t batch_size_arg, struct LDKThirtyTwoBytes funding_txid_arg); +uint64_t CommonOpenChannelFields_hash(const struct LDKCommonOpenChannelFields *NONNULL_PTR o); /** - * Creates a copy of the CommitmentSignedBatch + * Checks if two CommonOpenChannelFieldss 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. */ -struct LDKCommitmentSignedBatch CommitmentSignedBatch_clone(const struct LDKCommitmentSignedBatch *NONNULL_PTR orig); +bool CommonOpenChannelFields_eq(const struct LDKCommonOpenChannelFields *NONNULL_PTR a, const struct LDKCommonOpenChannelFields *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the CommitmentSignedBatch. + * The [`ChannelParameters`] for this channel. */ -uint64_t CommitmentSignedBatch_hash(const struct LDKCommitmentSignedBatch *NONNULL_PTR o); +MUST_USE_RES struct LDKChannelParameters CommonOpenChannelFields_channel_parameters(const struct LDKCommonOpenChannelFields *NONNULL_PTR this_arg); /** - * Checks if two CommitmentSignedBatchs 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. + * Frees any resources used by the ChannelParameters, if is_owned is set and inner is non-NULL. */ -bool CommitmentSignedBatch_eq(const struct LDKCommitmentSignedBatch *NONNULL_PTR a, const struct LDKCommitmentSignedBatch *NONNULL_PTR b); +void ChannelParameters_free(struct LDKChannelParameters this_obj); /** - * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted. */ -void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); +uint64_t ChannelParameters_get_dust_limit_satoshis(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * The channel ID + * The threshold below which outputs on transactions broadcast by the channel initiator will be + * omitted. */ -struct LDKChannelId CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +void ChannelParameters_set_dust_limit_satoshis(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel ID + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); +uint64_t ChannelParameters_get_max_htlc_value_in_flight_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * A signature on the commitment transaction + * The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi */ -struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +void ChannelParameters_set_max_htlc_value_in_flight_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A signature on the commitment transaction + * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi */ -void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +uint64_t ChannelParameters_get_htlc_minimum_msat(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Signatures on the HTLC transactions - * - * Returns a copy of the field. + * The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi */ -struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +void ChannelParameters_set_htlc_minimum_msat(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Signatures on the HTLC transactions + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); +uint32_t ChannelParameters_get_commitment_feerate_sat_per_1000_weight(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Optional batch size and other parameters - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The feerate for the commitment transaction set by the channel initiator until updated by + * [`UpdateFee`] */ -struct LDKCommitmentSignedBatch CommitmentSigned_get_batch(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); +void ChannelParameters_set_commitment_feerate_sat_per_1000_weight(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Optional batch size and other parameters - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The number of blocks which the non-channel-initator will have to wait to claim on-chain + * funds if they broadcast a commitment transaction. */ -void CommitmentSigned_set_batch(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCommitmentSignedBatch val); +uint16_t ChannelParameters_get_to_self_delay(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Constructs a new CommitmentSigned given each field - * - * Note that batch_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * The number of blocks which the non-channel-initator will have to wait to claim on-chain + * funds if they broadcast a commitment transaction. */ -MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg, struct LDKCommitmentSignedBatch batch_arg); +void ChannelParameters_set_to_self_delay(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Creates a copy of the CommitmentSigned + * The maximum number of pending HTLCs towards the channel initiator. */ -struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); +uint16_t ChannelParameters_get_max_accepted_htlcs(const struct LDKChannelParameters *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the CommitmentSigned. + * The maximum number of pending HTLCs towards the channel initiator. */ -uint64_t CommitmentSigned_hash(const struct LDKCommitmentSigned *NONNULL_PTR o); +void ChannelParameters_set_max_accepted_htlcs(struct LDKChannelParameters *NONNULL_PTR this_ptr, uint16_t val); /** - * Checks if two CommitmentSigneds 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. + * Constructs a new ChannelParameters given each field */ -bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); +MUST_USE_RES struct LDKChannelParameters ChannelParameters_new(uint64_t dust_limit_satoshis_arg, uint64_t max_htlc_value_in_flight_msat_arg, uint64_t htlc_minimum_msat_arg, uint32_t commitment_feerate_sat_per_1000_weight_arg, uint16_t to_self_delay_arg, uint16_t max_accepted_htlcs_arg); /** - * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelParameters */ -void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); +struct LDKChannelParameters ChannelParameters_clone(const struct LDKChannelParameters *NONNULL_PTR orig); /** - * The channel ID + * Generates a non-cryptographic 64-bit hash of the ChannelParameters. */ -struct LDKChannelId RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); +uint64_t ChannelParameters_hash(const struct LDKChannelParameters *NONNULL_PTR o); /** - * The channel ID + * Checks if two ChannelParameterss 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. */ -void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKChannelId val); +bool ChannelParameters_eq(const struct LDKChannelParameters *NONNULL_PTR a, const struct LDKChannelParameters *NONNULL_PTR b); /** - * The secret corresponding to the per-commitment point + * Frees any resources used by the OpenChannel, if is_owned is set and inner is non-NULL. */ -const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; +void OpenChannel_free(struct LDKOpenChannel this_obj); /** - * The secret corresponding to the per-commitment point + * Common fields of `open_channel(2)`-like messages */ -void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKCommonOpenChannelFields OpenChannel_get_common_fields(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * The next sender-broadcast commitment transaction's per-commitment point + * Common fields of `open_channel(2)`-like messages */ -struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); +void OpenChannel_set_common_fields(struct LDKOpenChannel *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); /** - * The next sender-broadcast commitment transaction's per-commitment point + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); +uint64_t OpenChannel_get_push_msat(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Constructs a new RevokeAndACK given each field + * The amount to push to the counterparty as part of the open, in milli-satoshi */ -MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg); +void OpenChannel_set_push_msat(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the RevokeAndACK + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); +uint64_t OpenChannel_get_channel_reserve_satoshis(const struct LDKOpenChannel *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the RevokeAndACK. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -uint64_t RevokeAndACK_hash(const struct LDKRevokeAndACK *NONNULL_PTR o); +void OpenChannel_set_channel_reserve_satoshis(struct LDKOpenChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two RevokeAndACKs 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. + * Constructs a new OpenChannel given each field */ -bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); +MUST_USE_RES struct LDKOpenChannel OpenChannel_new(struct LDKCommonOpenChannelFields common_fields_arg, uint64_t push_msat_arg, uint64_t channel_reserve_satoshis_arg); /** - * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. + * Creates a copy of the OpenChannel */ -void UpdateFee_free(struct LDKUpdateFee this_obj); +struct LDKOpenChannel OpenChannel_clone(const struct LDKOpenChannel *NONNULL_PTR orig); /** - * The channel ID + * Generates a non-cryptographic 64-bit hash of the OpenChannel. */ -struct LDKChannelId UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr); +uint64_t OpenChannel_hash(const struct LDKOpenChannel *NONNULL_PTR o); /** - * The channel ID + * Checks if two OpenChannels 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. */ -void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKChannelId val); +bool OpenChannel_eq(const struct LDKOpenChannel *NONNULL_PTR a, const struct LDKOpenChannel *NONNULL_PTR b); /** - * Fee rate per 1000-weight of the transaction + * Frees any resources used by the OpenChannelV2, if is_owned is set and inner is non-NULL. */ -uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); +void OpenChannelV2_free(struct LDKOpenChannelV2 this_obj); /** - * Fee rate per 1000-weight of the transaction + * Common fields of `open_channel(2)`-like messages */ -void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCommonOpenChannelFields OpenChannelV2_get_common_fields(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Constructs a new UpdateFee given each field + * Common fields of `open_channel(2)`-like messages */ -MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKChannelId channel_id_arg, uint32_t feerate_per_kw_arg); +void OpenChannelV2_set_common_fields(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonOpenChannelFields val); /** - * Creates a copy of the UpdateFee + * The feerate for the funding transaction set by the channel initiator */ -struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); +uint32_t OpenChannelV2_get_funding_feerate_sat_per_1000_weight(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the UpdateFee. + * The feerate for the funding transaction set by the channel initiator */ -uint64_t UpdateFee_hash(const struct LDKUpdateFee *NONNULL_PTR o); +void OpenChannelV2_set_funding_feerate_sat_per_1000_weight(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two UpdateFees 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. + * The locktime for the funding transaction */ -bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); +uint32_t OpenChannelV2_get_locktime(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. + * The locktime for the funding transaction */ -void ChannelReestablish_free(struct LDKChannelReestablish this_obj); +void OpenChannelV2_set_locktime(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, uint32_t val); /** - * The channel ID + * The second to-be-broadcast-by-channel-initiator transaction's per commitment point */ -struct LDKChannelId ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +struct LDKPublicKey OpenChannelV2_get_second_per_commitment_point(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * The channel ID + * The second to-be-broadcast-by-channel-initiator transaction's per commitment point */ -void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKChannelId val); +void OpenChannelV2_set_second_per_commitment_point(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The next commitment number for the sender + * Optionally, a requirement that only confirmed inputs can be added */ -uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +enum LDKCOption_NoneZ OpenChannelV2_get_require_confirmed_inputs(const struct LDKOpenChannelV2 *NONNULL_PTR this_ptr); /** - * The next commitment number for the sender + * Optionally, a requirement that only confirmed inputs can be added */ -void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +void OpenChannelV2_set_require_confirmed_inputs(struct LDKOpenChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * The next commitment number for the recipient + * Constructs a new OpenChannelV2 given each field */ -uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKOpenChannelV2 OpenChannelV2_new(struct LDKCommonOpenChannelFields common_fields_arg, uint32_t funding_feerate_sat_per_1000_weight_arg, uint32_t locktime_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * The next commitment number for the recipient + * Creates a copy of the OpenChannelV2 */ -void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); +struct LDKOpenChannelV2 OpenChannelV2_clone(const struct LDKOpenChannelV2 *NONNULL_PTR orig); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * Generates a non-cryptographic 64-bit hash of the OpenChannelV2. */ -const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; +uint64_t OpenChannelV2_hash(const struct LDKOpenChannelV2 *NONNULL_PTR o); /** - * Proof that the sender knows the per-commitment secret of a specific commitment transaction - * belonging to the recipient + * Checks if two OpenChannelV2s 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. */ -void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool OpenChannelV2_eq(const struct LDKOpenChannelV2 *NONNULL_PTR a, const struct LDKOpenChannelV2 *NONNULL_PTR b); /** - * The sender's per-commitment point for their current commitment transaction + * Frees any resources used by the CommonAcceptChannelFields, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +void CommonAcceptChannelFields_free(struct LDKCommonAcceptChannelFields this_obj); /** - * The sender's per-commitment point for their current commitment transaction + * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. */ -void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKChannelId CommonAcceptChannelFields_get_temporary_channel_id(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * The next funding transaction ID + * The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. */ -struct LDKCOption_ThirtyTwoBytesZ ChannelReestablish_get_next_funding_txid(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); +void CommonAcceptChannelFields_set_temporary_channel_id(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The next funding transaction ID + * The threshold below which outputs on transactions broadcast by the channel acceptor will be + * omitted */ -void ChannelReestablish_set_next_funding_txid(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +uint64_t CommonAcceptChannelFields_get_dust_limit_satoshis(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Constructs a new ChannelReestablish given each field + * The threshold below which outputs on transactions broadcast by the channel acceptor will be + * omitted */ -MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKChannelId 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); +void CommonAcceptChannelFields_set_dust_limit_satoshis(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the ChannelReestablish + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); +uint64_t CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the ChannelReestablish. + * The maximum inbound HTLC value in flight towards sender, in milli-satoshi */ -uint64_t ChannelReestablish_hash(const struct LDKChannelReestablish *NONNULL_PTR o); +void CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two ChannelReestablishs 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. + * The minimum HTLC size incoming to channel acceptor, in milli-satoshi */ -bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); +uint64_t CommonAcceptChannelFields_get_htlc_minimum_msat(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. + * The minimum HTLC size incoming to channel acceptor, in milli-satoshi */ -void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); +void CommonAcceptChannelFields_set_htlc_minimum_msat(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint64_t val); /** - * The channel ID + * Minimum depth of the funding transaction before the channel is considered open */ -struct LDKChannelId AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +uint32_t CommonAcceptChannelFields_get_minimum_depth(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * The channel ID + * Minimum depth of the funding transaction before the channel is considered open */ -void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); +void CommonAcceptChannelFields_set_minimum_depth(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint32_t val); /** - * The short channel ID + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +uint16_t CommonAcceptChannelFields_get_to_self_delay(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * The short channel ID + * The number of blocks which the counterparty will have to wait to claim on-chain funds if they + * broadcast a commitment transaction */ -void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); +void CommonAcceptChannelFields_set_to_self_delay(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * A signature by the node key + * The maximum number of inbound HTLCs towards channel acceptor */ -struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +uint16_t CommonAcceptChannelFields_get_max_accepted_htlcs(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * A signature by the node key + * The maximum number of inbound HTLCs towards channel acceptor */ -void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void CommonAcceptChannelFields_set_max_accepted_htlcs(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, uint16_t val); /** - * A signature by the funding key + * The channel acceptor's key controlling the funding transaction */ -struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); +struct LDKPublicKey CommonAcceptChannelFields_get_funding_pubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * A signature by the funding key + * The channel acceptor's key controlling the funding transaction */ -void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void CommonAcceptChannelFields_set_funding_pubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Constructs a new AnnouncementSignatures given each field + * Used to derive a revocation key for transactions broadcast by counterparty */ -MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKChannelId channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); +struct LDKPublicKey CommonAcceptChannelFields_get_revocation_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Creates a copy of the AnnouncementSignatures + * Used to derive a revocation key for transactions broadcast by counterparty */ -struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); +void CommonAcceptChannelFields_set_revocation_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. + * A payment key to channel acceptor for transactions broadcast by counterparty */ -uint64_t AnnouncementSignatures_hash(const struct LDKAnnouncementSignatures *NONNULL_PTR o); +struct LDKPublicKey CommonAcceptChannelFields_get_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Checks if two AnnouncementSignaturess 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. + * A payment key to channel acceptor for transactions broadcast by counterparty */ -bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); +void CommonAcceptChannelFields_set_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Frees any resources used by the SocketAddress + * Used to derive a payment key to channel acceptor for transactions broadcast by channel + * acceptor */ -void SocketAddress_free(struct LDKSocketAddress this_ptr); +struct LDKPublicKey CommonAcceptChannelFields_get_delayed_payment_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Creates a copy of the SocketAddress + * Used to derive a payment key to channel acceptor for transactions broadcast by channel + * acceptor */ -struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); +void CommonAcceptChannelFields_set_delayed_payment_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new TcpIpV4-variant SocketAddress + * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty */ -struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); +struct LDKPublicKey CommonAcceptChannelFields_get_htlc_basepoint(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new TcpIpV6-variant SocketAddress + * Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty */ -struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); +void CommonAcceptChannelFields_set_htlc_basepoint(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new OnionV2-variant SocketAddress + * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); +struct LDKPublicKey CommonAcceptChannelFields_get_first_per_commitment_point(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new OnionV3-variant SocketAddress + * The first to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +void CommonAcceptChannelFields_set_first_per_commitment_point(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new Hostname-variant SocketAddress + * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we + * collaboratively close */ -struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); +struct LDKCOption_CVec_u8ZZ CommonAcceptChannelFields_get_shutdown_scriptpubkey(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the SocketAddress. + * Optionally, a request to pre-set the to-channel-acceptor output's scriptPubkey for when we + * collaboratively close */ -uint64_t SocketAddress_hash(const struct LDKSocketAddress *NONNULL_PTR o); +void CommonAcceptChannelFields_set_shutdown_scriptpubkey(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Checks if two SocketAddresss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The channel type that this channel will represent. As defined in the latest + * specification, this field is required. However, it is an `Option` for legacy reasons. + * + * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s + * [`CommonOpenChannelFields::channel_type`]. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); +struct LDKChannelTypeFeatures CommonAcceptChannelFields_get_channel_type(const struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr); /** - * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read + * The channel type that this channel will represent. As defined in the latest + * specification, this field is required. However, it is an `Option` for legacy reasons. + * + * This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s + * [`CommonOpenChannelFields::channel_type`]. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj); +void CommonAcceptChannelFields_set_channel_type(struct LDKCommonAcceptChannelFields *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); /** - * Read a SocketAddress from a byte array, created by SocketAddress_write + * Constructs a new CommonAcceptChannelFields given each field + * + * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_new(struct LDKChannelId temporary_channel_id_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 LDKCOption_CVec_u8ZZ shutdown_scriptpubkey_arg, struct LDKChannelTypeFeatures channel_type_arg); /** - * Creates a copy of the SocketAddressParseError + * Creates a copy of the CommonAcceptChannelFields */ -enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); +struct LDKCommonAcceptChannelFields CommonAcceptChannelFields_clone(const struct LDKCommonAcceptChannelFields *NONNULL_PTR orig); /** - * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError + * Generates a non-cryptographic 64-bit hash of the CommonAcceptChannelFields. */ -enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); +uint64_t CommonAcceptChannelFields_hash(const struct LDKCommonAcceptChannelFields *NONNULL_PTR o); /** - * Utility method to constructs a new InvalidInput-variant SocketAddressParseError + * Checks if two CommonAcceptChannelFieldss 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. */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); +bool CommonAcceptChannelFields_eq(const struct LDKCommonAcceptChannelFields *NONNULL_PTR a, const struct LDKCommonAcceptChannelFields *NONNULL_PTR b); /** - * Utility method to constructs a new InvalidPort-variant SocketAddressParseError + * Frees any resources used by the AcceptChannel, if is_owned is set and inner is non-NULL. */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); +void AcceptChannel_free(struct LDKAcceptChannel this_obj); /** - * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError + * Common fields of `accept_channel(2)`-like messages */ -enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); +struct LDKCommonAcceptChannelFields AcceptChannel_get_common_fields(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. + * Common fields of `accept_channel(2)`-like messages */ -uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NONNULL_PTR o); +void AcceptChannel_set_common_fields(struct LDKAcceptChannel *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); /** - * Checks if two SocketAddressParseErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); +uint64_t AcceptChannel_get_channel_reserve_satoshis(const struct LDKAcceptChannel *NONNULL_PTR this_ptr); /** - * Get the string representation of a SocketAddressParseError object + * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel */ -struct LDKStr SocketAddressParseError_to_str(const enum LDKSocketAddressParseError *NONNULL_PTR o); +void AcceptChannel_set_channel_reserve_satoshis(struct LDKAcceptChannel *NONNULL_PTR this_ptr, uint64_t val); /** - * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. - * - * The host part must end with \".onion\". + * Constructs a new AcceptChannel given each field */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); +MUST_USE_RES struct LDKAcceptChannel AcceptChannel_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t channel_reserve_satoshis_arg); /** - * Get the string representation of a SocketAddress object + * Creates a copy of the AcceptChannel */ -struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); +struct LDKAcceptChannel AcceptChannel_clone(const struct LDKAcceptChannel *NONNULL_PTR orig); /** - * Read a SocketAddress object from a string + * Generates a non-cryptographic 64-bit hash of the AcceptChannel. */ -struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); +uint64_t AcceptChannel_hash(const struct LDKAcceptChannel *NONNULL_PTR o); /** - * Frees any resources used by the UnsignedGossipMessage + * Checks if two AcceptChannels 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. */ -void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); +bool AcceptChannel_eq(const struct LDKAcceptChannel *NONNULL_PTR a, const struct LDKAcceptChannel *NONNULL_PTR b); /** - * Creates a copy of the UnsignedGossipMessage + * Frees any resources used by the AcceptChannelV2, if is_owned is set and inner is non-NULL. */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); +void AcceptChannelV2_free(struct LDKAcceptChannelV2 this_obj); /** - * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage + * Common fields of `accept_channel(2)`-like messages */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); +struct LDKCommonAcceptChannelFields AcceptChannelV2_get_common_fields(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage + * Common fields of `accept_channel(2)`-like messages */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); +void AcceptChannelV2_set_common_fields(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKCommonAcceptChannelFields val); /** - * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage + * Part of the channel value contributed by the channel acceptor */ -struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); +uint64_t AcceptChannelV2_get_funding_satoshis(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read + * Part of the channel value contributed by the channel acceptor */ -struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); +void AcceptChannelV2_set_funding_satoshis(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. + * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); +struct LDKPublicKey AcceptChannelV2_get_second_per_commitment_point(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * The advertised features + * The second to-be-broadcast-by-channel-acceptor transaction's per commitment point */ -struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void AcceptChannelV2_set_second_per_commitment_point(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The advertised features + * Optionally, a requirement that only confirmed inputs can be added */ -void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +enum LDKCOption_NoneZ AcceptChannelV2_get_require_confirmed_inputs(const struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr); /** - * A strictly monotonic announcement counter, with gaps allowed + * Optionally, a requirement that only confirmed inputs can be added */ -uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +void AcceptChannelV2_set_require_confirmed_inputs(struct LDKAcceptChannelV2 *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * A strictly monotonic announcement counter, with gaps allowed + * Constructs a new AcceptChannelV2 given each field */ -void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKAcceptChannelV2 AcceptChannelV2_new(struct LDKCommonAcceptChannelFields common_fields_arg, uint64_t funding_satoshis_arg, struct LDKPublicKey second_per_commitment_point_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back - * to this node). + * Creates a copy of the AcceptChannelV2 */ -struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKAcceptChannelV2 AcceptChannelV2_clone(const struct LDKAcceptChannelV2 *NONNULL_PTR orig); /** - * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back - * to this node). + * Generates a non-cryptographic 64-bit hash of the AcceptChannelV2. */ -void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +uint64_t AcceptChannelV2_hash(const struct LDKAcceptChannelV2 *NONNULL_PTR o); /** - * An RGB color for UI purposes + * Checks if two AcceptChannelV2s 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. */ -const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; +bool AcceptChannelV2_eq(const struct LDKAcceptChannelV2 *NONNULL_PTR a, const struct LDKAcceptChannelV2 *NONNULL_PTR b); /** - * An RGB color for UI purposes + * Frees any resources used by the FundingCreated, if is_owned is set and inner is non-NULL. */ -void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +void FundingCreated_free(struct LDKFundingCreated this_obj); /** - * An alias, for UI purposes. - * - * This should be sanitized before use. There is no guarantee of uniqueness. + * A temporary channel ID, until the funding is established */ -struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKChannelId FundingCreated_get_temporary_channel_id(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * An alias, for UI purposes. - * - * This should be sanitized before use. There is no guarantee of uniqueness. + * A temporary channel ID, until the funding is established */ -void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val); +void FundingCreated_set_temporary_channel_id(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * List of addresses on which this node is reachable - * - * Returns a copy of the field. + * The funding transaction ID */ -struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +const uint8_t (*FundingCreated_get_funding_txid(const struct LDKFundingCreated *NONNULL_PTR this_ptr))[32]; /** - * List of addresses on which this node is reachable + * The funding transaction ID */ -void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); +void FundingCreated_set_funding_txid(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Excess address 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 address types are added to the lightning gossip protocol. - * - * Returns a copy of the field. + * The specific output index funding this channel */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_address_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +uint16_t FundingCreated_get_funding_output_index(const struct LDKFundingCreated *NONNULL_PTR this_ptr); /** - * Excess address 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 address types are added to the lightning gossip protocol. + * The specific output index funding this channel */ -void UnsignedNodeAnnouncement_set_excess_address_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void FundingCreated_set_funding_output_index(struct LDKFundingCreated *NONNULL_PTR this_ptr, uint16_t 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. + * The signature of the channel initiator (funder) on the initial commitment transaction */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingCreated_get_signature(const struct LDKFundingCreated *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. + * The signature of the channel initiator (funder) on the initial commitment transaction */ -void UnsignedNodeAnnouncement_set_excess_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void FundingCreated_set_signature(struct LDKFundingCreated *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Constructs a new UnsignedNodeAnnouncement given each field + * Constructs a new FundingCreated given each field */ -MUST_USE_RES struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_new(struct LDKNodeFeatures features_arg, uint32_t timestamp_arg, struct LDKNodeId node_id_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg, struct LDKCVec_u8Z excess_address_data_arg, struct LDKCVec_u8Z excess_data_arg); +MUST_USE_RES struct LDKFundingCreated FundingCreated_new(struct LDKChannelId temporary_channel_id_arg, struct LDKThirtyTwoBytes funding_txid_arg, uint16_t funding_output_index_arg, struct LDKECDSASignature signature_arg); /** - * Creates a copy of the UnsignedNodeAnnouncement + * Creates a copy of the FundingCreated */ -struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); +struct LDKFundingCreated FundingCreated_clone(const struct LDKFundingCreated *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. + * Generates a non-cryptographic 64-bit hash of the FundingCreated. */ -uint64_t UnsignedNodeAnnouncement_hash(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR o); +uint64_t FundingCreated_hash(const struct LDKFundingCreated *NONNULL_PTR o); /** - * Checks if two UnsignedNodeAnnouncements contain equal inner contents. + * Checks if two FundingCreateds 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 UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); +bool FundingCreated_eq(const struct LDKFundingCreated *NONNULL_PTR a, const struct LDKFundingCreated *NONNULL_PTR b); /** - * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. + * Frees any resources used by the FundingSigned, if is_owned is set and inner is non-NULL. */ -void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); +void FundingSigned_free(struct LDKFundingSigned this_obj); /** - * The signature by the node key + * The channel ID */ -struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKChannelId FundingSigned_get_channel_id(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * The signature by the node key + * The channel ID */ -void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void FundingSigned_set_channel_id(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The actual content of the announcement + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); +struct LDKECDSASignature FundingSigned_get_signature(const struct LDKFundingSigned *NONNULL_PTR this_ptr); /** - * The actual content of the announcement + * The signature of the channel acceptor (fundee) on the initial commitment transaction */ -void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); +void FundingSigned_set_signature(struct LDKFundingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Constructs a new NodeAnnouncement given each field + * Constructs a new FundingSigned given each field */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); +MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg); /** - * Creates a copy of the NodeAnnouncement + * Creates a copy of the FundingSigned */ -struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); +struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. + * Generates a non-cryptographic 64-bit hash of the FundingSigned. */ -uint64_t NodeAnnouncement_hash(const struct LDKNodeAnnouncement *NONNULL_PTR o); +uint64_t FundingSigned_hash(const struct LDKFundingSigned *NONNULL_PTR o); /** - * Checks if two NodeAnnouncements contain equal inner contents. + * Checks if two FundingSigneds 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 NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b); +bool FundingSigned_eq(const struct LDKFundingSigned *NONNULL_PTR a, const struct LDKFundingSigned *NONNULL_PTR b); /** - * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. */ -void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); +void ChannelReady_free(struct LDKChannelReady this_obj); /** - * The advertised channel features + * The channel ID */ -struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKChannelId ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * The advertised channel features + * The channel ID */ -void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The genesis hash of the blockchain where the channel is to be opened + * The per-commitment point of the second commitment transaction */ -const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; +struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * The per-commitment point of the second commitment transaction */ -void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The short channel ID + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ -uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** - * The short channel ID + * If set, provides a `short_channel_id` alias for this channel. + * + * The sender will accept payments to be forwarded over this SCID and forward them to this + * messages' recipient. */ -void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); +void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * One of the two `node_id`s which are endpoints of this channel + * Constructs a new ChannelReady given each field */ -struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKChannelId channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); /** - * One of the two `node_id`s which are endpoints of this channel + * Creates a copy of the ChannelReady */ -void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); /** - * The other of the two `node_id`s which are endpoints of this channel + * Generates a non-cryptographic 64-bit hash of the ChannelReady. */ -struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +uint64_t ChannelReady_hash(const struct LDKChannelReady *NONNULL_PTR o); /** - * The other of the two `node_id`s which are endpoints of this channel + * Checks if two ChannelReadys 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. */ -void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +bool ChannelReady_eq(const struct LDKChannelReady *NONNULL_PTR a, const struct LDKChannelReady *NONNULL_PTR b); /** - * The funding key for the first node + * Frees any resources used by the Stfu, if is_owned is set and inner is non-NULL. */ -struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +void Stfu_free(struct LDKStfu this_obj); /** - * The funding key for the first node + * The channel ID where quiescence is intended */ -void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKChannelId Stfu_get_channel_id(const struct LDKStfu *NONNULL_PTR this_ptr); /** - * The funding key for the second node + * The channel ID where quiescence is intended */ -struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +void Stfu_set_channel_id(struct LDKStfu *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The funding key for the second node + * Initiator flag, true if initiating, false if replying to an stfu. */ -void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); +bool Stfu_get_initiator(const struct LDKStfu *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. - * - * Returns a copy of the field. + * Initiator flag, true if initiating, false if replying to an stfu. */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); +void Stfu_set_initiator(struct LDKStfu *NONNULL_PTR this_ptr, bool 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. + * Constructs a new Stfu given each field */ -void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +MUST_USE_RES struct LDKStfu Stfu_new(struct LDKChannelId channel_id_arg, bool initiator_arg); /** - * Constructs a new UnsignedChannelAnnouncement given each field + * Creates a copy of the Stfu */ -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); +struct LDKStfu Stfu_clone(const struct LDKStfu *NONNULL_PTR orig); /** - * Creates a copy of the UnsignedChannelAnnouncement + * Checks if two Stfus 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. */ -struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); +bool Stfu_eq(const struct LDKStfu *NONNULL_PTR a, const struct LDKStfu *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. + * Frees any resources used by the SpliceInit, if is_owned is set and inner is non-NULL. */ -uint64_t UnsignedChannelAnnouncement_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR o); +void SpliceInit_free(struct LDKSpliceInit this_obj); /** - * Checks if two UnsignedChannelAnnouncements 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. + * The channel ID where splicing is intended */ -bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); +struct LDKChannelId SpliceInit_get_channel_id(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. + * The channel ID where splicing is intended */ -void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); +void SpliceInit_set_channel_id(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Authentication of the announcement by the first public node + * The amount the splice initiator is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +int64_t SpliceInit_get_funding_contribution_satoshis(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Authentication of the announcement by the first public node + * The amount the splice initiator is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void SpliceInit_set_funding_contribution_satoshis(struct LDKSpliceInit *NONNULL_PTR this_ptr, int64_t val); /** - * Authentication of the announcement by the second public node + * The feerate for the new funding transaction, set by the splice initiator */ -struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +uint32_t SpliceInit_get_funding_feerate_per_kw(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Authentication of the announcement by the second public node + * The feerate for the new funding transaction, set by the splice initiator */ -void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void SpliceInit_set_funding_feerate_per_kw(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_t val); /** - * Proof of funding UTXO ownership by the first public node + * The locktime for the new funding transaction */ -struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +uint32_t SpliceInit_get_locktime(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Proof of funding UTXO ownership by the first public node + * The locktime for the new funding transaction */ -void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void SpliceInit_set_locktime(struct LDKSpliceInit *NONNULL_PTR this_ptr, uint32_t val); /** - * Proof of funding UTXO ownership by the second public node + * The key of the sender (splice initiator) controlling the new funding transaction */ -struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +struct LDKPublicKey SpliceInit_get_funding_pubkey(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * Proof of funding UTXO ownership by the second public node + * The key of the sender (splice initiator) controlling the new funding transaction */ -void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void SpliceInit_set_funding_pubkey(struct LDKSpliceInit *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The actual announcement + * If set, only confirmed inputs added (by the splice acceptor) will be accepted */ -struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); +enum LDKCOption_NoneZ SpliceInit_get_require_confirmed_inputs(const struct LDKSpliceInit *NONNULL_PTR this_ptr); /** - * The actual announcement + * If set, only confirmed inputs added (by the splice acceptor) will be accepted */ -void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); +void SpliceInit_set_require_confirmed_inputs(struct LDKSpliceInit *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Constructs a new ChannelAnnouncement given each field + * Constructs a new SpliceInit given each field */ -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); +MUST_USE_RES struct LDKSpliceInit SpliceInit_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, uint32_t funding_feerate_per_kw_arg, uint32_t locktime_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * Creates a copy of the ChannelAnnouncement + * Creates a copy of the SpliceInit */ -struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); +struct LDKSpliceInit SpliceInit_clone(const struct LDKSpliceInit *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. + * Checks if two SpliceInits 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. */ -uint64_t ChannelAnnouncement_hash(const struct LDKChannelAnnouncement *NONNULL_PTR o); +bool SpliceInit_eq(const struct LDKSpliceInit *NONNULL_PTR a, const struct LDKSpliceInit *NONNULL_PTR b); /** - * Checks if two ChannelAnnouncements 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. + * Frees any resources used by the SpliceAck, if is_owned is set and inner is non-NULL. */ -bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); +void SpliceAck_free(struct LDKSpliceAck this_obj); /** - * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. + * The channel ID where splicing is intended */ -void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); +struct LDKChannelId SpliceAck_get_channel_id(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain where the channel is to be opened + * The channel ID where splicing is intended */ -const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; +void SpliceAck_set_channel_id(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The genesis hash of the blockchain where the channel is to be opened + * The amount the splice acceptor is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +int64_t SpliceAck_get_funding_contribution_satoshis(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * The short channel ID + * The amount the splice acceptor is intending to add to its channel balance (splice-in) + * or remove from its channel balance (splice-out). */ -uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceAck_set_funding_contribution_satoshis(struct LDKSpliceAck *NONNULL_PTR this_ptr, int64_t val); /** - * The short channel ID + * The key of the sender (splice acceptor) controlling the new funding transaction */ -void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPublicKey SpliceAck_get_funding_pubkey(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * The key of the sender (splice acceptor) controlling the new funding transaction */ -uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceAck_set_funding_pubkey(struct LDKSpliceAck *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * A strictly monotonic announcement counter, with gaps allowed, specific to this channel + * If set, only confirmed inputs added (by the splice initiator) will be accepted */ -void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +enum LDKCOption_NoneZ SpliceAck_get_require_confirmed_inputs(const struct LDKSpliceAck *NONNULL_PTR this_ptr); /** - * Flags pertaining to this message. + * If set, only confirmed inputs added (by the splice initiator) will be accepted */ -uint8_t UnsignedChannelUpdate_get_message_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceAck_set_require_confirmed_inputs(struct LDKSpliceAck *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Flags pertaining to this message. + * Constructs a new SpliceAck given each field */ -void UnsignedChannelUpdate_set_message_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKSpliceAck SpliceAck_new(struct LDKChannelId channel_id_arg, int64_t funding_contribution_satoshis_arg, struct LDKPublicKey funding_pubkey_arg, enum LDKCOption_NoneZ require_confirmed_inputs_arg); /** - * Flags pertaining to the channel, including to which direction in the channel this update - * applies and whether the direction is currently able to forward HTLCs. + * Creates a copy of the SpliceAck */ -uint8_t UnsignedChannelUpdate_get_channel_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKSpliceAck SpliceAck_clone(const struct LDKSpliceAck *NONNULL_PTR orig); /** - * Flags pertaining to the channel, including to which direction in the channel this update - * applies and whether the direction is currently able to forward HTLCs. + * Checks if two SpliceAcks 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. */ -void UnsignedChannelUpdate_set_channel_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); +bool SpliceAck_eq(const struct LDKSpliceAck *NONNULL_PTR a, const struct LDKSpliceAck *NONNULL_PTR b); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines - * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a - * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, - * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * Frees any resources used by the SpliceLocked, if is_owned is set and inner is non-NULL. */ -uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceLocked_free(struct LDKSpliceLocked this_obj); /** - * The number of blocks such that if: - * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` - * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines - * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a - * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, - * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before - * forwarding. Note that the HTLC sender is the one who originally sets this value when - * constructing the route. + * The channel ID */ -void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); +struct LDKChannelId SpliceLocked_get_channel_id(const struct LDKSpliceLocked *NONNULL_PTR this_ptr); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The channel ID */ -uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceLocked_set_channel_id(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The minimum HTLC size incoming to sender, in milli-satoshi + * The ID of the new funding transaction that has been locked */ -void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +const uint8_t (*SpliceLocked_get_splice_txid(const struct LDKSpliceLocked *NONNULL_PTR this_ptr))[32]; /** - * The maximum HTLC value incoming to sender, in milli-satoshi. - * - * This used to be optional. + * The ID of the new funding transaction that has been locked */ -uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void SpliceLocked_set_splice_txid(struct LDKSpliceLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The maximum HTLC value incoming to sender, in milli-satoshi. - * - * This used to be optional. + * Constructs a new SpliceLocked given each field */ -void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKSpliceLocked SpliceLocked_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes splice_txid_arg); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Creates a copy of the SpliceLocked */ -uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +struct LDKSpliceLocked SpliceLocked_clone(const struct LDKSpliceLocked *NONNULL_PTR orig); /** - * The base HTLC fee charged by sender, in milli-satoshi + * Checks if two SpliceLockeds 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. */ -void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +bool SpliceLocked_eq(const struct LDKSpliceLocked *NONNULL_PTR a, const struct LDKSpliceLocked *NONNULL_PTR b); /** - * The amount to fee multiplier, in micro-satoshi + * Frees any resources used by the TxAddInput, if is_owned is set and inner is non-NULL. */ -uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void TxAddInput_free(struct LDKTxAddInput this_obj); /** - * The amount to fee multiplier, in micro-satoshi + * The channel ID */ -void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +struct LDKChannelId TxAddInput_get_channel_id(const struct LDKTxAddInput *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. - * - * Returns a copy of the field. + * The channel ID */ -struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); +void TxAddInput_set_channel_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKChannelId 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. + * A randomly chosen unique identifier for this input, which is even for initiators and odd for + * non-initiators. */ -void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +uint64_t TxAddInput_get_serial_id(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Constructs a new UnsignedChannelUpdate given each field + * A randomly chosen unique identifier for this input, which is even for initiators and odd for + * non-initiators. */ -MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t message_flags_arg, uint8_t channel_flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); +void TxAddInput_set_serial_id(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the UnsignedChannelUpdate + * Serialized transaction that contains the output this input spends to verify that it is + * non-malleable. Omitted for shared input. */ -struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); +struct LDKCOption_TransactionZ TxAddInput_get_prevtx(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. + * Serialized transaction that contains the output this input spends to verify that it is + * non-malleable. Omitted for shared input. */ -uint64_t UnsignedChannelUpdate_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR o); +void TxAddInput_set_prevtx(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKCOption_TransactionZ val); /** - * Checks if two UnsignedChannelUpdates 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. + * The index of the output being spent */ -bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); +uint32_t TxAddInput_get_prevtx_out(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. + * The index of the output being spent */ -void ChannelUpdate_free(struct LDKChannelUpdate this_obj); +void TxAddInput_set_prevtx_out(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); /** - * A signature of the channel update + * The sequence number of this input */ -struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +uint32_t TxAddInput_get_sequence(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * A signature of the channel update + * The sequence number of this input */ -void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void TxAddInput_set_sequence(struct LDKTxAddInput *NONNULL_PTR this_ptr, uint32_t val); /** - * The actual channel update + * The ID of the previous funding transaction, when it is being added as an input during splicing */ -struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ TxAddInput_get_shared_input_txid(const struct LDKTxAddInput *NONNULL_PTR this_ptr); /** - * The actual channel update + * The ID of the previous funding transaction, when it is being added as an input during splicing */ -void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); +void TxAddInput_set_shared_input_txid(struct LDKTxAddInput *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Constructs a new ChannelUpdate given each field + * Constructs a new TxAddInput given each field */ -MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); +MUST_USE_RES struct LDKTxAddInput TxAddInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, struct LDKCOption_TransactionZ prevtx_arg, uint32_t prevtx_out_arg, uint32_t sequence_arg, struct LDKCOption_ThirtyTwoBytesZ shared_input_txid_arg); /** - * Creates a copy of the ChannelUpdate + * Creates a copy of the TxAddInput + */ +struct LDKTxAddInput TxAddInput_clone(const struct LDKTxAddInput *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the TxAddInput. + */ +uint64_t TxAddInput_hash(const struct LDKTxAddInput *NONNULL_PTR o); + +/** + * Checks if two TxAddInputs 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. */ -struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); +bool TxAddInput_eq(const struct LDKTxAddInput *NONNULL_PTR a, const struct LDKTxAddInput *NONNULL_PTR b); /** - * Generates a non-cryptographic 64-bit hash of the ChannelUpdate. + * Frees any resources used by the TxAddOutput, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelUpdate_hash(const struct LDKChannelUpdate *NONNULL_PTR o); +void TxAddOutput_free(struct LDKTxAddOutput this_obj); /** - * Checks if two ChannelUpdates 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. + * The channel ID */ -bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); +struct LDKChannelId TxAddOutput_get_channel_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. + * The channel ID */ -void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); +void TxAddOutput_set_channel_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The genesis hash of the blockchain being queried + * A randomly chosen unique identifier for this output, which is even for initiators and odd for + * non-initiators. */ -const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; +uint64_t TxAddOutput_get_serial_id(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain being queried + * A randomly chosen unique identifier for this output, which is even for initiators and odd for + * non-initiators. */ -void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void TxAddOutput_set_serial_id(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); /** - * The height of the first block for the channel UTXOs being queried + * The satoshi value of the output */ -uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +uint64_t TxAddOutput_get_sats(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * The height of the first block for the channel UTXOs being queried + * The satoshi value of the output */ -void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void TxAddOutput_set_sats(struct LDKTxAddOutput *NONNULL_PTR this_ptr, uint64_t val); /** - * The number of blocks to include in the query results + * The scriptPubKey for the output */ -uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAddOutput_get_script(const struct LDKTxAddOutput *NONNULL_PTR this_ptr); /** - * The number of blocks to include in the query results + * The scriptPubKey for the output */ -void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void TxAddOutput_set_script(struct LDKTxAddOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Constructs a new QueryChannelRange given each field + * Constructs a new TxAddOutput given each field */ -MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); +MUST_USE_RES struct LDKTxAddOutput TxAddOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg, uint64_t sats_arg, struct LDKCVec_u8Z script_arg); /** - * Creates a copy of the QueryChannelRange + * Creates a copy of the TxAddOutput */ -struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); +struct LDKTxAddOutput TxAddOutput_clone(const struct LDKTxAddOutput *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the QueryChannelRange. + * Generates a non-cryptographic 64-bit hash of the TxAddOutput. */ -uint64_t QueryChannelRange_hash(const struct LDKQueryChannelRange *NONNULL_PTR o); +uint64_t TxAddOutput_hash(const struct LDKTxAddOutput *NONNULL_PTR o); /** - * Checks if two QueryChannelRanges contain equal inner contents. + * Checks if two TxAddOutputs 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 QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); +bool TxAddOutput_eq(const struct LDKTxAddOutput *NONNULL_PTR a, const struct LDKTxAddOutput *NONNULL_PTR b); /** - * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. + * Frees any resources used by the TxRemoveInput, if is_owned is set and inner is non-NULL. */ -void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); +void TxRemoveInput_free(struct LDKTxRemoveInput this_obj); /** - * The genesis hash of the blockchain being queried + * The channel ID */ -const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; +struct LDKChannelId TxRemoveInput_get_channel_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain being queried + * The channel ID */ -void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void TxRemoveInput_set_channel_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * The height of the first block in the range of the reply + * The serial ID of the input to be removed */ -uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +uint64_t TxRemoveInput_get_serial_id(const struct LDKTxRemoveInput *NONNULL_PTR this_ptr); /** - * The height of the first block in the range of the reply + * The serial ID of the input to be removed */ -void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +void TxRemoveInput_set_serial_id(struct LDKTxRemoveInput *NONNULL_PTR this_ptr, uint64_t val); /** - * The number of blocks included in the range of the reply + * Constructs a new TxRemoveInput given each field */ -uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxRemoveInput TxRemoveInput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); /** - * The number of blocks included in the range of the reply + * Creates a copy of the TxRemoveInput */ -void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); +struct LDKTxRemoveInput TxRemoveInput_clone(const struct LDKTxRemoveInput *NONNULL_PTR orig); /** - * True when this is the final reply for a query + * Generates a non-cryptographic 64-bit hash of the TxRemoveInput. */ -bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +uint64_t TxRemoveInput_hash(const struct LDKTxRemoveInput *NONNULL_PTR o); /** - * True when this is the final reply for a query + * Checks if two TxRemoveInputs 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. */ -void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +bool TxRemoveInput_eq(const struct LDKTxRemoveInput *NONNULL_PTR a, const struct LDKTxRemoveInput *NONNULL_PTR b); /** - * The `short_channel_id`s in the channel range - * - * Returns a copy of the field. + * Frees any resources used by the TxRemoveOutput, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); +void TxRemoveOutput_free(struct LDKTxRemoveOutput this_obj); /** - * The `short_channel_id`s in the channel range + * The channel ID */ -void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKChannelId TxRemoveOutput_get_channel_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); /** - * Constructs a new ReplyChannelRange given each field + * The channel ID */ -MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); +void TxRemoveOutput_set_channel_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a copy of the ReplyChannelRange + * The serial ID of the output to be removed */ -struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); +uint64_t TxRemoveOutput_get_serial_id(const struct LDKTxRemoveOutput *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. + * The serial ID of the output to be removed */ -uint64_t ReplyChannelRange_hash(const struct LDKReplyChannelRange *NONNULL_PTR o); +void TxRemoveOutput_set_serial_id(struct LDKTxRemoveOutput *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two ReplyChannelRanges 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. + * Constructs a new TxRemoveOutput given each field */ -bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); +MUST_USE_RES struct LDKTxRemoveOutput TxRemoveOutput_new(struct LDKChannelId channel_id_arg, uint64_t serial_id_arg); /** - * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. + * Creates a copy of the TxRemoveOutput */ -void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); +struct LDKTxRemoveOutput TxRemoveOutput_clone(const struct LDKTxRemoveOutput *NONNULL_PTR orig); /** - * The genesis hash of the blockchain being queried + * Generates a non-cryptographic 64-bit hash of the TxRemoveOutput. */ -const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; +uint64_t TxRemoveOutput_hash(const struct LDKTxRemoveOutput *NONNULL_PTR o); /** - * The genesis hash of the blockchain being queried + * Checks if two TxRemoveOutputs 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. */ -void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +bool TxRemoveOutput_eq(const struct LDKTxRemoveOutput *NONNULL_PTR a, const struct LDKTxRemoveOutput *NONNULL_PTR b); /** - * The short_channel_ids that are being queried - * - * Returns a copy of the field. + * Frees any resources used by the TxComplete, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); +void TxComplete_free(struct LDKTxComplete this_obj); /** - * The short_channel_ids that are being queried + * The channel ID */ -void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKChannelId TxComplete_get_channel_id(const struct LDKTxComplete *NONNULL_PTR this_ptr); /** - * Constructs a new QueryShortChannelIds given each field + * The channel ID */ -MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); +void TxComplete_set_channel_id(struct LDKTxComplete *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a copy of the QueryShortChannelIds + * Constructs a new TxComplete given each field */ -struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); +MUST_USE_RES struct LDKTxComplete TxComplete_new(struct LDKChannelId channel_id_arg); /** - * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. + * Creates a copy of the TxComplete */ -uint64_t QueryShortChannelIds_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR o); +struct LDKTxComplete TxComplete_clone(const struct LDKTxComplete *NONNULL_PTR orig); /** - * Checks if two QueryShortChannelIdss contain equal inner contents. + * Generates a non-cryptographic 64-bit hash of the TxComplete. + */ +uint64_t TxComplete_hash(const struct LDKTxComplete *NONNULL_PTR o); + +/** + * Checks if two TxCompletes 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 QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); +bool TxComplete_eq(const struct LDKTxComplete *NONNULL_PTR a, const struct LDKTxComplete *NONNULL_PTR b); /** - * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. + * Frees any resources used by the TxSignatures, if is_owned is set and inner is non-NULL. */ -void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); +void TxSignatures_free(struct LDKTxSignatures this_obj); /** - * The genesis hash of the blockchain that was queried + * The channel ID */ -const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; +struct LDKChannelId TxSignatures_get_channel_id(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * The genesis hash of the blockchain that was queried + * The channel ID */ -void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void TxSignatures_set_channel_id(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Indicates if the query recipient maintains up-to-date channel - * information for the `chain_hash` + * The TXID */ -bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); +const uint8_t (*TxSignatures_get_tx_hash(const struct LDKTxSignatures *NONNULL_PTR this_ptr))[32]; /** - * Indicates if the query recipient maintains up-to-date channel - * information for the `chain_hash` + * The TXID */ -void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); +void TxSignatures_set_tx_hash(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Constructs a new ReplyShortChannelIdsEnd given each field + * The list of witnesses + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); +struct LDKCVec_WitnessZ TxSignatures_get_witnesses(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * Creates a copy of the ReplyShortChannelIdsEnd + * The list of witnesses */ -struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); +void TxSignatures_set_witnesses(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCVec_WitnessZ val); /** - * Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. + * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers */ -uint64_t ReplyShortChannelIdsEnd_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR o); +struct LDKCOption_ECDSASignatureZ TxSignatures_get_shared_input_signature(const struct LDKTxSignatures *NONNULL_PTR this_ptr); /** - * Checks if two ReplyShortChannelIdsEnds 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. + * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers */ -bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); +void TxSignatures_set_shared_input_signature(struct LDKTxSignatures *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. + * Constructs a new TxSignatures given each field */ -void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); +MUST_USE_RES struct LDKTxSignatures TxSignatures_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes tx_hash_arg, struct LDKCVec_WitnessZ witnesses_arg, struct LDKCOption_ECDSASignatureZ shared_input_signature_arg); /** - * The genesis hash of the blockchain for channel and node information + * Creates a copy of the TxSignatures */ -const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; +struct LDKTxSignatures TxSignatures_clone(const struct LDKTxSignatures *NONNULL_PTR orig); /** - * The genesis hash of the blockchain for channel and node information + * Generates a non-cryptographic 64-bit hash of the TxSignatures. */ -void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t TxSignatures_hash(const struct LDKTxSignatures *NONNULL_PTR o); /** - * The starting unix timestamp + * Checks if two TxSignaturess 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. */ -uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +bool TxSignatures_eq(const struct LDKTxSignatures *NONNULL_PTR a, const struct LDKTxSignatures *NONNULL_PTR b); /** - * The starting unix timestamp + * Frees any resources used by the TxInitRbf, if is_owned is set and inner is non-NULL. */ -void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +void TxInitRbf_free(struct LDKTxInitRbf this_obj); /** - * The range of information in seconds + * The channel ID */ -uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); +struct LDKChannelId TxInitRbf_get_channel_id(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * The range of information in seconds + * The channel ID */ -void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); +void TxInitRbf_set_channel_id(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Constructs a new GossipTimestampFilter given each field + * The locktime of the transaction */ -MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); +uint32_t TxInitRbf_get_locktime(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Creates a copy of the GossipTimestampFilter + * The locktime of the transaction */ -struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); +void TxInitRbf_set_locktime(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. + * The feerate of the transaction */ -uint64_t GossipTimestampFilter_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR o); +uint32_t TxInitRbf_get_feerate_sat_per_1000_weight(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Checks if two GossipTimestampFilters 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. + * The feerate of the transaction */ -bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); +void TxInitRbf_set_feerate_sat_per_1000_weight(struct LDKTxInitRbf *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the ErrorAction + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -void ErrorAction_free(struct LDKErrorAction this_ptr); +struct LDKCOption_i64Z TxInitRbf_get_funding_output_contribution(const struct LDKTxInitRbf *NONNULL_PTR this_ptr); /** - * Creates a copy of the ErrorAction + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); +void TxInitRbf_set_funding_output_contribution(struct LDKTxInitRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); /** - * Utility method to constructs a new DisconnectPeer-variant ErrorAction + * Constructs a new TxInitRbf given each field */ -struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); +MUST_USE_RES struct LDKTxInitRbf TxInitRbf_new(struct LDKChannelId channel_id_arg, uint32_t locktime_arg, uint32_t feerate_sat_per_1000_weight_arg, struct LDKCOption_i64Z funding_output_contribution_arg); /** - * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction + * Creates a copy of the TxInitRbf */ -struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg); +struct LDKTxInitRbf TxInitRbf_clone(const struct LDKTxInitRbf *NONNULL_PTR orig); /** - * Utility method to constructs a new IgnoreError-variant ErrorAction + * Generates a non-cryptographic 64-bit hash of the TxInitRbf. */ -struct LDKErrorAction ErrorAction_ignore_error(void); +uint64_t TxInitRbf_hash(const struct LDKTxInitRbf *NONNULL_PTR o); /** - * Utility method to constructs a new IgnoreAndLog-variant ErrorAction + * Checks if two TxInitRbfs 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. */ -struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); +bool TxInitRbf_eq(const struct LDKTxInitRbf *NONNULL_PTR a, const struct LDKTxInitRbf *NONNULL_PTR b); /** - * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction + * Frees any resources used by the TxAckRbf, if is_owned is set and inner is non-NULL. */ -struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); +void TxAckRbf_free(struct LDKTxAckRbf this_obj); /** - * Utility method to constructs a new SendErrorMessage-variant ErrorAction + * The channel ID */ -struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); +struct LDKChannelId TxAckRbf_get_channel_id(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendWarningMessage-variant ErrorAction + * The channel ID */ -struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); +void TxAckRbf_set_channel_id(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Generates a non-cryptographic 64-bit hash of the ErrorAction. + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -uint64_t ErrorAction_hash(const struct LDKErrorAction *NONNULL_PTR o); +struct LDKCOption_i64Z TxAckRbf_get_funding_output_contribution(const struct LDKTxAckRbf *NONNULL_PTR this_ptr); /** - * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. + * The number of satoshis the sender will contribute to or, if negative, remove from + * (e.g. splice-out) the funding output of the transaction */ -void LightningError_free(struct LDKLightningError this_obj); +void TxAckRbf_set_funding_output_contribution(struct LDKTxAckRbf *NONNULL_PTR this_ptr, struct LDKCOption_i64Z val); /** - * A human-readable message describing the error + * Constructs a new TxAckRbf given each field */ -struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxAckRbf TxAckRbf_new(struct LDKChannelId channel_id_arg, struct LDKCOption_i64Z funding_output_contribution_arg); /** - * A human-readable message describing the error + * Creates a copy of the TxAckRbf */ -void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); +struct LDKTxAckRbf TxAckRbf_clone(const struct LDKTxAckRbf *NONNULL_PTR orig); /** - * The action which should be taken against the offending peer. + * Generates a non-cryptographic 64-bit hash of the TxAckRbf. */ -struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); +uint64_t TxAckRbf_hash(const struct LDKTxAckRbf *NONNULL_PTR o); /** - * The action which should be taken against the offending peer. + * Checks if two TxAckRbfs 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. */ -void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); +bool TxAckRbf_eq(const struct LDKTxAckRbf *NONNULL_PTR a, const struct LDKTxAckRbf *NONNULL_PTR b); /** - * Constructs a new LightningError given each field + * Frees any resources used by the TxAbort, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); +void TxAbort_free(struct LDKTxAbort this_obj); /** - * Creates a copy of the LightningError + * The channel ID */ -struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); +struct LDKChannelId TxAbort_get_channel_id(const struct LDKTxAbort *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. + * The channel ID */ -void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); +void TxAbort_set_channel_id(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * `update_add_htlc` messages which should be sent + * Message data + * + * Returns a copy of the field. */ -struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z TxAbort_get_data(const struct LDKTxAbort *NONNULL_PTR this_ptr); /** - * `update_add_htlc` messages which should be sent + * Message data */ -void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); +void TxAbort_set_data(struct LDKTxAbort *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * `update_fulfill_htlc` messages which should be sent + * Constructs a new TxAbort given each field */ -struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKTxAbort TxAbort_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z data_arg); /** - * `update_fulfill_htlc` messages which should be sent + * Creates a copy of the TxAbort */ -void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); +struct LDKTxAbort TxAbort_clone(const struct LDKTxAbort *NONNULL_PTR orig); /** - * `update_fail_htlc` messages which should be sent + * Generates a non-cryptographic 64-bit hash of the TxAbort. */ -struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +uint64_t TxAbort_hash(const struct LDKTxAbort *NONNULL_PTR o); /** - * `update_fail_htlc` messages which should be sent + * Checks if two TxAborts 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. */ -void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); +bool TxAbort_eq(const struct LDKTxAbort *NONNULL_PTR a, const struct LDKTxAbort *NONNULL_PTR b); /** - * `update_fail_malformed_htlc` messages which should be sent + * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +void Shutdown_free(struct LDKShutdown this_obj); /** - * `update_fail_malformed_htlc` messages which should be sent + * The channel ID */ -void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); +struct LDKChannelId Shutdown_get_channel_id(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * An `update_fee` message which should be sent - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The channel ID */ -struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +void Shutdown_set_channel_id(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * An `update_fee` message which should be sent + * The destination of this peer's funds on closing. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); +struct LDKCVec_u8Z Shutdown_get_scriptpubkey(const struct LDKShutdown *NONNULL_PTR this_ptr); /** - * A `commitment_signed` message which should be sent + * The destination of this peer's funds on closing. + * + * Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. */ -struct LDKCommitmentSigned CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); +void Shutdown_set_scriptpubkey(struct LDKShutdown *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * A `commitment_signed` message which should be sent + * Constructs a new Shutdown given each field */ -void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCommitmentSigned val); +MUST_USE_RES struct LDKShutdown Shutdown_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z scriptpubkey_arg); /** - * 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 + * Creates a copy of the Shutdown */ -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); +struct LDKShutdown Shutdown_clone(const struct LDKShutdown *NONNULL_PTR orig); /** - * Creates a copy of the CommitmentUpdate + * Generates a non-cryptographic 64-bit hash of the Shutdown. */ -struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); +uint64_t Shutdown_hash(const struct LDKShutdown *NONNULL_PTR o); /** - * Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. + * Checks if two Shutdowns 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. */ -uint64_t CommitmentUpdate_hash(const struct LDKCommitmentUpdate *NONNULL_PTR o); +bool Shutdown_eq(const struct LDKShutdown *NONNULL_PTR a, const struct LDKShutdown *NONNULL_PTR b); /** - * Checks if two CommitmentUpdates 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. + * Frees any resources used by the ClosingSignedFeeRange, if is_owned is set and inner is non-NULL. */ -bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); +void ClosingSignedFeeRange_free(struct LDKClosingSignedFeeRange this_obj); /** - * Calls the free function if one is set + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); +uint64_t ClosingSignedFeeRange_get_min_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * The minimum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); +void ClosingSignedFeeRange_set_min_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * Calls the free function if one is set + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); +uint64_t ClosingSignedFeeRange_get_max_fee_satoshis(const struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr); /** - * Frees any resources used by the FinalOnionHopData, if is_owned is set and inner is non-NULL. + * The maximum absolute fee, in satoshis, which the sender is willing to place on the closing + * transaction. */ -void FinalOnionHopData_free(struct LDKFinalOnionHopData this_obj); +void ClosingSignedFeeRange_set_max_fee_satoshis(struct LDKClosingSignedFeeRange *NONNULL_PTR this_ptr, uint64_t val); /** - * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. - * Because it is generated by the recipient and included in the invoice, it also provides - * proof to the recipient that the payment was sent by someone with the generated invoice. + * Constructs a new ClosingSignedFeeRange given each field */ -const uint8_t (*FinalOnionHopData_get_payment_secret(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKClosingSignedFeeRange ClosingSignedFeeRange_new(uint64_t min_fee_satoshis_arg, uint64_t max_fee_satoshis_arg); /** - * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. - * Because it is generated by the recipient and included in the invoice, it also provides - * proof to the recipient that the payment was sent by someone with the generated invoice. + * Creates a copy of the ClosingSignedFeeRange */ -void FinalOnionHopData_set_payment_secret(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKClosingSignedFeeRange ClosingSignedFeeRange_clone(const struct LDKClosingSignedFeeRange *NONNULL_PTR orig); /** - * The intended total amount that this payment is for. - * - * Message serialization may panic if this value is more than 21 million Bitcoin. + * Generates a non-cryptographic 64-bit hash of the ClosingSignedFeeRange. */ -uint64_t FinalOnionHopData_get_total_msat(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr); +uint64_t ClosingSignedFeeRange_hash(const struct LDKClosingSignedFeeRange *NONNULL_PTR o); /** - * The intended total amount that this payment is for. - * - * Message serialization may panic if this value is more than 21 million Bitcoin. + * Checks if two ClosingSignedFeeRanges 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. */ -void FinalOnionHopData_set_total_msat(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, uint64_t val); +bool ClosingSignedFeeRange_eq(const struct LDKClosingSignedFeeRange *NONNULL_PTR a, const struct LDKClosingSignedFeeRange *NONNULL_PTR b); /** - * Constructs a new FinalOnionHopData given each field + * Frees any resources used by the ClosingSigned, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyTwoBytes payment_secret_arg, uint64_t total_msat_arg); +void ClosingSigned_free(struct LDKClosingSigned this_obj); /** - * Creates a copy of the FinalOnionHopData + * The channel ID */ -struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig); +struct LDKChannelId ClosingSigned_get_channel_id(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * Checks if two FinalOnionHopDatas 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. + * The channel ID */ -bool FinalOnionHopData_eq(const struct LDKFinalOnionHopData *NONNULL_PTR a, const struct LDKFinalOnionHopData *NONNULL_PTR b); +void ClosingSigned_set_channel_id(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Frees any resources used by the OnionPacket, if is_owned is set and inner is non-NULL. + * The proposed total fee for the closing transaction */ -void OnionPacket_free(struct LDKOnionPacket this_obj); +uint64_t ClosingSigned_get_fee_satoshis(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * BOLT 4 version number. + * The proposed total fee for the closing transaction */ -uint8_t OnionPacket_get_version(const struct LDKOnionPacket *NONNULL_PTR this_ptr); +void ClosingSigned_set_fee_satoshis(struct LDKClosingSigned *NONNULL_PTR this_ptr, uint64_t val); /** - * BOLT 4 version number. + * A signature on the closing transaction */ -void OnionPacket_set_version(struct LDKOnionPacket *NONNULL_PTR this_ptr, uint8_t val); +struct LDKECDSASignature ClosingSigned_get_signature(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * In order to ensure we always return an error on onion decode in compliance with [BOLT - * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to - * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral - * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd - * like. - * - * Returns a copy of the field. + * A signature on the closing transaction */ -struct LDKCResult_PublicKeySecp256k1ErrorZ OnionPacket_get_public_key(const struct LDKOnionPacket *NONNULL_PTR this_ptr); +void ClosingSigned_set_signature(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * In order to ensure we always return an error on onion decode in compliance with [BOLT - * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to - * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral - * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd - * like. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void OnionPacket_set_public_key(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKCResult_PublicKeySecp256k1ErrorZ val); +struct LDKClosingSignedFeeRange ClosingSigned_get_fee_range(const struct LDKClosingSigned *NONNULL_PTR this_ptr); /** - * HMAC to verify the integrity of hop_data. + * The minimum and maximum fees which the sender is willing to accept, provided only by new + * nodes. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -const uint8_t (*OnionPacket_get_hmac(const struct LDKOnionPacket *NONNULL_PTR this_ptr))[32]; +void ClosingSigned_set_fee_range(struct LDKClosingSigned *NONNULL_PTR this_ptr, struct LDKClosingSignedFeeRange val); /** - * HMAC to verify the integrity of hop_data. + * 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 */ -void OnionPacket_set_hmac(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKClosingSigned ClosingSigned_new(struct LDKChannelId channel_id_arg, uint64_t fee_satoshis_arg, struct LDKECDSASignature signature_arg, struct LDKClosingSignedFeeRange fee_range_arg); /** - * Creates a copy of the OnionPacket + * Creates a copy of the ClosingSigned */ -struct LDKOnionPacket OnionPacket_clone(const struct LDKOnionPacket *NONNULL_PTR orig); +struct LDKClosingSigned ClosingSigned_clone(const struct LDKClosingSigned *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the OnionPacket. + * Generates a non-cryptographic 64-bit hash of the ClosingSigned. */ -uint64_t OnionPacket_hash(const struct LDKOnionPacket *NONNULL_PTR o); +uint64_t ClosingSigned_hash(const struct LDKClosingSigned *NONNULL_PTR o); /** - * Checks if two OnionPackets contain equal inner contents. + * Checks if two ClosingSigneds 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 OnionPacket_eq(const struct LDKOnionPacket *NONNULL_PTR a, const struct LDKOnionPacket *NONNULL_PTR b); +bool ClosingSigned_eq(const struct LDKClosingSigned *NONNULL_PTR a, const struct LDKClosingSigned *NONNULL_PTR b); /** - * Frees any resources used by the TrampolineOnionPacket, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ClosingComplete, if is_owned is set and inner is non-NULL. */ -void TrampolineOnionPacket_free(struct LDKTrampolineOnionPacket this_obj); +void ClosingComplete_free(struct LDKClosingComplete this_obj); /** - * Bolt 04 version number + * The channel ID. */ -uint8_t TrampolineOnionPacket_get_version(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); +struct LDKChannelId ClosingComplete_get_channel_id(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Bolt 04 version number + * The channel ID. */ -void TrampolineOnionPacket_set_version(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, uint8_t val); +void ClosingComplete_set_channel_id(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + * The destination of the closer's funds on closing. */ -struct LDKPublicKey TrampolineOnionPacket_get_public_key(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ClosingComplete_get_closer_scriptpubkey(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data + * The destination of the closer's funds on closing. */ -void TrampolineOnionPacket_set_public_key(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ClosingComplete_set_closer_scriptpubkey(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Encrypted payload for the next hop - * - * Returns a copy of the field. + * The destination of the closee's funds on closing. */ -struct LDKCVec_u8Z TrampolineOnionPacket_get_hop_data(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ClosingComplete_get_closee_scriptpubkey(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Encrypted payload for the next hop + * The destination of the closee's funds on closing. */ -void TrampolineOnionPacket_set_hop_data(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +void ClosingComplete_set_closee_scriptpubkey(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * HMAC to verify the integrity of hop_data + * The proposed total fee for the closing transaction. */ -const uint8_t (*TrampolineOnionPacket_get_hmac(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr))[32]; +uint64_t ClosingComplete_get_fee_satoshis(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * HMAC to verify the integrity of hop_data + * The proposed total fee for the closing transaction. */ -void TrampolineOnionPacket_set_hmac(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ClosingComplete_set_fee_satoshis(struct LDKClosingComplete *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new TrampolineOnionPacket given each field + * The locktime of the closing transaction. */ -MUST_USE_RES struct LDKTrampolineOnionPacket TrampolineOnionPacket_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); +uint32_t ClosingComplete_get_locktime(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Creates a copy of the TrampolineOnionPacket + * The locktime of the closing transaction. */ -struct LDKTrampolineOnionPacket TrampolineOnionPacket_clone(const struct LDKTrampolineOnionPacket *NONNULL_PTR orig); +void ClosingComplete_set_locktime(struct LDKClosingComplete *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket. + * A signature on the closing transaction omitting the `closee` output. */ -uint64_t TrampolineOnionPacket_hash(const struct LDKTrampolineOnionPacket *NONNULL_PTR o); +struct LDKCOption_ECDSASignatureZ ClosingComplete_get_closer_output_only(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Checks if two TrampolineOnionPackets 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. + * A signature on the closing transaction omitting the `closee` output. */ -bool TrampolineOnionPacket_eq(const struct LDKTrampolineOnionPacket *NONNULL_PTR a, const struct LDKTrampolineOnionPacket *NONNULL_PTR b); +void ClosingComplete_set_closer_output_only(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Serialize the TrampolineOnionPacket object into a byte array which can be read by TrampolineOnionPacket_read + * A signature on the closing transaction omitting the `closer` output. */ -struct LDKCVec_u8Z TrampolineOnionPacket_write(const struct LDKTrampolineOnionPacket *NONNULL_PTR obj); +struct LDKCOption_ECDSASignatureZ ClosingComplete_get_closee_output_only(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Get the string representation of a DecodeError object + * A signature on the closing transaction omitting the `closer` output. */ -struct LDKStr DecodeError_to_str(const struct LDKDecodeError *NONNULL_PTR o); +void ClosingComplete_set_closee_output_only(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read + * A signature on the closing transaction covering both `closer` and `closee` outputs. */ -struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); +struct LDKCOption_ECDSASignatureZ ClosingComplete_get_closer_and_closee_outputs(const struct LDKClosingComplete *NONNULL_PTR this_ptr); /** - * Read a AcceptChannel from a byte array, created by AcceptChannel_write + * A signature on the closing transaction covering both `closer` and `closee` outputs. */ -struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); +void ClosingComplete_set_closer_and_closee_outputs(struct LDKClosingComplete *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read + * Constructs a new ClosingComplete given each field */ -struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj); +MUST_USE_RES struct LDKClosingComplete ClosingComplete_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z closer_scriptpubkey_arg, struct LDKCVec_u8Z closee_scriptpubkey_arg, uint64_t fee_satoshis_arg, uint32_t locktime_arg, struct LDKCOption_ECDSASignatureZ closer_output_only_arg, struct LDKCOption_ECDSASignatureZ closee_output_only_arg, struct LDKCOption_ECDSASignatureZ closer_and_closee_outputs_arg); /** - * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write + * Creates a copy of the ClosingComplete */ -struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser); +struct LDKClosingComplete ClosingComplete_clone(const struct LDKClosingComplete *NONNULL_PTR orig); /** - * Serialize the Stfu object into a byte array which can be read by Stfu_read + * Generates a non-cryptographic 64-bit hash of the ClosingComplete. */ -struct LDKCVec_u8Z Stfu_write(const struct LDKStfu *NONNULL_PTR obj); +uint64_t ClosingComplete_hash(const struct LDKClosingComplete *NONNULL_PTR o); /** - * Read a Stfu from a byte array, created by Stfu_write + * Checks if two ClosingCompletes 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. */ -struct LDKCResult_StfuDecodeErrorZ Stfu_read(struct LDKu8slice ser); +bool ClosingComplete_eq(const struct LDKClosingComplete *NONNULL_PTR a, const struct LDKClosingComplete *NONNULL_PTR b); /** - * Serialize the SpliceInit object into a byte array which can be read by SpliceInit_read + * Frees any resources used by the ClosingSig, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z SpliceInit_write(const struct LDKSpliceInit *NONNULL_PTR obj); +void ClosingSig_free(struct LDKClosingSig this_obj); /** - * Read a SpliceInit from a byte array, created by SpliceInit_write + * The channel ID. */ -struct LDKCResult_SpliceInitDecodeErrorZ SpliceInit_read(struct LDKu8slice ser); +struct LDKChannelId ClosingSig_get_channel_id(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read + * The channel ID. */ -struct LDKCVec_u8Z SpliceAck_write(const struct LDKSpliceAck *NONNULL_PTR obj); +void ClosingSig_set_channel_id(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a SpliceAck from a byte array, created by SpliceAck_write + * The destination of the closer's funds on closing. */ -struct LDKCResult_SpliceAckDecodeErrorZ SpliceAck_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ClosingSig_get_closer_scriptpubkey(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read + * The destination of the closer's funds on closing. */ -struct LDKCVec_u8Z SpliceLocked_write(const struct LDKSpliceLocked *NONNULL_PTR obj); +void ClosingSig_set_closer_scriptpubkey(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Read a SpliceLocked from a byte array, created by SpliceLocked_write + * The destination of the closee's funds on closing. */ -struct LDKCResult_SpliceLockedDecodeErrorZ SpliceLocked_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ClosingSig_get_closee_scriptpubkey(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read + * The destination of the closee's funds on closing. */ -struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj); +void ClosingSig_set_closee_scriptpubkey(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Read a TxAddInput from a byte array, created by TxAddInput_write + * The proposed total fee for the closing transaction. */ -struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser); +uint64_t ClosingSig_get_fee_satoshis(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read + * The proposed total fee for the closing transaction. */ -struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj); +void ClosingSig_set_fee_satoshis(struct LDKClosingSig *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a TxAddOutput from a byte array, created by TxAddOutput_write + * The locktime of the closing transaction. */ -struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser); +uint32_t ClosingSig_get_locktime(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read + * The locktime of the closing transaction. */ -struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj); +void ClosingSig_set_locktime(struct LDKClosingSig *NONNULL_PTR this_ptr, uint32_t val); /** - * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write + * A signature on the closing transaction omitting the `closee` output. */ -struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser); +struct LDKCOption_ECDSASignatureZ ClosingSig_get_closer_output_only(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read + * A signature on the closing transaction omitting the `closee` output. */ -struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj); +void ClosingSig_set_closer_output_only(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write + * A signature on the closing transaction omitting the `closer` output. */ -struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser); +struct LDKCOption_ECDSASignatureZ ClosingSig_get_closee_output_only(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxComplete object into a byte array which can be read by TxComplete_read + * A signature on the closing transaction omitting the `closer` output. */ -struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj); +void ClosingSig_set_closee_output_only(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Read a TxComplete from a byte array, created by TxComplete_write + * A signature on the closing transaction covering both `closer` and `closee` outputs. */ -struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser); +struct LDKCOption_ECDSASignatureZ ClosingSig_get_closer_and_closee_outputs(const struct LDKClosingSig *NONNULL_PTR this_ptr); /** - * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read + * A signature on the closing transaction covering both `closer` and `closee` outputs. */ -struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj); +void ClosingSig_set_closer_and_closee_outputs(struct LDKClosingSig *NONNULL_PTR this_ptr, struct LDKCOption_ECDSASignatureZ val); /** - * Read a TxSignatures from a byte array, created by TxSignatures_write + * Constructs a new ClosingSig given each field */ -struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKClosingSig ClosingSig_new(struct LDKChannelId channel_id_arg, struct LDKCVec_u8Z closer_scriptpubkey_arg, struct LDKCVec_u8Z closee_scriptpubkey_arg, uint64_t fee_satoshis_arg, uint32_t locktime_arg, struct LDKCOption_ECDSASignatureZ closer_output_only_arg, struct LDKCOption_ECDSASignatureZ closee_output_only_arg, struct LDKCOption_ECDSASignatureZ closer_and_closee_outputs_arg); /** - * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read + * Creates a copy of the ClosingSig */ -struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj); +struct LDKClosingSig ClosingSig_clone(const struct LDKClosingSig *NONNULL_PTR orig); /** - * Read a TxInitRbf from a byte array, created by TxInitRbf_write + * Generates a non-cryptographic 64-bit hash of the ClosingSig. */ -struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser); +uint64_t ClosingSig_hash(const struct LDKClosingSig *NONNULL_PTR o); /** - * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read + * Checks if two ClosingSigs 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. */ -struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj); +bool ClosingSig_eq(const struct LDKClosingSig *NONNULL_PTR a, const struct LDKClosingSig *NONNULL_PTR b); /** - * Read a TxAckRbf from a byte array, created by TxAckRbf_write + * Frees any resources used by the StartBatch, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser); +void StartBatch_free(struct LDKStartBatch this_obj); /** - * Serialize the TxAbort object into a byte array which can be read by TxAbort_read + * The channel ID of all messages in the batch. */ -struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj); +struct LDKChannelId StartBatch_get_channel_id(const struct LDKStartBatch *NONNULL_PTR this_ptr); /** - * Read a TxAbort from a byte array, created by TxAbort_write + * The channel ID of all messages in the batch. */ -struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser); +void StartBatch_set_channel_id(struct LDKStartBatch *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read + * The number of messages to follow. */ -struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); +uint16_t StartBatch_get_batch_size(const struct LDKStartBatch *NONNULL_PTR this_ptr); /** - * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write + * The number of messages to follow. */ -struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); +void StartBatch_set_batch_size(struct LDKStartBatch *NONNULL_PTR this_ptr, uint16_t val); /** - * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read + * The type of all messages expected in the batch. */ -struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); +struct LDKCOption_u16Z StartBatch_get_message_type(const struct LDKStartBatch *NONNULL_PTR this_ptr); /** - * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write + * The type of all messages expected in the batch. */ -struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); +void StartBatch_set_message_type(struct LDKStartBatch *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); /** - * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read + * Constructs a new StartBatch given each field */ -struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); +MUST_USE_RES struct LDKStartBatch StartBatch_new(struct LDKChannelId channel_id_arg, uint16_t batch_size_arg, struct LDKCOption_u16Z message_type_arg); /** - * Read a ClosingSigned from a byte array, created by ClosingSigned_write + * Creates a copy of the StartBatch */ -struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); +struct LDKStartBatch StartBatch_clone(const struct LDKStartBatch *NONNULL_PTR orig); /** - * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read + * Generates a non-cryptographic 64-bit hash of the StartBatch. */ -struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); +uint64_t StartBatch_hash(const struct LDKStartBatch *NONNULL_PTR o); /** - * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write + * Checks if two StartBatchs 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. */ -struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); +bool StartBatch_eq(const struct LDKStartBatch *NONNULL_PTR a, const struct LDKStartBatch *NONNULL_PTR b); /** - * Serialize the CommitmentSignedBatch object into a byte array which can be read by CommitmentSignedBatch_read + * Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z CommitmentSignedBatch_write(const struct LDKCommitmentSignedBatch *NONNULL_PTR obj); +void UpdateAddHTLC_free(struct LDKUpdateAddHTLC this_obj); /** - * Read a CommitmentSignedBatch from a byte array, created by CommitmentSignedBatch_write + * The channel ID */ -struct LDKCResult_CommitmentSignedBatchDecodeErrorZ CommitmentSignedBatch_read(struct LDKu8slice ser); +struct LDKChannelId UpdateAddHTLC_get_channel_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read + * The channel ID */ -struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); +void UpdateAddHTLC_set_channel_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write + * The HTLC ID */ -struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); +uint64_t UpdateAddHTLC_get_htlc_id(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read + * The HTLC ID */ -struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); +void UpdateAddHTLC_set_htlc_id(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a FundingCreated from a byte array, created by FundingCreated_write + * The HTLC value in milli-satoshi */ -struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); +uint64_t UpdateAddHTLC_get_amount_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read + * The HTLC value in milli-satoshi */ -struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); +void UpdateAddHTLC_set_amount_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a FundingSigned from a byte array, created by FundingSigned_write + * The payment hash, the pre-image of which controls HTLC redemption */ -struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); +const uint8_t (*UpdateAddHTLC_get_payment_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr))[32]; /** - * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read + * The payment hash, the pre-image of which controls HTLC redemption */ -struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); +void UpdateAddHTLC_set_payment_hash(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Read a ChannelReady from a byte array, created by ChannelReady_write + * The expiry height of the HTLC */ -struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); +uint32_t UpdateAddHTLC_get_cltv_expiry(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the Init object into a byte array which can be read by Init_read + * The expiry height of the HTLC */ -struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); +void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, uint32_t val); /** - * Read a Init from a byte array, created by Init_write + * The extra fee skimmed by the sender of this message. See + * [`ChannelConfig::accept_underpaying_htlcs`]. + * + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs */ -struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); +struct LDKCOption_u64Z UpdateAddHTLC_get_skimmed_fee_msat(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read + * The extra fee skimmed by the sender of this message. See + * [`ChannelConfig::accept_underpaying_htlcs`]. + * + * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs */ -struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); +void UpdateAddHTLC_set_skimmed_fee_msat(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Read a OpenChannel from a byte array, created by OpenChannel_write + * The onion routing packet with encrypted data for the next hop. */ -struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); +struct LDKOnionPacket UpdateAddHTLC_get_onion_routing_packet(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read + * The onion routing packet with encrypted data for the next hop. */ -struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj); +void UpdateAddHTLC_set_onion_routing_packet(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKOnionPacket val); /** - * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser); +struct LDKPublicKey UpdateAddHTLC_get_blinding_point(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read + * Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion + * routing packet and the recipient-provided encrypted payload within. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); +void UpdateAddHTLC_set_blinding_point(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write + * Set to `Some` if the sender wants the receiver of this message to hold onto this HTLC until + * receipt of a [`ReleaseHeldHtlc`] onion message from the payment recipient. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc */ -struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); +enum LDKCOption_NoneZ UpdateAddHTLC_get_hold_htlc(const struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr); /** - * Serialize the Shutdown object into a byte array which can be read by Shutdown_read + * Set to `Some` if the sender wants the receiver of this message to hold onto this HTLC until + * receipt of a [`ReleaseHeldHtlc`] onion message from the payment recipient. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc */ -struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); +void UpdateAddHTLC_set_hold_htlc(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); /** - * Read a Shutdown from a byte array, created by Shutdown_write + * Constructs a new UpdateAddHTLC given each field + * + * Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKUpdateAddHTLC UpdateAddHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, uint64_t amount_msat_arg, struct LDKThirtyTwoBytes payment_hash_arg, uint32_t cltv_expiry_arg, struct LDKCOption_u64Z skimmed_fee_msat_arg, struct LDKOnionPacket onion_routing_packet_arg, struct LDKPublicKey blinding_point_arg, enum LDKCOption_NoneZ hold_htlc_arg); /** - * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read + * Creates a copy of the UpdateAddHTLC */ -struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); +struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); /** - * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write + * Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. */ -struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); +uint64_t UpdateAddHTLC_hash(const struct LDKUpdateAddHTLC *NONNULL_PTR o); /** - * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read + * Checks if two UpdateAddHTLCs 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. */ -struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); +bool UpdateAddHTLC_eq(const struct LDKUpdateAddHTLC *NONNULL_PTR a, const struct LDKUpdateAddHTLC *NONNULL_PTR b); /** - * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write + * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); +void OnionMessage_free(struct LDKOnionMessage this_obj); /** - * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read + * Used in decrypting the onion packet's payload. */ -struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); +struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); /** - * Read a UpdateFee from a byte array, created by UpdateFee_write + * Used in decrypting the onion packet's payload. */ -struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); +void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read + * The full onion packet including hop data, pubkey, and hmac */ -struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); +struct LDKPacket OnionMessage_get_onion_routing_packet(const struct LDKOnionMessage *NONNULL_PTR this_ptr); /** - * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write + * The full onion packet including hop data, pubkey, and hmac */ -struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); +void OnionMessage_set_onion_routing_packet(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPacket val); /** - * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read + * Constructs a new OnionMessage given each field */ -struct LDKCVec_u8Z OnionPacket_write(const struct LDKOnionPacket *NONNULL_PTR obj); +MUST_USE_RES struct LDKOnionMessage OnionMessage_new(struct LDKPublicKey blinding_point_arg, struct LDKPacket onion_routing_packet_arg); /** - * Read a OnionPacket from a byte array, created by OnionPacket_write + * Creates a copy of the OnionMessage */ -struct LDKCResult_OnionPacketDecodeErrorZ OnionPacket_read(struct LDKu8slice ser); +struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); /** - * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read + * Generates a non-cryptographic 64-bit hash of the OnionMessage. */ -struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); +uint64_t OnionMessage_hash(const struct LDKOnionMessage *NONNULL_PTR o); /** - * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write + * Checks if two OnionMessages 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. */ -struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); +bool OnionMessage_eq(const struct LDKOnionMessage *NONNULL_PTR a, const struct LDKOnionMessage *NONNULL_PTR b); /** - * Read a OnionMessage from a byte array, created by OnionMessage_write + * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); +void UpdateFulfillHTLC_free(struct LDKUpdateFulfillHTLC this_obj); /** - * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read + * The channel ID */ -struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); +struct LDKChannelId UpdateFulfillHTLC_get_channel_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read + * The channel ID */ -struct LDKCVec_u8Z FinalOnionHopData_write(const struct LDKFinalOnionHopData *NONNULL_PTR obj); +void UpdateFulfillHTLC_set_channel_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write + * The HTLC ID */ -struct LDKCResult_FinalOnionHopDataDecodeErrorZ FinalOnionHopData_read(struct LDKu8slice ser); +uint64_t UpdateFulfillHTLC_get_htlc_id(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Serialize the Ping object into a byte array which can be read by Ping_read + * The HTLC ID */ -struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); +void UpdateFulfillHTLC_set_htlc_id(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Read a Ping from a byte array, created by Ping_write + * The pre-image of the payment hash, allowing HTLC redemption */ -struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); +const uint8_t (*UpdateFulfillHTLC_get_payment_preimage(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr))[32]; /** - * Serialize the Pong object into a byte array which can be read by Pong_read + * The pre-image of the payment hash, allowing HTLC redemption */ -struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); +void UpdateFulfillHTLC_set_payment_preimage(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Read a Pong from a byte array, created by Pong_write + * Optional field for attribution data that allows the sender to receive per hop HTLC hold times. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); +struct LDKAttributionData UpdateFulfillHTLC_get_attribution_data(const struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr); /** - * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read + * Optional field for attribution data that allows the sender to receive per hop HTLC hold times. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); +void UpdateFulfillHTLC_set_attribution_data(struct LDKUpdateFulfillHTLC *NONNULL_PTR this_ptr, struct LDKAttributionData val); /** - * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write + * Constructs a new UpdateFulfillHTLC given each field + * + * Note that attribution_data_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_new(struct LDKChannelId channel_id_arg, uint64_t htlc_id_arg, struct LDKThirtyTwoBytes payment_preimage_arg, struct LDKAttributionData attribution_data_arg); /** - * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read + * Creates a copy of the UpdateFulfillHTLC */ -struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); +struct LDKUpdateFulfillHTLC UpdateFulfillHTLC_clone(const struct LDKUpdateFulfillHTLC *NONNULL_PTR orig); /** - * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write + * Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. */ -struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); +uint64_t UpdateFulfillHTLC_hash(const struct LDKUpdateFulfillHTLC *NONNULL_PTR o); /** - * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read + * Checks if two UpdateFulfillHTLCs 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. */ -struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); +bool UpdateFulfillHTLC_eq(const struct LDKUpdateFulfillHTLC *NONNULL_PTR a, const struct LDKUpdateFulfillHTLC *NONNULL_PTR b); /** - * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write + * Frees any resources used by the PeerStorage, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); +void PeerStorage_free(struct LDKPeerStorage this_obj); /** - * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read + * Our encrypted backup data included in the msg. + * + * Returns a copy of the field. */ -struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); +struct LDKCVec_u8Z PeerStorage_get_data(const struct LDKPeerStorage *NONNULL_PTR this_ptr); /** - * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write + * Our encrypted backup data included in the msg. */ -struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); +void PeerStorage_set_data(struct LDKPeerStorage *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read + * Constructs a new PeerStorage given each field */ -struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); +MUST_USE_RES struct LDKPeerStorage PeerStorage_new(struct LDKCVec_u8Z data_arg); /** - * Read a ErrorMessage from a byte array, created by ErrorMessage_write + * Creates a copy of the PeerStorage */ -struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); +struct LDKPeerStorage PeerStorage_clone(const struct LDKPeerStorage *NONNULL_PTR orig); /** - * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read + * Generates a non-cryptographic 64-bit hash of the PeerStorage. */ -struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); +uint64_t PeerStorage_hash(const struct LDKPeerStorage *NONNULL_PTR o); /** - * Read a WarningMessage from a byte array, created by WarningMessage_write + * Checks if two PeerStorages 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. */ -struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); +bool PeerStorage_eq(const struct LDKPeerStorage *NONNULL_PTR a, const struct LDKPeerStorage *NONNULL_PTR b); /** - * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read + * Frees any resources used by the PeerStorageRetrieval, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); +void PeerStorageRetrieval_free(struct LDKPeerStorageRetrieval this_obj); /** - * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write + * Most recent peer's data included in the msg. + * + * Returns a copy of the field. */ -struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); +struct LDKCVec_u8Z PeerStorageRetrieval_get_data(const struct LDKPeerStorageRetrieval *NONNULL_PTR this_ptr); /** - * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read + * Most recent peer's data included in the msg. */ -struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); +void PeerStorageRetrieval_set_data(struct LDKPeerStorageRetrieval *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write + * Constructs a new PeerStorageRetrieval given each field */ -struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPeerStorageRetrieval PeerStorageRetrieval_new(struct LDKCVec_u8Z data_arg); /** - * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write + * Creates a copy of the PeerStorageRetrieval */ -struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); +struct LDKPeerStorageRetrieval PeerStorageRetrieval_clone(const struct LDKPeerStorageRetrieval *NONNULL_PTR orig); /** - * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read + * Generates a non-cryptographic 64-bit hash of the PeerStorageRetrieval. */ -struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); +uint64_t PeerStorageRetrieval_hash(const struct LDKPeerStorageRetrieval *NONNULL_PTR o); /** - * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read + * Checks if two PeerStorageRetrievals 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. */ -struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); +bool PeerStorageRetrieval_eq(const struct LDKPeerStorageRetrieval *NONNULL_PTR a, const struct LDKPeerStorageRetrieval *NONNULL_PTR b); /** - * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write + * Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); +void UpdateFailHTLC_free(struct LDKUpdateFailHTLC this_obj); /** - * Calculates the overflow safe ending block height for the query. - * - * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. + * The channel ID */ -MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); +struct LDKChannelId UpdateFailHTLC_get_channel_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read + * The channel ID */ -struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); +void UpdateFailHTLC_set_channel_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write + * The HTLC ID */ -struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); +uint64_t UpdateFailHTLC_get_htlc_id(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write + * The HTLC ID */ -struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); +void UpdateFailHTLC_set_htlc_id(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read + * Optional field for the attribution data that allows the sender to pinpoint the failing node under all conditions + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); +struct LDKAttributionData UpdateFailHTLC_get_attribution_data(const struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr); /** - * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read + * Optional field for the attribution data that allows the sender to pinpoint the failing node under all conditions + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); +void UpdateFailHTLC_set_attribution_data(struct LDKUpdateFailHTLC *NONNULL_PTR this_ptr, struct LDKAttributionData val); /** - * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write + * Creates a copy of the UpdateFailHTLC */ -struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); +struct LDKUpdateFailHTLC UpdateFailHTLC_clone(const struct LDKUpdateFailHTLC *NONNULL_PTR orig); /** - * Calls the free function if one is set + * Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. */ -void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); +uint64_t UpdateFailHTLC_hash(const struct LDKUpdateFailHTLC *NONNULL_PTR o); /** - * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. + * Checks if two UpdateFailHTLCs 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. */ -void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); +bool UpdateFailHTLC_eq(const struct LDKUpdateFailHTLC *NONNULL_PTR a, const struct LDKUpdateFailHTLC *NONNULL_PTR b); /** - * Constructs a new IgnoringMessageHandler given each field + * Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); +void UpdateFailMalformedHTLC_free(struct LDKUpdateFailMalformedHTLC this_obj); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The channel ID */ -struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKChannelId UpdateFailMalformedHTLC_get_channel_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is + * The channel ID */ -struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void UpdateFailMalformedHTLC_set_channel_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is + * The HTLC ID */ -struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +uint64_t UpdateFailMalformedHTLC_get_htlc_id(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is + * The HTLC ID */ -struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void UpdateFailMalformedHTLC_set_htlc_id(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is + * The failure code */ -struct LDKAsyncPaymentsMessageHandler IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +uint16_t UpdateFailMalformedHTLC_get_failure_code(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr); /** - * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is + * The failure code */ -struct LDKDNSResolverMessageHandler IgnoringMessageHandler_as_DNSResolverMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +void UpdateFailMalformedHTLC_set_failure_code(struct LDKUpdateFailMalformedHTLC *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is + * Creates a copy of the UpdateFailMalformedHTLC */ -struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +struct LDKUpdateFailMalformedHTLC UpdateFailMalformedHTLC_clone(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR orig); /** - * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is + * Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. */ -struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +uint64_t UpdateFailMalformedHTLC_hash(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR o); /** - * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is + * Checks if two UpdateFailMalformedHTLCs 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. */ -struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +bool UpdateFailMalformedHTLC_eq(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR a, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR b); /** - * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. + * Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. */ -void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); +void CommitmentSigned_free(struct LDKCommitmentSigned this_obj); /** - * Constructs a new ErroringMessageHandler + * The channel ID */ -MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); +struct LDKChannelId CommitmentSigned_get_channel_id(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * The channel ID */ -struct LDKMessageSendEventsProvider ErroringMessageHandler_as_MessageSendEventsProvider(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +void CommitmentSigned_set_channel_id(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is + * A signature on the commitment transaction */ -struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); +struct LDKECDSASignature CommitmentSigned_get_signature(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. + * A signature on the commitment transaction */ -void MessageHandler_free(struct LDKMessageHandler this_obj); +void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. + * Signatures on the HTLC transactions * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Returns a copy of the field. */ -const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +struct LDKCVec_ECDSASignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * A message handler which handles messages specific to channels. Usually this is just a - * [`ChannelManager`] object or an [`ErroringMessageHandler`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * Signatures on the HTLC transactions */ -void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); +void CommitmentSigned_set_htlc_signatures(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. - * - * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync + * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ -const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +struct LDKCOption_ThirtyTwoBytesZ CommitmentSigned_get_funding_txid(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); /** - * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. - * - * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync + * The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) */ -void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); +void CommitmentSigned_set_funding_txid(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * A message handler which handles onion messages. This should generally be an - * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. - * - * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * Constructs a new CommitmentSigned given each field + */ +MUST_USE_RES struct LDKCommitmentSigned CommitmentSigned_new(struct LDKChannelId channel_id_arg, struct LDKECDSASignature signature_arg, struct LDKCVec_ECDSASignatureZ htlc_signatures_arg, struct LDKCOption_ThirtyTwoBytesZ funding_txid_arg); + +/** + * Creates a copy of the CommitmentSigned */ -const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +struct LDKCommitmentSigned CommitmentSigned_clone(const struct LDKCommitmentSigned *NONNULL_PTR orig); /** - * A message handler which handles onion messages. This should generally be an - * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. - * - * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger + * Generates a non-cryptographic 64-bit hash of the CommitmentSigned. */ -void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); +uint64_t CommitmentSigned_hash(const struct LDKCommitmentSigned *NONNULL_PTR o); /** - * A message handler which handles custom messages. The only LDK-provided implementation is - * [`IgnoringMessageHandler`]. + * Checks if two CommitmentSigneds 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. */ -const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); +bool CommitmentSigned_eq(const struct LDKCommitmentSigned *NONNULL_PTR a, const struct LDKCommitmentSigned *NONNULL_PTR b); /** - * A message handler which handles custom messages. The only LDK-provided implementation is - * [`IgnoringMessageHandler`]. + * Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. */ -void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val); +void RevokeAndACK_free(struct LDKRevokeAndACK this_obj); /** - * Constructs a new MessageHandler given each field + * The channel ID */ -MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg, struct LDKCustomMessageHandler custom_message_handler_arg); +struct LDKChannelId RevokeAndACK_get_channel_id(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * Creates a copy of a SocketDescriptor + * The channel ID */ -struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); +void RevokeAndACK_set_channel_id(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Calls the free function if one is set + * The secret corresponding to the per-commitment point */ -void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); +const uint8_t (*RevokeAndACK_get_per_commitment_secret(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr))[32]; /** - * Frees any resources used by the PeerDetails, if is_owned is set and inner is non-NULL. + * The secret corresponding to the per-commitment point */ -void PeerDetails_free(struct LDKPeerDetails this_obj); +void RevokeAndACK_set_per_commitment_secret(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * The node id of the peer. - * - * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter - * passed in to [`PeerManager::new_outbound_connection`]. + * The next sender-broadcast commitment transaction's per-commitment point */ -struct LDKPublicKey PeerDetails_get_counterparty_node_id(const struct LDKPeerDetails *NONNULL_PTR this_ptr); +struct LDKPublicKey RevokeAndACK_get_next_per_commitment_point(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * The node id of the peer. - * - * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter - * passed in to [`PeerManager::new_outbound_connection`]. + * The next sender-broadcast commitment transaction's per-commitment point */ -void PeerDetails_set_counterparty_node_id(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void RevokeAndACK_set_next_per_commitment_point(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The socket address the peer provided in the initial handshake. + * A list of `(htlc_id, blinded_path)`. The receiver of this message will use the blinded paths + * as reply paths to [`HeldHtlcAvailable`] onion messages that they send to the often-offline + * receiver of this HTLC. The `htlc_id` is used by the receiver of this message to identify which + * held HTLC a given blinded path corresponds to. * - * Will only be `Some` if an address had been previously provided to - * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable * * Returns a copy of the field. */ -struct LDKCOption_SocketAddressZ PeerDetails_get_socket_address(const struct LDKPeerDetails *NONNULL_PTR this_ptr); +struct LDKCVec_C2Tuple_u64BlindedMessagePathZZ RevokeAndACK_get_release_htlc_message_paths(const struct LDKRevokeAndACK *NONNULL_PTR this_ptr); /** - * The socket address the peer provided in the initial handshake. + * A list of `(htlc_id, blinded_path)`. The receiver of this message will use the blinded paths + * as reply paths to [`HeldHtlcAvailable`] onion messages that they send to the often-offline + * receiver of this HTLC. The `htlc_id` is used by the receiver of this message to identify which + * held HTLC a given blinded path corresponds to. * - * Will only be `Some` if an address had been previously provided to - * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable */ -void PeerDetails_set_socket_address(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); +void RevokeAndACK_set_release_htlc_message_paths(struct LDKRevokeAndACK *NONNULL_PTR this_ptr, struct LDKCVec_C2Tuple_u64BlindedMessagePathZZ val); /** - * The features the peer provided in the initial handshake. + * Constructs a new RevokeAndACK given each field */ -struct LDKInitFeatures PeerDetails_get_init_features(const struct LDKPeerDetails *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRevokeAndACK RevokeAndACK_new(struct LDKChannelId channel_id_arg, struct LDKThirtyTwoBytes per_commitment_secret_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCVec_C2Tuple_u64BlindedMessagePathZZ release_htlc_message_paths_arg); /** - * The features the peer provided in the initial handshake. + * Creates a copy of the RevokeAndACK */ -void PeerDetails_set_init_features(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val); +struct LDKRevokeAndACK RevokeAndACK_clone(const struct LDKRevokeAndACK *NONNULL_PTR orig); /** - * Indicates the direction of the peer connection. - * - * Will be `true` for inbound connections, and `false` for outbound connections. + * Generates a non-cryptographic 64-bit hash of the RevokeAndACK. */ -bool PeerDetails_get_is_inbound_connection(const struct LDKPeerDetails *NONNULL_PTR this_ptr); +uint64_t RevokeAndACK_hash(const struct LDKRevokeAndACK *NONNULL_PTR o); /** - * Indicates the direction of the peer connection. - * - * Will be `true` for inbound connections, and `false` for outbound connections. + * Checks if two RevokeAndACKs 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. */ -void PeerDetails_set_is_inbound_connection(struct LDKPeerDetails *NONNULL_PTR this_ptr, bool val); +bool RevokeAndACK_eq(const struct LDKRevokeAndACK *NONNULL_PTR a, const struct LDKRevokeAndACK *NONNULL_PTR b); /** - * Constructs a new PeerDetails given each field + * Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPeerDetails PeerDetails_new(struct LDKPublicKey counterparty_node_id_arg, struct LDKCOption_SocketAddressZ socket_address_arg, struct LDKInitFeatures init_features_arg, bool is_inbound_connection_arg); +void UpdateFee_free(struct LDKUpdateFee this_obj); /** - * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. + * The channel ID */ -void PeerHandleError_free(struct LDKPeerHandleError this_obj); +struct LDKChannelId UpdateFee_get_channel_id(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * Constructs a new PeerHandleError given each field + * The channel ID */ -MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); +void UpdateFee_set_channel_id(struct LDKUpdateFee *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Creates a copy of the PeerHandleError + * Fee rate per 1000-weight of the transaction */ -struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); +uint32_t UpdateFee_get_feerate_per_kw(const struct LDKUpdateFee *NONNULL_PTR this_ptr); /** - * Get the string representation of a PeerHandleError object + * Fee rate per 1000-weight of the transaction */ -struct LDKStr PeerHandleError_to_str(const struct LDKPeerHandleError *NONNULL_PTR o); +void UpdateFee_set_feerate_per_kw(struct LDKUpdateFee *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. + * Constructs a new UpdateFee given each field */ -void PeerManager_free(struct LDKPeerManager this_obj); +MUST_USE_RES struct LDKUpdateFee UpdateFee_new(struct LDKChannelId channel_id_arg, uint32_t feerate_per_kw_arg); /** - * Constructs a new `PeerManager` with the given message handlers. - * - * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be - * cryptographically secure random bytes. - * - * `current_time` is used as an always-increasing counter that survives across restarts and is - * incremented irregularly internally. In general it is best to simply use the current UNIX - * timestamp, however if it is not available a persistent counter that increases once per - * minute should suffice. + * Creates a copy of the UpdateFee */ -MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKNodeSigner node_signer); +struct LDKUpdateFee UpdateFee_clone(const struct LDKUpdateFee *NONNULL_PTR orig); /** - * Returns a list of [`PeerDetails`] for connected peers that have completed the initial - * handshake. + * Generates a non-cryptographic 64-bit hash of the UpdateFee. */ -MUST_USE_RES struct LDKCVec_PeerDetailsZ PeerManager_list_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); +uint64_t UpdateFee_hash(const struct LDKUpdateFee *NONNULL_PTR o); /** - * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake. - * - * Will return `None` if the peer is unknown or it hasn't completed the initial handshake. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two UpdateFees 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. */ -MUST_USE_RES struct LDKPeerDetails PeerManager_peer_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id); +bool UpdateFee_eq(const struct LDKUpdateFee *NONNULL_PTR a, const struct LDKUpdateFee *NONNULL_PTR b); /** - * Indicates a new outbound connection has been established to a node with the given `node_id` - * and an optional remote network address. - * - * The remote network address adds the option to report a remote IP address back to a connecting - * peer using the init message. - * The user should pass the remote network address of the host they are connected to. - * - * If an `Err` is returned here you must disconnect the connection immediately. - * - * Returns a small number of bytes to send to the remote node (currently always 50). - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected`]. - * - * [`socket_disconnected`]: PeerManager::socket_disconnected + * Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. */ -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); +void ChannelReestablish_free(struct LDKChannelReestablish this_obj); /** - * Indicates a new inbound connection has been established to a node with an optional remote - * network address. - * - * The remote network address adds the option to report a remote IP address back to a connecting - * peer using the init message. - * The user should pass the remote network address of the host they are connected to. - * - * May refuse the connection by returning an Err, but will never write bytes to the remote end - * (outbound connector always speaks first). If an `Err` is returned here you must disconnect - * the connection immediately. - * - * Panics if descriptor is duplicative with some other descriptor which has not yet been - * [`socket_disconnected`]. - * - * [`socket_disconnected`]: PeerManager::socket_disconnected + * The channel ID */ -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); +struct LDKChannelId ChannelReestablish_get_channel_id(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Indicates that there is room to write data to the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. - * - * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before - * returning. Thus, be very careful with reentrancy issues! The invariants around calling - * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be - * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't - * sufficient! - * - * [`send_data`]: SocketDescriptor::send_data - * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail + * The channel ID */ -MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); +void ChannelReestablish_set_channel_id(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Indicates that data was read from the given socket descriptor. - * - * May return an Err to indicate that the connection should be closed. - * - * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. - * Thus, however, you should call [`process_events`] after any `read_event` to generate - * [`send_data`] calls to handle responses. - * - * If `Ok(true)` is returned, further read_events should not be triggered until a - * [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the - * send buffer). - * - * In order to avoid processing too many messages at once per peer, `data` should be on the - * order of 4KiB. - * - * [`send_data`]: SocketDescriptor::send_data - * [`process_events`]: PeerManager::process_events + * The next commitment number for the sender */ -MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); +uint64_t ChannelReestablish_get_next_local_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Checks for any events generated by our handlers and processes them. Includes sending most - * response messages as well as messages generated by calls to handler functions directly (eg - * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). - * - * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! - * - * This should be called any time we may have messages to send. It is automatically called by - * [`lightning-net-tokio`] after processing incoming messages, and by - * [`lightning-background-processor`] when channel state has changed. Therefore, If you are not - * using both [`lightning-net-tokio`] and [`lightning-background-processor`], you may need to call - * this function manually to prevent messages from being delayed. - * - * Note that if there are any other calls to this function waiting on lock(s) this may return - * without doing any work. All available events that need handling will be handled before the - * other calls return. - * - * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - * [`send_data`]: SocketDescriptor::send_data + * The next commitment number for the sender */ -void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); +void ChannelReestablish_set_next_local_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * Indicates that the given socket descriptor's connection is now closed. + * The next commitment number for the recipient */ -void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); +uint64_t ChannelReestablish_get_next_remote_commitment_number(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Disconnect a peer given its node id. - * - * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the - * peer. Thus, be very careful about reentrancy issues. - * - * [`disconnect_socket`]: SocketDescriptor::disconnect_socket + * The next commitment number for the recipient */ -void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); +void ChannelReestablish_set_next_remote_commitment_number(struct LDKChannelReestablish *NONNULL_PTR this_ptr, uint64_t val); /** - * Disconnects all currently-connected peers. This is useful on platforms where there may be - * an indication that TCP sockets have stalled even if we weren't around to time them out - * using regular ping/pongs. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient */ -void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); +const uint8_t (*ChannelReestablish_get_your_last_per_commitment_secret(const struct LDKChannelReestablish *NONNULL_PTR this_ptr))[32]; /** - * Send pings to each peer and disconnect those which did not respond to the last round of - * pings. + * Proof that the sender knows the per-commitment secret of a specific commitment transaction + * belonging to the recipient + */ +void ChannelReestablish_set_your_last_per_commitment_secret(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * The sender's per-commitment point for their current commitment transaction + */ +struct LDKPublicKey ChannelReestablish_get_my_current_per_commitment_point(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); + +/** + * The sender's per-commitment point for their current commitment transaction + */ +void ChannelReestablish_set_my_current_per_commitment_point(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The next funding transaction ID * - * This may be called on any timescale you want, however, roughly once every ten seconds is - * preferred. The call rate determines both how often we send a ping to our peers and how much - * time they have to respond before we disconnect them. + * Allows peers to finalize the signing steps of an interactive transaction construction, or + * safely abort that transaction if it was not signed by one of the peers, who has thus already + * removed it from its state. * - * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy - * issues! + * If we've sent `commtiment_signed` for an interactively constructed transaction + * during a signing session, but have not received `tx_signatures` we MUST set `next_funding` + * to the txid of that interactive transaction, else we MUST NOT set it. * - * [`send_data`]: SocketDescriptor::send_data + * See the spec for further details on this: + * * `channel_reestablish`-sending node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2466-L2470 + * * `channel_reestablish`-receiving node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2520-L2531 + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +struct LDKNextFunding ChannelReestablish_get_next_funding(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Generates a signed node_announcement from the given arguments, sending it to all connected - * peers. Note that peers will likely ignore this message unless we have at least one public - * channel which has at least six confirmations on-chain. + * The next funding transaction ID * - * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this - * node to humans. They carry no in-protocol meaning. + * Allows peers to finalize the signing steps of an interactive transaction construction, or + * safely abort that transaction if it was not signed by one of the peers, who has thus already + * removed it from its state. * - * `addresses` represent the set (possibly empty) of socket addresses on which this node - * accepts incoming connections. These will be included in the node_announcement, publicly - * tying these addresses together and to this node. If you wish to preserve user privacy, - * addresses should likely contain only Tor Onion addresses. + * If we've sent `commtiment_signed` for an interactively constructed transaction + * during a signing session, but have not received `tx_signatures` we MUST set `next_funding` + * to the txid of that interactive transaction, else we MUST NOT set it. * - * Panics if `addresses` is absurdly large (more than 100). + * See the spec for further details on this: + * * `channel_reestablish`-sending node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2466-L2470 + * * `channel_reestablish`-receiving node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2520-L2531 * - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); +void ChannelReestablish_set_next_funding(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKNextFunding val); /** - * Gets the weight for an HTLC-Success transaction. + * The last funding txid sent by the sending node, which may be: + * - the txid of the last `splice_locked` it sent, otherwise + * - the txid of the funding transaction if it sent `channel_ready`, or else + * - `None` if it has never sent `channel_ready` or `splice_locked` + * + * Also contains a bitfield indicating which messages should be retransmitted. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t htlc_success_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +struct LDKFundingLocked ChannelReestablish_get_my_current_funding_locked(const struct LDKChannelReestablish *NONNULL_PTR this_ptr); /** - * Gets the weight for an HTLC-Timeout transaction. + * The last funding txid sent by the sending node, which may be: + * - the txid of the last `splice_locked` it sent, otherwise + * - the txid of the funding transaction if it sent `channel_ready`, or else + * - `None` if it has never sent `channel_ready` or `splice_locked` + * + * Also contains a bitfield indicating which messages should be retransmitted. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t htlc_timeout_tx_weight(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features); +void ChannelReestablish_set_my_current_funding_locked(struct LDKChannelReestablish *NONNULL_PTR this_ptr, struct LDKFundingLocked val); /** - * Creates a copy of the HTLCClaim + * Constructs a new ChannelReestablish given each field + * + * Note that next_funding_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that my_current_funding_locked_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelReestablish ChannelReestablish_new(struct LDKChannelId 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 LDKNextFunding next_funding_arg, struct LDKFundingLocked my_current_funding_locked_arg); /** - * Utility method to constructs a new OfferedTimeout-variant HTLCClaim + * Creates a copy of the ChannelReestablish */ -enum LDKHTLCClaim HTLCClaim_offered_timeout(void); +struct LDKChannelReestablish ChannelReestablish_clone(const struct LDKChannelReestablish *NONNULL_PTR orig); /** - * Utility method to constructs a new OfferedPreimage-variant HTLCClaim + * Generates a non-cryptographic 64-bit hash of the ChannelReestablish. */ -enum LDKHTLCClaim HTLCClaim_offered_preimage(void); +uint64_t ChannelReestablish_hash(const struct LDKChannelReestablish *NONNULL_PTR o); /** - * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim + * Checks if two ChannelReestablishs 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. */ -enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); +bool ChannelReestablish_eq(const struct LDKChannelReestablish *NONNULL_PTR a, const struct LDKChannelReestablish *NONNULL_PTR b); /** - * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim + * Frees any resources used by the NextFunding, if is_owned is set and inner is non-NULL. */ -enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); +void NextFunding_free(struct LDKNextFunding this_obj); /** - * Utility method to constructs a new Revocation-variant HTLCClaim + * The txid of the interactive transaction construction. */ -enum LDKHTLCClaim HTLCClaim_revocation(void); +const uint8_t (*NextFunding_get_txid(const struct LDKNextFunding *NONNULL_PTR this_ptr))[32]; /** - * Checks if two HTLCClaims contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The txid of the interactive transaction construction. */ -bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); +void NextFunding_set_txid(struct LDKNextFunding *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Check if a given input witness attempts to claim a HTLC. + * A bitfield indicating which messages should be retransmitted by the receiving node. + * + * See [`NextFundingFlag`] for details. */ -MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); +uint8_t NextFunding_get_retransmit_flags(const struct LDKNextFunding *NONNULL_PTR this_ptr); /** - * Build the commitment secret from the seed and the commitment number + * A bitfield indicating which messages should be retransmitted by the receiving node. + * + * See [`NextFundingFlag`] for details. */ -struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx); +void NextFunding_set_retransmit_flags(struct LDKNextFunding *NONNULL_PTR this_ptr, uint8_t val); /** - * Build a closing transaction + * Constructs a new NextFunding given each field */ -struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); +MUST_USE_RES struct LDKNextFunding NextFunding_new(struct LDKThirtyTwoBytes txid_arg, uint8_t retransmit_flags_arg); /** - * Frees any resources used by the CounterpartyCommitmentSecrets, if is_owned is set and inner is non-NULL. + * Creates a copy of the NextFunding */ -void CounterpartyCommitmentSecrets_free(struct LDKCounterpartyCommitmentSecrets this_obj); +struct LDKNextFunding NextFunding_clone(const struct LDKNextFunding *NONNULL_PTR orig); /** - * Creates a copy of the CounterpartyCommitmentSecrets + * Generates a non-cryptographic 64-bit hash of the NextFunding. */ -struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_clone(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR orig); +uint64_t NextFunding_hash(const struct LDKNextFunding *NONNULL_PTR o); /** - * Creates a new empty `CounterpartyCommitmentSecrets` structure. + * Checks if two NextFundings 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. */ -MUST_USE_RES struct LDKCounterpartyCommitmentSecrets CounterpartyCommitmentSecrets_new(void); +bool NextFunding_eq(const struct LDKNextFunding *NONNULL_PTR a, const struct LDKNextFunding *NONNULL_PTR b); /** - * Returns the minimum index of all stored secrets. Note that indexes start - * at 1 << 48 and get decremented by one for each new secret. + * Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`. */ -MUST_USE_RES uint64_t CounterpartyCommitmentSecrets_get_min_seen_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg); +void NextFunding_retransmit(struct LDKNextFunding *NONNULL_PTR this_arg, enum LDKNextFundingFlag flag); /** - * Inserts the `secret` at `idx`. Returns `Ok(())` if the secret - * was generated in accordance with BOLT 3 and is consistent with previous secrets. + * Returns whether the message corresponding to `flag` should be retransmitted. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ CounterpartyCommitmentSecrets_provide_secret(struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx, struct LDKThirtyTwoBytes secret); +MUST_USE_RES bool NextFunding_should_retransmit(const struct LDKNextFunding *NONNULL_PTR this_arg, enum LDKNextFundingFlag flag); /** - * Returns the secret at `idx`. - * Returns `None` if `idx` is < [`CounterpartyCommitmentSecrets::get_min_seen_secret`]. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the NextFundingFlag */ -MUST_USE_RES struct LDKThirtyTwoBytes CounterpartyCommitmentSecrets_get_secret(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR this_arg, uint64_t idx); +enum LDKNextFundingFlag NextFundingFlag_clone(const enum LDKNextFundingFlag *NONNULL_PTR orig); /** - * Serialize the CounterpartyCommitmentSecrets object into a byte array which can be read by CounterpartyCommitmentSecrets_read + * Utility method to constructs a new CommitmentSigned-variant NextFundingFlag */ -struct LDKCVec_u8Z CounterpartyCommitmentSecrets_write(const struct LDKCounterpartyCommitmentSecrets *NONNULL_PTR obj); +enum LDKNextFundingFlag NextFundingFlag_commitment_signed(void); /** - * Read a CounterpartyCommitmentSecrets from a byte array, created by CounterpartyCommitmentSecrets_write + * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitmentSecrets_read(struct LDKu8slice ser); +void FundingLocked_free(struct LDKFundingLocked this_obj); /** - * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) - * from the base secret and the per_commitment_point. + * The last txid sent by the sending node, which may be either from the last `splice_locked` or + * for the initial funding transaction if it sent `channel_ready`. */ -struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +const uint8_t (*FundingLocked_get_txid(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; /** - * Derives a per-commitment-transaction revocation key from its constituent parts. + * The last txid sent by the sending node, which may be either from the last `splice_locked` or + * for the initial funding transaction if it sent `channel_ready`. + */ +void FundingLocked_set_txid(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * A bitfield indicating which messages should be retransmitted by the receiving node. * - * Only the cheating participant owns a valid witness to propagate a revoked - * commitment transaction, thus per_commitment_secret always come from cheater - * and revocation_base_secret always come from punisher, which is the broadcaster - * of the transaction spending with this key knowledge. + * See [`FundingLockedFlags`] for details. */ -struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +uint8_t FundingLocked_get_retransmit_flags(const struct LDKFundingLocked *NONNULL_PTR this_ptr); /** - * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. + * A bitfield indicating which messages should be retransmitted by the receiving node. + * + * See [`FundingLockedFlags`] for details. */ -void TxCreationKeys_free(struct LDKTxCreationKeys this_obj); +void FundingLocked_set_retransmit_flags(struct LDKFundingLocked *NONNULL_PTR this_ptr, uint8_t val); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * Constructs a new FundingLocked given each field */ -struct LDKPublicKey TxCreationKeys_get_per_commitment_point(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes txid_arg, uint8_t retransmit_flags_arg); /** - * The broadcaster's per-commitment public key which was used to derive the other keys. + * Creates a copy of the FundingLocked */ -void TxCreationKeys_set_per_commitment_point(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Generates a non-cryptographic 64-bit hash of the FundingLocked. */ -struct LDKRevocationKey TxCreationKeys_get_revocation_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +uint64_t FundingLocked_hash(const struct LDKFundingLocked *NONNULL_PTR o); /** - * The revocation key which is used to allow the broadcaster of the commitment - * transaction to provide their counterparty the ability to punish them if they broadcast - * an old state. + * Checks if two FundingLockeds 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. */ -void TxCreationKeys_set_revocation_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKRevocationKey val); +bool FundingLocked_eq(const struct LDKFundingLocked *NONNULL_PTR a, const struct LDKFundingLocked *NONNULL_PTR b); /** - * Broadcaster's HTLC Key + * Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`. */ -struct LDKHtlcKey TxCreationKeys_get_broadcaster_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void FundingLocked_retransmit(struct LDKFundingLocked *NONNULL_PTR this_arg, enum LDKFundingLockedFlags flag); /** - * Broadcaster's HTLC Key + * Returns whether the message corresponding to `flag` should be retransmitted. */ -void TxCreationKeys_set_broadcaster_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); +MUST_USE_RES bool FundingLocked_should_retransmit(const struct LDKFundingLocked *NONNULL_PTR this_arg, enum LDKFundingLockedFlags flag); /** - * Countersignatory's HTLC Key + * Creates a copy of the FundingLockedFlags */ -struct LDKHtlcKey TxCreationKeys_get_countersignatory_htlc_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +enum LDKFundingLockedFlags FundingLockedFlags_clone(const enum LDKFundingLockedFlags *NONNULL_PTR orig); /** - * Countersignatory's HTLC Key + * Utility method to constructs a new AnnouncementSignatures-variant FundingLockedFlags */ -void TxCreationKeys_set_countersignatory_htlc_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKHtlcKey val); +enum LDKFundingLockedFlags FundingLockedFlags_announcement_signatures(void); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. */ -struct LDKDelayedPaymentKey TxCreationKeys_get_broadcaster_delayed_payment_key(const struct LDKTxCreationKeys *NONNULL_PTR this_ptr); +void AnnouncementSignatures_free(struct LDKAnnouncementSignatures this_obj); /** - * Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) + * The channel ID */ -void TxCreationKeys_set_broadcaster_delayed_payment_key(struct LDKTxCreationKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentKey val); +struct LDKChannelId AnnouncementSignatures_get_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Constructs a new TxCreationKeys given each field + * The channel ID */ -MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_new(struct LDKPublicKey per_commitment_point_arg, struct LDKRevocationKey revocation_key_arg, struct LDKHtlcKey broadcaster_htlc_key_arg, struct LDKHtlcKey countersignatory_htlc_key_arg, struct LDKDelayedPaymentKey broadcaster_delayed_payment_key_arg); +void AnnouncementSignatures_set_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKChannelId val); /** - * Checks if two TxCreationKeyss 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. + * The short channel ID */ -bool TxCreationKeys_eq(const struct LDKTxCreationKeys *NONNULL_PTR a, const struct LDKTxCreationKeys *NONNULL_PTR b); +uint64_t AnnouncementSignatures_get_short_channel_id(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Creates a copy of the TxCreationKeys + * The short channel ID */ -struct LDKTxCreationKeys TxCreationKeys_clone(const struct LDKTxCreationKeys *NONNULL_PTR orig); +void AnnouncementSignatures_set_short_channel_id(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, uint64_t val); /** - * Serialize the TxCreationKeys object into a byte array which can be read by TxCreationKeys_read + * A signature by the node key */ -struct LDKCVec_u8Z TxCreationKeys_write(const struct LDKTxCreationKeys *NONNULL_PTR obj); +struct LDKECDSASignature AnnouncementSignatures_get_node_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * Read a TxCreationKeys from a byte array, created by TxCreationKeys_write + * A signature by the node key */ -struct LDKCResult_TxCreationKeysDecodeErrorZ TxCreationKeys_read(struct LDKu8slice ser); +void AnnouncementSignatures_set_node_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Frees any resources used by the ChannelPublicKeys, if is_owned is set and inner is non-NULL. + * A signature by the funding key */ -void ChannelPublicKeys_free(struct LDKChannelPublicKeys this_obj); +struct LDKECDSASignature AnnouncementSignatures_get_bitcoin_signature(const struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * A signature by the funding key */ -struct LDKPublicKey ChannelPublicKeys_get_funding_pubkey(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +void AnnouncementSignatures_set_bitcoin_signature(struct LDKAnnouncementSignatures *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * The public key which is used to sign all commitment transactions, as it appears in the - * on-chain channel lock-in 2-of-2 multisig output. + * Constructs a new AnnouncementSignatures given each field */ -void ChannelPublicKeys_set_funding_pubkey(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKAnnouncementSignatures AnnouncementSignatures_new(struct LDKChannelId channel_id_arg, uint64_t short_channel_id_arg, struct LDKECDSASignature node_signature_arg, struct LDKECDSASignature bitcoin_signature_arg); /** - * The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Creates a copy of the AnnouncementSignatures */ -struct LDKRevocationBasepoint ChannelPublicKeys_get_revocation_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKAnnouncementSignatures AnnouncementSignatures_clone(const struct LDKAnnouncementSignatures *NONNULL_PTR orig); /** - * The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment - * revocation keys. This is combined with the per-commitment-secret generated by the - * counterparty to create a secret which the counterparty can reveal to revoke previous - * states. + * Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. */ -void ChannelPublicKeys_set_revocation_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKRevocationBasepoint val); +uint64_t AnnouncementSignatures_hash(const struct LDKAnnouncementSignatures *NONNULL_PTR o); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Checks if two AnnouncementSignaturess 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. */ -struct LDKPublicKey ChannelPublicKeys_get_payment_point(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +bool AnnouncementSignatures_eq(const struct LDKAnnouncementSignatures *NONNULL_PTR a, const struct LDKAnnouncementSignatures *NONNULL_PTR b); /** - * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately - * spendable primary channel balance on the broadcaster's commitment transaction. This key is - * static across every commitment transaction. + * Frees any resources used by the SocketAddress */ -void ChannelPublicKeys_set_payment_point(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void SocketAddress_free(struct LDKSocketAddress this_ptr); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Creates a copy of the SocketAddress */ -struct LDKDelayedPaymentBasepoint ChannelPublicKeys_get_delayed_payment_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKSocketAddress SocketAddress_clone(const struct LDKSocketAddress *NONNULL_PTR orig); /** - * The base point which is used (with derive_public_key) to derive a per-commitment payment - * public key which receives non-HTLC-encumbered funds which are only available for spending - * after some delay (or can be claimed via the revocation path). + * Utility method to constructs a new TcpIpV4-variant SocketAddress */ -void ChannelPublicKeys_set_delayed_payment_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKDelayedPaymentBasepoint val); +struct LDKSocketAddress SocketAddress_tcp_ip_v4(struct LDKFourBytes addr, uint16_t port); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Utility method to constructs a new TcpIpV6-variant SocketAddress */ -struct LDKHtlcBasepoint ChannelPublicKeys_get_htlc_basepoint(const struct LDKChannelPublicKeys *NONNULL_PTR this_ptr); +struct LDKSocketAddress SocketAddress_tcp_ip_v6(struct LDKSixteenBytes addr, uint16_t port); /** - * The base point which is used (with derive_public_key) to derive a per-commitment public key - * which is used to encumber HTLC-in-flight outputs. + * Utility method to constructs a new OnionV2-variant SocketAddress */ -void ChannelPublicKeys_set_htlc_basepoint(struct LDKChannelPublicKeys *NONNULL_PTR this_ptr, struct LDKHtlcBasepoint val); +struct LDKSocketAddress SocketAddress_onion_v2(struct LDKTwelveBytes a); /** - * Constructs a new ChannelPublicKeys given each field + * Utility method to constructs a new OnionV3-variant SocketAddress */ -MUST_USE_RES struct LDKChannelPublicKeys ChannelPublicKeys_new(struct LDKPublicKey funding_pubkey_arg, struct LDKRevocationBasepoint revocation_basepoint_arg, struct LDKPublicKey payment_point_arg, struct LDKDelayedPaymentBasepoint delayed_payment_basepoint_arg, struct LDKHtlcBasepoint htlc_basepoint_arg); +struct LDKSocketAddress SocketAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); /** - * Creates a copy of the ChannelPublicKeys + * Utility method to constructs a new Hostname-variant SocketAddress */ -struct LDKChannelPublicKeys ChannelPublicKeys_clone(const struct LDKChannelPublicKeys *NONNULL_PTR orig); +struct LDKSocketAddress SocketAddress_hostname(struct LDKHostname hostname, uint16_t port); /** - * Generates a non-cryptographic 64-bit hash of the ChannelPublicKeys. + * Generates a non-cryptographic 64-bit hash of the SocketAddress. */ -uint64_t ChannelPublicKeys_hash(const struct LDKChannelPublicKeys *NONNULL_PTR o); +uint64_t SocketAddress_hash(const struct LDKSocketAddress *NONNULL_PTR o); /** - * Checks if two ChannelPublicKeyss 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. - * Two objects with NULL inner values will be considered "equal" here. */ -bool ChannelPublicKeys_eq(const struct LDKChannelPublicKeys *NONNULL_PTR a, const struct LDKChannelPublicKeys *NONNULL_PTR b); +bool SocketAddress_eq(const struct LDKSocketAddress *NONNULL_PTR a, const struct LDKSocketAddress *NONNULL_PTR b); /** - * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read + * Serialize the SocketAddress object into a byte array which can be read by SocketAddress_read */ -struct LDKCVec_u8Z ChannelPublicKeys_write(const struct LDKChannelPublicKeys *NONNULL_PTR obj); +struct LDKCVec_u8Z SocketAddress_write(const struct LDKSocketAddress *NONNULL_PTR obj); /** - * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write + * Read a SocketAddress from a byte array, created by SocketAddress_write */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LDKu8slice ser); +struct LDKCResult_SocketAddressDecodeErrorZ SocketAddress_read(struct LDKu8slice ser); /** - * Create per-state keys from channel base points and the per-commitment point. - * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. + * Creates a copy of the SocketAddressParseError */ -MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, const struct LDKDelayedPaymentBasepoint *NONNULL_PTR broadcaster_delayed_payment_base, const struct LDKHtlcBasepoint *NONNULL_PTR broadcaster_htlc_base, const struct LDKRevocationBasepoint *NONNULL_PTR countersignatory_revocation_base, const struct LDKHtlcBasepoint *NONNULL_PTR countersignatory_htlc_base); +enum LDKSocketAddressParseError SocketAddressParseError_clone(const enum LDKSocketAddressParseError *NONNULL_PTR orig); /** - * Generate per-state keys from channel static keys. - * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. + * Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError */ -MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +enum LDKSocketAddressParseError SocketAddressParseError_socket_addr_parse(void); /** - * A script either spendable by the revocation - * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain. - * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions. + * Utility method to constructs a new InvalidInput-variant SocketAddressParseError */ -struct LDKCVec_u8Z get_revokeable_redeemscript(const struct LDKRevocationKey *NONNULL_PTR revocation_key, uint16_t contest_delay, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_input(void); /** - * Returns the script for the counterparty's output on a holder's commitment transaction based on - * the channel type. + * Utility method to constructs a new InvalidPort-variant SocketAddressParseError */ -struct LDKCVec_u8Z get_counterparty_payment_script(const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, struct LDKPublicKey payment_key); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_port(void); /** - * Frees any resources used by the HTLCOutputInCommitment, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError */ -void HTLCOutputInCommitment_free(struct LDKHTLCOutputInCommitment this_obj); +enum LDKSocketAddressParseError SocketAddressParseError_invalid_onion_v3(void); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. */ -bool HTLCOutputInCommitment_get_offered(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +uint64_t SocketAddressParseError_hash(const enum LDKSocketAddressParseError *NONNULL_PTR o); /** - * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). - * Note that this is not the same as whether it is ountbound *from us*. To determine that you - * need to compare this value to whether the commitment transaction in question is that of - * the counterparty or our own. + * Checks if two SocketAddressParseErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void HTLCOutputInCommitment_set_offered(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, bool val); +bool SocketAddressParseError_eq(const enum LDKSocketAddressParseError *NONNULL_PTR a, const enum LDKSocketAddressParseError *NONNULL_PTR b); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Get the string representation of a SocketAddressParseError object */ -uint64_t HTLCOutputInCommitment_get_amount_msat(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKStr SocketAddressParseError_to_str(const enum LDKSocketAddressParseError *NONNULL_PTR o); /** - * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is - * this divided by 1000. + * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. + * + * The host part must end with \".onion\". */ -void HTLCOutputInCommitment_set_amount_msat(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ parse_onion_address(struct LDKStr host, uint16_t port); /** - * The CLTV lock-time at which this HTLC expires. + * Get the string representation of a SocketAddress object */ -uint32_t HTLCOutputInCommitment_get_cltv_expiry(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKStr SocketAddress_to_str(const struct LDKSocketAddress *NONNULL_PTR o); /** - * The CLTV lock-time at which this HTLC expires. + * Read a SocketAddress object from a string */ -void HTLCOutputInCommitment_set_cltv_expiry(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_SocketAddressSocketAddressParseErrorZ SocketAddress_from_str(struct LDKStr s); /** - * The hash of the preimage which unlocks this HTLC. + * Frees any resources used by the UnsignedGossipMessage */ -const uint8_t (*HTLCOutputInCommitment_get_payment_hash(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr))[32]; +void UnsignedGossipMessage_free(struct LDKUnsignedGossipMessage this_ptr); /** - * The hash of the preimage which unlocks this HTLC. + * Creates a copy of the UnsignedGossipMessage */ -void HTLCOutputInCommitment_set_payment_hash(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_clone(const struct LDKUnsignedGossipMessage *NONNULL_PTR orig); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage */ -struct LDKCOption_u32Z HTLCOutputInCommitment_get_transaction_output_index(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_announcement(struct LDKUnsignedChannelAnnouncement a); /** - * The position within the commitment transactions' outputs. This may be None if the value is - * below the dust limit (in which case no output appears in the commitment transaction and the - * value is spent to additional transaction fees). + * Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage */ -void HTLCOutputInCommitment_set_transaction_output_index(struct LDKHTLCOutputInCommitment *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_channel_update(struct LDKUnsignedChannelUpdate a); /** - * Constructs a new HTLCOutputInCommitment given each field + * Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage */ -MUST_USE_RES struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_new(bool offered_arg, uint64_t amount_msat_arg, uint32_t cltv_expiry_arg, struct LDKThirtyTwoBytes payment_hash_arg, struct LDKCOption_u32Z transaction_output_index_arg); +struct LDKUnsignedGossipMessage UnsignedGossipMessage_node_announcement(struct LDKUnsignedNodeAnnouncement a); /** - * Creates a copy of the HTLCOutputInCommitment + * Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read */ -struct LDKHTLCOutputInCommitment HTLCOutputInCommitment_clone(const struct LDKHTLCOutputInCommitment *NONNULL_PTR orig); +struct LDKCVec_u8Z UnsignedGossipMessage_write(const struct LDKUnsignedGossipMessage *NONNULL_PTR obj); /** - * Checks if two HTLCOutputInCommitments 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. + * Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. */ -bool HTLCOutputInCommitment_eq(const struct LDKHTLCOutputInCommitment *NONNULL_PTR a, const struct LDKHTLCOutputInCommitment *NONNULL_PTR b); +void UnsignedNodeAnnouncement_free(struct LDKUnsignedNodeAnnouncement this_obj); /** - * Converts HTLC's value with millisatoshi precision into [bitcoin::Amount] with satoshi precision. - * Typically this conversion is needed when transitioning from LN into base-layer Bitcoin, - * e. g. in commitment transactions. + * The advertised features */ -MUST_USE_RES uint64_t HTLCOutputInCommitment_to_bitcoin_amount(const struct LDKHTLCOutputInCommitment *NONNULL_PTR this_arg); +struct LDKNodeFeatures UnsignedNodeAnnouncement_get_features(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read + * The advertised features */ -struct LDKCVec_u8Z HTLCOutputInCommitment_write(const struct LDKHTLCOutputInCommitment *NONNULL_PTR obj); +void UnsignedNodeAnnouncement_set_features(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write + * A strictly monotonic announcement counter, with gaps allowed */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ HTLCOutputInCommitment_read(struct LDKu8slice ser); +uint32_t UnsignedNodeAnnouncement_get_timestamp(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc - * does not need to have its previous_output_index filled. + * A strictly monotonic announcement counter, with gaps allowed */ -struct LDKCVec_u8Z get_htlc_redeemscript(const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKTxCreationKeys *NONNULL_PTR keys); +void UnsignedNodeAnnouncement_set_timestamp(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, uint32_t val); /** - * Gets the redeemscript for a funding output from the two funding public keys. - * Note that the order of funding public keys does not matter. + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, struct LDKPublicKey countersignatory); +struct LDKNodeId UnsignedNodeAnnouncement_get_node_id(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Builds an unsigned HTLC-Success or HTLC-Timeout transaction from the given channel and HTLC - * parameters. This is used by [`TrustedCommitmentTransaction::get_htlc_sigs`] to fetch the - * transaction which needs signing, and can be used to construct an HTLC transaction which is - * broadcastable given a counterparty HTLC signature. - * - * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the - * commitment transaction). + * The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back + * to this node). */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, const struct LDKChannelTypeFeatures *NONNULL_PTR channel_type_features, const struct LDKDelayedPaymentKey *NONNULL_PTR broadcaster_delayed_payment_key, const struct LDKRevocationKey *NONNULL_PTR revocation_key); +void UnsignedNodeAnnouncement_set_node_id(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Returns the witness required to satisfy and spend a HTLC input. + * An RGB color for UI purposes */ -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); +const uint8_t (*UnsignedNodeAnnouncement_get_rgb(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[3]; /** - * Gets the witnessScript for the to_remote output when anchors are enabled. + * An RGB color for UI purposes */ -struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); +void UnsignedNodeAnnouncement_set_rgb(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * Gets the witnessScript for an anchor output from the funding public key. - * The witness in the spending input must be: - * - * After 16 blocks of confirmation, an alternative satisfying witness could be: - * <> - * (empty vector required to satisfy compliance with MINIMALIF-standard rule) + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ -struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); +struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Returns the witness required to satisfy and spend an anchor input. + * An alias, for UI purposes. + * + * This should be sanitized before use. There is no guarantee of uniqueness. */ -struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKECDSASignature funding_sig); +void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * List of addresses on which this node is reachable + * + * Returns a copy of the field. */ -void ChannelTransactionParameters_free(struct LDKChannelTransactionParameters this_obj); +struct LDKCVec_SocketAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Holder public keys + * List of addresses on which this node is reachable */ -struct LDKChannelPublicKeys ChannelTransactionParameters_get_holder_pubkeys(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_addresses(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** - * Holder public keys + * Excess address 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 address types are added to the lightning gossip protocol. + * + * Returns a copy of the field. */ -void ChannelTransactionParameters_set_holder_pubkeys(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_address_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * Excess address 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 address types are added to the lightning gossip protocol. */ -uint16_t ChannelTransactionParameters_get_holder_selected_contest_delay(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_excess_address_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The contest delay selected by the holder, which applies to counterparty-broadcast transactions + * 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. */ -void ChannelTransactionParameters_set_holder_selected_contest_delay(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_get_excess_data(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * 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. */ -bool ChannelTransactionParameters_get_is_outbound_from_holder(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +void UnsignedNodeAnnouncement_set_excess_data(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Whether the holder is the initiator of this channel. - * This is an input to the commitment number obscure factor computation. + * Constructs a new UnsignedNodeAnnouncement given each field */ -void ChannelTransactionParameters_set_is_outbound_from_holder(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_new(struct LDKNodeFeatures features_arg, uint32_t timestamp_arg, struct LDKNodeId node_id_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg, struct LDKCVec_u8Z excess_address_data_arg, struct LDKCVec_u8Z excess_data_arg); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the UnsignedNodeAnnouncement */ -struct LDKCounterpartyChannelTransactionParameters ChannelTransactionParameters_get_counterparty_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKUnsignedNodeAnnouncement UnsignedNodeAnnouncement_clone(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR orig); /** - * The late-bound counterparty channel transaction parameters. - * These parameters are populated at the point in the protocol where the counterparty provides them. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. */ -void ChannelTransactionParameters_set_counterparty_parameters(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKCounterpartyChannelTransactionParameters val); +uint64_t UnsignedNodeAnnouncement_hash(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR o); /** - * The late-bound funding outpoint - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two UnsignedNodeAnnouncements 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. */ -struct LDKOutPoint ChannelTransactionParameters_get_funding_outpoint(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +bool UnsignedNodeAnnouncement_eq(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR a, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR b); /** - * The late-bound funding outpoint - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. */ -void ChannelTransactionParameters_set_funding_outpoint(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void NodeAnnouncement_free(struct LDKNodeAnnouncement this_obj); /** - * This channel's type, as negotiated during channel open. For old objects where this field - * wasn't serialized, it will default to static_remote_key at deserialization. + * The signature by the node key */ -struct LDKChannelTypeFeatures ChannelTransactionParameters_get_channel_type_features(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKECDSASignature NodeAnnouncement_get_signature(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * This channel's type, as negotiated during channel open. For old objects where this field - * wasn't serialized, it will default to static_remote_key at deserialization. + * The signature by the node key */ -void ChannelTransactionParameters_set_channel_type_features(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelTypeFeatures val); +void NodeAnnouncement_set_signature(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * 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 + * The actual content of the announcement */ -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); +struct LDKUnsignedNodeAnnouncement NodeAnnouncement_get_contents(const struct LDKNodeAnnouncement *NONNULL_PTR this_ptr); /** - * Creates a copy of the ChannelTransactionParameters + * The actual content of the announcement */ -struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig); +void NodeAnnouncement_set_contents(struct LDKNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedNodeAnnouncement val); /** - * Generates a non-cryptographic 64-bit hash of the ChannelTransactionParameters. + * Constructs a new NodeAnnouncement given each field */ -uint64_t ChannelTransactionParameters_hash(const struct LDKChannelTransactionParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncement_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedNodeAnnouncement contents_arg); /** - * 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. + * Creates a copy of the NodeAnnouncement */ -bool ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b); +struct LDKNodeAnnouncement NodeAnnouncement_clone(const struct LDKNodeAnnouncement *NONNULL_PTR orig); /** - * Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. */ -void CounterpartyChannelTransactionParameters_free(struct LDKCounterpartyChannelTransactionParameters this_obj); +uint64_t NodeAnnouncement_hash(const struct LDKNodeAnnouncement *NONNULL_PTR o); /** - * Counter-party public keys + * Checks if two NodeAnnouncements 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. */ -struct LDKChannelPublicKeys CounterpartyChannelTransactionParameters_get_pubkeys(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +bool NodeAnnouncement_eq(const struct LDKNodeAnnouncement *NONNULL_PTR a, const struct LDKNodeAnnouncement *NONNULL_PTR b); /** - * Counter-party public keys + * Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -void CounterpartyChannelTransactionParameters_set_pubkeys(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, struct LDKChannelPublicKeys val); +void UnsignedChannelAnnouncement_free(struct LDKUnsignedChannelAnnouncement this_obj); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * The advertised channel features */ -uint16_t CounterpartyChannelTransactionParameters_get_selected_contest_delay(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr); +struct LDKChannelFeatures UnsignedChannelAnnouncement_get_features(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The contest delay selected by the counterparty, which applies to holder-broadcast transactions + * The advertised channel features */ -void CounterpartyChannelTransactionParameters_set_selected_contest_delay(struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR this_ptr, uint16_t val); +void UnsignedChannelAnnouncement_set_features(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Constructs a new CounterpartyChannelTransactionParameters given each field + * The genesis hash of the blockchain where the channel is to be opened */ -MUST_USE_RES struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_new(struct LDKChannelPublicKeys pubkeys_arg, uint16_t selected_contest_delay_arg); +const uint8_t (*UnsignedChannelAnnouncement_get_chain_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr))[32]; /** - * Creates a copy of the CounterpartyChannelTransactionParameters + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig); +void UnsignedChannelAnnouncement_set_chain_hash(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Generates a non-cryptographic 64-bit hash of the CounterpartyChannelTransactionParameters. + * The short channel ID */ -uint64_t CounterpartyChannelTransactionParameters_hash(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR o); +uint64_t UnsignedChannelAnnouncement_get_short_channel_id(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * 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. + * The short channel ID */ -bool CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b); +void UnsignedChannelAnnouncement_set_short_channel_id(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, uint64_t val); /** - * Whether the late bound parameters are populated. + * One of the two `node_id`s which are endpoints of this channel */ -MUST_USE_RES bool ChannelTransactionParameters_is_populated(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the holder is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * One of the two `node_id`s which are endpoints of this channel */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_holder_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_node_id_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters, - * given that the counterparty is the broadcaster. - * - * self.is_populated() must be true before calling this function. + * The other of the two `node_id`s which are endpoints of this channel */ -MUST_USE_RES struct LDKDirectedChannelTransactionParameters ChannelTransactionParameters_as_counterparty_broadcastable(const struct LDKChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKNodeId UnsignedChannelAnnouncement_get_node_id_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read + * The other of the two `node_id`s which are endpoints of this channel */ -struct LDKCVec_u8Z CounterpartyChannelTransactionParameters_write(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR obj); +void UnsignedChannelAnnouncement_set_node_id_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Read a CounterpartyChannelTransactionParameters from a byte array, created by CounterpartyChannelTransactionParameters_write + * The funding key for the first node */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CounterpartyChannelTransactionParameters_read(struct LDKu8slice ser); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_1(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read + * The funding key for the first node */ -struct LDKCVec_u8Z ChannelTransactionParameters_write(const struct LDKChannelTransactionParameters *NONNULL_PTR obj); +void UnsignedChannelAnnouncement_set_bitcoin_key_1(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write + * The funding key for the second node */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ ChannelTransactionParameters_read(struct LDKu8slice ser); +struct LDKNodeId UnsignedChannelAnnouncement_get_bitcoin_key_2(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Frees any resources used by the DirectedChannelTransactionParameters, if is_owned is set and inner is non-NULL. + * The funding key for the second node */ -void DirectedChannelTransactionParameters_free(struct LDKDirectedChannelTransactionParameters this_obj); +void UnsignedChannelAnnouncement_set_bitcoin_key_2(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Get the channel pubkeys for the broadcaster + * 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. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_broadcaster_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_get_excess_data(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Get the channel pubkeys for the countersignatory + * 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. */ -MUST_USE_RES struct LDKChannelPublicKeys DirectedChannelTransactionParameters_countersignatory_pubkeys(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +void UnsignedChannelAnnouncement_set_excess_data(struct LDKUnsignedChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Get the contest delay applicable to the transactions. - * Note that the contest delay was selected by the countersignatory. + * Constructs a new UnsignedChannelAnnouncement given each field */ -MUST_USE_RES uint16_t DirectedChannelTransactionParameters_contest_delay(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +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); /** - * Whether the channel is outbound from the broadcaster. - * - * The boolean representing the side that initiated the channel is - * an input to the commitment number obscure factor computation. + * Creates a copy of the UnsignedChannelAnnouncement */ -MUST_USE_RES bool DirectedChannelTransactionParameters_is_outbound(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +struct LDKUnsignedChannelAnnouncement UnsignedChannelAnnouncement_clone(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR orig); /** - * The funding outpoint + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. */ -MUST_USE_RES struct LDKOutPoint DirectedChannelTransactionParameters_funding_outpoint(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +uint64_t UnsignedChannelAnnouncement_hash(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR o); /** - * Whether to use anchors for this channel + * Checks if two UnsignedChannelAnnouncements 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. */ -MUST_USE_RES struct LDKChannelTypeFeatures DirectedChannelTransactionParameters_channel_type_features(const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR this_arg); +bool UnsignedChannelAnnouncement_eq(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR a, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR b); /** - * Frees any resources used by the HolderCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. */ -void HolderCommitmentTransaction_free(struct LDKHolderCommitmentTransaction this_obj); +void ChannelAnnouncement_free(struct LDKChannelAnnouncement this_obj); /** - * Our counterparty's signature for the transaction + * Authentication of the announcement by the first public node */ -struct LDKECDSASignature HolderCommitmentTransaction_get_counterparty_sig(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Our counterparty's signature for the transaction + * Authentication of the announcement by the first public node */ -void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +void ChannelAnnouncement_set_node_signature_1(struct LDKChannelAnnouncement *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. + * Authentication of the announcement by the second public node */ -struct LDKCVec_ECDSASignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); +struct LDKECDSASignature ChannelAnnouncement_get_node_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * Authentication of the announcement by the second public node */ -void HolderCommitmentTransaction_set_counterparty_htlc_sigs(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKCVec_ECDSASignatureZ val); +void ChannelAnnouncement_set_node_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Creates a copy of the HolderCommitmentTransaction + * Proof of funding UTXO ownership by the first public node */ -struct LDKHolderCommitmentTransaction HolderCommitmentTransaction_clone(const struct LDKHolderCommitmentTransaction *NONNULL_PTR orig); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_1(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * Serialize the HolderCommitmentTransaction object into a byte array which can be read by HolderCommitmentTransaction_read + * Proof of funding UTXO ownership by the first public node */ -struct LDKCVec_u8Z HolderCommitmentTransaction_write(const struct LDKHolderCommitmentTransaction *NONNULL_PTR obj); +void ChannelAnnouncement_set_bitcoin_signature_1(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Read a HolderCommitmentTransaction from a byte array, created by HolderCommitmentTransaction_write + * Proof of funding UTXO ownership by the second public node */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ HolderCommitmentTransaction_read(struct LDKu8slice ser); +struct LDKECDSASignature ChannelAnnouncement_get_bitcoin_signature_2(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * 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. + * Proof of funding UTXO ownership by the second public node */ -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); +void ChannelAnnouncement_set_bitcoin_signature_2(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Frees any resources used by the BuiltCommitmentTransaction, if is_owned is set and inner is non-NULL. + * The actual announcement */ -void BuiltCommitmentTransaction_free(struct LDKBuiltCommitmentTransaction this_obj); +struct LDKUnsignedChannelAnnouncement ChannelAnnouncement_get_contents(const struct LDKChannelAnnouncement *NONNULL_PTR this_ptr); /** - * The commitment transaction + * The actual announcement */ -struct LDKTransaction BuiltCommitmentTransaction_get_transaction(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr); +void ChannelAnnouncement_set_contents(struct LDKChannelAnnouncement *NONNULL_PTR this_ptr, struct LDKUnsignedChannelAnnouncement val); /** - * The commitment transaction + * Constructs a new ChannelAnnouncement given each field */ -void BuiltCommitmentTransaction_set_transaction(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKTransaction val); +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); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Creates a copy of the ChannelAnnouncement */ -const uint8_t (*BuiltCommitmentTransaction_get_txid(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr))[32]; +struct LDKChannelAnnouncement ChannelAnnouncement_clone(const struct LDKChannelAnnouncement *NONNULL_PTR orig); /** - * The txid for the commitment transaction. - * - * This is provided as a performance optimization, instead of calling transaction.txid() - * multiple times. + * Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. */ -void BuiltCommitmentTransaction_set_txid(struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +uint64_t ChannelAnnouncement_hash(const struct LDKChannelAnnouncement *NONNULL_PTR o); /** - * Constructs a new BuiltCommitmentTransaction given each field + * Checks if two ChannelAnnouncements 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. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_new(struct LDKTransaction transaction_arg, struct LDKThirtyTwoBytes txid_arg); +bool ChannelAnnouncement_eq(const struct LDKChannelAnnouncement *NONNULL_PTR a, const struct LDKChannelAnnouncement *NONNULL_PTR b); /** - * Creates a copy of the BuiltCommitmentTransaction + * Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKBuiltCommitmentTransaction BuiltCommitmentTransaction_clone(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR orig); +void UnsignedChannelUpdate_free(struct LDKUnsignedChannelUpdate this_obj); /** - * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKCVec_u8Z BuiltCommitmentTransaction_write(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR obj); +const uint8_t (*UnsignedChannelUpdate_get_chain_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr))[32]; /** - * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write + * The genesis hash of the blockchain where the channel is to be opened */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ BuiltCommitmentTransaction_read(struct LDKu8slice ser); +void UnsignedChannelUpdate_set_chain_hash(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Get the SIGHASH_ALL sighash value of the transaction. - * - * This can be used to verify a signature. + * The short channel ID */ -MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +uint64_t UnsignedChannelUpdate_get_short_channel_id(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Signs the counterparty's commitment transaction. + * The short channel ID */ -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); +void UnsignedChannelUpdate_set_short_channel_id(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * Signs the holder commitment transaction because we are about to broadcast it. + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -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); +uint32_t UnsignedChannelUpdate_get_timestamp(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL. + * A strictly monotonic announcement counter, with gaps allowed, specific to this channel */ -void ClosingTransaction_free(struct LDKClosingTransaction this_obj); +void UnsignedChannelUpdate_set_timestamp(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the ClosingTransaction + * Flags pertaining to this message. */ -struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig); +uint8_t UnsignedChannelUpdate_get_message_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the ClosingTransaction. + * Flags pertaining to this message. */ -uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o); +void UnsignedChannelUpdate_set_message_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * Checks if two ClosingTransactions 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. + * Flags pertaining to the channel, including to which direction in the channel this update + * applies and whether the direction is currently able to forward HTLCs. */ -bool ClosingTransaction_eq(const struct LDKClosingTransaction *NONNULL_PTR a, const struct LDKClosingTransaction *NONNULL_PTR b); +uint8_t UnsignedChannelUpdate_get_channel_flags(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Construct an object of the class + * Flags pertaining to the channel, including to which direction in the channel this update + * applies and whether the direction is currently able to forward HTLCs. */ -MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint); +void UnsignedChannelUpdate_set_channel_flags(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint8_t val); /** - * Trust our pre-built transaction. - * - * Applies a wrapper which allows access to the transaction. - * - * This should only be used if you fully trust the builder of this object. It should not - * be used by an external signer - instead use the verify function. + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +uint16_t UnsignedChannelUpdate_get_cltv_expiry_delta(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Verify our pre-built transaction. - * - * Applies a wrapper which allows access to the transaction. - * - * An external validating signer must call this method before signing - * or using the built transaction. + * The number of blocks such that if: + * `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` + * then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines + * the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a + * `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, + * then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before + * forwarding. Note that the HTLC sender is the one who originally sets this value when + * constructing the route. */ -MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint); +void UnsignedChannelUpdate_set_cltv_expiry_delta(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint16_t val); /** - * The value to be sent to the holder, or zero if the output will be omitted + * The minimum HTLC size incoming to sender, in milli-satoshi */ -MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The value to be sent to the counterparty, or zero if the output will be omitted + * The minimum HTLC size incoming to sender, in milli-satoshi */ -MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * The destination of the holder's output + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The destination of the counterparty's output + * The maximum HTLC value incoming to sender, in milli-satoshi. + * + * This used to be optional. */ -MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg); +void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); /** - * Frees any resources used by the TrustedClosingTransaction, if is_owned is set and inner is non-NULL. + * The base HTLC fee charged by sender, in milli-satoshi */ -void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj); +uint32_t UnsignedChannelUpdate_get_fee_base_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * The pre-built Bitcoin commitment transaction + * The base HTLC fee charged by sender, in milli-satoshi */ -MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg); +void UnsignedChannelUpdate_set_fee_base_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Get the SIGHASH_ALL sighash value of the transaction. - * - * This can be used to verify a signature. + * The amount to fee multiplier, in micro-satoshi */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis); +uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Sign a transaction, either because we are counter-signing the counterparty's transaction or - * because we are about to broadcast a holder transaction. + * The amount to fee multiplier, in micro-satoshi */ -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); +void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the CommitmentTransaction, if is_owned is set and inner is non-NULL. + * 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. */ -void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj); +struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); /** - * Creates a copy of the CommitmentTransaction + * 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. */ -struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig); +void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Serialize the CommitmentTransaction object into a byte array which can be read by CommitmentTransaction_read + * Constructs a new UnsignedChannelUpdate given each field */ -struct LDKCVec_u8Z CommitmentTransaction_write(const struct LDKCommitmentTransaction *NONNULL_PTR obj); +MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t message_flags_arg, uint8_t channel_flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); /** - * Read a CommitmentTransaction from a byte array, created by CommitmentTransaction_write + * Creates a copy of the UnsignedChannelUpdate */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CommitmentTransaction_read(struct LDKu8slice ser); +struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_clone(const struct LDKUnsignedChannelUpdate *NONNULL_PTR orig); /** - * The backwards-counting commitment number + * Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. */ -MUST_USE_RES uint64_t CommitmentTransaction_commitment_number(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +uint64_t UnsignedChannelUpdate_hash(const struct LDKUnsignedChannelUpdate *NONNULL_PTR o); /** - * The per commitment point used by the broadcaster. + * Checks if two UnsignedChannelUpdates 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. */ -MUST_USE_RES struct LDKPublicKey CommitmentTransaction_per_commitment_point(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +bool UnsignedChannelUpdate_eq(const struct LDKUnsignedChannelUpdate *NONNULL_PTR a, const struct LDKUnsignedChannelUpdate *NONNULL_PTR b); /** - * The value to be sent to the broadcaster + * Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES uint64_t CommitmentTransaction_to_broadcaster_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelUpdate_free(struct LDKChannelUpdate this_obj); /** - * The value to be sent to the counterparty + * A signature of the channel update */ -MUST_USE_RES uint64_t CommitmentTransaction_to_countersignatory_value_sat(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKECDSASignature ChannelUpdate_get_signature(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * The feerate paid per 1000-weight-unit in this commitment transaction. + * A signature of the channel update */ -MUST_USE_RES uint32_t CommitmentTransaction_feerate_per_kw(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +void ChannelUpdate_set_signature(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Trust our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. - * - * This should only be used if you fully trust the builder of this object. It should not - * be used by an external signer - instead use the verify function. + * The actual channel update */ -MUST_USE_RES struct LDKTrustedCommitmentTransaction CommitmentTransaction_trust(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKUnsignedChannelUpdate ChannelUpdate_get_contents(const struct LDKChannelUpdate *NONNULL_PTR this_ptr); /** - * Verify our pre-built transaction and derived transaction creation public keys. - * - * Applies a wrapper which allows access to these fields. - * - * An external validating signer must call this method before signing - * or using the built transaction. + * The actual channel update */ -MUST_USE_RES struct LDKCResult_TrustedCommitmentTransactionNoneZ CommitmentTransaction_verify(const struct LDKCommitmentTransaction *NONNULL_PTR this_arg, const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +void ChannelUpdate_set_contents(struct LDKChannelUpdate *NONNULL_PTR this_ptr, struct LDKUnsignedChannelUpdate val); /** - * Frees any resources used by the TrustedCommitmentTransaction, if is_owned is set and inner is non-NULL. + * Constructs a new ChannelUpdate given each field */ -void TrustedCommitmentTransaction_free(struct LDKTrustedCommitmentTransaction this_obj); +MUST_USE_RES struct LDKChannelUpdate ChannelUpdate_new(struct LDKECDSASignature signature_arg, struct LDKUnsignedChannelUpdate contents_arg); /** - * The transaction ID of the built Bitcoin transaction + * Creates a copy of the ChannelUpdate */ -MUST_USE_RES struct LDKThirtyTwoBytes TrustedCommitmentTransaction_txid(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +struct LDKChannelUpdate ChannelUpdate_clone(const struct LDKChannelUpdate *NONNULL_PTR orig); /** - * The pre-built Bitcoin commitment transaction + * Generates a non-cryptographic 64-bit hash of the ChannelUpdate. */ -MUST_USE_RES struct LDKBuiltCommitmentTransaction TrustedCommitmentTransaction_built_transaction(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +uint64_t ChannelUpdate_hash(const struct LDKChannelUpdate *NONNULL_PTR o); /** - * The pre-calculated transaction creation public keys. + * Checks if two ChannelUpdates 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. */ -MUST_USE_RES struct LDKTxCreationKeys TrustedCommitmentTransaction_keys(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +bool ChannelUpdate_eq(const struct LDKChannelUpdate *NONNULL_PTR a, const struct LDKChannelUpdate *NONNULL_PTR b); /** - * Should anchors be used. + * Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelTypeFeatures TrustedCommitmentTransaction_channel_type_features(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void QueryChannelRange_free(struct LDKQueryChannelRange this_obj); /** - * Get a signature for each HTLC which was included in the commitment transaction (ie for - * which HTLCOutputInCommitment::transaction_output_index.is_some()). - * - * The returned Vec has one entry for each HTLC, and in the same order. - * - * This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All. + * The genesis hash of the blockchain being queried */ -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); +const uint8_t (*QueryChannelRange_get_chain_hash(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr))[32]; /** - * 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. + * The genesis hash of the blockchain being queried */ -MUST_USE_RES struct LDKCOption_usizeZ TrustedCommitmentTransaction_revokeable_output_index(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg); +void QueryChannelRange_set_chain_hash(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * 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. + * The height of the first block for the channel UTXOs being queried */ -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); +uint32_t QueryChannelRange_get_first_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a - * shared secret first. This prevents on-chain observers from discovering how many commitment - * transactions occurred in a channel before it was closed. - * - * This function gets the shared secret from relevant channel public keys and can be used to - * \"decrypt\" the commitment transaction number given a commitment transaction on-chain. + * The height of the first block for the channel UTXOs being queried */ -uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); +void QueryChannelRange_set_first_blocknum(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. + * The number of blocks to include in the query results */ -void ShutdownScript_free(struct LDKShutdownScript this_obj); +uint32_t QueryChannelRange_get_number_of_blocks(const struct LDKQueryChannelRange *NONNULL_PTR this_ptr); /** - * Creates a copy of the ShutdownScript + * The number of blocks to include in the query results */ -struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); +void QueryChannelRange_set_number_of_blocks(struct LDKQueryChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if two ShutdownScripts 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. + * Constructs a new QueryChannelRange given each field */ -bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); +MUST_USE_RES struct LDKQueryChannelRange QueryChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg); /** - * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. + * Creates a copy of the QueryChannelRange */ -void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); +struct LDKQueryChannelRange QueryChannelRange_clone(const struct LDKQueryChannelRange *NONNULL_PTR orig); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * Generates a non-cryptographic 64-bit hash of the QueryChannelRange. */ -struct LDKCVec_u8Z InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); +uint64_t QueryChannelRange_hash(const struct LDKQueryChannelRange *NONNULL_PTR o); /** - * The script that did not meet the requirements from [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + * Checks if two QueryChannelRanges 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. */ -void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); +bool QueryChannelRange_eq(const struct LDKQueryChannelRange *NONNULL_PTR a, const struct LDKQueryChannelRange *NONNULL_PTR b); /** - * Constructs a new InvalidShutdownScript given each field + * Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); +void ReplyChannelRange_free(struct LDKReplyChannelRange this_obj); /** - * Creates a copy of the InvalidShutdownScript + * The genesis hash of the blockchain being queried */ -struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); +const uint8_t (*ReplyChannelRange_get_chain_hash(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr))[32]; /** - * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read + * The genesis hash of the blockchain being queried */ -struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); +void ReplyChannelRange_set_chain_hash(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Read a ShutdownScript from a byte array, created by ShutdownScript_write + * The height of the first block in the range of the reply */ -struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); +uint32_t ReplyChannelRange_get_first_blocknum(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. + * The height of the first block in the range of the reply */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); +void ReplyChannelRange_set_first_blocknum(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a P2WSH script pubkey from the given [`WScriptHash`]. + * The number of blocks included in the range of the reply */ -MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); +uint32_t ReplyChannelRange_get_number_of_blocks(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Generates a witness script pubkey from the given segwit version and program. - * - * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or - * [`ShutdownScript::new_p2wsh`] instead. - * - * # Errors - * - * This function may return an error if `program` is invalid for the segwit `version`. + * The number of blocks included in the range of the reply */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessProgram witness_program); +void ReplyChannelRange_set_number_of_blocks(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, uint32_t val); /** - * Converts the shutdown script into the underlying [`ScriptBuf`]. + * True when this is the final reply for a query */ -MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); +bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * True when this is the final reply for a query */ -MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); +void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); /** - * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. + * The `short_channel_id`s in the channel range * - * Specifically, checks for compliance with feature `option_shutdown_anysegwit`. + * Returns a copy of the field. */ -MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); +struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); /** - * Get the string representation of a ShutdownScript object + * The `short_channel_id`s in the channel range */ -struct LDKStr ShutdownScript_to_str(const struct LDKShutdownScript *NONNULL_PTR o); +void ReplyChannelRange_set_short_channel_ids(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Frees any resources used by the ChannelId, if is_owned is set and inner is non-NULL. + * Constructs a new ReplyChannelRange given each field */ -void ChannelId_free(struct LDKChannelId this_obj); - -const uint8_t (*ChannelId_get_a(const struct LDKChannelId *NONNULL_PTR this_ptr))[32]; - -void ChannelId_set_a(struct LDKChannelId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKReplyChannelRange ReplyChannelRange_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_blocknum_arg, uint32_t number_of_blocks_arg, bool sync_complete_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * Constructs a new ChannelId given each field + * Creates a copy of the ReplyChannelRange */ -MUST_USE_RES struct LDKChannelId ChannelId_new(struct LDKThirtyTwoBytes a_arg); +struct LDKReplyChannelRange ReplyChannelRange_clone(const struct LDKReplyChannelRange *NONNULL_PTR orig); /** - * Creates a copy of the ChannelId + * Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. */ -struct LDKChannelId ChannelId_clone(const struct LDKChannelId *NONNULL_PTR orig); +uint64_t ReplyChannelRange_hash(const struct LDKReplyChannelRange *NONNULL_PTR o); /** - * Checks if two ChannelIds contain equal inner contents. + * Checks if two ReplyChannelRanges 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 ChannelId_eq(const struct LDKChannelId *NONNULL_PTR a, const struct LDKChannelId *NONNULL_PTR b); - -/** - * Generates a non-cryptographic 64-bit hash of the ChannelId. - */ -uint64_t ChannelId_hash(const struct LDKChannelId *NONNULL_PTR o); +bool ReplyChannelRange_eq(const struct LDKReplyChannelRange *NONNULL_PTR a, const struct LDKReplyChannelRange *NONNULL_PTR b); /** - * Create _v1_ channel ID based on a funding TX ID and output index + * Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_txid(const uint8_t (*txid)[32], uint16_t output_index); +void QueryShortChannelIds_free(struct LDKQueryShortChannelIds this_obj); /** - * Create _v1_ channel ID from a funding tx outpoint + * The genesis hash of the blockchain being queried */ -MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_outpoint(struct LDKOutPoint outpoint); +const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr))[32]; /** - * Create a _temporary_ channel ID randomly, based on an entropy source. + * The genesis hash of the blockchain being queried */ -MUST_USE_RES struct LDKChannelId ChannelId_temporary_from_entropy_source(const struct LDKEntropySource *NONNULL_PTR entropy_source); +void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Generic constructor; create a new channel ID from the provided data. - * Use a more specific `*_from_*` constructor when possible. + * The short_channel_ids that are being queried + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKChannelId ChannelId_from_bytes(struct LDKThirtyTwoBytes data); +struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); /** - * Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder). + * The short_channel_ids that are being queried */ -MUST_USE_RES struct LDKChannelId ChannelId_new_zero(void); +void QueryShortChannelIds_set_short_channel_ids(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Check whether ID is consisting of all zeros (uninitialized) + * Constructs a new QueryShortChannelIds given each field */ -MUST_USE_RES bool ChannelId_is_zero(const struct LDKChannelId *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQueryShortChannelIds QueryShortChannelIds_new(struct LDKThirtyTwoBytes chain_hash_arg, struct LDKCVec_u64Z short_channel_ids_arg); /** - * Create _v2_ channel ID by concatenating the holder revocation basepoint with the counterparty - * revocation basepoint and hashing the result. The basepoints will be concatenated in increasing - * sorted order. + * Creates a copy of the QueryShortChannelIds */ -MUST_USE_RES struct LDKChannelId ChannelId_v2_from_revocation_basepoints(const struct LDKRevocationBasepoint *NONNULL_PTR ours, const struct LDKRevocationBasepoint *NONNULL_PTR theirs); +struct LDKQueryShortChannelIds QueryShortChannelIds_clone(const struct LDKQueryShortChannelIds *NONNULL_PTR orig); /** - * Create temporary _v2_ channel ID by concatenating a zeroed out basepoint with the holder - * revocation basepoint and hashing the result. + * Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. */ -MUST_USE_RES struct LDKChannelId ChannelId_temporary_v2_from_revocation_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR our_revocation_basepoint); +uint64_t QueryShortChannelIds_hash(const struct LDKQueryShortChannelIds *NONNULL_PTR o); /** - * Serialize the ChannelId object into a byte array which can be read by ChannelId_read + * Checks if two QueryShortChannelIdss 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. */ -struct LDKCVec_u8Z ChannelId_write(const struct LDKChannelId *NONNULL_PTR obj); +bool QueryShortChannelIds_eq(const struct LDKQueryShortChannelIds *NONNULL_PTR a, const struct LDKQueryShortChannelIds *NONNULL_PTR b); /** - * Read a ChannelId from a byte array, created by ChannelId_write + * Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelIdDecodeErrorZ ChannelId_read(struct LDKu8slice ser); +void ReplyShortChannelIdsEnd_free(struct LDKReplyShortChannelIdsEnd this_obj); /** - * 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. - * - * `phantom_route_hints` parameter: - * * Contains channel info for all nodes participating in the phantom invoice - * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each - * participating node - * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is - * updated when a channel becomes disabled or closes - * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice - * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared - * down - * - * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference - * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). - * If `None` is provided for `payment_hash`, then one will be created. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * `duration_since_epoch` is the current time since epoch in seconds. - * - * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to - * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3. - * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block - * confirmations during routing. - * - * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom - * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this - * requirement). - * - * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager - * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash - * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels - * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA - * - *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. + * The genesis hash of the blockchain that was queried */ -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); +const uint8_t (*ReplyShortChannelIdsEnd_get_chain_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr))[32]; /** - * 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. - * - * `phantom_route_hints` parameter: - * * Contains channel info for all nodes participating in the phantom invoice - * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each - * participating node - * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is - * updated when a channel becomes disabled or closes - * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum - * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected - * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node - * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as - * desired, but note that some nodes will be trimmed if more than 3 nodes are provided. - * - * `description_hash` is a SHA-256 hash of the description text - * - * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference - * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). - * If `None` is provided for `payment_hash`, then one will be created. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * `duration_since_epoch` is the current time since epoch in seconds. - * - * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom - * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this - * requirement). - * - * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager - * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints - * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment - * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash - * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels - * - *This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. + * The genesis hash of the blockchain that was queried */ -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); +void ReplyShortChannelIdsEnd_set_chain_hash(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility to construct an invoice. Generally, unless you want to do something like a custom - * cltv_expiry, this is what you should be using to create an invoice. The reason being, this - * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user - * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify - * that the payment secret is valid when the invoice is paid. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to - * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. - * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block - * confirmations during routing. - * - * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +bool ReplyShortChannelIdsEnd_get_full_information(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr); /** - * Utility to construct an invoice. Generally, unless you want to do something like a custom - * cltv_expiry, this is what you should be using to create an invoice. The reason being, this - * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user - * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify - * that the payment secret is valid when the invoice is paid. - * Use this variant if you want to pass the `description_hash` to the invoice. - * - * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for - * in excess of the current time. - * - * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to - * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. - * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block - * confirmations during routing. - * - * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + * Indicates if the query recipient maintains up-to-date channel + * information for the `chain_hash` */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +void ReplyShortChannelIdsEnd_set_full_information(struct LDKReplyShortChannelIdsEnd *NONNULL_PTR this_ptr, bool val); /** - * See [`create_invoice_from_channelmanager`]. - * - * This version allows for providing custom [`PaymentHash`] and description hash for the invoice. - * - * This may be useful if you're building an on-chain swap or involving another protocol where - * the payment hash is also involved outside the scope of lightning and want to set the - * description hash. + * Constructs a new ReplyShortChannelIdsEnd given each field */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +MUST_USE_RES struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_new(struct LDKThirtyTwoBytes chain_hash_arg, bool full_information_arg); /** - * See [`create_invoice_from_channelmanager`]. - * - * This version allows for providing a custom [`PaymentHash`] for the invoice. - * This may be useful if you're building an on-chain swap or involving another protocol where - * the payment hash is also involved outside the scope of lightning. + * Creates a copy of the ReplyShortChannelIdsEnd */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKReplyShortChannelIdsEnd ReplyShortChannelIdsEnd_clone(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR orig); /** - * Builds the necessary parameters to pay or pre-flight probe the given variable-amount - * (also known as 'zero-amount') [`Bolt11Invoice`] using - * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. - * - * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the - * same [`PaymentHash`] has never been paid before. - * - * Will always succeed unless the invoice has an amount specified, in which case - * [`payment_parameters_from_invoice`] should be used. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes + * Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_variable_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat); +uint64_t ReplyShortChannelIdsEnd_hash(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR o); /** - * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using - * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. - * - * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the - * same [`PaymentHash`] has never been paid before. - * - * Will always succeed unless the invoice has no amount specified, in which case - * [`payment_parameters_from_variable_amount_invoice`] should be used. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes + * Checks if two ReplyShortChannelIdsEnds 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. */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice); +bool ReplyShortChannelIdsEnd_eq(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR a, const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR b); /** - * Frees any resources used by the Retry + * Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. */ -void Retry_free(struct LDKRetry this_ptr); +void GossipTimestampFilter_free(struct LDKGossipTimestampFilter this_obj); /** - * Creates a copy of the Retry + * The genesis hash of the blockchain for channel and node information */ -struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); +const uint8_t (*GossipTimestampFilter_get_chain_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr))[32]; /** - * Utility method to constructs a new Attempts-variant Retry + * The genesis hash of the blockchain for channel and node information */ -struct LDKRetry Retry_attempts(uint32_t a); +void GossipTimestampFilter_set_chain_hash(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new Timeout-variant Retry + * The starting unix timestamp */ -struct LDKRetry Retry_timeout(uint64_t a); +uint32_t GossipTimestampFilter_get_first_timestamp(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * Checks if two Retrys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The starting unix timestamp */ -bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); +void GossipTimestampFilter_set_first_timestamp(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * Generates a non-cryptographic 64-bit hash of the Retry. + * The range of information in seconds */ -uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); +uint32_t GossipTimestampFilter_get_timestamp_range(const struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr); /** - * Serialize the Retry object into a byte array which can be read by Retry_read + * The range of information in seconds */ -struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); +void GossipTimestampFilter_set_timestamp_range(struct LDKGossipTimestampFilter *NONNULL_PTR this_ptr, uint32_t val); /** - * Read a Retry from a byte array, created by Retry_write + * Constructs a new GossipTimestampFilter given each field */ -struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKGossipTimestampFilter GossipTimestampFilter_new(struct LDKThirtyTwoBytes chain_hash_arg, uint32_t first_timestamp_arg, uint32_t timestamp_range_arg); /** - * Creates a copy of the RetryableSendFailure + * Creates a copy of the GossipTimestampFilter */ -enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); +struct LDKGossipTimestampFilter GossipTimestampFilter_clone(const struct LDKGossipTimestampFilter *NONNULL_PTR orig); /** - * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure + * Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. */ -enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); +uint64_t GossipTimestampFilter_hash(const struct LDKGossipTimestampFilter *NONNULL_PTR o); /** - * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure + * Checks if two GossipTimestampFilters 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. */ -enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); +bool GossipTimestampFilter_eq(const struct LDKGossipTimestampFilter *NONNULL_PTR a, const struct LDKGossipTimestampFilter *NONNULL_PTR b); /** - * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure + * Frees any resources used by the ErrorAction */ -enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); +void ErrorAction_free(struct LDKErrorAction this_ptr); /** - * Utility method to constructs a new OnionPacketSizeExceeded-variant RetryableSendFailure + * Creates a copy of the ErrorAction */ -enum LDKRetryableSendFailure RetryableSendFailure_onion_packet_size_exceeded(void); +struct LDKErrorAction ErrorAction_clone(const struct LDKErrorAction *NONNULL_PTR orig); /** - * Checks if two RetryableSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new DisconnectPeer-variant ErrorAction */ -bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b); +struct LDKErrorAction ErrorAction_disconnect_peer(struct LDKErrorMessage msg); /** - * Frees any resources used by the Bolt12PaymentError + * Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction */ -void Bolt12PaymentError_free(struct LDKBolt12PaymentError this_ptr); +struct LDKErrorAction ErrorAction_disconnect_peer_with_warning(struct LDKWarningMessage msg); /** - * Creates a copy of the Bolt12PaymentError + * Utility method to constructs a new IgnoreError-variant ErrorAction */ -struct LDKBolt12PaymentError Bolt12PaymentError_clone(const struct LDKBolt12PaymentError *NONNULL_PTR orig); +struct LDKErrorAction ErrorAction_ignore_error(void); /** - * Utility method to constructs a new UnexpectedInvoice-variant Bolt12PaymentError + * Utility method to constructs a new IgnoreAndLog-variant ErrorAction */ -struct LDKBolt12PaymentError Bolt12PaymentError_unexpected_invoice(void); +struct LDKErrorAction ErrorAction_ignore_and_log(enum LDKLevel a); /** - * Utility method to constructs a new DuplicateInvoice-variant Bolt12PaymentError + * Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction */ -struct LDKBolt12PaymentError Bolt12PaymentError_duplicate_invoice(void); +struct LDKErrorAction ErrorAction_ignore_duplicate_gossip(void); /** - * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12PaymentError + * Utility method to constructs a new SendErrorMessage-variant ErrorAction */ -struct LDKBolt12PaymentError Bolt12PaymentError_unknown_required_features(void); +struct LDKErrorAction ErrorAction_send_error_message(struct LDKErrorMessage msg); /** - * Utility method to constructs a new SendingFailed-variant Bolt12PaymentError + * Utility method to constructs a new SendWarningMessage-variant ErrorAction */ -struct LDKBolt12PaymentError Bolt12PaymentError_sending_failed(enum LDKRetryableSendFailure a); +struct LDKErrorAction ErrorAction_send_warning_message(struct LDKWarningMessage msg, enum LDKLevel log_level); /** - * Checks if two Bolt12PaymentErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Generates a non-cryptographic 64-bit hash of the ErrorAction. */ -bool Bolt12PaymentError_eq(const struct LDKBolt12PaymentError *NONNULL_PTR a, const struct LDKBolt12PaymentError *NONNULL_PTR b); +uint64_t ErrorAction_hash(const struct LDKErrorAction *NONNULL_PTR o); /** - * Frees any resources used by the ProbeSendFailure + * Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. */ -void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); +void LightningError_free(struct LDKLightningError this_obj); /** - * Creates a copy of the ProbeSendFailure + * A human-readable message describing the error */ -struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); +struct LDKStr LightningError_get_err(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure + * A human-readable message describing the error */ -struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); +void LightningError_set_err(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Utility method to constructs a new ParameterError-variant ProbeSendFailure + * The action which should be taken against the offending peer. */ -struct LDKProbeSendFailure ProbeSendFailure_parameter_error(struct LDKAPIError a); +struct LDKErrorAction LightningError_get_action(const struct LDKLightningError *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DuplicateProbe-variant ProbeSendFailure + * The action which should be taken against the offending peer. */ -struct LDKProbeSendFailure ProbeSendFailure_duplicate_probe(void); +void LightningError_set_action(struct LDKLightningError *NONNULL_PTR this_ptr, struct LDKErrorAction val); /** - * Checks if two ProbeSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Constructs a new LightningError given each field */ -bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); +MUST_USE_RES struct LDKLightningError LightningError_new(struct LDKStr err_arg, struct LDKErrorAction action_arg); /** - * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. + * Creates a copy of the LightningError */ -void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); +struct LDKLightningError LightningError_clone(const struct LDKLightningError *NONNULL_PTR orig); /** - * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat - * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to - * authenticate the sender to the recipient and prevent payment-probing (deanonymization) - * attacks. - * - * If you do not have one, the [`Route`] you pay over must not contain multiple paths as - * multi-path payments require a recipient-provided secret. - * - * Some implementations may reject spontaneous payments with payment secrets, so you may only - * want to provide a secret for a spontaneous payment if MPP is needed and you know your - * recipient will not reject it. + * Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. */ -struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj); /** - * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat - * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to - * authenticate the sender to the recipient and prevent payment-probing (deanonymization) - * attacks. - * - * If you do not have one, the [`Route`] you pay over must not contain multiple paths as - * multi-path payments require a recipient-provided secret. - * - * Some implementations may reject spontaneous payments with payment secrets, so you may only - * want to provide a secret for a spontaneous payment if MPP is needed and you know your - * recipient will not reject it. + * `update_add_htlc` messages which should be sent */ -void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of - * arbitrary length. This gives recipients substantially more flexibility to receive - * additional data. - * - * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication - * scheme to authenticate received payments against expected payments and invoices, this field - * is not used in LDK for received payments, and can be used to store arbitrary data in - * invoices which will be received with the payment. - * - * Note that this field was added to the lightning specification more recently than - * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata - * may not be supported as universally. - * - * Returns a copy of the field. + * `update_add_htlc` messages which should be sent */ -struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); +void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val); /** - * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of - * arbitrary length. This gives recipients substantially more flexibility to receive - * additional data. - * - * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication - * scheme to authenticate received payments against expected payments and invoices, this field - * is not used in LDK for received payments, and can be used to store arbitrary data in - * invoices which will be received with the payment. - * - * Note that this field was added to the lightning specification more recently than - * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata - * may not be supported as universally. + * `update_fulfill_htlc` messages which should be sent */ -void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Creates a copy of the RecipientOnionFields + * `update_fulfill_htlc` messages which should be sent */ -struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig); +void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val); /** - * Checks if two RecipientOnionFieldss 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. + * `update_fail_htlc` messages which should be sent */ -bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b); +struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read + * `update_fail_htlc` messages which should be sent */ -struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj); +void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val); /** - * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write + * `update_fail_malformed_htlc` messages which should be sent */ -struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser); +struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common - * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`] - * but do not require or provide any further data. + * `update_fail_malformed_htlc` messages which should be sent */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret); +void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val); /** - * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create - * payable HTLCs except for single-path spontaneous payments, i.e. this should generally - * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending - * a spontaneous MPP this will not work as all MPP require payment secrets; you may - * instead want to use [`RecipientOnionFields::secret_only`]. + * An `update_fee` message which should be sent * - * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment - * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); +struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * 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. + * An `update_fee` message which should be sent * - * See [`Self::custom_tlvs`] for more info. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); +void CommitmentUpdate_set_update_fee(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKUpdateFee val); /** - * 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`]. + * `commitment_signed` messages which should be sent */ -MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); +struct LDKCVec_CommitmentSignedZ CommitmentUpdate_get_commitment_signed(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * `commitment_signed` messages which should be sent */ -void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); +void CommitmentUpdate_set_commitment_signed(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_CommitmentSignedZ val); /** - * Creates a copy of a Type + * 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 */ -struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); +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 LDKCVec_CommitmentSignedZ commitment_signed_arg); /** - * Calls the free function if one is set + * Creates a copy of the CommitmentUpdate */ -void Type_free(struct LDKType this_ptr); +struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig); /** - * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read + * Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. */ -struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); +uint64_t CommitmentUpdate_hash(const struct LDKCommitmentUpdate *NONNULL_PTR o); /** - * Read a InitFeatures from a byte array, created by InitFeatures_write + * Checks if two CommitmentUpdates 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. */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); +bool CommitmentUpdate_eq(const struct LDKCommitmentUpdate *NONNULL_PTR a, const struct LDKCommitmentUpdate *NONNULL_PTR b); /** - * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read + * Frees any resources used by the MessageSendEvent */ -struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); +void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); /** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + * Creates a copy of the MessageSendEvent */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); /** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); /** - * Read a NodeFeatures from a byte array, created by NodeFeatures_write + * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent */ -struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg); /** - * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read + * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent */ -struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); /** - * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write + * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg); /** - * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read + * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent */ -struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); /** - * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write + * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); /** - * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read + * Utility method to constructs a new SendStfu-variant MessageSendEvent */ -struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_stfu(struct LDKPublicKey node_id, struct LDKStfu msg); /** - * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write + * Utility method to constructs a new SendSpliceInit-variant MessageSendEvent */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_splice_init(struct LDKPublicKey node_id, struct LDKSpliceInit msg); /** - * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + * Utility method to constructs a new SendSpliceAck-variant MessageSendEvent */ -struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_splice_ack(struct LDKPublicKey node_id, struct LDKSpliceAck msg); /** - * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + * Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_splice_locked(struct LDKPublicKey node_id, struct LDKSpliceLocked msg); /** - * Frees any resources used by the OfferId, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent */ -void OfferId_free(struct LDKOfferId this_obj); - -const uint8_t (*OfferId_get_a(const struct LDKOfferId *NONNULL_PTR this_ptr))[32]; - -void OfferId_set_a(struct LDKOfferId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg); /** - * Constructs a new OfferId given each field + * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent */ -MUST_USE_RES struct LDKOfferId OfferId_new(struct LDKThirtyTwoBytes a_arg); +struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg); /** - * Creates a copy of the OfferId + * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent */ -struct LDKOfferId OfferId_clone(const struct LDKOfferId *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg); /** - * Checks if two OfferIds 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. + * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent */ -bool OfferId_eq(const struct LDKOfferId *NONNULL_PTR a, const struct LDKOfferId *NONNULL_PTR b); +struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg); /** - * Serialize the OfferId object into a byte array which can be read by OfferId_read + * Utility method to constructs a new SendTxComplete-variant MessageSendEvent */ -struct LDKCVec_u8Z OfferId_write(const struct LDKOfferId *NONNULL_PTR obj); +struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg); /** - * Read a OfferId from a byte array, created by OfferId_write + * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent */ -struct LDKCResult_OfferIdDecodeErrorZ OfferId_read(struct LDKu8slice ser); +struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg); /** - * Frees any resources used by the OfferWithExplicitMetadataBuilder, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent */ -void OfferWithExplicitMetadataBuilder_free(struct LDKOfferWithExplicitMetadataBuilder this_obj); +struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg); /** - * Creates a copy of the OfferWithExplicitMetadataBuilder + * Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent */ -struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_clone(const struct LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg); /** - * Frees any resources used by the OfferWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendTxAbort-variant MessageSendEvent */ -void OfferWithDerivedMetadataBuilder_free(struct LDKOfferWithDerivedMetadataBuilder this_obj); +struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); /** - * Creates a copy of the OfferWithDerivedMetadataBuilder + * Utility method to constructs a new SendChannelReady-variant MessageSendEvent */ -struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_clone(const struct LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR orig); +struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); /** - * Creates a new builder for an offer using the `signing_pubkey` for signing invoices. The - * associated secret key must be remembered while the offer is valid. - * - * Use a different pubkey per offer to avoid correlating offers. - * - * # Note - * - * If constructing an [`Offer`] for use with a [`ChannelManager`], use - * [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder + * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent */ -MUST_USE_RES struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_new(struct LDKPublicKey signing_pubkey); +struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); /** - * Sets the [`Offer::metadata`] to the given bytes. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_metadata(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKCVec_u8Z metadata); +struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKChannelId channel_id, struct LDKCommitmentUpdate updates); /** - * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, - * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. - * - * See [`Offer::chains`] on how this relates to the payment currency. - * - * Successive calls to this method will add another chain hash. + * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_chain(struct LDKOfferWithExplicitMetadataBuilder this_arg, enum LDKNetwork network); +struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); /** - * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_amount_msats(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t amount_msats); +struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); /** - * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. - *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendClosingComplete-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_absolute_expiry(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t absolute_expiry); +struct LDKMessageSendEvent MessageSendEvent_send_closing_complete(struct LDKPublicKey node_id, struct LDKClosingComplete msg); /** - * Sets the [`Offer::description`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendClosingSig-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_description(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr description); +struct LDKMessageSendEvent MessageSendEvent_send_closing_sig(struct LDKPublicKey node_id, struct LDKClosingSig msg); /** - * Sets the [`Offer::issuer`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendShutdown-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_issuer(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr issuer); +struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); /** - * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by - * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. - * - * Successive calls to this method will add another blinded path. Caller is responsible for not - * adding duplicate paths. + * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_path(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKBlindedMessagePath path); +struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); /** - * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to - * [`Quantity::One`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent */ -MUST_USE_RES void OfferWithExplicitMetadataBuilder_supported_quantity(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKQuantity quantity); +struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * Builds an [`Offer`] from the builder's settings. + * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent */ -MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_build(struct LDKOfferWithExplicitMetadataBuilder this_arg); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing - * pubkey is derived from the given [`ExpandedKey`] and [`Nonce`]. This provides recipient - * privacy by using a different signing pubkey for each offer. Otherwise, the provided - * `node_id` is used for [`Offer::issuer_signing_pubkey`]. - * - * Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by - * [`InvoiceRequest::verify_using_metadata`] to determine if the request was produced for the - * offer given an [`ExpandedKey`]. However, if [`OfferBuilder::path`] is called, then the - * metadata will not be set and must be included in each [`BlindedMessagePath`] instead. In this case, - * use [`InvoiceRequest::verify_using_recipient_data`]. - * - * [`InvoiceRequest::verify_using_metadata`]: crate::offers::invoice_request::InvoiceRequest::verify_using_metadata - * [`InvoiceRequest::verify_using_recipient_data`]: crate::offers::invoice_request::InvoiceRequest::verify_using_recipient_data - * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey + * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent */ -MUST_USE_RES struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); /** - * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, - * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. - * - * See [`Offer::chains`] on how this relates to the payment currency. - * - * Successive calls to this method will add another chain hash. + * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_chain(struct LDKOfferWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); +struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); /** - * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_amount_msats(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t amount_msats); +struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); /** - * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. - *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new HandleError-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_absolute_expiry(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); +struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); /** - * Sets the [`Offer::description`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_description(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr description); +struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); /** - * Sets the [`Offer::issuer`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_issuer(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); +struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); /** - * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by - * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. - * - * Successive calls to this method will add another blinded path. Caller is responsible for not - * adding duplicate paths. + * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_path(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); +struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); /** - * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to - * [`Quantity::One`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent */ -MUST_USE_RES void OfferWithDerivedMetadataBuilder_supported_quantity(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKQuantity quantity); +struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); /** - * Builds an [`Offer`] from the builder's settings. + * Utility method to constructs a new SendPeerStorage-variant MessageSendEvent */ -MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithDerivedMetadataBuilder_build(struct LDKOfferWithDerivedMetadataBuilder this_arg); +struct LDKMessageSendEvent MessageSendEvent_send_peer_storage(struct LDKPublicKey node_id, struct LDKPeerStorage msg); /** - * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new SendPeerStorageRetrieval-variant MessageSendEvent */ -void Offer_free(struct LDKOffer this_obj); +struct LDKMessageSendEvent MessageSendEvent_send_peer_storage_retrieval(struct LDKPublicKey node_id, struct LDKPeerStorageRetrieval msg); /** - * Creates a copy of the Offer + * Calls the free function if one is set */ -struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); +void BaseMessageHandler_free(struct LDKBaseMessageHandler this_ptr); /** - * 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. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); +void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); /** - * 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`. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); +void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); /** - * The minimum amount required for a successful payment of a single item. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCOption_AmountZ Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); +void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); /** - * 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. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Calls the free function if one is set */ -MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); +void SendOnlyMessageHandler_free(struct LDKSendOnlyMessageHandler this_ptr); /** - * Features pertaining to the offer. + * Frees any resources used by the FinalOnionHopData, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); +void FinalOnionHopData_free(struct LDKFinalOnionHopData this_obj); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. */ -MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); +const uint8_t (*FinalOnionHopData_get_payment_secret(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr))[32]; /** - * 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 + * When sending a multi-part payment, this secret is used to identify a payment across HTLCs. + * Because it is generated by the recipient and included in the invoice, it also provides + * proof to the recipient that the payment was sent by someone with the generated invoice. */ -MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); +void FinalOnionHopData_set_payment_secret(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); +uint64_t FinalOnionHopData_get_total_msat(const struct LDKFinalOnionHopData *NONNULL_PTR this_ptr); /** - * The quantity of items supported. + * The intended total amount that this payment is for. + * + * Message serialization may panic if this value is more than 21 million Bitcoin. */ -MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +void FinalOnionHopData_set_total_msat(struct LDKFinalOnionHopData *NONNULL_PTR this_ptr, uint64_t val); /** - * The public key corresponding to the key used by the recipient to sign invoices. - * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for - * sending an [`InvoiceRequest`]. - * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. - * - If `None`, the signing pubkey will be the final blinded node id from the - * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. - * - * See also [`Bolt12Invoice::signing_pubkey`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new FinalOnionHopData given each field */ -MUST_USE_RES struct LDKPublicKey Offer_issuer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyTwoBytes payment_secret_arg, uint64_t total_msat_arg); /** - * Returns the id of the offer. + * Creates a copy of the FinalOnionHopData */ -MUST_USE_RES struct LDKOfferId Offer_id(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig); /** - * Returns whether the given chain is supported by the offer. + * Checks if two FinalOnionHopDatas 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. */ -MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); +bool FinalOnionHopData_eq(const struct LDKFinalOnionHopData *NONNULL_PTR a, const struct LDKFinalOnionHopData *NONNULL_PTR b); /** - * Whether the offer has expired. + * Frees any resources used by the OnionPacket, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); +void OnionPacket_free(struct LDKOnionPacket this_obj); /** - * Whether the offer has expired given the duration since the Unix epoch. + * BOLT 4 version number. */ -MUST_USE_RES bool Offer_is_expired_no_std(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t duration_since_epoch); +uint8_t OnionPacket_get_version(const struct LDKOnionPacket *NONNULL_PTR this_ptr); /** - * Returns whether the given quantity is valid for the offer. + * BOLT 4 version number. */ -MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); +void OnionPacket_set_version(struct LDKOnionPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * Returns a copy of the field. */ -MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); +struct LDKCResult_PublicKeySecp256k1ErrorZ OnionPacket_get_public_key(const struct LDKOnionPacket *NONNULL_PTR this_ptr); /** - * Creates an [`InvoiceRequestBuilder`] for the offer, which - * - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used - * for each request in order to protect the sender's privacy, - * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is - * called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine - * if the invoice was requested using a base [`ExpandedKey`] from which the payer id was - * derived, and - * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can - * be used when sending the payment for the requested invoice. - * - * Errors if the offer contains unknown required features. - * - * [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey - * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata - * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata - * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey + * In order to ensure we always return an error on onion decode in compliance with [BOLT + * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to + * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral + * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd + * like. */ -MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); +void OnionPacket_set_public_key(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKCResult_PublicKeySecp256k1ErrorZ val); /** - * Generates a non-cryptographic 64-bit hash of the Offer. + * HMAC to verify the integrity of hop_data. */ -uint64_t Offer_hash(const struct LDKOffer *NONNULL_PTR o); +const uint8_t (*OnionPacket_get_hmac(const struct LDKOnionPacket *NONNULL_PTR this_ptr))[32]; /** - * Read a Offer from a byte array, created by Offer_write + * HMAC to verify the integrity of hop_data. */ -struct LDKCResult_OfferDecodeErrorZ Offer_read(struct LDKu8slice ser); +void OnionPacket_set_hmac(struct LDKOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the Offer object into a byte array which can be read by Offer_read + * Creates a copy of the OnionPacket */ -struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); +struct LDKOnionPacket OnionPacket_clone(const struct LDKOnionPacket *NONNULL_PTR orig); /** - * Frees any resources used by the Amount + * Generates a non-cryptographic 64-bit hash of the OnionPacket. */ -void Amount_free(struct LDKAmount this_ptr); +uint64_t OnionPacket_hash(const struct LDKOnionPacket *NONNULL_PTR o); /** - * Creates a copy of the Amount + * Checks if two OnionPackets 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. */ -struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); +bool OnionPacket_eq(const struct LDKOnionPacket *NONNULL_PTR a, const struct LDKOnionPacket *NONNULL_PTR b); /** - * Utility method to constructs a new Bitcoin-variant Amount + * Frees any resources used by the TrampolineOnionPacket, if is_owned is set and inner is non-NULL. */ -struct LDKAmount Amount_bitcoin(uint64_t amount_msats); +void TrampolineOnionPacket_free(struct LDKTrampolineOnionPacket this_obj); /** - * Utility method to constructs a new Currency-variant Amount + * Bolt 04 version number */ -struct LDKAmount Amount_currency(struct LDKThreeBytes iso4217_code, uint64_t amount); +uint8_t TrampolineOnionPacket_get_version(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Quantity + * Bolt 04 version number */ -void Quantity_free(struct LDKQuantity this_ptr); +void TrampolineOnionPacket_set_version(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, uint8_t val); /** - * Creates a copy of the Quantity + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); +struct LDKPublicKey TrampolineOnionPacket_get_public_key(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new Bounded-variant Quantity + * A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data */ -struct LDKQuantity Quantity_bounded(uint64_t a); +void TrampolineOnionPacket_set_public_key(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new Unbounded-variant Quantity + * Encrypted payload for the next hop + * + * Returns a copy of the field. */ -struct LDKQuantity Quantity_unbounded(void); +struct LDKCVec_u8Z TrampolineOnionPacket_get_hop_data(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new One-variant Quantity + * Encrypted payload for the next hop */ -struct LDKQuantity Quantity_one(void); +void TrampolineOnionPacket_set_hop_data(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Read a Offer object from a string + * HMAC to verify the integrity of hop_data */ -struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); +const uint8_t (*TrampolineOnionPacket_get_hmac(const struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr))[32]; /** - * Get the string representation of a Offer object + * HMAC to verify the integrity of hop_data */ -struct LDKStr Offer_to_str(const struct LDKOffer *NONNULL_PTR o); +void TrampolineOnionPacket_set_hmac(struct LDKTrampolineOnionPacket *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Frees any resources used by the InvoiceWithExplicitSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. + * Constructs a new TrampolineOnionPacket given each field */ -void InvoiceWithExplicitSigningPubkeyBuilder_free(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj); +MUST_USE_RES struct LDKTrampolineOnionPacket TrampolineOnionPacket_new(uint8_t version_arg, struct LDKPublicKey public_key_arg, struct LDKCVec_u8Z hop_data_arg, struct LDKThirtyTwoBytes hmac_arg); /** - * Frees any resources used by the InvoiceWithDerivedSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. + * Creates a copy of the TrampolineOnionPacket */ -void InvoiceWithDerivedSigningPubkeyBuilder_free(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj); +struct LDKTrampolineOnionPacket TrampolineOnionPacket_clone(const struct LDKTrampolineOnionPacket *NONNULL_PTR orig); /** - * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. + * Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket. */ -MUST_USE_RES struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ InvoiceWithExplicitSigningPubkeyBuilder_build(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); +uint64_t TrampolineOnionPacket_hash(const struct LDKTrampolineOnionPacket *NONNULL_PTR o); /** - *Sets the [`Bolt12Invoice::relative_expiry`] - *as seconds since [`Bolt12Invoice::created_at`]. - *Any expiry that has already passed is valid and can be checked for using - *[`Bolt12Invoice::is_expired`]. - * - * Successive calls to this method will override the previous setting. + * Checks if two TrampolineOnionPackets 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. */ -MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); +bool TrampolineOnionPacket_eq(const struct LDKTrampolineOnionPacket *NONNULL_PTR a, const struct LDKTrampolineOnionPacket *NONNULL_PTR b); /** - *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. + * Serialize the TrampolineOnionPacket object into a byte array which can be read by TrampolineOnionPacket_read */ -MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); +struct LDKCVec_u8Z TrampolineOnionPacket_write(const struct LDKTrampolineOnionPacket *NONNULL_PTR obj); /** - *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. + * Read a TrampolineOnionPacket from a byte array, created by TrampolineOnionPacket_write */ -MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); +struct LDKCResult_TrampolineOnionPacketDecodeErrorZ TrampolineOnionPacket_read(struct LDKu8slice ser); /** - *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. + * Get the string representation of a DecodeError object */ -MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); +struct LDKStr DecodeError_to_str(const struct LDKDecodeError *NONNULL_PTR o); /** - *Sets [`Bolt12Invoice::invoice_features`] - *to indicate MPP may be used. Otherwise, MPP is disallowed. + * Build a DecodeError from a IOError */ -MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); +struct LDKDecodeError DecodeError_from_IOError(enum LDKIOError f); /** - * Builds a signed [`Bolt12Invoice`] after checking for valid semantics. + * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ -MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); +struct LDKCVec_u8Z AcceptChannel_write(const struct LDKAcceptChannel *NONNULL_PTR obj); /** - *Sets the [`Bolt12Invoice::relative_expiry`] - *as seconds since [`Bolt12Invoice::created_at`]. - *Any expiry that has already passed is valid and can be checked for using - *[`Bolt12Invoice::is_expired`]. - * - * Successive calls to this method will override the previous setting. + * Read a AcceptChannel from a byte array, created by AcceptChannel_write */ -MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); +struct LDKCResult_AcceptChannelDecodeErrorZ AcceptChannel_read(struct LDKu8slice ser); /** - *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. + * Serialize the AcceptChannelV2 object into a byte array which can be read by AcceptChannelV2_read */ -MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); +struct LDKCVec_u8Z AcceptChannelV2_write(const struct LDKAcceptChannelV2 *NONNULL_PTR obj); /** - *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. + * Read a AcceptChannelV2 from a byte array, created by AcceptChannelV2_write */ -MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); +struct LDKCResult_AcceptChannelV2DecodeErrorZ AcceptChannelV2_read(struct LDKu8slice ser); /** - *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. - * - * Successive calls to this method will add another address. Caller is responsible for not - * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. + * Serialize the Stfu object into a byte array which can be read by Stfu_read */ -MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); +struct LDKCVec_u8Z Stfu_write(const struct LDKStfu *NONNULL_PTR obj); /** - *Sets [`Bolt12Invoice::invoice_features`] - *to indicate MPP may be used. Otherwise, MPP is disallowed. + * Read a Stfu from a byte array, created by Stfu_write */ -MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); +struct LDKCResult_StfuDecodeErrorZ Stfu_read(struct LDKu8slice ser); /** - * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. + * Serialize the SpliceInit object into a byte array which can be read by SpliceInit_read */ -void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); +struct LDKCVec_u8Z SpliceInit_write(const struct LDKSpliceInit *NONNULL_PTR obj); /** - * Creates a copy of the UnsignedBolt12Invoice + * Read a SpliceInit from a byte array, created by SpliceInit_write */ -struct LDKUnsignedBolt12Invoice UnsignedBolt12Invoice_clone(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR orig); +struct LDKCResult_SpliceInitDecodeErrorZ SpliceInit_read(struct LDKu8slice ser); /** - * Calls the free function if one is set + * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read */ -void SignBolt12InvoiceFn_free(struct LDKSignBolt12InvoiceFn this_ptr); +struct LDKCVec_u8Z SpliceAck_write(const struct LDKSpliceAck *NONNULL_PTR obj); /** - * Returns the [`TaggedHash`] of the invoice to sign. + * Read a SpliceAck from a byte array, created by SpliceAck_write */ -MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_SpliceAckDecodeErrorZ SpliceAck_read(struct LDKu8slice ser); /** - * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. + * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read */ -void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); +struct LDKCVec_u8Z SpliceLocked_write(const struct LDKSpliceLocked *NONNULL_PTR obj); /** - * Creates a copy of the Bolt12Invoice + * Read a SpliceLocked from a byte array, created by SpliceLocked_write */ -struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); +struct LDKCResult_SpliceLockedDecodeErrorZ SpliceLocked_read(struct LDKu8slice ser); /** - * Paths to the recipient originating from publicly reachable nodes, including information - * needed for routing payments across them. - * - * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this - * privacy is lost if a public node id is used for - *[`UnsignedBolt12Invoice::signing_pubkey`]. + * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read */ -MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ UnsignedBolt12Invoice_payment_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxAddInput_write(const struct LDKTxAddInput *NONNULL_PTR obj); /** - * Duration since the Unix epoch when the invoice was created. + * Read a TxAddInput from a byte array, created by TxAddInput_write */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxAddInputDecodeErrorZ TxAddInput_read(struct LDKu8slice ser); /** - * Duration since - *[`UnsignedBolt12Invoice::created_at`] - * when the invoice has expired and therefore should no longer be paid. + * Serialize the TxAddOutput object into a byte array which can be read by TxAddOutput_read */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxAddOutput_write(const struct LDKTxAddOutput *NONNULL_PTR obj); /** - * Whether the invoice has expired. + * Read a TxAddOutput from a byte array, created by TxAddOutput_write */ -MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxAddOutputDecodeErrorZ TxAddOutput_read(struct LDKu8slice ser); /** - * Fallback addresses for paying the invoice on-chain, in order of most-preferred to - * least-preferred. + * Serialize the TxRemoveInput object into a byte array which can be read by TxRemoveInput_read */ -MUST_USE_RES struct LDKCVec_AddressZ UnsignedBolt12Invoice_fallbacks(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxRemoveInput_write(const struct LDKTxRemoveInput *NONNULL_PTR obj); /** - * Features pertaining to paying an invoice. + * Read a TxRemoveInput from a byte array, created by TxRemoveInput_write */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxRemoveInputDecodeErrorZ TxRemoveInput_read(struct LDKu8slice ser); /** - * A typically transient public key corresponding to the key used to sign the invoice. - * - * If the invoices was created in response to an [`Offer`], then this will be: - * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise - * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. - * - * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by - * the recipient. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey - * [`Offer::paths`]: crate::offers::offer::Offer::paths - * [`Refund`]: crate::offers::refund::Refund + * Serialize the TxRemoveOutput object into a byte array which can be read by TxRemoveOutput_read */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxRemoveOutput_write(const struct LDKTxRemoveOutput *NONNULL_PTR obj); /** - * 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 + * Read a TxRemoveOutput from a byte array, created by TxRemoveOutput_write */ -MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxRemoveOutputDecodeErrorZ TxRemoveOutput_read(struct LDKu8slice ser); /** - * 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 + * Serialize the TxComplete object into a byte array which can be read by TxComplete_read */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxComplete_write(const struct LDKTxComplete *NONNULL_PTR obj); /** - * 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 + * Read a TxComplete from a byte array, created by TxComplete_write */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxCompleteDecodeErrorZ TxComplete_read(struct LDKu8slice ser); /** - * 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 + * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read */ -MUST_USE_RES struct LDKCOption_AmountZ UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxSignatures_write(const struct LDKTxSignatures *NONNULL_PTR obj); /** - * 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 + * Read a TxSignatures from a byte array, created by TxSignatures_write */ -MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxSignaturesDecodeErrorZ TxSignatures_read(struct LDKu8slice ser); /** - * 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 - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the TxInitRbf object into a byte array which can be read by TxInitRbf_read */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxInitRbf_write(const struct LDKTxInitRbf *NONNULL_PTR obj); /** - * 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 + * Read a TxInitRbf from a byte array, created by TxInitRbf_write */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxInitRbfDecodeErrorZ TxInitRbf_read(struct LDKu8slice ser); /** - * 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 + * Serialize the TxAckRbf object into a byte array which can be read by TxAckRbf_read */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxAckRbf_write(const struct LDKTxAckRbf *NONNULL_PTR obj); /** - * Paths to the recipient originating from publicly reachable nodes. - * - * From [`Offer::paths`] or [`Refund::paths`]. - * - * [`Offer::paths`]: crate::offers::offer::Offer::paths + * Read a TxAckRbf from a byte array, created by TxAckRbf_write */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxAckRbfDecodeErrorZ TxAckRbf_read(struct LDKu8slice ser); /** - * 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 + * Serialize the TxAbort object into a byte array which can be read by TxAbort_read */ -MUST_USE_RES struct LDKCOption_QuantityZ UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z TxAbort_write(const struct LDKTxAbort *NONNULL_PTR obj); /** - * The public key used by the recipient to sign invoices. - * - * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was - * created in response to a [`Refund`]. - * - * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a TxAbort from a byte array, created by TxAbort_write */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_issuer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_TxAbortDecodeErrorZ TxAbort_read(struct LDKu8slice ser); /** - * An unpredictable series of bytes from the payer. - * - * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read */ -MUST_USE_RES struct LDKu8slice UnsignedBolt12Invoice_payer_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z AnnouncementSignatures_write(const struct LDKAnnouncementSignatures *NONNULL_PTR obj); /** - * Features pertaining to requesting an invoice. - * - * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write */ -MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedBolt12Invoice_invoice_request_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_AnnouncementSignaturesDecodeErrorZ AnnouncementSignatures_read(struct LDKu8slice ser); /** - * The quantity of items requested or refunded for. - * - * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + * Serialize the ChannelReestablish object into a byte array which can be read by ChannelReestablish_read */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelReestablish_write(const struct LDKChannelReestablish *NONNULL_PTR obj); /** - * 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 + * Read a ChannelReestablish from a byte array, created by ChannelReestablish_write */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ChannelReestablishDecodeErrorZ ChannelReestablish_read(struct LDKu8slice ser); /** - * 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 + * Serialize the NextFunding object into a byte array which can be read by NextFunding_read */ -MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z NextFunding_write(const struct LDKNextFunding *NONNULL_PTR obj); /** - * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + * Read a NextFunding from a byte array, created by NextFunding_write */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_NextFundingDecodeErrorZ NextFunding_read(struct LDKu8slice ser); /** - * The minimum amount required for a successful payment of the invoice. + * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read */ -MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); /** - * Paths to the recipient originating from publicly reachable nodes, including information - * needed for routing payments across them. - * - * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this - * privacy is lost if a public node id is used for - *[`Bolt12Invoice::signing_pubkey`]. + * Read a FundingLocked from a byte array, created by FundingLocked_write */ -MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ Bolt12Invoice_payment_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); /** - * Duration since the Unix epoch when the invoice was created. + * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read */ -MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ClosingSigned_write(const struct LDKClosingSigned *NONNULL_PTR obj); /** - * Duration since - *[`Bolt12Invoice::created_at`] - * when the invoice has expired and therefore should no longer be paid. + * Read a ClosingSigned from a byte array, created by ClosingSigned_write */ -MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ClosingSignedDecodeErrorZ ClosingSigned_read(struct LDKu8slice ser); /** - * Whether the invoice has expired. + * Serialize the ClosingComplete object into a byte array which can be read by ClosingComplete_read */ -MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ClosingComplete_write(const struct LDKClosingComplete *NONNULL_PTR obj); /** - * Fallback addresses for paying the invoice on-chain, in order of most-preferred to - * least-preferred. + * Read a ClosingComplete from a byte array, created by ClosingComplete_write */ -MUST_USE_RES struct LDKCVec_AddressZ Bolt12Invoice_fallbacks(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ClosingCompleteDecodeErrorZ ClosingComplete_read(struct LDKu8slice ser); /** - * Features pertaining to paying an invoice. + * Serialize the ClosingSig object into a byte array which can be read by ClosingSig_read */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ClosingSig_write(const struct LDKClosingSig *NONNULL_PTR obj); /** - * A typically transient public key corresponding to the key used to sign the invoice. - * - * If the invoices was created in response to an [`Offer`], then this will be: - * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise - * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. - * - * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by - * the recipient. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey - * [`Offer::paths`]: crate::offers::offer::Offer::paths - * [`Refund`]: crate::offers::refund::Refund + * Read a ClosingSig from a byte array, created by ClosingSig_write */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ClosingSigDecodeErrorZ ClosingSig_read(struct LDKu8slice ser); /** - * 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 + * Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read */ -MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ClosingSignedFeeRange_write(const struct LDKClosingSignedFeeRange *NONNULL_PTR obj); /** - * 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 + * Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ ClosingSignedFeeRange_read(struct LDKu8slice ser); /** - * 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 + * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z CommitmentSigned_write(const struct LDKCommitmentSigned *NONNULL_PTR obj); /** - * 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 + * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write */ -MUST_USE_RES struct LDKCOption_AmountZ Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_CommitmentSignedDecodeErrorZ CommitmentSigned_read(struct LDKu8slice ser); /** - * 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 + * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read */ -MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z FundingCreated_write(const struct LDKFundingCreated *NONNULL_PTR obj); /** - * 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 - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a FundingCreated from a byte array, created by FundingCreated_write */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_FundingCreatedDecodeErrorZ FundingCreated_read(struct LDKu8slice ser); /** - * 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 + * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read + */ +struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PTR obj); + +/** + * Read a FundingSigned from a byte array, created by FundingSigned_write + */ +struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); + +/** + * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read */ -MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); /** - * 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 + * Read a ChannelReady from a byte array, created by ChannelReady_write */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); /** - * Paths to the recipient originating from publicly reachable nodes. - * - * From [`Offer::paths`] or [`Refund::paths`]. - * - * [`Offer::paths`]: crate::offers::offer::Offer::paths + * Serialize the Init object into a byte array which can be read by Init_read */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Init_write(const struct LDKInit *NONNULL_PTR obj); /** - * 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 + * Read a Init from a byte array, created by Init_write */ -MUST_USE_RES struct LDKCOption_QuantityZ Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_InitDecodeErrorZ Init_read(struct LDKu8slice ser); /** - * The public key used by the recipient to sign invoices. - * - * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was - * created in response to a [`Refund`]. - * - * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_issuer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z OpenChannel_write(const struct LDKOpenChannel *NONNULL_PTR obj); /** - * An unpredictable series of bytes from the payer. - * - * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. + * Read a OpenChannel from a byte array, created by OpenChannel_write */ -MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_OpenChannelDecodeErrorZ OpenChannel_read(struct LDKu8slice ser); /** - * Features pertaining to requesting an invoice. - * - * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. + * Serialize the OpenChannelV2 object into a byte array which can be read by OpenChannelV2_read */ -MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z OpenChannelV2_write(const struct LDKOpenChannelV2 *NONNULL_PTR obj); /** - * The quantity of items requested or refunded for. - * - * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. + * Read a OpenChannelV2 from a byte array, created by OpenChannelV2_write */ -MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_OpenChannelV2DecodeErrorZ OpenChannelV2_read(struct LDKu8slice ser); /** - * 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 + * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z RevokeAndACK_write(const struct LDKRevokeAndACK *NONNULL_PTR obj); /** - * 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 + * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write */ -MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_RevokeAndACKDecodeErrorZ RevokeAndACK_read(struct LDKu8slice ser); /** - * SHA256 hash of the payment preimage that will be given in return for paying the invoice. + * Serialize the Shutdown object into a byte array which can be read by Shutdown_read */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Shutdown_write(const struct LDKShutdown *NONNULL_PTR obj); /** - * The minimum amount required for a successful payment of the invoice. + * Read a Shutdown from a byte array, created by Shutdown_write */ -MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_ShutdownDecodeErrorZ Shutdown_read(struct LDKu8slice ser); /** - * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. + * Serialize the UpdateFailHTLC object into a byte array which can be read by UpdateFailHTLC_read */ -MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCVec_u8Z UpdateFailHTLC_write(const struct LDKUpdateFailHTLC *NONNULL_PTR obj); /** - * Hash that was used for signing the invoice. + * Read a UpdateFailHTLC from a byte array, created by UpdateFailHTLC_write */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +struct LDKCResult_UpdateFailHTLCDecodeErrorZ UpdateFailHTLC_read(struct LDKu8slice ser); /** - * Verifies that the invoice was for a request or refund created using the given key by - * checking the payer metadata from the invoice request. - * - * Returns the associated [`PaymentId`] to use when sending the payment. + * Serialize the UpdateFailMalformedHTLC object into a byte array which can be read by UpdateFailMalformedHTLC_read */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +struct LDKCVec_u8Z UpdateFailMalformedHTLC_write(const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR obj); /** - * Verifies that the invoice was for a request or refund created using the given key by - * checking a payment id and nonce included with the [`BlindedMessagePath`] for which the invoice was - * sent through. + * Read a UpdateFailMalformedHTLC from a byte array, created by UpdateFailMalformedHTLC_write */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_payer_data(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); +struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ UpdateFailMalformedHTLC_read(struct LDKu8slice ser); /** - * Generates a non-cryptographic 64-bit hash of the Bolt12Invoice. + * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read */ -uint64_t Bolt12Invoice_hash(const struct LDKBolt12Invoice *NONNULL_PTR o); +struct LDKCVec_u8Z UpdateFee_write(const struct LDKUpdateFee *NONNULL_PTR obj); /** - * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read + * Read a UpdateFee from a byte array, created by UpdateFee_write */ -struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); +struct LDKCResult_UpdateFeeDecodeErrorZ UpdateFee_read(struct LDKu8slice ser); /** - * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read + * Serialize the UpdateFulfillHTLC object into a byte array which can be read by UpdateFulfillHTLC_read */ -struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj); +struct LDKCVec_u8Z UpdateFulfillHTLC_write(const struct LDKUpdateFulfillHTLC *NONNULL_PTR obj); /** - * Read a Bolt12Invoice from a byte array, created by Bolt12Invoice_write + * Read a UpdateFulfillHTLC from a byte array, created by UpdateFulfillHTLC_write */ -struct LDKCResult_Bolt12InvoiceDecodeErrorZ Bolt12Invoice_read(struct LDKu8slice ser); +struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ UpdateFulfillHTLC_read(struct LDKu8slice ser); /** - * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL. + * Serialize the PeerStorage object into a byte array which can be read by PeerStorage_read */ -void InvoiceError_free(struct LDKInvoiceError this_obj); +struct LDKCVec_u8Z PeerStorage_write(const struct LDKPeerStorage *NONNULL_PTR obj); /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a PeerStorage from a byte array, created by PeerStorage_write */ -struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr); +struct LDKCResult_PeerStorageDecodeErrorZ PeerStorage_read(struct LDKu8slice ser); /** - * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the PeerStorageRetrieval object into a byte array which can be read by PeerStorageRetrieval_read */ -void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val); +struct LDKCVec_u8Z PeerStorageRetrieval_write(const struct LDKPeerStorageRetrieval *NONNULL_PTR obj); /** - * An explanation of the error. + * Read a PeerStorageRetrieval from a byte array, created by PeerStorageRetrieval_write */ -struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr); +struct LDKCResult_PeerStorageRetrievalDecodeErrorZ PeerStorageRetrieval_read(struct LDKu8slice ser); /** - * An explanation of the error. + * Serialize the StartBatch object into a byte array which can be read by StartBatch_read */ -void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val); +struct LDKCVec_u8Z StartBatch_write(const struct LDKStartBatch *NONNULL_PTR obj); /** - * 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 + * Read a StartBatch from a byte array, created by StartBatch_write */ -MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); +struct LDKCResult_StartBatchDecodeErrorZ StartBatch_read(struct LDKu8slice ser); /** - * Creates a copy of the InvoiceError + * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read */ -struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig); +struct LDKCVec_u8Z OnionPacket_write(const struct LDKOnionPacket *NONNULL_PTR obj); /** - * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL. + * Read a OnionPacket from a byte array, created by OnionPacket_write */ -void ErroneousField_free(struct LDKErroneousField this_obj); +struct LDKCResult_OnionPacketDecodeErrorZ OnionPacket_read(struct LDKu8slice ser); /** - * The type number of the TLV field containing the error. + * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read */ -uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PTR obj); /** - * The type number of the TLV field containing the error. + * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write */ -void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); /** - * A value to use for the TLV field to avoid the error. - * - * Returns a copy of the field. + * Read a OnionMessage from a byte array, created by OnionMessage_write */ -struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr); +struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); /** - * A value to use for the TLV field to avoid the error. + * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read */ -void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); +struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); /** - * Constructs a new ErroneousField given each field + * Serialize the FinalOnionHopData object into a byte array which can be read by FinalOnionHopData_read */ -MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg); +struct LDKCVec_u8Z FinalOnionHopData_write(const struct LDKFinalOnionHopData *NONNULL_PTR obj); /** - * Creates a copy of the ErroneousField + * Read a FinalOnionHopData from a byte array, created by FinalOnionHopData_write */ -struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); +struct LDKCResult_FinalOnionHopDataDecodeErrorZ FinalOnionHopData_read(struct LDKu8slice ser); /** - * Creates an [`InvoiceError`] with the given message. + * Serialize the Ping object into a byte array which can be read by Ping_read */ -MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); +struct LDKCVec_u8Z Ping_write(const struct LDKPing *NONNULL_PTR obj); /** - * Get the string representation of a InvoiceError object + * Read a Ping from a byte array, created by Ping_write */ -struct LDKStr InvoiceError_to_str(const struct LDKInvoiceError *NONNULL_PTR o); +struct LDKCResult_PingDecodeErrorZ Ping_read(struct LDKu8slice ser); /** - * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read + * Serialize the Pong object into a byte array which can be read by Pong_read */ -struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj); +struct LDKCVec_u8Z Pong_write(const struct LDKPong *NONNULL_PTR obj); /** - * Read a InvoiceError from a byte array, created by InvoiceError_write + * Read a Pong from a byte array, created by Pong_write */ -struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); +struct LDKCResult_PongDecodeErrorZ Pong_read(struct LDKu8slice ser); /** - * Frees any resources used by the InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. + * Serialize the UnsignedChannelAnnouncement object into a byte array which can be read by UnsignedChannelAnnouncement_read */ -void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_obj); +struct LDKCVec_u8Z UnsignedChannelAnnouncement_write(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR obj); /** - * Builds a signed [`InvoiceRequest`] after checking for valid semantics. + * Read a UnsignedChannelAnnouncement from a byte array, created by UnsignedChannelAnnouncement_write */ -MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg); +struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ UnsignedChannelAnnouncement_read(struct LDKu8slice ser); /** - * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not - * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported - * by the offer. - * - * Successive calls to this method will override the previous setting. + * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, enum LDKNetwork network); +struct LDKCVec_u8Z ChannelAnnouncement_write(const struct LDKChannelAnnouncement *NONNULL_PTR obj); /** - * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is - * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). - * - * Successive calls to this method will override the previous setting. - * - * [`quantity`]: Self::quantity + * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t amount_msats); +struct LDKCResult_ChannelAnnouncementDecodeErrorZ ChannelAnnouncement_read(struct LDKu8slice ser); /** - * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` - * does not conform to [`Offer::is_valid_quantity`]. - * - * Successive calls to this method will override the previous setting. + * Serialize the UnsignedChannelUpdate object into a byte array which can be read by UnsignedChannelUpdate_read */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t quantity); +struct LDKCVec_u8Z UnsignedChannelUpdate_write(const struct LDKUnsignedChannelUpdate *NONNULL_PTR obj); /** - * Sets the [`InvoiceRequest::payer_note`]. - * - * Successive calls to this method will override the previous setting. + * Read a UnsignedChannelUpdate from a byte array, created by UnsignedChannelUpdate_write */ -MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKStr payer_note); +struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ UnsignedChannelUpdate_read(struct LDKu8slice ser); /** - * Sets the [`InvoiceRequest::offer_from_hrn`]. - * - * Successive calls to this method will override the previous setting. + * Serialize the ChannelUpdate object into a byte array which can be read by ChannelUpdate_read */ -MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_sourced_from_human_readable_name(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKHumanReadableName hrn); +struct LDKCVec_u8Z ChannelUpdate_write(const struct LDKChannelUpdate *NONNULL_PTR obj); /** - * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. + * Read a ChannelUpdate from a byte array, created by ChannelUpdate_write */ -void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); +struct LDKCResult_ChannelUpdateDecodeErrorZ ChannelUpdate_read(struct LDKu8slice ser); /** - * Creates a copy of the UnsignedInvoiceRequest + * Serialize the ErrorMessage object into a byte array which can be read by ErrorMessage_read */ -struct LDKUnsignedInvoiceRequest UnsignedInvoiceRequest_clone(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR orig); +struct LDKCVec_u8Z ErrorMessage_write(const struct LDKErrorMessage *NONNULL_PTR obj); /** - * Calls the free function if one is set + * Read a ErrorMessage from a byte array, created by ErrorMessage_write */ -void SignInvoiceRequestFn_free(struct LDKSignInvoiceRequestFn this_ptr); +struct LDKCResult_ErrorMessageDecodeErrorZ ErrorMessage_read(struct LDKu8slice ser); /** - * Returns the [`TaggedHash`] of the invoice to sign. + * Serialize the WarningMessage object into a byte array which can be read by WarningMessage_read */ -MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z WarningMessage_write(const struct LDKWarningMessage *NONNULL_PTR obj); /** - * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. + * Read a WarningMessage from a byte array, created by WarningMessage_write */ -void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); +struct LDKCResult_WarningMessageDecodeErrorZ WarningMessage_read(struct LDKu8slice ser); /** - * Creates a copy of the InvoiceRequest + * Serialize the UnsignedNodeAnnouncement object into a byte array which can be read by UnsignedNodeAnnouncement_read */ -struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); +struct LDKCVec_u8Z UnsignedNodeAnnouncement_write(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR obj); /** - * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. + * Read a UnsignedNodeAnnouncement from a byte array, created by UnsignedNodeAnnouncement_write */ -void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); +struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ UnsignedNodeAnnouncement_read(struct LDKu8slice ser); /** - * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. + * Serialize the NodeAnnouncement object into a byte array which can be read by NodeAnnouncement_read */ -struct LDKOfferId VerifiedInvoiceRequest_get_offer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z NodeAnnouncement_write(const struct LDKNodeAnnouncement *NONNULL_PTR obj); /** - * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. + * Read a NodeAnnouncement from a byte array, created by NodeAnnouncement_write */ -void VerifiedInvoiceRequest_set_offer_id(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKOfferId val); +struct LDKCResult_NodeAnnouncementDecodeErrorZ NodeAnnouncement_read(struct LDKu8slice ser); /** - * Creates a copy of the VerifiedInvoiceRequest + * Read a QueryShortChannelIds from a byte array, created by QueryShortChannelIds_write */ -struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); +struct LDKCResult_QueryShortChannelIdsDecodeErrorZ QueryShortChannelIds_read(struct LDKu8slice ser); /** - * 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. + * Serialize the QueryShortChannelIds object into a byte array which can be read by QueryShortChannelIds_read */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj); /** - * 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`. + * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj); /** - * The minimum amount required for a successful payment of a single item. + * Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write */ -MUST_USE_RES struct LDKCOption_AmountZ UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser); /** - * 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. + * Calculates the overflow safe ending block height for the query. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Overflow returns `0xffffffff`, otherwise returns `first_blocknum + number_of_blocks`. */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg); /** - * Features pertaining to the offer. + * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read */ -MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * Read a QueryChannelRange from a byte array, created by QueryChannelRange_write */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser); /** - * 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 + * Read a ReplyChannelRange from a byte array, created by ReplyChannelRange_write */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * Serialize the ReplyChannelRange object into a byte array which can be read by ReplyChannelRange_read */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj); /** - * The quantity of items supported. + * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read */ -MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj); /** - * The public key corresponding to the key used by the recipient to sign invoices. - * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for - * sending an [`InvoiceRequest`]. - * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. - * - If `None`, the signing pubkey will be the final blinded node id from the - * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. - * - * See also [`Bolt12Invoice::signing_pubkey`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_issuer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_signing_pubkey`]. - * - * [`payer_signing_pubkey`]: Self::payer_signing_pubkey + * Frees any resources used by the InboundHTLCErr, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InboundHTLCErr_free(struct LDKInboundHTLCErr this_obj); /** - * A chain from [`Offer::chains`] that the offer is valid for. + * BOLT 4 error code. */ -MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason InboundHTLCErr_get_reason(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * 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 + * BOLT 4 error code. */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InboundHTLCErr_set_reason(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKLocalHTLCFailureReason val); /** - * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` - * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * Data attached to this error. * - * [`amount_msats`]: Self::amount_msats - * [`quantity`]: Self::quantity + * Returns a copy of the field. */ -MUST_USE_RES bool UnsignedInvoiceRequest_has_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCVec_u8Z InboundHTLCErr_get_err_data(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * Features pertaining to requesting an invoice. + * Data attached to this error. */ -MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InboundHTLCErr_set_err_data(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Error message text. */ -MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKStr InboundHTLCErr_get_msg(const struct LDKInboundHTLCErr *NONNULL_PTR this_ptr); /** - * A possibly transient pubkey used to sign the invoice request. + * Error message text. */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +void InboundHTLCErr_set_msg(struct LDKInboundHTLCErr *NONNULL_PTR this_ptr, struct LDKStr val); /** - * 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 + * Constructs a new InboundHTLCErr given each field */ -MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInboundHTLCErr InboundHTLCErr_new(struct LDKLocalHTLCFailureReason reason_arg, struct LDKCVec_u8Z err_data_arg, struct LDKStr msg_arg); /** - * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the - * builder to indicate the original [`HumanReadableName`] which was resolved. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Creates a copy of the InboundHTLCErr */ -MUST_USE_RES struct LDKHumanReadableName UnsignedInvoiceRequest_offer_from_hrn(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKInboundHTLCErr InboundHTLCErr_clone(const struct LDKInboundHTLCErr *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. + * Generates a non-cryptographic 64-bit hash of the InboundHTLCErr. */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +uint64_t InboundHTLCErr_hash(const struct LDKInboundHTLCErr *NONNULL_PTR o); /** - * 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`. + * Checks if two InboundHTLCErrs 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. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +bool InboundHTLCErr_eq(const struct LDKInboundHTLCErr *NONNULL_PTR a, const struct LDKInboundHTLCErr *NONNULL_PTR b); /** - * The minimum amount required for a successful payment of a single item. + * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information + * about the intended next-hop for the HTLC. + * + * This does all the relevant context-free checks that LDK requires for payment relay or + * acceptance. If the payment is to be received, and the amount matches the expected amount for + * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the + * channel, will generate an [`Event::PaymentClaimable`]. + * + * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable */ -MUST_USE_RES struct LDKCOption_AmountZ InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, uint32_t cur_height, bool allow_skimmed_fees); /** - * 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. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the DecryptedOurPeerStorage, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +void DecryptedOurPeerStorage_free(struct LDKDecryptedOurPeerStorage this_obj); /** - * Features pertaining to the offer. + * Returns [`DecryptedOurPeerStorage`] with the given data. */ -MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKDecryptedOurPeerStorage DecryptedOurPeerStorage_new(struct LDKCVec_u8Z data); /** - * Duration since the Unix epoch when an invoice should no longer be requested. - * - * If `None`, the offer does not expire. + * Returns data stored in [`Vec`] format. */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u8Z DecryptedOurPeerStorage_into_vec(struct LDKDecryptedOurPeerStorage 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 + * Encrypts the data inside [`DecryptedOurPeerStorage`] using [`PeerStorageKey`] and `random_bytes` + * and returns [`EncryptedOurPeerStorage`]. */ -MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKEncryptedOurPeerStorage DecryptedOurPeerStorage_encrypt(struct LDKDecryptedOurPeerStorage this_arg, const struct LDKPeerStorageKey *NONNULL_PTR key, const uint8_t (*random_bytes)[32]); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * Frees any resources used by the EncryptedOurPeerStorage, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +void EncryptedOurPeerStorage_free(struct LDKEncryptedOurPeerStorage this_obj); /** - * The quantity of items supported. + * Returns [`EncryptedOurPeerStorage`] if cipher is of appropriate length, else returns error. */ -MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_EncryptedOurPeerStorageNoneZ EncryptedOurPeerStorage_new(struct LDKCVec_u8Z cipher); /** - * The public key corresponding to the key used by the recipient to sign invoices. - * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for - * sending an [`InvoiceRequest`]. - * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. - * - If `None`, the signing pubkey will be the final blinded node id from the - * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. - * - * See also [`Bolt12Invoice::signing_pubkey`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns cipher in the format [`Vec`]. */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_issuer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u8Z EncryptedOurPeerStorage_into_vec(struct LDKEncryptedOurPeerStorage this_arg); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_signing_pubkey`]. - * - * [`payer_signing_pubkey`]: Self::payer_signing_pubkey + * Returns [`DecryptedOurPeerStorage`] if it successfully decrypts the ciphertext with the `key`, + * else returns error. */ -MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_DecryptedOurPeerStorageNoneZ EncryptedOurPeerStorage_decrypt(struct LDKEncryptedOurPeerStorage this_arg, const struct LDKPeerStorageKey *NONNULL_PTR key); /** - * A chain from [`Offer::chains`] that the offer is valid for. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr); /** - * 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 + * Frees any resources used by the IgnoringMessageHandler, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj); /** - * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` - * then it was inferred from the [`Offer::amount`] and [`quantity`]. - * - * [`amount_msats`]: Self::amount_msats - * [`quantity`]: Self::quantity + * Constructs a new IgnoringMessageHandler given each field */ -MUST_USE_RES bool InvoiceRequest_has_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void); /** - * Features pertaining to requesting an invoice. + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKBaseMessageHandler IgnoringMessageHandler_as_BaseMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * A possibly transient pubkey used to sign the invoice request. + * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKOnionMessageHandler IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *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 + * Constructs a new OffersMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OffersMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the - * builder to indicate the original [`HumanReadableName`] which was resolved. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new AsyncPaymentsMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned AsyncPaymentsMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKHumanReadableName InvoiceRequest_offer_from_hrn(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKAsyncPaymentsMessageHandler IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the - * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. - * - * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned - * creation time is used for the `created_at` parameter. - * - * [`Duration`]: core::time::Duration + * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); +struct LDKDNSResolverMessageHandler IgnoringMessageHandler_as_DNSResolverMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Creates an [`InvoiceBuilder`] for the request with the given required fields. - * - * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after - * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. - *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. - * - * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment - * for the invoice. - * - * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It - * must contain one or more elements ordered from most-preferred to least-preferred, if there's - * a preference. Note, however, that any privacy is lost if a public node id was used for - * [`Offer::issuer_signing_pubkey`]. - * - * Errors if the request contains unknown required features. - * - * # Note - * - * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], - * then first use [`InvoiceRequest::verify_using_metadata`] or - * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods - * instead. - * - * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at - * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey + * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with_no_std(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); +struct LDKCustomOnionMessageHandler IgnoringMessageHandler_as_CustomOnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Verifies that the request was for an offer created using the given key by checking the - * metadata from the offer. - * - * 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 + * Constructs a new SendOnlyMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SendOnlyMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_metadata(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); +struct LDKSendOnlyMessageHandler IgnoringMessageHandler_as_SendOnlyMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Verifies that the request was for an offer created using the given key by checking a nonce - * included with the [`BlindedMessagePath`] for which the request was sent through. - * - * 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 + * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is */ -MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_recipient_data(struct LDKInvoiceRequest this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); +struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); /** - * Signature of the invoice request using [`payer_signing_pubkey`]. - * - * [`payer_signing_pubkey`]: Self::payer_signing_pubkey + * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *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. + * Frees any resources used by the ErroringMessageHandler, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj); /** - * 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`. + * Constructs a new ErroringMessageHandler */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void); /** - * The minimum amount required for a successful payment of a single item. + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKCOption_AmountZ VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKBaseMessageHandler ErroringMessageHandler_as_BaseMessageHandler(const struct LDKErroringMessageHandler *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. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new ChannelMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelMessageHandler must be freed before this_arg is */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKChannelMessageHandler ErroringMessageHandler_as_ChannelMessageHandler(const struct LDKErroringMessageHandler *NONNULL_PTR this_arg); /** - * Features pertaining to the offer. + * Frees any resources used by the MessageHandler, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void MessageHandler_free(struct LDKMessageHandler this_obj); /** - * Duration since the Unix epoch when an invoice should no longer be requested. + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. * - * If `None`, the offer does not expire. + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +const struct LDKChannelMessageHandler *MessageHandler_get_chan_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * 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. + * A message handler which handles messages specific to channels. Usually this is just a + * [`ChannelManager`] object or an [`ErroringMessageHandler`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKChannelMessageHandler val); /** - * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide - * recipient privacy by obfuscating its node id. + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. + * + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * The quantity of items supported. + * A message handler which handles messages updating our knowledge of the network channel + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. + * + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ -MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); /** - * The public key corresponding to the key used by the recipient to sign invoices. - * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for - * sending an [`InvoiceRequest`]. - * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. - * - If `None`, the signing pubkey will be the final blinded node id from the - * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. - * - * See also [`Bolt12Invoice::signing_pubkey`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey + * A message handler which handles onion messages. This should generally be an + * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_issuer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_signing_pubkey`]. + * A message handler which handles onion messages. This should generally be an + * [`OnionMessenger`], but can also be an [`IgnoringMessageHandler`]. * - * [`payer_signing_pubkey`]: Self::payer_signing_pubkey + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ -MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); /** - * A chain from [`Offer::chains`] that the offer is valid for. + * A message handler which handles custom messages. The only LDK-provided implementation is + * [`IgnoringMessageHandler`]. */ -MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +const struct LDKCustomMessageHandler *MessageHandler_get_custom_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * 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. + * A message handler which handles custom messages. The only LDK-provided implementation is + * [`IgnoringMessageHandler`]. + */ +void MessageHandler_set_custom_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKCustomMessageHandler val); + +/** + * A message handler which can be used to send messages. * - * [`chain`]: Self::chain + * This should generally be a [`ChainMonitor`]. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +const struct LDKSendOnlyMessageHandler *MessageHandler_get_send_only_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** - * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` - * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * A message handler which can be used to send messages. * - * [`amount_msats`]: Self::amount_msats - * [`quantity`]: Self::quantity + * This should generally be a [`ChainMonitor`]. + * + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ -MUST_USE_RES bool VerifiedInvoiceRequest_has_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void MessageHandler_set_send_only_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKSendOnlyMessageHandler val); /** - * Features pertaining to requesting an invoice. + * Constructs a new MessageHandler given each field */ -MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg, struct LDKCustomMessageHandler custom_message_handler_arg, struct LDKSendOnlyMessageHandler send_only_message_handler_arg); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Creates a copy of a SocketDescriptor */ -MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKSocketDescriptor SocketDescriptor_clone(const struct LDKSocketDescriptor *NONNULL_PTR orig); /** - * A possibly transient pubkey used to sign the invoice request. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); /** - * 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 + * Frees any resources used by the PeerDetails, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void PeerDetails_free(struct LDKPeerDetails this_obj); /** - * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the - * builder to indicate the original [`HumanReadableName`] which was resolved. + * The node id of the peer. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`PeerManager::new_outbound_connection`]. */ -MUST_USE_RES struct LDKHumanReadableName VerifiedInvoiceRequest_offer_from_hrn(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +struct LDKPublicKey PeerDetails_get_counterparty_node_id(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the - * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. - * - * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned - * creation time is used for the `created_at` parameter. + * The node id of the peer. * - * [`Duration`]: core::time::Duration + * For outbound connections, this [`PublicKey`] will be the same as the `their_node_id` parameter + * passed in to [`PeerManager::new_outbound_connection`]. */ -MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); +void PeerDetails_set_counterparty_node_id(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates an [`InvoiceBuilder`] for the request with the given required fields. - * - * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after - * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. - *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. - * - * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment - * for the invoice. - * - * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It - * must contain one or more elements ordered from most-preferred to least-preferred, if there's - * a preference. Note, however, that any privacy is lost if a public node id was used for - * [`Offer::issuer_signing_pubkey`]. - * - * Errors if the request contains unknown required features. - * - * # Note + * The socket address the peer provided in the initial handshake. * - * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], - * then first use [`InvoiceRequest::verify_using_metadata`] or - * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods - * instead. + * Will only be `Some` if an address had been previously provided to + * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. * - * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at - * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey + * Returns a copy of the field. */ -MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); +struct LDKCOption_SocketAddressZ PeerDetails_get_socket_address(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses - * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use - * the same [`ExpandedKey`] as the one used to create the offer. - * - * See [`InvoiceRequest::respond_with`] for further details. + * The socket address the peer provided in the initial handshake. * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Will only be `Some` if an address had been previously provided to + * [`PeerManager::new_outbound_connection`] or [`PeerManager::new_inbound_connection`]. */ -MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); +void PeerDetails_set_socket_address(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKCOption_SocketAddressZ val); /** - * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses - * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use - * the same [`ExpandedKey`] as the one used to create the offer. - * - * See [`InvoiceRequest::respond_with_no_std`] for further details. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * The features the peer provided in the initial handshake. */ -MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); +struct LDKInitFeatures PeerDetails_get_init_features(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Fetch the [`InvoiceRequestFields`] for this verified invoice. - * - * These are fields which we expect to be useful when receiving a payment for this invoice - * request, and include the returned [`InvoiceRequestFields`] in the - * [`PaymentContext::Bolt12Offer`]. - * - * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer + * The features the peer provided in the initial handshake. */ -MUST_USE_RES struct LDKInvoiceRequestFields VerifiedInvoiceRequest_fields(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +void PeerDetails_set_init_features(struct LDKPeerDetails *NONNULL_PTR this_ptr, struct LDKInitFeatures val); /** - * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read + * Indicates the direction of the peer connection. + * + * Will be `true` for inbound connections, and `false` for outbound connections. */ -struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); +bool PeerDetails_get_is_inbound_connection(const struct LDKPeerDetails *NONNULL_PTR this_ptr); /** - * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read + * Indicates the direction of the peer connection. + * + * Will be `true` for inbound connections, and `false` for outbound connections. */ -struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); +void PeerDetails_set_is_inbound_connection(struct LDKPeerDetails *NONNULL_PTR this_ptr, bool val); /** - * Read a InvoiceRequest from a byte array, created by InvoiceRequest_write + * Constructs a new PeerDetails given each field */ -struct LDKCResult_InvoiceRequestDecodeErrorZ InvoiceRequest_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKPeerDetails PeerDetails_new(struct LDKPublicKey counterparty_node_id_arg, struct LDKCOption_SocketAddressZ socket_address_arg, struct LDKInitFeatures init_features_arg, bool is_inbound_connection_arg); /** - * Frees any resources used by the InvoiceRequestFields, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PeerHandleError, if is_owned is set and inner is non-NULL. */ -void InvoiceRequestFields_free(struct LDKInvoiceRequestFields this_obj); +void PeerHandleError_free(struct LDKPeerHandleError this_obj); /** - * A possibly transient pubkey used to sign the invoice request. + * Constructs a new PeerHandleError given each field */ -struct LDKPublicKey InvoiceRequestFields_get_payer_signing_pubkey(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPeerHandleError PeerHandleError_new(void); /** - * A possibly transient pubkey used to sign the invoice request. + * Creates a copy of the PeerHandleError */ -void InvoiceRequestFields_set_payer_signing_pubkey(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKPeerHandleError PeerHandleError_clone(const struct LDKPeerHandleError *NONNULL_PTR orig); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Get the string representation of a PeerHandleError object */ -struct LDKCOption_u64Z InvoiceRequestFields_get_quantity(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); +struct LDKStr PeerHandleError_to_str(const struct LDKPeerHandleError *NONNULL_PTR o); /** - * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. + * Frees any resources used by the PeerManager, if is_owned is set and inner is non-NULL. */ -void InvoiceRequestFields_set_quantity(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void PeerManager_free(struct LDKPeerManager this_obj); /** - * A payer-provided note which will be seen by the recipient and reflected back in the invoice - * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. + * Constructs a new `PeerManager` with the given message handlers. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be + * cryptographically secure random bytes. + * + * `current_time` is used as an always-increasing counter that survives across restarts and is + * incremented irregularly internally. In general it is best to simply use the current UNIX + * timestamp, however if it is not available a persistent counter that increases once per + * minute should suffice. */ -struct LDKUntrustedString InvoiceRequestFields_get_payer_note_truncated(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, uint32_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKNodeSigner node_signer); /** - * A payer-provided note which will be seen by the recipient and reflected back in the invoice - * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Returns a list of [`PeerDetails`] for connected peers that have completed the initial + * handshake. */ -void InvoiceRequestFields_set_payer_note_truncated(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKUntrustedString val); +MUST_USE_RES struct LDKCVec_PeerDetailsZ PeerManager_list_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * The Human Readable Name which the sender indicated they were paying to. + * Returns the [`PeerDetails`] of a connected peer that has completed the initial handshake. + * + * Will return `None` if the peer is unknown or it hasn't completed the initial handshake. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKHumanReadableName InvoiceRequestFields_get_human_readable_name(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPeerDetails PeerManager_peer_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id); /** - * The Human Readable Name which the sender indicated they were paying to. + * Indicates a new outbound connection has been established to a node with the given `node_id` + * and an optional remote network address. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * The remote network address adds the option to report a remote IP address back to a connecting + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. + * + * If an `Err` is returned here you must disconnect the connection immediately. + * + * Returns a small number of bytes to send to the remote node (currently always 50). + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected`]. + * + * [`socket_disconnected`]: PeerManager::socket_disconnected */ -void InvoiceRequestFields_set_human_readable_name(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKHumanReadableName val); +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); /** - * Constructs a new InvoiceRequestFields given each field + * Indicates a new inbound connection has been established to a node with an optional remote + * network address. * - * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that human_readable_name_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * The remote network address adds the option to report a remote IP address back to a connecting + * peer using the init message. + * The user should pass the remote network address of the host they are connected to. + * + * May refuse the connection by returning an Err, but will never write bytes to the remote end + * (outbound connector always speaks first). If an `Err` is returned here you must disconnect + * the connection immediately. + * + * Panics if descriptor is duplicative with some other descriptor which has not yet been + * [`socket_disconnected`]. + * + * [`socket_disconnected`]: PeerManager::socket_disconnected */ -MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_signing_pubkey_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_arg, struct LDKHumanReadableName human_readable_name_arg); +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); /** - * Creates a copy of the InvoiceRequestFields + * Indicates that there is room to write data to the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * May call [`send_data`] on the descriptor passed in (or an equal descriptor) before + * returning. Thus, be very careful with reentrancy issues! The invariants around calling + * [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be + * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't + * sufficient! + * + * [`send_data`]: SocketDescriptor::send_data + * [`write_buffer_space_avail`]: PeerManager::write_buffer_space_avail */ -struct LDKInvoiceRequestFields InvoiceRequestFields_clone(const struct LDKInvoiceRequestFields *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_write_buffer_space_avail(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * Checks if two InvoiceRequestFieldss 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. + * Indicates that data was read from the given socket descriptor. + * + * May return an Err to indicate that the connection should be closed. + * + * Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. + * Thus, however, you should call [`process_events`] after any `read_event` to generate + * [`send_data`] calls to handle responses. This is also important to give [`send_data`] calls + * a chance to pause reads if too many messages have been queued in response allowing a peer + * to bloat our memory. + * + * In order to avoid processing too many messages at once per peer, `data` should be on the + * order of 4KiB. + * + * [`send_data`]: SocketDescriptor::send_data + * [`process_events`]: PeerManager::process_events */ -bool InvoiceRequestFields_eq(const struct LDKInvoiceRequestFields *NONNULL_PTR a, const struct LDKInvoiceRequestFields *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_read_event(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor *NONNULL_PTR peer_descriptor, struct LDKu8slice data); /** - * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read + * Checks for any events generated by our handlers and processes them. Includes sending most + * response messages as well as messages generated by calls to handler functions directly (eg + * functions like [`ChannelManager::process_pending_htlc_forwards`] or [`send_payment`]). + * + * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * This should be called any time we may have messages to send. It is automatically called by + * [`lightning-net-tokio`] after processing incoming messages, and by + * [`lightning-background-processor`] when channel state has changed. Therefore, If you are not + * using both [`lightning-net-tokio`] and [`lightning-background-processor`], you may need to call + * this function manually to prevent messages from being delayed. + * + * Note that if there are any other calls to this function waiting on lock(s) this may return + * without doing any work. All available events that need handling will be handled before the + * other calls return. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards + * [`send_data`]: SocketDescriptor::send_data + * [`lightning-net-tokio`]: https://docs.rs/lightning-net-tokio/latest/lightning_net_tokio + * [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor */ -struct LDKCVec_u8Z InvoiceRequestFields_write(const struct LDKInvoiceRequestFields *NONNULL_PTR obj); +void PeerManager_process_events(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write + * Indicates that the given socket descriptor's connection is now closed. */ -struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ InvoiceRequestFields_read(struct LDKu8slice ser); +void PeerManager_socket_disconnected(const struct LDKPeerManager *NONNULL_PTR this_arg, const struct LDKSocketDescriptor *NONNULL_PTR descriptor); /** - * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. + * Disconnect a peer given its node id. + * + * If a peer is connected, this will call [`disconnect_socket`] on the descriptor for the + * peer. Thus, be very careful about reentrancy issues. + * + * [`disconnect_socket`]: SocketDescriptor::disconnect_socket */ -void TaggedHash_free(struct LDKTaggedHash this_obj); +void PeerManager_disconnect_by_node_id(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * Creates a copy of the TaggedHash + * Disconnects all currently-connected peers. This is useful on platforms where there may be + * an indication that TCP sockets have stalled even if we weren't around to time them out + * using regular ping/pongs. */ -struct LDKTaggedHash TaggedHash_clone(const struct LDKTaggedHash *NONNULL_PTR orig); +void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Returns the digest to sign. + * Send pings to each peer and disconnect those which did not respond to the last round of + * pings. + * + * This may be called on any timescale you want, however, roughly once every ten seconds is + * preferred. The call rate determines both how often we send a ping to our peers and how much + * time they have to respond before we disconnect them. + * + * May call [`send_data`] on all [`SocketDescriptor`]s. Thus, be very careful with reentrancy + * issues! + * + * [`send_data`]: SocketDescriptor::send_data */ -MUST_USE_RES const uint8_t (*TaggedHash_as_digest(const struct LDKTaggedHash *NONNULL_PTR this_arg))[32]; +void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); /** - * Returns the tag used in the tagged hash. + * Generates a signed node_announcement from the given arguments, sending it to all connected + * peers. Note that peers will likely ignore this message unless we have at least one public + * channel which has at least six confirmations on-chain. + * + * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this + * node to humans. They carry no in-protocol meaning. + * + * `addresses` represent the set (possibly empty) of socket addresses on which this node + * accepts incoming connections. These will be included in the node_announcement, publicly + * tying these addresses together and to this node. If you wish to preserve user privacy, + * addresses should likely contain only Tor Onion addresses. + * + * Panics if `addresses` is absurdly large (more than 100). + * + * [`get_and_clear_pending_msg_events`]: BaseMessageHandler::get_and_clear_pending_msg_events */ -MUST_USE_RES struct LDKStr TaggedHash_tag(const struct LDKTaggedHash *NONNULL_PTR this_arg); +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_SocketAddressZ addresses); /** - * Returns the merkle root used in the tagged hash. + * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKThirtyTwoBytes TaggedHash_merkle_root(const struct LDKTaggedHash *NONNULL_PTR this_arg); +void ShutdownScript_free(struct LDKShutdownScript this_obj); /** - * Frees any resources used by the SignError + * Creates a copy of the ShutdownScript */ -void SignError_free(struct LDKSignError this_ptr); +struct LDKShutdownScript ShutdownScript_clone(const struct LDKShutdownScript *NONNULL_PTR orig); /** - * Creates a copy of the SignError + * Checks if two ShutdownScripts 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. */ -struct LDKSignError SignError_clone(const struct LDKSignError *NONNULL_PTR orig); +bool ShutdownScript_eq(const struct LDKShutdownScript *NONNULL_PTR a, const struct LDKShutdownScript *NONNULL_PTR b); /** - * Utility method to constructs a new Signing-variant SignError + * Frees any resources used by the InvalidShutdownScript, if is_owned is set and inner is non-NULL. */ -struct LDKSignError SignError_signing(void); +void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); /** - * Utility method to constructs a new Verification-variant SignError + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -struct LDKSignError SignError_verification(enum LDKSecp256k1Error a); +struct LDKCVec_u8Z InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Nonce, if is_owned is set and inner is non-NULL. + * The script that did not meet the requirements from [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ -void Nonce_free(struct LDKNonce this_obj); +void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); /** - * Creates a copy of the Nonce + * Constructs a new InvalidShutdownScript given each field */ -struct LDKNonce Nonce_clone(const struct LDKNonce *NONNULL_PTR orig); +MUST_USE_RES struct LDKInvalidShutdownScript InvalidShutdownScript_new(struct LDKCVec_u8Z script_arg); /** - * Checks if two Nonces 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. + * Creates a copy of the InvalidShutdownScript */ -bool Nonce_eq(const struct LDKNonce *NONNULL_PTR a, const struct LDKNonce *NONNULL_PTR b); +struct LDKInvalidShutdownScript InvalidShutdownScript_clone(const struct LDKInvalidShutdownScript *NONNULL_PTR orig); /** - * Creates a `Nonce` from the given [`EntropySource`]. + * Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read */ -MUST_USE_RES struct LDKNonce Nonce_from_entropy_source(struct LDKEntropySource entropy_source); +struct LDKCVec_u8Z ShutdownScript_write(const struct LDKShutdownScript *NONNULL_PTR obj); /** - * Returns a slice of the underlying bytes of size [`Nonce::LENGTH`]. + * Read a ShutdownScript from a byte array, created by ShutdownScript_write */ -MUST_USE_RES struct LDKu8slice Nonce_as_slice(const struct LDKNonce *NONNULL_PTR this_arg); +struct LDKCResult_ShutdownScriptDecodeErrorZ ShutdownScript_read(struct LDKu8slice ser); /** - * Serialize the Nonce object into a byte array which can be read by Nonce_read + * Generates a P2WPKH script pubkey from the given [`WPubkeyHash`]. */ -struct LDKCVec_u8Z Nonce_write(const struct LDKNonce *NONNULL_PTR obj); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wpkh(const uint8_t (*pubkey_hash)[20]); /** - * Read a Nonce from a byte array, created by Nonce_write + * Generates a P2WSH script pubkey from the given [`WScriptHash`]. */ -struct LDKCResult_NonceDecodeErrorZ Nonce_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*script_hash)[32]); /** - * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. + * Generates a witness script pubkey from the given segwit version and program. + * + * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or + * [`ShutdownScript::new_p2wsh`] instead. + * + * # Errors + * + * This function may return an error if `program` is invalid for the segwit `version`. */ -void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessProgram witness_program); /** - * Creates a copy of the Bolt12ParseError + * Converts the shutdown script into the underlying [`ScriptBuf`]. */ -struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_u8Z ShutdownScript_into_inner(struct LDKShutdownScript this_arg); /** - * Creates a copy of the Bolt12SemanticError + * Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig); +MUST_USE_RES struct LDKPublicKey ShutdownScript_as_legacy_pubkey(const struct LDKShutdownScript *NONNULL_PTR this_arg); /** - * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError + * Returns whether the shutdown script is compatible with the features as defined by BOLT #2. + * + * Specifically, checks for compliance with feature `option_shutdown_anysegwit` and/or + * `option_simple_close`. */ -enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void); +MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features); /** - * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError + * Get the string representation of a ShutdownScript object */ -enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void); +struct LDKStr ShutdownScript_to_str(const struct LDKShutdownScript *NONNULL_PTR o); /** - * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError + * Frees any resources used by the ChannelId, if is_owned is set and inner is non-NULL. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void); +void ChannelId_free(struct LDKChannelId this_obj); + +const uint8_t (*ChannelId_get_a(const struct LDKChannelId *NONNULL_PTR this_ptr))[32]; + +void ChannelId_set_a(struct LDKChannelId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError + * Constructs a new ChannelId given each field */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void); +MUST_USE_RES struct LDKChannelId ChannelId_new(struct LDKThirtyTwoBytes a_arg); /** - * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError + * Creates a copy of the ChannelId */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void); +struct LDKChannelId ChannelId_clone(const struct LDKChannelId *NONNULL_PTR orig); /** - * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError + * Checks if two ChannelIds 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. */ -enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void); +bool ChannelId_eq(const struct LDKChannelId *NONNULL_PTR a, const struct LDKChannelId *NONNULL_PTR b); /** - * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError + * Generates a non-cryptographic 64-bit hash of the ChannelId. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void); +uint64_t ChannelId_hash(const struct LDKChannelId *NONNULL_PTR o); /** - * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError + * Create _v1_ channel ID based on a funding TX ID and output index */ -enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void); +MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_txid(const uint8_t (*txid)[32], uint16_t output_index); /** - * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError + * Create _v1_ channel ID from a funding tx outpoint */ -enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void); +MUST_USE_RES struct LDKChannelId ChannelId_v1_from_funding_outpoint(struct LDKOutPoint outpoint); /** - * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError + * Create a _temporary_ channel ID randomly, based on an entropy source. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void); +MUST_USE_RES struct LDKChannelId ChannelId_temporary_from_entropy_source(const struct LDKEntropySource *NONNULL_PTR entropy_source); /** - * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError + * Generic constructor; create a new channel ID from the provided data. + * Use a more specific `*_from_*` constructor when possible. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void); +MUST_USE_RES struct LDKChannelId ChannelId_from_bytes(struct LDKThirtyTwoBytes data); /** - * Utility method to constructs a new MissingIssuerSigningPubkey-variant Bolt12SemanticError + * Create a channel ID consisting of all-zeros data (e.g. when uninitialized or a placeholder). */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_issuer_signing_pubkey(void); +MUST_USE_RES struct LDKChannelId ChannelId_new_zero(void); /** - * Utility method to constructs a new UnexpectedIssuerSigningPubkey-variant Bolt12SemanticError + * Check whether ID is consisting of all zeros (uninitialized) */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_issuer_signing_pubkey(void); +MUST_USE_RES bool ChannelId_is_zero(const struct LDKChannelId *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError + * Create _v2_ channel ID by concatenating the holder revocation basepoint with the counterparty + * revocation basepoint and hashing the result. The basepoints will be concatenated in increasing + * sorted order. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void); +MUST_USE_RES struct LDKChannelId ChannelId_v2_from_revocation_basepoints(const struct LDKRevocationBasepoint *NONNULL_PTR ours, const struct LDKRevocationBasepoint *NONNULL_PTR theirs); /** - * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError + * Create temporary _v2_ channel ID by concatenating a zeroed out basepoint with the holder + * revocation basepoint and hashing the result. */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void); +MUST_USE_RES struct LDKChannelId ChannelId_temporary_v2_from_revocation_basepoint(const struct LDKRevocationBasepoint *NONNULL_PTR our_revocation_basepoint); /** - * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError + * Indicates whether this is a V2 channel ID for the given local and remote revocation basepoints. */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void); +MUST_USE_RES bool ChannelId_is_v2_channel_id(const struct LDKChannelId *NONNULL_PTR this_arg, const struct LDKRevocationBasepoint *NONNULL_PTR ours, const struct LDKRevocationBasepoint *NONNULL_PTR theirs); /** - * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError + * Serialize the ChannelId object into a byte array which can be read by ChannelId_read */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void); +struct LDKCVec_u8Z ChannelId_write(const struct LDKChannelId *NONNULL_PTR obj); /** - * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError + * Read a ChannelId from a byte array, created by ChannelId_write */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void); +struct LDKCResult_ChannelIdDecodeErrorZ ChannelId_read(struct LDKu8slice ser); /** - * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError + * 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. + * + * `phantom_route_hints` parameter: + * * Contains channel info for all nodes participating in the phantom invoice + * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice + * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared + * down + * + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. + * + * `duration_since_epoch` is the current time since epoch in seconds. + * + * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3. + * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block + * confirmations during routing. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom + * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this + * requirement). + * + * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash + * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels + * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA + * + *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. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); +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 method to constructs a new MissingPayerSigningPubkey-variant Bolt12SemanticError + * 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. + * + * `phantom_route_hints` parameter: + * * Contains channel info for all nodes participating in the phantom invoice + * * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each + * participating node + * * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is + * updated when a channel becomes disabled or closes + * * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum + * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected + * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node + * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as + * desired, but note that some nodes will be trimmed if more than 3 nodes are provided. + * + * `description_hash` is a SHA-256 hash of the description text + * + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. + * + * `duration_since_epoch` is the current time since epoch in seconds. + * + * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom + * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this + * requirement). + * + * [`PhantomKeysManager`]: crate::sign::PhantomKeysManager + * [`ChannelManager::get_phantom_route_hints`]: crate::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash + * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels + * + *This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_signing_pubkey(void); +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 method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError + * Frees any resources used by the LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); +void LocalHTLCFailureReason_free(struct LDKLocalHTLCFailureReason this_ptr); /** - * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError + * Creates a copy of the LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_clone(const struct LDKLocalHTLCFailureReason *NONNULL_PTR orig); /** - * Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError + * Utility method to constructs a new TemporaryNodeFailure-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_paths(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_temporary_node_failure(void); /** - * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError + * Utility method to constructs a new PermanentNodeFailure-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_permanent_node_failure(void); /** - * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError + * Utility method to constructs a new RequiredNodeFeature-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_required_node_feature(void); /** - * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError + * Utility method to constructs a new InvalidOnionVersion-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_onion_version(void); /** - * Utility method to constructs a new UnexpectedPaymentHash-variant Bolt12SemanticError + * Utility method to constructs a new InvalidOnionHMAC-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_payment_hash(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_onion_hmac(void); /** - * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError + * Utility method to constructs a new InvalidOnionKey-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_onion_key(void); /** - * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError + * Utility method to constructs a new TemporaryChannelFailure-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_temporary_channel_failure(void); /** - * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError + * Utility method to constructs a new PermanentChannelFailure-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_permanent_channel_failure(void); /** - * Utility method to constructs a new UnexpectedHumanReadableName-variant Bolt12SemanticError + * Utility method to constructs a new RequiredChannelFeature-variant LocalHTLCFailureReason */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_human_readable_name(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_required_channel_feature(void); /** - * Frees any resources used by the RefundMaybeWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new UnknownNextPeer-variant LocalHTLCFailureReason */ -void RefundMaybeWithDerivedMetadataBuilder_free(struct LDKRefundMaybeWithDerivedMetadataBuilder this_obj); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_unknown_next_peer(void); /** - * Creates a copy of the RefundMaybeWithDerivedMetadataBuilder + * Utility method to constructs a new AmountBelowMinimum-variant LocalHTLCFailureReason */ -struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBuilder_clone(const struct LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR orig); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_amount_below_minimum(void); /** - * Creates a new builder for a refund using the `signing_pubkey` for the public node id to send - * to if no [`Refund::paths`] are set. Otherwise, `signing_pubkey` may be a transient pubkey. - * - * Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], - * and [`Refund::amount_msats`]. - * - * # Note - * - * If constructing a [`Refund`] for use with a [`ChannelManager`], use - * [`ChannelManager::create_refund_builder`] instead of [`RefundBuilder::new`]. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder + * Utility method to constructs a new FeeInsufficient-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey signing_pubkey, uint64_t amount_msats); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_fee_insufficient(void); /** - * Similar to [`RefundBuilder::new`] except, if [`RefundBuilder::path`] is called, the payer id - * is derived from the given [`ExpandedKey`] and nonce. This provides sender privacy by using a - * different payer id for each refund, assuming a different nonce is used. Otherwise, the - * provided `node_id` is used for the payer id. - * - * Also, sets the metadata when [`RefundBuilder::build`] is called such that it can be used by - * [`Bolt12Invoice::verify_using_metadata`] to determine if the invoice was produced for the - * refund given an [`ExpandedKey`]. However, if [`RefundBuilder::path`] is called, then the - * metadata must be included in each [`BlindedMessagePath`] instead. In this case, use - * [`Bolt12Invoice::verify_using_payer_data`]. - * - * The `payment_id` is encrypted in the metadata and should be unique. This ensures that only - * one invoice will be paid for the refund and that payments can be uniquely identified. - * - * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata - * [`Bolt12Invoice::verify_using_payer_data`]: crate::offers::invoice::Bolt12Invoice::verify_using_payer_data - * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey + * Utility method to constructs a new IncorrectCLTVExpiry-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_incorrect_cltvexpiry(void); /** - * Sets the [`Refund::description`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new CLTVExpiryTooSoon-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_description(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr description); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_cltvexpiry_too_soon(void); /** - * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. - *Any expiry that has already passed is valid and can be checked for using [`Refund::is_expired`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new IncorrectPaymentDetails-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_incorrect_payment_details(void); /** - * Sets the [`Refund::issuer`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new FinalIncorrectCLTVExpiry-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_issuer(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_final_incorrect_cltvexpiry(void); /** - * Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected - * by private channels or if [`Refund::payer_signing_pubkey`] is not a public node id. - * - * Successive calls to this method will add another blinded path. Caller is responsible for not - * adding duplicate paths. + * Utility method to constructs a new FinalIncorrectHTLCAmount-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_path(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_final_incorrect_htlcamount(void); /** - * Sets the [`Refund::chain`] of the given [`Network`] for paying an invoice. If not - * called, [`Network::Bitcoin`] is assumed. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new ChannelDisabled-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_chain(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_channel_disabled(void); /** - * Sets [`Refund::quantity`] of items. This is purely for informational purposes. It is useful - * when the refund pertains to a [`Bolt12Invoice`] that paid for more than one item from an - * [`Offer`] as specified by [`InvoiceRequest::quantity`]. - * - * Successive calls to this method will override the previous setting. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity - * [`Offer`]: crate::offers::offer::Offer + * Utility method to constructs a new CLTVExpiryTooFar-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_quantity(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t quantity); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_cltvexpiry_too_far(void); /** - * Sets the [`Refund::payer_note`]. - * - * Successive calls to this method will override the previous setting. + * Utility method to constructs a new InvalidOnionPayload-variant LocalHTLCFailureReason */ -MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_payer_note(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr payer_note); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_onion_payload(void); /** - * Builds a [`Refund`] after checking for valid semantics. + * Utility method to constructs a new MPPTimeout-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCResult_RefundBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_build(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_mpptimeout(void); /** - * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new InvalidOnionBlinding-variant LocalHTLCFailureReason */ -void Refund_free(struct LDKRefund this_obj); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_onion_blinding(void); /** - * Creates a copy of the Refund + * Utility method to constructs a new UnknownFailureCode-variant LocalHTLCFailureReason */ -struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_unknown_failure_code(uint16_t code); /** - * A complete description of the purpose of the refund. Intended to be displayed to the user - * but with the caveat that it has not been verified in any way. + * Utility method to constructs a new ForwardExpiryBuffer-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_forward_expiry_buffer(void); /** - * Duration since the Unix epoch when an invoice should no longer be sent. - * - * If `None`, the refund does not expire. + * Utility method to constructs a new InvalidTrampolineForward-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_trampoline_forward(void); /** - * Whether the refund has expired. + * Utility method to constructs a new PaymentClaimBuffer-variant LocalHTLCFailureReason */ -MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_payment_claim_buffer(void); /** - * Whether the refund has expired given the duration since the Unix epoch. + * Utility method to constructs a new DustLimitHolder-variant LocalHTLCFailureReason */ -MUST_USE_RES bool Refund_is_expired_no_std(const struct LDKRefund *NONNULL_PTR this_arg, uint64_t duration_since_epoch); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_dust_limit_holder(void); /** - * The issuer of the refund, 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 + * Utility method to constructs a new DustLimitCounterparty-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_dust_limit_counterparty(void); /** - * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender - * privacy by obfuscating its node id. + * Utility method to constructs a new FeeSpikeBuffer-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_fee_spike_buffer(void); /** - * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_signing_pubkey`]. - * - * [`payer_signing_pubkey`]: Self::payer_signing_pubkey + * Utility method to constructs a new PrivateChannelForward-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_private_channel_forward(void); /** - * A chain that the refund is valid for. + * Utility method to constructs a new RealSCIDForward-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_real_scidforward(void); /** - * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]). - * - * [`chain`]: Self::chain + * Utility method to constructs a new ChannelNotReady-variant LocalHTLCFailureReason */ -MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_channel_not_ready(void); /** - * Features pertaining to requesting an invoice. + * Utility method to constructs a new InvalidKeysendPreimage-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_keysend_preimage(void); /** - * The quantity of an item that refund is for. + * Utility method to constructs a new InvalidTrampolinePayload-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_invalid_trampoline_payload(void); /** - * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly - * transient pubkey. - * - * [`paths`]: Self::paths + * Utility method to constructs a new PaymentSecretRequired-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKPublicKey Refund_payer_signing_pubkey(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_payment_secret_required(void); /** - * Payer provided note to include in the invoice. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new OutgoingCLTVTooSoon-variant LocalHTLCFailureReason */ -MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_outgoing_cltvtoo_soon(void); /** - * Generates a non-cryptographic 64-bit hash of the Refund. + * Utility method to constructs a new ChannelClosed-variant LocalHTLCFailureReason */ -uint64_t Refund_hash(const struct LDKRefund *NONNULL_PTR o); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_channel_closed(void); /** - * Read a Refund from a byte array, created by Refund_write + * Utility method to constructs a new OnChainTimeout-variant LocalHTLCFailureReason */ -struct LDKCResult_RefundDecodeErrorZ Refund_read(struct LDKu8slice ser); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_on_chain_timeout(void); /** - * Serialize the Refund object into a byte array which can be read by Refund_read + * Utility method to constructs a new ZeroAmount-variant LocalHTLCFailureReason */ -struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_zero_amount(void); /** - * Read a Refund object from a string + * Utility method to constructs a new HTLCMinimum-variant LocalHTLCFailureReason */ -struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_htlcminimum(void); /** - * Get the string representation of a Refund object + * Utility method to constructs a new HTLCMaximum-variant LocalHTLCFailureReason */ -struct LDKStr Refund_to_str(const struct LDKRefund *NONNULL_PTR o); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_htlcmaximum(void); /** - * Creates a copy of the UtxoLookupError + * Utility method to constructs a new PeerOffline-variant LocalHTLCFailureReason */ -enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_peer_offline(void); /** - * Utility method to constructs a new UnknownChain-variant UtxoLookupError + * Utility method to constructs a new ChannelBalanceOverdrawn-variant LocalHTLCFailureReason */ -enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_channel_balance_overdrawn(void); /** - * Utility method to constructs a new UnknownTx-variant UtxoLookupError + * Generates a non-cryptographic 64-bit hash of the LocalHTLCFailureReason. */ -enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); +uint64_t LocalHTLCFailureReason_hash(const struct LDKLocalHTLCFailureReason *NONNULL_PTR o); /** - * Frees any resources used by the UtxoResult + * Checks if two LocalHTLCFailureReasons contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void UtxoResult_free(struct LDKUtxoResult this_ptr); +bool LocalHTLCFailureReason_eq(const struct LDKLocalHTLCFailureReason *NONNULL_PTR a, const struct LDKLocalHTLCFailureReason *NONNULL_PTR b); /** - * Creates a copy of the UtxoResult + * Build a LocalHTLCFailureReason from a u16 */ -struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); +struct LDKLocalHTLCFailureReason LocalHTLCFailureReason_from_u16(uint16_t f); /** - * Utility method to constructs a new Sync-variant UtxoResult + * Read a LocalHTLCFailureReason from a byte array, created by LocalHTLCFailureReason_write */ -struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); +struct LDKCResult_LocalHTLCFailureReasonDecodeErrorZ LocalHTLCFailureReason_read(struct LDKu8slice ser); /** - * Utility method to constructs a new Async-variant UtxoResult + * Serialize the LocalHTLCFailureReason object into a byte array which can be read by LocalHTLCFailureReason_read */ -struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); +struct LDKCVec_u8Z LocalHTLCFailureReason_write(const struct LDKLocalHTLCFailureReason *NONNULL_PTR obj); /** - * Calls the free function if one is set + * Build a payment onion, returning the first hop msat and cltv values as well. + * + * `cur_block_height` should be set to the best known block height + 1. + * + * Note that invoice_request (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void UtxoLookup_free(struct LDKUtxoLookup this_ptr); +struct LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ create_payment_onion(const struct LDKPath *NONNULL_PTR path, const uint8_t (*session_priv)[32], uint64_t total_msat, const struct LDKRecipientOnionFields *NONNULL_PTR recipient_onion, uint32_t cur_block_height, const uint8_t (*payment_hash)[32], struct LDKCOption_ThirtyTwoBytesZ keysend_preimage, struct LDKInvoiceRequest invoice_request, struct LDKThirtyTwoBytes prng_seed); /** - * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. + * Frees any resources used by the AttributionData, if is_owned is set and inner is non-NULL. */ -void UtxoFuture_free(struct LDKUtxoFuture this_obj); +void AttributionData_free(struct LDKAttributionData this_obj); /** - * Creates a copy of the UtxoFuture + * Creates a copy of the AttributionData */ -struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); +struct LDKAttributionData AttributionData_clone(const struct LDKAttributionData *NONNULL_PTR orig); /** - * Builds a new future for later resolution. + * Generates a non-cryptographic 64-bit hash of the AttributionData. */ -MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); +uint64_t AttributionData_hash(const struct LDKAttributionData *NONNULL_PTR o); /** - * Resolves this future against the given `graph` and with the given `result`. - * - * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling - * forwarding the validated gossip message onwards to peers. - * - * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order - * to allow us to interact with peers again, you should call [`PeerManager::process_events`] - * after this. - * - * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high - * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * Checks if two AttributionDatas 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. */ -void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); +bool AttributionData_eq(const struct LDKAttributionData *NONNULL_PTR a, const struct LDKAttributionData *NONNULL_PTR b); /** - * Resolves this future against the given `graph` and with the given `result`. - * - * The given `gossip` is used to broadcast any validated messages onwards to all peers which - * have available buffer space. - * - * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order - * to allow us to interact with peers again, you should call [`PeerManager::process_events`] - * after this. - * - * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high - * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * Serialize the AttributionData object into a byte array which can be read by AttributionData_read */ -void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result); +struct LDKCVec_u8Z AttributionData_write(const struct LDKAttributionData *NONNULL_PTR obj); /** - * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. + * Read a AttributionData from a byte array, created by AttributionData_write */ -void NodeId_free(struct LDKNodeId this_obj); +struct LDKCResult_AttributionDataDecodeErrorZ AttributionData_read(struct LDKu8slice ser); /** - * Creates a copy of the NodeId + * Frees any resources used by the Retry */ -struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); +void Retry_free(struct LDKRetry this_ptr); /** - * Checks if two NodeIds 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. + * Creates a copy of the Retry */ -bool NodeId_eq(const struct LDKNodeId *NONNULL_PTR a, const struct LDKNodeId *NONNULL_PTR b); +struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** - * Create a new NodeId from a public key + * Utility method to constructs a new Attempts-variant Retry */ -MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); +struct LDKRetry Retry_attempts(uint32_t a); /** - * Create a new NodeId from a slice of bytes + * Utility method to constructs a new Timeout-variant Retry */ -MUST_USE_RES struct LDKCResult_NodeIdDecodeErrorZ NodeId_from_slice(struct LDKu8slice bytes); +struct LDKRetry Retry_timeout(uint64_t a); /** - * Get the public key slice from this NodeId + * Checks if two Retrys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); +bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); /** - * Get the public key as an array from this NodeId + * Generates a non-cryptographic 64-bit hash of the Retry. */ -MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR this_arg))[33]; +uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); /** - * Get the public key from this NodeId + * Serialize the Retry object into a byte array which can be read by Retry_read */ -MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); +struct LDKCVec_u8Z Retry_write(const struct LDKRetry *NONNULL_PTR obj); /** - * Get the string representation of a NodeId object + * Read a Retry from a byte array, created by Retry_write */ -struct LDKStr NodeId_to_str(const struct LDKNodeId *NONNULL_PTR o); +struct LDKCResult_RetryDecodeErrorZ Retry_read(struct LDKu8slice ser); /** - * Generates a non-cryptographic 64-bit hash of the NodeId. + * Creates a copy of the RetryableSendFailure */ -uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); +enum LDKRetryableSendFailure RetryableSendFailure_clone(const enum LDKRetryableSendFailure *NONNULL_PTR orig); /** - * Serialize the NodeId object into a byte array which can be read by NodeId_read + * Utility method to constructs a new PaymentExpired-variant RetryableSendFailure */ -struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); +enum LDKRetryableSendFailure RetryableSendFailure_payment_expired(void); /** - * Read a NodeId from a byte array, created by NodeId_write + * Utility method to constructs a new RouteNotFound-variant RetryableSendFailure */ -struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); +enum LDKRetryableSendFailure RetryableSendFailure_route_not_found(void); /** - * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new DuplicatePayment-variant RetryableSendFailure */ -void NetworkGraph_free(struct LDKNetworkGraph this_obj); +enum LDKRetryableSendFailure RetryableSendFailure_duplicate_payment(void); /** - * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new OnionPacketSizeExceeded-variant RetryableSendFailure */ -void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); +enum LDKRetryableSendFailure RetryableSendFailure_onion_packet_size_exceeded(void); /** - * Frees any resources used by the NetworkUpdate + * Checks if two RetryableSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); +bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b); /** - * Creates a copy of the NetworkUpdate + * Frees any resources used by the Bolt11PaymentError */ -struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); +void Bolt11PaymentError_free(struct LDKBolt11PaymentError this_ptr); /** - * Utility method to constructs a new ChannelFailure-variant NetworkUpdate + * Creates a copy of the Bolt11PaymentError */ -struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); +struct LDKBolt11PaymentError Bolt11PaymentError_clone(const struct LDKBolt11PaymentError *NONNULL_PTR orig); /** - * Utility method to constructs a new NodeFailure-variant NetworkUpdate + * Utility method to constructs a new InvalidAmount-variant Bolt11PaymentError */ -struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); +struct LDKBolt11PaymentError Bolt11PaymentError_invalid_amount(void); /** - * Checks if two NetworkUpdates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new SendingFailed-variant Bolt11PaymentError */ -bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); +struct LDKBolt11PaymentError Bolt11PaymentError_sending_failed(enum LDKRetryableSendFailure a); /** - * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read + * Frees any resources used by the Bolt12PaymentError */ -struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); +void Bolt12PaymentError_free(struct LDKBolt12PaymentError this_ptr); /** - * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write + * Creates a copy of the Bolt12PaymentError */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); +struct LDKBolt12PaymentError Bolt12PaymentError_clone(const struct LDKBolt12PaymentError *NONNULL_PTR orig); /** - * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new UnexpectedInvoice-variant Bolt12PaymentError */ -void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); +struct LDKBolt12PaymentError Bolt12PaymentError_unexpected_invoice(void); /** - * Creates a new tracker of the actual state of the network of channels and nodes, - * assuming an existing [`NetworkGraph`]. - * UTXO lookup is used to make sure announced channels exist on-chain, channel data is - * correct, and the announcement is signed with channel owners' keys. + * Utility method to constructs a new DuplicateInvoice-variant Bolt12PaymentError */ -MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); +struct LDKBolt12PaymentError Bolt12PaymentError_duplicate_invoice(void); /** - * Adds a provider used to check new announcements. Does not affect - * existing announcements unless they are updated. - * Add, update or remove the provider would replace the current one. + * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12PaymentError */ -void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); +struct LDKBolt12PaymentError Bolt12PaymentError_unknown_required_features(void); /** - * Handles any network updates originating from [`Event`]s. - * - * [`Event`]: crate::events::Event + * Utility method to constructs a new SendingFailed-variant Bolt12PaymentError */ -void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); +struct LDKBolt12PaymentError Bolt12PaymentError_sending_failed(enum LDKRetryableSendFailure a); /** - * Gets the chain hash for this network graph. + * Utility method to constructs a new BlindedPathCreationFailed-variant Bolt12PaymentError */ -MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKBolt12PaymentError Bolt12PaymentError_blinded_path_creation_failed(void); /** - * Verifies the signature of a [`NodeAnnouncement`]. - * - * Returns an error if it is invalid. + * Checks if two Bolt12PaymentErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); +bool Bolt12PaymentError_eq(const struct LDKBolt12PaymentError *NONNULL_PTR a, const struct LDKBolt12PaymentError *NONNULL_PTR b); /** - * Verifies all signatures included in a [`ChannelAnnouncement`]. - * - * Returns an error if one of the signatures is invalid. + * Frees any resources used by the ProbeSendFailure */ -struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); +void ProbeSendFailure_free(struct LDKProbeSendFailure this_ptr); /** - * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is + * Creates a copy of the ProbeSendFailure */ -struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailure *NONNULL_PTR orig); /** - * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is + * Utility method to constructs a new RouteNotFound-variant ProbeSendFailure */ -struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); +struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); /** - * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new ParameterError-variant ProbeSendFailure */ -void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); +struct LDKProbeSendFailure ProbeSendFailure_parameter_error(struct LDKAPIError a); /** - * The minimum value, which must be relayed to the next hop via the channel + * Utility method to constructs a new DuplicateProbe-variant ProbeSendFailure */ -uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKProbeSendFailure ProbeSendFailure_duplicate_probe(void); /** - * The minimum value, which must be relayed to the next hop via the channel + * Checks if two ProbeSendFailures contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +bool ProbeSendFailure_eq(const struct LDKProbeSendFailure *NONNULL_PTR a, const struct LDKProbeSendFailure *NONNULL_PTR b); /** - * The maximum value which may be relayed to the next hop via the channel. + * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL. */ -uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj); /** - * The maximum value which may be relayed to the next hop via the channel. + * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat + * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. + * + * If you do not have one, the [`Route`] you pay over must not contain multiple paths as + * multi-path payments require a recipient-provided secret. + * + * Some implementations may reject spontaneous payments with payment secrets, so you may only + * want to provide a secret for a spontaneous payment if MPP is needed and you know your + * recipient will not reject it. */ -void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCOption_ThirtyTwoBytesZ RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * Fees charged when the channel is used for routing + * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat + * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to + * authenticate the sender to the recipient and prevent payment-probing (deanonymization) + * attacks. + * + * If you do not have one, the [`Route`] you pay over must not contain multiple paths as + * multi-path payments require a recipient-provided secret. + * + * Some implementations may reject spontaneous payments with payment secrets, so you may only + * want to provide a secret for a spontaneous payment if MPP is needed and you know your + * recipient will not reject it. */ -struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Fees charged when the channel is used for routing + * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of + * arbitrary length. This gives recipients substantially more flexibility to receive + * additional data. + * + * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication + * scheme to authenticate received payments against expected payments and invoices, this field + * is not used in LDK for received payments, and can be used to store arbitrary data in + * invoices which will be received with the payment. + * + * Note that this field was added to the lightning specification more recently than + * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata + * may not be supported as universally. + * + * Returns a copy of the field. */ -void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of + * arbitrary length. This gives recipients substantially more flexibility to receive + * additional data. + * + * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication + * scheme to authenticate received payments against expected payments and invoices, this field + * is not used in LDK for received payments, and can be used to store arbitrary data in + * invoices which will be received with the payment. + * + * Note that this field was added to the lightning specification more recently than + * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata + * may not be supported as universally. */ -uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * When the last update to the channel direction was issued. - * Value is opaque, as set in the announcement. + * Creates a copy of the RecipientOnionFields */ -void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); +struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig); /** - * The difference in CLTV values that you must have when routing through this channel. + * Checks if two RecipientOnionFieldss 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. */ -uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +bool RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b); /** - * The difference in CLTV values that you must have when routing through this channel. + * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read */ -void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); +struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj); /** - * Whether the channel can be currently used for payments (in this one direction). + * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write */ -bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser); /** - * Whether the channel can be currently used for payments (in this one direction). + * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common + * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`] + * but do not require or provide any further data. */ -void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret); /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. + * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create + * payable HTLCs except for single-path spontaneous payments, i.e. this should generally + * only be used for calls to [`ChannelManager::send_spontaneous_payment`]. If you are sending + * a spontaneous MPP this will not work as all MPP require payment secrets; you may + * instead want to use [`RecipientOnionFields::secret_only`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment + * [`RecipientOnionFields::secret_only`]: RecipientOnionFields::secret_only */ -struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void); /** - * Most recent update for the channel received from the network - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. + * 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(())`. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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. */ -void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); +MUST_USE_RES struct LDKCResult_RecipientOnionFieldsNoneZ RecipientOnionFields_with_custom_tlvs(struct LDKRecipientOnionFields this_arg, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs); /** - * Constructs a new ChannelUpdateInfo given each field + * Gets the custom TLVs that will be sent or have been received. * - * Note that last_update_message_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 LDKChannelUpdateInfo ChannelUpdateInfo_new(uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, uint32_t last_update_arg, uint16_t cltv_expiry_delta_arg, bool enabled_arg, struct LDKChannelUpdate last_update_message_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_u64CVec_u8ZZZ RecipientOnionFields_custom_tlvs(const struct LDKRecipientOnionFields *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelUpdateInfo + * Calls the free function if one is set */ -struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); +void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr); /** - * Checks if two ChannelUpdateInfos 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. + * Creates a copy of a Type */ -bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); +struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); /** - * Get the string representation of a ChannelUpdateInfo object + * Calls the free function if one is set */ -struct LDKStr ChannelUpdateInfo_to_str(const struct LDKChannelUpdateInfo *NONNULL_PTR o); +void Type_free(struct LDKType this_ptr); /** - * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read + * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read */ -struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); /** - * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write + * Read a InitFeatures from a byte array, created by InitFeatures_write */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); /** - * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. + * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read */ -void ChannelInfo_free(struct LDKChannelInfo this_obj); +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); /** - * Protocol features of a channel communicated during its announcement + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write */ -struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); /** - * Protocol features of a channel communicated during its announcement + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read */ -void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); /** - * Source node of the first direction of a channel + * Read a NodeFeatures from a byte array, created by NodeFeatures_write */ -struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); /** - * Source node of the first direction of a channel + * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read */ -void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); /** - * Source node of the second direction of a channel + * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write */ -struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); /** - * Source node of the second direction of a channel + * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read */ -void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); +struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write */ -struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); /** - * The channel capacity as seen on-chain, if chain lookup is available. + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read */ -void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); /** - * Details about the first direction of a channel - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write */ -struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); /** - * Details about the first direction of a channel - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read */ -void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); /** - * Details about the second direction of a channel - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write */ -struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); /** - * Details about the second direction of a channel - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the OfferId, if is_owned is set and inner is non-NULL. */ -void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); +void OfferId_free(struct LDKOfferId this_obj); -/** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); +const uint8_t (*OfferId_get_a(const struct LDKOfferId *NONNULL_PTR this_ptr))[32]; + +void OfferId_set_a(struct LDKOfferId *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * An initial announcement of the channel - * Mostly redundant with the data we store in fields explicitly. - * Everything else is useful only for sending out for initial routing sync. - * Not stored if contains excess data to prevent DoS. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Constructs a new OfferId given each field */ -void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); +MUST_USE_RES struct LDKOfferId OfferId_new(struct LDKThirtyTwoBytes a_arg); /** - * Creates a copy of the ChannelInfo + * Creates a copy of the OfferId */ -struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); +struct LDKOfferId OfferId_clone(const struct LDKOfferId *NONNULL_PTR orig); /** - * Checks if two ChannelInfos contain equal inner contents. + * Checks if two OfferIds 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 ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); - -/** - * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); +bool OfferId_eq(const struct LDKOfferId *NONNULL_PTR a, const struct LDKOfferId *NONNULL_PTR b); /** - * Get the string representation of a ChannelInfo object + * Serialize the OfferId object into a byte array which can be read by OfferId_read */ -struct LDKStr ChannelInfo_to_str(const struct LDKChannelInfo *NONNULL_PTR o); +struct LDKCVec_u8Z OfferId_write(const struct LDKOfferId *NONNULL_PTR obj); /** - * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read + * Read a OfferId from a byte array, created by OfferId_write */ -struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); +struct LDKCResult_OfferIdDecodeErrorZ OfferId_read(struct LDKu8slice ser); /** - * Read a ChannelInfo from a byte array, created by ChannelInfo_write + * Frees any resources used by the OfferWithExplicitMetadataBuilder, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); +void OfferWithExplicitMetadataBuilder_free(struct LDKOfferWithExplicitMetadataBuilder this_obj); /** - * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. + * Creates a copy of the OfferWithExplicitMetadataBuilder */ -void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); +struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_clone(const struct LDKOfferWithExplicitMetadataBuilder *NONNULL_PTR orig); /** - * Creates a copy of the DirectedChannelInfo + * Frees any resources used by the OfferWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. */ -struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); +void OfferWithDerivedMetadataBuilder_free(struct LDKOfferWithDerivedMetadataBuilder this_obj); /** - * Returns information for the channel. + * Creates a copy of the OfferWithDerivedMetadataBuilder */ -MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_clone(const struct LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * Returns the [`EffectiveCapacity`] of the channel in the direction. + * Creates a new builder for an offer using the `signing_pubkey` for signing invoices. The + * associated secret key must be remembered while the offer is valid. * - * This is either the total capacity from the funding transaction, if known, or the - * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, - * otherwise. - */ -MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); - -/** - * Returns the `node_id` of the source hop. + * Use a different pubkey per offer to avoid correlating offers. * - * Refers to the `node_id` forwarding the payment to the next hop. - */ -MUST_USE_RES struct LDKNodeId DirectedChannelInfo_source(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); - -/** - * Returns the `node_id` of the target hop. + * # Note * - * Refers to the `node_id` receiving the payment from the previous hop. + * If constructing an [`Offer`] for use with a [`ChannelManager`], use + * [`ChannelManager::create_offer_builder`] instead of [`OfferBuilder::new`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_offer_builder`]: crate::ln::channelmanager::ChannelManager::create_offer_builder */ -MUST_USE_RES struct LDKNodeId DirectedChannelInfo_target(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferWithExplicitMetadataBuilder OfferWithExplicitMetadataBuilder_new(struct LDKPublicKey signing_pubkey); /** - * Frees any resources used by the EffectiveCapacity + * Sets the [`Offer::metadata`] to the given bytes. + * + * Successive calls to this method will override the previous setting. */ -void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_metadata(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKCVec_u8Z metadata); /** - * Creates a copy of the EffectiveCapacity + * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, + * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. + * + * See [`Offer::chains`] on how this relates to the payment currency. + * + * Successive calls to this method will add another chain hash. */ -struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_chain(struct LDKOfferWithExplicitMetadataBuilder this_arg, enum LDKNetwork network); /** - * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity + * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_amount_msats(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t amount_msats); /** - * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_absolute_expiry(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * Utility method to constructs a new Total-variant EffectiveCapacity + * Sets the [`Offer::description`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_description(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr description); /** - * Utility method to constructs a new Infinite-variant EffectiveCapacity + * Sets the [`Offer::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_issuer(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKStr issuer); /** - * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity + * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by + * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_path(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * Utility method to constructs a new Unknown-variant EffectiveCapacity + * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to + * [`Quantity::One`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); +MUST_USE_RES void OfferWithExplicitMetadataBuilder_supported_quantity(struct LDKOfferWithExplicitMetadataBuilder this_arg, struct LDKQuantity quantity); /** - * Returns the effective capacity denominated in millisatoshi. + * Builds an [`Offer`] from the builder's settings. */ -MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithExplicitMetadataBuilder_build(struct LDKOfferWithExplicitMetadataBuilder this_arg); /** - * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read + * Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing + * pubkey is derived from the given [`ExpandedKey`] and [`Nonce`]. This provides recipient + * privacy by using a different signing pubkey for each offer. Otherwise, the provided + * `node_id` is used for [`Offer::issuer_signing_pubkey`]. + * + * Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by + * [`InvoiceRequest::verify_using_metadata`] to determine if the request was produced for the + * offer given an [`ExpandedKey`]. However, if [`OfferBuilder::path`] is called, then the + * metadata will not be set and must be included in each [`BlindedMessagePath`] instead. In this case, + * use [`InvoiceRequest::verify_using_recipient_data`]. + * + * [`InvoiceRequest::verify_using_metadata`]: crate::offers::invoice_request::InvoiceRequest::verify_using_metadata + * [`InvoiceRequest::verify_using_recipient_data`]: crate::offers::invoice_request::InvoiceRequest::verify_using_recipient_data + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); +MUST_USE_RES struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce); /** - * Read a RoutingFees from a byte array, created by RoutingFees_write + * Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called, + * the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported. + * + * See [`Offer::chains`] on how this relates to the payment currency. + * + * Successive calls to this method will add another chain hash. */ -struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_chain(struct LDKOfferWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); /** - * Frees any resources used by the NodeAnnouncementDetails, if is_owned is set and inner is non-NULL. + * Sets the [`Offer::amount`] as an [`Amount::Bitcoin`]. + * + * Successive calls to this method will override the previous setting. */ -void NodeAnnouncementDetails_free(struct LDKNodeAnnouncementDetails this_obj); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_amount_msats(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t amount_msats); /** - * Protocol features the node announced support for + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKNodeFeatures NodeAnnouncementDetails_get_features(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_absolute_expiry(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * Protocol features the node announced support for + * Sets the [`Offer::description`]. + * + * Successive calls to this method will override the previous setting. */ -void NodeAnnouncementDetails_set_features(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_description(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr description); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * Sets the [`Offer::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -uint32_t NodeAnnouncementDetails_get_last_update(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_issuer(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); /** - * When the last known update to the node state was issued. - * Value is opaque, as set in the announcement. + * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by + * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -void NodeAnnouncementDetails_set_last_update(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES void OfferWithDerivedMetadataBuilder_path(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * Color assigned to the node + * Sets the quantity of items for [`Offer::supported_quantity`]. If not called, defaults to + * [`Quantity::One`]. + * + * Successive calls to this method will override the previous setting. */ -const uint8_t (*NodeAnnouncementDetails_get_rgb(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr))[3]; +MUST_USE_RES void OfferWithDerivedMetadataBuilder_supported_quantity(struct LDKOfferWithDerivedMetadataBuilder this_arg, struct LDKQuantity quantity); /** - * Color assigned to the node + * Builds an [`Offer`] from the builder's settings. */ -void NodeAnnouncementDetails_set_rgb(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKThreeBytes val); +MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithDerivedMetadataBuilder_build(struct LDKOfferWithDerivedMetadataBuilder this_arg); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * Frees any resources used by the OfferFromHrn, if is_owned is set and inner is non-NULL. */ -struct LDKNodeAlias NodeAnnouncementDetails_get_alias(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); +void OfferFromHrn_free(struct LDKOfferFromHrn this_obj); /** - * Moniker assigned to the node. - * May be invalid or malicious (eg control chars), - * should not be exposed to the user. + * The offer itself. + * + * When you resolve this into an [`InvoiceRequestBuilder`] you *must* call + * [`InvoiceRequestBuilder::sourced_from_human_readable_name`]. + * + * If you call [`Self::request_invoice`] rather than [`Offer::request_invoice`] this will be + * handled for you. */ -void NodeAnnouncementDetails_set_alias(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeAlias val); +struct LDKOffer OfferFromHrn_get_offer(const struct LDKOfferFromHrn *NONNULL_PTR this_ptr); /** - * Internet-level addresses via which one can connect to the node + * The offer itself. * - * Returns a copy of the field. + * When you resolve this into an [`InvoiceRequestBuilder`] you *must* call + * [`InvoiceRequestBuilder::sourced_from_human_readable_name`]. + * + * If you call [`Self::request_invoice`] rather than [`Offer::request_invoice`] this will be + * handled for you. */ -struct LDKCVec_SocketAddressZ NodeAnnouncementDetails_get_addresses(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); +void OfferFromHrn_set_offer(struct LDKOfferFromHrn *NONNULL_PTR this_ptr, struct LDKOffer val); /** - * Internet-level addresses via which one can connect to the node + * The human readable name which was resolved to fetch the [`Self::offer`]. */ -void NodeAnnouncementDetails_set_addresses(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); +struct LDKHumanReadableName OfferFromHrn_get_hrn(const struct LDKOfferFromHrn *NONNULL_PTR this_ptr); /** - * Constructs a new NodeAnnouncementDetails given each field + * The human readable name which was resolved to fetch the [`Self::offer`]. */ -MUST_USE_RES struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg); +void OfferFromHrn_set_hrn(struct LDKOfferFromHrn *NONNULL_PTR this_ptr, struct LDKHumanReadableName val); /** - * Creates a copy of the NodeAnnouncementDetails + * Constructs a new OfferFromHrn given each field */ -struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_clone(const struct LDKNodeAnnouncementDetails *NONNULL_PTR orig); +MUST_USE_RES struct LDKOfferFromHrn OfferFromHrn_new(struct LDKOffer offer_arg, struct LDKHumanReadableName hrn_arg); /** - * Checks if two NodeAnnouncementDetailss 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. + * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL. */ -bool NodeAnnouncementDetails_eq(const struct LDKNodeAnnouncementDetails *NONNULL_PTR a, const struct LDKNodeAnnouncementDetails *NONNULL_PTR b); +void Offer_free(struct LDKOffer this_obj); /** - * Frees any resources used by the NodeAnnouncementInfo + * Creates a copy of the Offer */ -void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); +struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig); /** - * Creates a copy of the NodeAnnouncementInfo + * 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. */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Relayed-variant NodeAnnouncementInfo + * 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`. */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_relayed(struct LDKNodeAnnouncement a); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Local-variant NodeAnnouncementInfo + * The minimum amount required for a successful payment of a single item. */ -struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_local(struct LDKNodeAnnouncementDetails a); +MUST_USE_RES struct LDKCOption_AmountZ Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Checks if two NodeAnnouncementInfos contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * 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. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); +MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Protocol features the node announced support for + * Features pertaining to the offer. */ -MUST_USE_RES struct LDKNodeFeatures NodeAnnouncementInfo_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferFeatures Offer_offer_features(const struct LDKOffer *NONNULL_PTR this_arg); /** - * When the last known update to the node state was issued. + * Duration since the Unix epoch when an invoice should no longer be requested. * - * Value may or may not be a timestamp, depending on the policy of the origin node. + * If `None`, the offer does not expire. */ -MUST_USE_RES uint32_t NodeAnnouncementInfo_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Color assigned to the node + * 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 LDKThreeBytes NodeAnnouncementInfo_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Moniker assigned to the node. - * - * May be invalid or malicious (eg control chars), should not be exposed to the user. + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -MUST_USE_RES struct LDKNodeAlias NodeAnnouncementInfo_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Internet-level addresses via which one can connect to the node + * The quantity of items supported. */ -MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * An initial announcement of the node + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. * - * Not stored if contains excess data to prevent DoS. + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncementInfo_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Offer_issuer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read + * Returns the id of the offer. */ -struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); +MUST_USE_RES struct LDKOfferId Offer_id(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write + * Returns whether the given chain is supported by the offer. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain); /** - * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. + * Whether the offer has expired. */ -void NodeAlias_free(struct LDKNodeAlias this_obj); - -const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg); -void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +/** + * Whether the offer has expired given the duration since the Unix epoch. + */ +MUST_USE_RES bool Offer_is_expired_no_std(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Constructs a new NodeAlias given each field + * Returns whether the given quantity is valid for the offer. */ -MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); +MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity); /** - * Creates a copy of the NodeAlias + * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ -struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); +MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the NodeAlias. + * Creates an [`InvoiceRequestBuilder`] for the offer, which + * - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used + * for each request in order to protect the sender's privacy, + * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is + * called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine + * if the invoice was requested using a base [`ExpandedKey`] from which the payer id was + * derived, and + * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can + * be used when sending the payment for the requested invoice. + * + * Errors if the offer contains unknown required features. + * + * [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey + * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata + * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); /** - * Checks if two NodeAliass 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. + * Creates an [`InvoiceRequestBuilder`] for the offer, which + * - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used + * for each request in order to protect the sender's privacy, + * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is + * called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine + * if the invoice was requested using a base [`ExpandedKey`] from which the payer id was + * derived, and + * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can + * be used when sending the payment for the requested invoice. + * + * Errors if the offer contains unknown required features. + * + * [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey + * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata + * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ OfferFromHrn_request_invoice(const struct LDKOfferFromHrn *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); /** - * Get the string representation of a NodeAlias object + * Generates a non-cryptographic 64-bit hash of the Offer. */ -struct LDKStr NodeAlias_to_str(const struct LDKNodeAlias *NONNULL_PTR o); +uint64_t Offer_hash(const struct LDKOffer *NONNULL_PTR o); /** - * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read + * Read a Offer from a byte array, created by Offer_write */ -struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); +struct LDKCResult_OfferDecodeErrorZ Offer_read(struct LDKu8slice ser); /** - * Read a NodeAlias from a byte array, created by NodeAlias_write + * Serialize the Offer object into a byte array which can be read by Offer_read */ -struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); +struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj); /** - * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. + * Frees any resources used by the Amount */ -void NodeInfo_free(struct LDKNodeInfo this_obj); +void Amount_free(struct LDKAmount this_ptr); /** - * All valid channels a node has announced - * - * Returns a copy of the field. + * Creates a copy of the Amount */ -struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig); /** - * All valid channels a node has announced + * Utility method to constructs a new Bitcoin-variant Amount */ -void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKAmount Amount_bitcoin(uint64_t amount_msats); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. - * - * Returns a copy of the field. + * Utility method to constructs a new Currency-variant Amount */ -struct LDKCOption_NodeAnnouncementInfoZ NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); +struct LDKAmount Amount_currency(struct LDKCurrencyCode iso4217_code, uint64_t amount); /** - * More information about a node from node_announcement. - * Optional because we store a Node entry after learning about it from - * a channel announcement, but before receiving a node announcement. + * Frees any resources used by the CurrencyCode, if is_owned is set and inner is non-NULL. */ -void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCOption_NodeAnnouncementInfoZ val); +void CurrencyCode_free(struct LDKCurrencyCode this_obj); /** - * Creates a copy of the NodeInfo + * Creates a copy of the CurrencyCode */ -struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); +struct LDKCurrencyCode CurrencyCode_clone(const struct LDKCurrencyCode *NONNULL_PTR orig); /** - * Checks if two NodeInfos contain equal inner contents. + * Checks if two CurrencyCodes 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 NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); +bool CurrencyCode_eq(const struct LDKCurrencyCode *NONNULL_PTR a, const struct LDKCurrencyCode *NONNULL_PTR b); /** - * Returns whether the node has only announced Tor addresses. + * Generates a non-cryptographic 64-bit hash of the CurrencyCode. */ -MUST_USE_RES bool NodeInfo_is_tor_only(const struct LDKNodeInfo *NONNULL_PTR this_arg); +uint64_t CurrencyCode_hash(const struct LDKCurrencyCode *NONNULL_PTR o); /** - * Get the string representation of a NodeInfo object + * Creates a new `CurrencyCode` from a 3-byte array. + * + * Returns an error if the bytes are not valid UTF-8 or not all ASCII uppercase. */ -struct LDKStr NodeInfo_to_str(const struct LDKNodeInfo *NONNULL_PTR o); +MUST_USE_RES struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ CurrencyCode_new(struct LDKThreeBytes code); /** - * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read + * Returns the currency code as a byte array. */ -struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); +MUST_USE_RES const uint8_t (*CurrencyCode_as_bytes(const struct LDKCurrencyCode *NONNULL_PTR this_arg))[3]; /** - * Read a NodeInfo from a byte array, created by NodeInfo_write + * Returns the currency code as a string slice. */ -struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKStr CurrencyCode_as_str(const struct LDKCurrencyCode *NONNULL_PTR this_arg); /** - * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read + * Read a CurrencyCode object from a string */ -struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); +struct LDKCResult_CurrencyCodeCurrencyCodeErrorZ CurrencyCode_from_str(struct LDKStr s); /** - * Read a NetworkGraph from a byte array, created by NetworkGraph_write + * Get the string representation of a CurrencyCode object */ -struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); +struct LDKStr CurrencyCode_to_str(const struct LDKCurrencyCode *NONNULL_PTR o); /** - * Get the string representation of a NetworkGraph object + * Frees any resources used by the Quantity */ -struct LDKStr NetworkGraph_to_str(const struct LDKNetworkGraph *NONNULL_PTR o); +void Quantity_free(struct LDKQuantity this_ptr); /** - * Creates a new, empty, network graph. + * Creates a copy of the Quantity */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); +struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig); /** - * Returns a read-only view of the network graph. + * Utility method to constructs a new Bounded-variant Quantity */ -MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKQuantity Quantity_bounded(uint64_t a); /** - * The unix timestamp provided by the most recent rapid gossip sync. - * It will be set by the rapid sync process after every sync completion. + * Utility method to constructs a new Unbounded-variant Quantity */ -MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +struct LDKQuantity Quantity_unbounded(void); /** - * Update the unix timestamp provided by the most recent rapid gossip sync. - * This should be done automatically by the rapid sync process after every sync completion. + * Utility method to constructs a new One-variant Quantity */ -void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); +struct LDKQuantity Quantity_one(void); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement. - * - * You probably don't want to call this directly, instead relying on a P2PGossipSync's - * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. + * Read a Offer object from a string */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); +struct LDKCResult_OfferBolt12ParseErrorZ Offer_from_str(struct LDKStr s); /** - * For an already known node (from channel announcements), update its stored properties from a - * given node announcement without verifying the associated signatures. Because we aren't - * given the associated signatures here we cannot relay the node announcement to any of our - * peers. + * Get the string representation of a Offer object */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); +struct LDKStr Offer_to_str(const struct LDKOffer *NONNULL_PTR o); /** - * Store or update channel info from a channel announcement. - * - * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s - * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. - * - * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. + * Frees any resources used by the CurrencyCodeError, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); +void CurrencyCodeError_free(struct LDKCurrencyCodeError this_obj); /** - * Store or update channel info from a channel announcement. - * - * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s - * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. - * - * This will skip verification of if the channel is actually on-chain. + * Constructs a new CurrencyCodeError given each field */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement_no_lookup(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); +MUST_USE_RES struct LDKCurrencyCodeError CurrencyCodeError_new(void); /** - * Store or update channel info from a channel announcement without verifying the associated - * signatures. Because we aren't given the associated signatures here we cannot relay the - * channel announcement to any of our peers. - * - * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify - * the corresponding UTXO exists on chain and is correctly-formatted. + * Creates a copy of the CurrencyCodeError */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); +struct LDKCurrencyCodeError CurrencyCodeError_clone(const struct LDKCurrencyCodeError *NONNULL_PTR orig); /** - * Update channel from partial announcement data received via rapid gossip sync - * - * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the - * rapid gossip sync server) - * - * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. + * Checks if two CurrencyCodeErrors 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. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2); +bool CurrencyCodeError_eq(const struct LDKCurrencyCodeError *NONNULL_PTR a, const struct LDKCurrencyCodeError *NONNULL_PTR b); /** - * Marks a channel in the graph as failed permanently. - * - * The channel and any node for which this was their last channel are removed from the graph. + * Get the string representation of a CurrencyCodeError object */ -void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); +struct LDKStr CurrencyCodeError_to_str(const struct LDKCurrencyCodeError *NONNULL_PTR o); /** - * Marks a node in the graph as permanently failed, effectively removing it and its channels - * from local storage. + * Frees any resources used by the OffersMessageFlow, if is_owned is set and inner is non-NULL. */ -void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); +void OffersMessageFlow_free(struct LDKOffersMessageFlow this_obj); /** - * Removes information about channels that we haven't heard any updates about in some time. - * This can be used regularly to prune the network graph of channels that likely no longer - * exist. - * - * While there is no formal requirement that nodes regularly re-broadcast their channel - * updates every two weeks, the non-normative section of BOLT 7 currently suggests that - * pruning occur for updates which are at least two weeks old, which we implement here. - * - * Note that for users of the `lightning-background-processor` crate this method may be - * automatically called regularly for you. + * Creates a new [`OffersMessageFlow`] + */ +MUST_USE_RES struct LDKOffersMessageFlow OffersMessageFlow_new(struct LDKThirtyTwoBytes chain_hash, struct LDKBestBlock best_block, struct LDKPublicKey our_network_pubkey, uint32_t current_timestamp, struct LDKExpandedKey inbound_payment_key, struct LDKReceiveAuthKey receive_auth_key, struct LDKMessageRouter message_router, struct LDKLogger logger); + +/** + * If we are an async recipient, on startup we'll interactively build offers and static invoices + * with an always-online node that will serve static invoices on our behalf. Once the offer is + * built and the static invoice is confirmed as persisted by the server, the underlying + * [`AsyncReceiveOfferCache`] should be persisted using + * [`Self::writeable_async_receive_offer_cache`] so we remember the offers we've built. + */ +MUST_USE_RES struct LDKOffersMessageFlow OffersMessageFlow_with_async_payments_offers_cache(struct LDKOffersMessageFlow this_arg, struct LDKAsyncReceiveOfferCache async_receive_offer_cache); + +/** + * Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build + * [`Offer`]s with a static invoice server, so the server can serve [`StaticInvoice`]s to payers + * on our behalf when we're offline. * - * This method will also cause us to stop tracking removed nodes and channels if they have been - * in the map for a while so that these can be resynced from gossip in the future. + * This method will also send out messages initiating async offer creation to the static invoice + * server, if any peers are connected. * - * This method is only available with the `std` feature. See - * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for non-`std` use. + * This method only needs to be called once when the server first takes on the recipient as a + * client, or when the paths change, e.g. if the paths are set to expire at a particular time. */ -void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ OffersMessageFlow_set_paths_to_static_invoice_server(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKCVec_BlindedMessagePathZ paths_to_static_invoice_server, struct LDKCVec_MessageForwardNodeZ peers); /** - * Removes information about channels that we haven't heard any updates about in some time. - * This can be used regularly to prune the network graph of channels that likely no longer - * exist. - * - * While there is no formal requirement that nodes regularly re-broadcast their channel - * updates every two weeks, the non-normative section of BOLT 7 currently suggests that - * pruning occur for updates which are at least two weeks old, which we implement here. + * Notifies the [`OffersMessageFlow`] that a new block has been observed. * - * This method will also cause us to stop tracking removed nodes and channels if they have been - * in the map for a while so that these can be resynced from gossip in the future. + * This allows the flow to keep in sync with the latest block timestamp, + * which may be used for time-sensitive operations. * - *This function takes the current unix time as an argument. For users with the `std` feature - *enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. + * Must be called whenever a new chain tip becomes available. May be skipped + * for intermediary blocks. */ -void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); +void OffersMessageFlow_best_block_updated(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t _height); /** - * For an already known (from announcement) channel, update info about one of the directions - * of the channel. + * [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively + * build [`Offer`]s and [`StaticInvoice`]s for receiving async payments. * - * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s - * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept - * routing messages from a source using a protocol other than the lightning P2P protocol. + * If `relative_expiry` is unset, the [`BlindedMessagePath`]s will never expire. * - * If not built with `std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * Returns the paths that the recipient should be configured with via + * [`Self::set_paths_to_static_invoice_server`]. + * + * Errors if blinded path creation fails or the provided `recipient_id` is larger than 1KiB. */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +MUST_USE_RES struct LDKCResult_CVec_BlindedMessagePathZNoneZ OffersMessageFlow_blinded_paths_for_async_recipient(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKCVec_u8Z recipient_id, struct LDKCOption_u64Z relative_expiry, struct LDKCVec_MessageForwardNodeZ peers); /** - * For an already known (from announcement) channel, update info about one of the directions - * of the channel without verifying the associated signatures. Because we aren't given the - * associated signatures here we cannot relay the channel update to any of our peers. - * - * If not built with `std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * Frees any resources used by the InvreqResponseInstructions */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +void InvreqResponseInstructions_free(struct LDKInvreqResponseInstructions this_ptr); /** - * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. - * - * This checks whether the update currently is applicable by [`Self::update_channel`]. - * - * If not built with `std`, any updates with a timestamp more than two weeks in the past or - * materially in the future will be rejected. + * Creates a copy of the InvreqResponseInstructions */ -MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); +struct LDKInvreqResponseInstructions InvreqResponseInstructions_clone(const struct LDKInvreqResponseInstructions *NONNULL_PTR orig); /** - * Returns information on a channel with the given id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new SendInvoice-variant InvreqResponseInstructions */ -MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); +struct LDKInvreqResponseInstructions InvreqResponseInstructions_send_invoice(struct LDKVerifiedInvoiceRequest a); /** - * Returns the list of channels in the graph + * Utility method to constructs a new SendStaticInvoice-variant InvreqResponseInstructions */ -MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +struct LDKInvreqResponseInstructions InvreqResponseInstructions_send_static_invoice(struct LDKCVec_u8Z recipient_id, uint16_t invoice_slot, struct LDKInvoiceRequest invoice_request); /** - * Returns information on a node with the given id. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the HeldHtlcReplyPath */ -MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +void HeldHtlcReplyPath_free(struct LDKHeldHtlcReplyPath this_ptr); /** - * Returns the list of nodes in the graph + * Creates a copy of the HeldHtlcReplyPath */ -MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); +struct LDKHeldHtlcReplyPath HeldHtlcReplyPath_clone(const struct LDKHeldHtlcReplyPath *NONNULL_PTR orig); /** - * Get network addresses by node id. - * Returns None if the requested node is completely unknown, - * or if node announcement for the node was never received. + * Utility method to constructs a new ToUs-variant HeldHtlcReplyPath */ -MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +struct LDKHeldHtlcReplyPath HeldHtlcReplyPath_to_us(struct LDKThirtyTwoBytes payment_id, struct LDKCVec_MessageForwardNodeZ peers); /** - * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new ToCounterparty-variant HeldHtlcReplyPath */ -void DefaultRouter_free(struct LDKDefaultRouter this_obj); +struct LDKHeldHtlcReplyPath HeldHtlcReplyPath_to_counterparty(struct LDKBlindedMessagePath path); /** - * Creates a new router. + * Verifies an [`InvoiceRequest`] using the provided [`OffersContext`] or the [`InvoiceRequest::metadata`]. + * + * - If an [`OffersContext::InvoiceRequest`] with a `nonce` is provided, verification is performed using recipient context data. + * - If no context is provided but the [`InvoiceRequest`] contains [`Offer`] metadata, verification is performed using that metadata. + * - If neither is available, verification fails. + * + * # Errors + * + * Returns an error if: + * - Both [`OffersContext`] and [`InvoiceRequest`] metadata are absent or invalid. + * - The verification process (via recipient context data or metadata) fails. */ -MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); +MUST_USE_RES struct LDKCResult_InvreqResponseInstructionsNoneZ OffersMessageFlow_verify_invoice_request(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKInvoiceRequest invoice_request, struct LDKCOption_OffersContextZ context); /** - * Constructs a new Router which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is + * Verifies a [`Bolt12Invoice`] using the provided [`OffersContext`] or the invoice's payer metadata, + * returning the corresponding [`PaymentId`] if successful. + * + * - If an [`OffersContext::OutboundPayment`] with a `nonce` is provided, verification is performed + * using this to form the payer metadata. + * - If no context is provided and the invoice corresponds to a [`Refund`] without blinded paths, + * verification is performed using the [`Bolt12Invoice::payer_metadata`]. + * - If neither condition is met, verification fails. */ -struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ OffersMessageFlow_verify_bolt12_invoice(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const struct LDKBolt12Invoice *NONNULL_PTR invoice, struct LDKCOption_OffersContextZ context); /** - * Calls the free function if one is set + * Verifies the provided [`AsyncPaymentsContext`] for an inbound [`HeldHtlcAvailable`] message. + * + * Because blinded path contexts are verified as a part of onion message processing, this only + * validates that the context is not yet expired based on `path_absolute_expiry`. + * + * # Errors + * + * Returns `Err(())` if: + * - The inbound payment context has expired. */ -void Router_free(struct LDKRouter this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ OffersMessageFlow_verify_inbound_async_payment_context(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKAsyncPaymentsContext context); /** - * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. + * Creates a response for the provided [`VerifiedInvoiceRequest`]. + * + * A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`], + * or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`]. + * + * An [`OffersMessage::InvoiceError`] will be generated if: + * - We fail to generate valid payment paths to include in the [`Bolt12Invoice`]. + * - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`]. */ -void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); +MUST_USE_RES struct LDKC2Tuple_OffersMessageCOption_MessageContextZZ OffersMessageFlow_create_response_for_invoice_request(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR signer, const struct LDKRouter *NONNULL_PTR router, struct LDKEntropySource entropy_source, struct LDKVerifiedInvoiceRequest invoice_request, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_ChannelDetailsZ usable_channels); /** - * Initialize a new `ScorerAccountingForInFlightHtlcs`. + * Enqueues the created [`InvoiceRequest`] to be sent to the counterparty. + * + * # Payment + * + * The provided `payment_id` is used to create a unique [`MessageContext`] for the + * blinded paths sent to the counterparty. This allows them to respond with an invoice, + * over those blinded paths, which can be verified against the intended outbound payment, + * ensuring the invoice corresponds to a payment we actually want to make. + * + * # Nonce + * The nonce is used to create a unique [`MessageContext`] for the reply paths. + * These will be used to verify the corresponding [`Bolt12Invoice`] when it is received. + * + * Note: The provided [`Nonce`] MUST be the same as the [`Nonce`] used for creating the + * [`InvoiceRequest`] to ensure correct verification of the corresponding [`Bolt12Invoice`]. + * + * See [`OffersMessageFlow::create_invoice_request_builder`] for more details. + * + * # Peers + * + * The user must provide a list of [`MessageForwardNode`] that will be used to generate + * valid reply paths for the counterparty to send back the corresponding [`Bolt12Invoice`] + * or [`InvoiceError`]. + * + * [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages */ -MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OffersMessageFlow_enqueue_invoice_request(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKInvoiceRequest invoice_request, struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, struct LDKCVec_MessageForwardNodeZ peers); /** - * 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 + * Enqueues the created [`Bolt12Invoice`] corresponding to a [`Refund`] to be sent + * to the counterparty. + * + * # Peers + * + * The user must provide a list of [`MessageForwardNode`] that will be used to generate valid + * reply paths for the counterparty to send back the corresponding [`InvoiceError`] if we fail + * to create blinded reply paths + * + * [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages */ -struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OffersMessageFlow_enqueue_invoice(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKBolt12Invoice invoice, const struct LDKRefund *NONNULL_PTR refund, struct LDKCVec_MessageForwardNodeZ peers); /** - * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. + * Forwards a [`StaticInvoice`] over the provided [`Responder`] in response to an + * [`InvoiceRequest`] that we as a static invoice server received on behalf of an often-offline + * recipient. */ -void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OffersMessageFlow_enqueue_static_invoice(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKStaticInvoice invoice, struct LDKResponder responder); /** - * Creates a copy of the InFlightHtlcs + * Forwards an [`InvoiceRequest`] to the specified [`BlindedMessagePath`]. If we receive an + * invoice request as a static invoice server on behalf of an often-offline recipient this + * can be used to forward the request to give the recipient a chance to provide an + * invoice if the recipient is online. The reply_path [`Responder`] provided is the path to + * the sender where the recipient can send the invoice. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`Responder`]: crate::onion_message::messenger::Responder */ -struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); +void OffersMessageFlow_enqueue_invoice_request_to_forward(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKInvoiceRequest invoice_request, struct LDKBlindedMessagePath destination, struct LDKResponder reply_path); /** - * Constructs an empty `InFlightHtlcs`. + * Enqueues `held_htlc_available` onion messages to be sent to the payee via the reply paths + * contained within the provided [`StaticInvoice`]. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + * [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages */ -MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OffersMessageFlow_enqueue_held_htlc_available(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const struct LDKStaticInvoice *NONNULL_PTR invoice, struct LDKHeldHtlcReplyPath reply_path_params); /** - * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`. + * If we are holding an HTLC on behalf of an often-offline sender, this method allows us to + * create a path for the sender to use as the reply path when they send the recipient a + * [`HeldHtlcAvailable`] onion message, so the recipient's [`ReleaseHeldHtlc`] response will be + * received to our node. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc */ -void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id); +MUST_USE_RES struct LDKBlindedMessagePath OffersMessageFlow_path_for_release_held_htlc(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, uint64_t prev_outbound_scid_alias, uint64_t htlc_id, struct LDKEntropySource entropy); /** - * Adds a known HTLC given the public key of the HTLC source, target, and short channel - * id. + * Enqueues the created [`DNSSECQuery`] to be sent to the counterparty. + * + * # Peers + * + * The user must provide a list of [`MessageForwardNode`] that will be used to generate + * valid reply paths for the counterparty to send back the corresponding response for + * the [`DNSSECQuery`] message. + * + * [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages */ -void InFlightHtlcs_add_inflight_htlc(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid, uint64_t used_msat); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ OffersMessageFlow_enqueue_dns_onion_message(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKDNSSECQuery message, struct LDKDNSResolverContext context, struct LDKCVec_DestinationZ dns_resolvers, struct LDKCVec_MessageForwardNodeZ peers); /** - * Returns liquidity in msat given the public key of the HTLC source, target, and short channel - * id. + * Gets the enqueued [`OffersMessage`] with their corresponding [`MessageSendInstructions`]. */ -MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid); +MUST_USE_RES struct LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ OffersMessageFlow_release_pending_offers_messages(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg); /** - * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read + * Gets the enqueued [`AsyncPaymentsMessage`] with their corresponding [`MessageSendInstructions`]. */ -struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); +MUST_USE_RES struct LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ OffersMessageFlow_release_pending_async_messages(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg); /** - * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write + * Gets the enqueued [`DNSResolverMessage`] with their corresponding [`MessageSendInstructions`]. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ OffersMessageFlow_release_pending_dns_messages(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg); /** - * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. + * Retrieve an [`Offer`] for receiving async payments as an often-offline recipient. Will only + * return an offer if [`Self::set_paths_to_static_invoice_server`] was called and we succeeded in + * interactively building a [`StaticInvoice`] with the static invoice server. + * + * Returns the requested offer as well as a bool indicating whether the cache needs to be + * persisted using [`Self::writeable_async_receive_offer_cache`]. */ -void RouteHop_free(struct LDKRouteHop this_obj); +MUST_USE_RES struct LDKCResult_C2Tuple_OfferboolZNoneZ OffersMessageFlow_get_async_receive_offer(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg); /** - * The node_id of the node at this hop. + * Sends out [`OfferPathsRequest`] and [`ServeStaticInvoice`] onion messages if we are an + * often-offline recipient and are configured to interactively build offers and static invoices + * with a static invoice server. + * + * # Usage + * + * This method should be called on peer connection and once per minute or so, to keep the offers + * cache updated. When calling this method once per minute, SHOULD set `timer_tick_occurred` so + * the cache can self-regulate the number of messages sent out. + * + * Errors if we failed to create blinded reply paths when sending an [`OfferPathsRequest`] message. */ -struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ OffersMessageFlow_check_refresh_async_receive_offer_cache(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKCVec_MessageForwardNodeZ peers, struct LDKCVec_ChannelDetailsZ usable_channels, struct LDKEntropySource entropy, struct LDKRouter router, bool timer_tick_occurred); /** - * The node_id of the node at this hop. + * Handles an incoming [`OfferPathsRequest`] onion message from an often-offline recipient who + * wants us (the static invoice server) to serve [`StaticInvoice`]s to payers on their behalf. + * Sends out [`OfferPaths`] onion messages in response. */ -void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCOption_C2Tuple_OfferPathsMessageContextZZ OffersMessageFlow_handle_offer_paths_request(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const struct LDKOfferPathsRequest *NONNULL_PTR request, struct LDKAsyncPaymentsContext context, struct LDKCVec_MessageForwardNodeZ peers); /** - * The node_announcement features of the node at this hop. For the last hop, these may be - * amended to match the features present in the invoice this node generated. + * Handles an incoming [`OfferPaths`] message from the static invoice server, sending out + * [`ServeStaticInvoice`] onion messages in response if we've built a new async receive offer and + * need the corresponding [`StaticInvoice`] to be persisted by the static invoice server. + * + * Returns `None` if we have enough offers cached already, verification of `message` fails, or we + * fail to create blinded paths. */ -struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ OffersMessageFlow_handle_offer_paths(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKOfferPaths message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder, struct LDKCVec_MessageForwardNodeZ peers, struct LDKCVec_ChannelDetailsZ usable_channels, struct LDKEntropySource entropy, struct LDKRouter router); /** - * The node_announcement features of the node at this hop. For the last hop, these may be - * amended to match the features present in the invoice this node generated. + * Verifies an incoming [`ServeStaticInvoice`] onion message from an often-offline recipient who + * wants us as a static invoice server to serve the [`ServeStaticInvoice::invoice`] to payers on + * their behalf. + * + * On success, returns `(recipient_id, invoice_slot)` for use in persisting and later retrieving + * the static invoice from the database. + * + * Errors if the [`ServeStaticInvoice::invoice`] is expired or larger than + * [`MAX_STATIC_INVOICE_SIZE_BYTES`]. + * + * [`ServeStaticInvoice::invoice`]: crate::onion_message::async_payments::ServeStaticInvoice::invoice */ -void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); +MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ OffersMessageFlow_verify_serve_static_invoice_message(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, const struct LDKServeStaticInvoice *NONNULL_PTR message, struct LDKAsyncPaymentsContext context); /** - * The channel that should be used from the previous hop to reach this node. + * Indicates that a [`ServeStaticInvoice::invoice`] has been persisted and is ready to be served + * to payers on behalf of an often-offline recipient. This method must be called after persisting + * a [`StaticInvoice`] to confirm to the recipient that their corresponding [`Offer`] is ready to + * receive async payments. */ -uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); +void OffersMessageFlow_static_invoice_persisted(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKResponder responder); /** - * The channel that should be used from the previous hop to reach this node. + * Handles an incoming [`StaticInvoicePersisted`] onion message from the static invoice server. + * Returns a bool indicating whether the async receive offer cache needs to be re-persisted using + * [`Self::writeable_async_receive_offer_cache`]. + * + * [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted */ -void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool OffersMessageFlow_handle_static_invoice_persisted(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg, struct LDKAsyncPaymentsContext context); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Get the encoded [`AsyncReceiveOfferCache`] for persistence. */ -struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_u8Z OffersMessageFlow_writeable_async_receive_offer_cache(const struct LDKOffersMessageFlow *NONNULL_PTR this_arg); /** - * The channel_announcement features of the channel that should be used from the previous hop - * to reach this node. + * Frees any resources used by the AsyncReceiveOfferCache, if is_owned is set and inner is non-NULL. */ -void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); +void AsyncReceiveOfferCache_free(struct LDKAsyncReceiveOfferCache this_obj); /** - * The fee taken on this hop (for paying for the use of the *next* channel in the path). - * If this is the last hop in [`Path::hops`]: - * * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire - * blinded path - * * otherwise, this is the full value of this [`Path`]'s part of the payment + * Creates an empty [`AsyncReceiveOfferCache`] to be passed into [`OffersMessageFlow`]. + * + * [`OffersMessageFlow`]: crate::offers::flow::OffersMessageFlow */ -uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKAsyncReceiveOfferCache AsyncReceiveOfferCache_new(void); /** - * The fee taken on this hop (for paying for the use of the *next* channel in the path). - * If this is the last hop in [`Path::hops`]: - * * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire - * blinded path - * * otherwise, this is the full value of this [`Path`]'s part of the payment + * Serialize the AsyncReceiveOfferCache object into a byte array which can be read by AsyncReceiveOfferCache_read */ -void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); +struct LDKCVec_u8Z AsyncReceiveOfferCache_write(const struct LDKAsyncReceiveOfferCache *NONNULL_PTR obj); /** - * The CLTV delta added for this hop. - * If this is the last hop in [`Path::hops`]: - * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded - * path - * * otherwise, this is the CLTV delta expected at the destination + * Read a AsyncReceiveOfferCache from a byte array, created by AsyncReceiveOfferCache_write */ -uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); +struct LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ AsyncReceiveOfferCache_read(struct LDKu8slice ser); /** - * The CLTV delta added for this hop. - * If this is the last hop in [`Path::hops`]: - * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded - * path - * * otherwise, this is the CLTV delta expected at the destination + * Frees any resources used by the InvoiceWithExplicitSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); +void InvoiceWithExplicitSigningPubkeyBuilder_free(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_obj); /** - * 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. + * Frees any resources used by the InvoiceWithDerivedSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); +void InvoiceWithDerivedSigningPubkeyBuilder_free(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj); /** - * 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. + * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. */ -void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); +MUST_USE_RES struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ InvoiceWithExplicitSigningPubkeyBuilder_build(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); /** - * Constructs a new RouteHop given each field + *Sets the [`Bolt12Invoice::relative_expiry`] + *as seconds since [`Bolt12Invoice::created_at`]. + *Any expiry that has already passed is valid and can be checked for using + *[`Bolt12Invoice::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -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); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); /** - * Creates a copy of the RouteHop + *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. */ -struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); /** - * Generates a non-cryptographic 64-bit hash of the RouteHop. + *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. */ -uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); /** - * Checks if two RouteHops 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. + *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. */ -bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); /** - * Serialize the RouteHop object into a byte array which can be read by RouteHop_read + *Sets [`Bolt12Invoice::invoice_features`] + *to indicate MPP may be used. Otherwise, MPP is disallowed. */ -struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); +MUST_USE_RES void InvoiceWithExplicitSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); /** - * Read a RouteHop from a byte array, created by RouteHop_write + * Builds a signed [`Bolt12Invoice`] after checking for valid semantics. */ -struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ InvoiceWithDerivedSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); /** - * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL. + *Sets the [`Bolt12Invoice::relative_expiry`] + *as seconds since [`Bolt12Invoice::created_at`]. + *Any expiry that has already passed is valid and can be checked for using + *[`Bolt12Invoice::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -void BlindedTail_free(struct LDKBlindedTail this_obj); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_relative_expiry(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, uint32_t relative_expiry_secs); /** - * The hops of the [`BlindedPaymentPath`] provided by the recipient. + *Adds a P2WSH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WSH addresses. */ -struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wsh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*script_hash)[32]); /** - * The hops of the [`BlindedPaymentPath`] provided by the recipient. + *Adds a P2WPKH address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses. */ -void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v0_p2wpkh(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, const uint8_t (*pubkey_hash)[20]); /** - * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. + *Adds a P2TR address to [`Bolt12Invoice::fallbacks`]. + * + * Successive calls to this method will add another address. Caller is responsible for not + * adding duplicate addresses and only calling if capable of receiving to P2TR addresses. */ -struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_fallback_v1_p2tr_tweaked(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg, struct LDKTweakedPublicKey output_key); /** - * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. + *Sets [`Bolt12Invoice::invoice_features`] + *to indicate MPP may be used. Otherwise, MPP is disallowed. */ -void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES void InvoiceWithDerivedSigningPubkeyBuilder_allow_mpp(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_arg); /** - * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from - * inferring the destination. May be 0. + * Frees any resources used by the UnsignedBolt12Invoice, if is_owned is set and inner is non-NULL. */ -uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +void UnsignedBolt12Invoice_free(struct LDKUnsignedBolt12Invoice this_obj); /** - * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from - * inferring the destination. May be 0. + * Creates a copy of the UnsignedBolt12Invoice */ -void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val); +struct LDKUnsignedBolt12Invoice UnsignedBolt12Invoice_clone(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR orig); /** - * The total amount paid on this [`Path`], excluding the fees. + * Calls the free function if one is set */ -uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr); +void SignBolt12InvoiceFn_free(struct LDKSignBolt12InvoiceFn this_ptr); /** - * The total amount paid on this [`Path`], excluding the fees. + * Returns the [`TaggedHash`] of the invoice to sign. */ -void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKTaggedHash UnsignedBolt12Invoice_tagged_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Constructs a new BlindedTail given each field + * Frees any resources used by the Bolt12Invoice, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKBlindedTail BlindedTail_new(struct LDKCVec_BlindedHopZ hops_arg, struct LDKPublicKey blinding_point_arg, uint32_t excess_final_cltv_expiry_delta_arg, uint64_t final_value_msat_arg); +void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); /** - * Creates a copy of the BlindedTail + * Creates a copy of the Bolt12Invoice */ -struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig); +struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the BlindedTail. + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. + * + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`UnsignedBolt12Invoice::signing_pubkey`]. */ -uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o); +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ UnsignedBolt12Invoice_payment_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Checks if two BlindedTails 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. + * Duration since the Unix epoch when the invoice was created. */ -bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read + * Duration since + *[`UnsignedBolt12Invoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a BlindedTail from a byte array, created by BlindedTail_write + * Whether the invoice has expired. */ -struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser); +MUST_USE_RES bool UnsignedBolt12Invoice_is_expired(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the Path, if is_owned is set and inner is non-NULL. + * Whether the invoice has expired given the current time as duration since the Unix epoch. */ -void Path_free(struct LDKPath this_obj); +MUST_USE_RES bool UnsignedBolt12Invoice_is_expired_no_std(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * The list of unblinded hops in this [`Path`]. Must be at least length one. + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_AddressZ UnsignedBolt12Invoice_fallbacks(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The list of unblinded hops in this [`Path`]. Must be at least length one. + * Features pertaining to paying an invoice. */ -void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val); +MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * A typically transient public key corresponding to the key used to sign the invoice. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr); - -/** - * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * If the invoices was created in response to an [`Offer`], then this will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by + * the recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths + * [`Refund`]: crate::offers::refund::Refund */ -void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Constructs a new Path given each field + * The chains that may be used when paying a requested invoice. * - * Note that blinded_tail_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * 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 LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ UnsignedBolt12Invoice_offer_chains(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Creates a copy of the Path + * 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 */ -struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_chain(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Path. + * 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 */ -uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedBolt12Invoice_metadata(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Checks if two Paths 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. + * 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 */ -bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b); +MUST_USE_RES struct LDKCOption_AmountZ UnsignedBolt12Invoice_amount(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Gets the fees for a given path, excluding any excess paid to the recipient. + * 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 uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferFeatures UnsignedBolt12Invoice_offer_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Gets the total amount paid on this [`Path`], excluding the fees. + * 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 + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_description(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Gets the final hop's CLTV expiry delta. + * 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_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_absolute_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. + * 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 */ -void Route_free(struct LDKRoute this_obj); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_issuer(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no - * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be - * the same. + * Paths to the recipient originating from publicly reachable nodes. + * + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedBolt12Invoice_message_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no - * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be - * the same. + * 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 */ -void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); +MUST_USE_RES struct LDKCOption_QuantityZ UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The `route_params` parameter passed to [`find_route`]. + * The public key used by the recipient to sign invoices. * - * This is used by `ChannelManager` to track information which may be required for retries. + * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was + * created in response to a [`Refund`]. * - * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_issuer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The `route_params` parameter passed to [`find_route`]. + * An unpredictable series of bytes from the payer. * - * This is used by `ChannelManager` to track information which may be required for retries. + * 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. * - * Will be `None` for objects serialized with LDK versions prior to 0.0.117. + * 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. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. */ -void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); +MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Constructs a new Route given each field + * 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`]. * - * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`message_paths`]: Self::message_paths */ -MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Creates a copy of the Route + * 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 */ -struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString UnsignedBolt12Invoice_payer_note(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Route. + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. */ -uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Checks if two Routes 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. + * The minimum amount required for a successful payment of the invoice. */ -bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); +MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * Returns the total amount of fees paid on this [`Route`]. - * - * 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. + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. * - * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`Bolt12Invoice::signing_pubkey`]. */ -MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ Bolt12Invoice_payment_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * 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 + * Duration since the Unix epoch when the invoice was created. */ -MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t Bolt12Invoice_created_at(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Get the string representation of a Route object + * Duration since + *[`Bolt12Invoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -struct LDKStr Route_to_str(const struct LDKRoute *NONNULL_PTR o); +MUST_USE_RES uint64_t Bolt12Invoice_relative_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the Route object into a byte array which can be read by Route_read + * Whether the invoice has expired. */ -struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); +MUST_USE_RES bool Bolt12Invoice_is_expired(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a Route from a byte array, created by Route_write + * Whether the invoice has expired given the current time as duration since the Unix epoch. */ -struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); +MUST_USE_RES bool Bolt12Invoice_is_expired_no_std(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -void RouteParameters_free(struct LDKRouteParameters this_obj); +MUST_USE_RES struct LDKCVec_AddressZ Bolt12Invoice_fallbacks(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The parameters of the failed payment path. + * Features pertaining to paying an invoice. */ -struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The parameters of the failed payment path. + * A typically transient public key corresponding to the key used to sign the invoice. + * + * If the invoices was created in response to an [`Offer`], then this will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. + * + * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by + * the recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths + * [`Refund`]: crate::offers::refund::Refund */ -void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The amount in msats sent on the failed payment path. + * 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 */ -uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_CVec_ThirtyTwoBytesZZ Bolt12Invoice_offer_chains(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The amount in msats sent on the failed payment path. + * 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 */ -void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_chain(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum total fees, in millisatoshi, that may accrue during route finding. + * Opaque bytes set by the originating [`Offer`]. * - * This limit also applies to the total fees that may arise while retrying failed payment - * paths. + * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or + * if the [`Offer`] did not set it. * - * Note that values below a few sats may result in some paths being spuriously ignored. + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ -struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt12Invoice_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum total fees, in millisatoshi, that may accrue during route finding. + * The minimum amount required for a successful payment of a single item. * - * This limit also applies to the total fees that may arise while retrying failed payment - * paths. + * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if + * the [`Offer`] did not set it. * - * Note that values below a few sats may result in some paths being spuriously ignored. + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::amount`]: crate::offers::offer::Offer::amount */ -void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKCOption_AmountZ Bolt12Invoice_amount(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Constructs a new RouteParameters given each field + * 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 LDKRouteParameters RouteParameters_new(struct LDKPaymentParameters payment_params_arg, uint64_t final_value_msat_arg, struct LDKCOption_u64Z max_total_routing_fee_msat_arg); +MUST_USE_RES struct LDKOfferFeatures Bolt12Invoice_offer_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Creates a copy of the RouteParameters + * 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 + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_description(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RouteParameters. + * 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 */ -uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_absolute_expiry(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * 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. + * 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 */ -bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_issuer(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Constructs [`RouteParameters`] from the given [`PaymentParameters`] and a payment amount. + * Paths to the recipient originating from publicly reachable nodes. * - * [`Self::max_total_routing_fee_msat`] defaults to 1% of the payment amount + 50 sats + * From [`Offer::paths`] or [`Refund::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Bolt12Invoice_message_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Sets the maximum number of hops that can be included in a payment path, based on the provided - * [`RecipientOnionFields`] and blinded paths. + * 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 */ -MUST_USE_RES struct LDKCResult_NoneNoneZ RouteParameters_set_max_path_length(struct LDKRouteParameters *NONNULL_PTR this_arg, const struct LDKRecipientOnionFields *NONNULL_PTR recipient_onion, bool is_keysend, uint32_t best_block_height); +MUST_USE_RES struct LDKCOption_QuantityZ Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read + * The public key used by the recipient to sign invoices. + * + * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was + * created in response to a [`Refund`]. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_issuer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Read a RouteParameters from a byte array, created by RouteParameters_write + * An unpredictable series of bytes from the payer. + * + * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. */ -struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKu8slice Bolt12Invoice_payer_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. + * Features pertaining to requesting an invoice. + * + * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. */ -void PaymentParameters_free(struct LDKPaymentParameters this_obj); +MUST_USE_RES struct LDKInvoiceRequestFeatures Bolt12Invoice_invoice_request_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Information about the payee, such as their features and route hints for their channels. + * The quantity of items requested or refunded for. + * + * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. */ -struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Information about the payee, such as their features and route hints for their channels. + * 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 */ -void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * 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 */ -struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPrintableString Bolt12Invoice_payer_note(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. + * SHA256 hash of the payment preimage that will be given in return for paying the invoice. */ -void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_payment_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * The minimum amount required for a successful payment of the invoice. */ -uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t Bolt12Invoice_amount_msats(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum total CLTV delta we accept for the route. - * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. + * Signature of the invoice verified using [`Bolt12Invoice::signing_pubkey`]. */ -void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKSchnorrSignature Bolt12Invoice_signature(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Hash that was used for signing the invoice. */ -uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt12Invoice_signable_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum number of paths that may be used by (MPP) payments. - * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + * Returns the [`OfferId`] if this invoice corresponds to an [`Offer`]. + * + * [`Offer`]: crate::offers::offer::Offer + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKOfferId Bolt12Invoice_offer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The maximum number of [`Path::hops`] in any returned path. - * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. + * Verifies that the invoice was for a request or refund created using the given key by + * checking the payer metadata from the invoice request. + * + * Returns the associated [`PaymentId`] to use when sending the payment. */ -uint8_t PaymentParameters_get_max_path_length(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_metadata(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** - * The maximum number of [`Path::hops`] in any returned path. - * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. + * Verifies that the invoice was for a request or refund created using the given key by + * checking a payment id and nonce included with the [`BlindedMessagePath`] for which the invoice was + * sent through. */ -void PaymentParameters_set_max_path_length(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesNoneZ Bolt12Invoice_verify_using_payer_data(const struct LDKBolt12Invoice *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Selects the maximum share of a channel's total capacity which will be sent over a channel, - * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas - * a lower value prefers to send larger MPP parts, potentially saturating channels and - * increasing failure probability for those paths. - * - * Note that this restriction will be relaxed during pathfinding after paths which meet this - * restriction have been found. While paths which meet this criteria will be searched for, it - * is ultimately up to the scorer to select them over other paths. - * - * A value of 0 will allow payments up to and including a channel's total announced usable - * capacity, a value of one will only use up to half its capacity, two 1/4, etc. - * - * Default value: 2 + * Returns the [`TaggedHash`] of the invoice that was signed. + */ +MUST_USE_RES struct LDKTaggedHash Bolt12Invoice_tagged_hash(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + +/** + * Generates a non-cryptographic 64-bit hash of the Bolt12Invoice. */ -uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +uint64_t Bolt12Invoice_hash(const struct LDKBolt12Invoice *NONNULL_PTR o); /** - * Selects the maximum share of a channel's total capacity which will be sent over a channel, - * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas - * a lower value prefers to send larger MPP parts, potentially saturating channels and - * increasing failure probability for those paths. - * - * Note that this restriction will be relaxed during pathfinding after paths which meet this - * restriction have been found. While paths which meet this criteria will be searched for, it - * is ultimately up to the scorer to select them over other paths. - * - * A value of 0 will allow payments up to and including a channel's total announced usable - * capacity, a value of one will only use up to half its capacity, two 1/4, etc. - * - * Default value: 2 + * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read */ -void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); +struct LDKCVec_u8Z UnsignedBolt12Invoice_write(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR obj); /** - * A list of SCIDs which this payment was previously attempted over and which caused the - * payment to fail. Future attempts for the same payment shouldn't be relayed through any of - * these SCIDs. - * - * Returns a copy of the field. + * Serialize the Bolt12Invoice object into a byte array which can be read by Bolt12Invoice_read */ -struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Bolt12Invoice_write(const struct LDKBolt12Invoice *NONNULL_PTR obj); /** - * A list of SCIDs which this payment was previously attempted over and which caused the - * payment to fail. Future attempts for the same payment shouldn't be relayed through any of - * these SCIDs. + * Read a Bolt12Invoice from a byte array, created by Bolt12Invoice_write */ -void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +struct LDKCResult_Bolt12InvoiceDecodeErrorZ Bolt12Invoice_read(struct LDKu8slice ser); /** - * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this - * payment was previously attempted over and which caused the payment to fail. Future attempts - * for the same payment shouldn't be relayed through any of these blinded paths. + * Frees any resources used by the InvoiceError, if is_owned is set and inner is non-NULL. + */ +void InvoiceError_free(struct LDKInvoiceError this_obj); + +/** + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. * - * Returns a copy of the field. + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u64Z PaymentParameters_get_previously_failed_blinded_path_idxs(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); +struct LDKErroneousField InvoiceError_get_erroneous_field(const struct LDKInvoiceError *NONNULL_PTR this_ptr); /** - * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this - * payment was previously attempted over and which caused the payment to fail. Future attempts - * for the same payment shouldn't be relayed through any of these blinded paths. + * The field in the [`InvoiceRequest`] or the [`Bolt12Invoice`] that contained an error. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PaymentParameters_set_previously_failed_blinded_path_idxs(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); +void InvoiceError_set_erroneous_field(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKErroneousField val); /** - * Constructs a new PaymentParameters given each field + * An explanation of the error. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_path_length_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, struct LDKCVec_u64Z previously_failed_blinded_path_idxs_arg); +struct LDKUntrustedString InvoiceError_get_message(const struct LDKInvoiceError *NONNULL_PTR this_ptr); /** - * Creates a copy of the PaymentParameters + * An explanation of the error. */ -struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); +void InvoiceError_set_message(struct LDKInvoiceError *NONNULL_PTR this_ptr, struct LDKUntrustedString val); /** - * Generates a non-cryptographic 64-bit hash of the PaymentParameters. + * 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 */ -uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); +MUST_USE_RES struct LDKInvoiceError InvoiceError_new(struct LDKErroneousField erroneous_field_arg, struct LDKUntrustedString message_arg); /** - * Checks if two PaymentParameterss 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. + * Creates a copy of the InvoiceError */ -bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); +struct LDKInvoiceError InvoiceError_clone(const struct LDKInvoiceError *NONNULL_PTR orig); /** - * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read + * Frees any resources used by the ErroneousField, if is_owned is set and inner is non-NULL. */ -struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); +void ErroneousField_free(struct LDKErroneousField this_obj); /** - * Read a PaymentParameters from a byte array, created by PaymentParameters_write + * The type number of the TLV field containing the error. */ -struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); +uint64_t ErroneousField_get_tlv_fieldnum(const struct LDKErroneousField *NONNULL_PTR this_ptr); /** - * Creates a payee with the node id of the given `pubkey`. - * - * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has - * provided. + * The type number of the TLV field containing the error. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); +void ErroneousField_set_tlv_fieldnum(struct LDKErroneousField *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a payee with the node id of the given `pubkey` to use for keysend payments. - * - * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has - * provided. - * - * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose - * whether your router will be allowed to find a multi-part route for this payment. If you - * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via - * [`RecipientOnionFields::secret_only`]. + * A value to use for the TLV field to avoid the error. * - * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only + * Returns a copy of the field. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp); +struct LDKCOption_CVec_u8ZZ ErroneousField_get_suggested_value(const struct LDKErroneousField *NONNULL_PTR this_ptr); /** - * Creates parameters for paying to a blinded payee from the provided invoice. Sets - * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and - * [`PaymentParameters::expiry_time`]. + * A value to use for the TLV field to avoid the error. */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); +void ErroneousField_set_suggested_value(struct LDKErroneousField *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val); /** - * Creates parameters for paying to a blinded payee from the provided blinded route hints. + * Constructs a new ErroneousField given each field */ -MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_BlindedPaymentPathZ blinded_route_hints); +MUST_USE_RES struct LDKErroneousField ErroneousField_new(uint64_t tlv_fieldnum_arg, struct LDKCOption_CVec_u8ZZ suggested_value_arg); /** - * Frees any resources used by the Payee + * Creates a copy of the ErroneousField */ -void Payee_free(struct LDKPayee this_ptr); +struct LDKErroneousField ErroneousField_clone(const struct LDKErroneousField *NONNULL_PTR orig); /** - * Creates a copy of the Payee + * Creates an [`InvoiceError`] with the given message. */ -struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); +MUST_USE_RES struct LDKInvoiceError InvoiceError_from_string(struct LDKStr s); /** - * Utility method to constructs a new Blinded-variant Payee + * Get the string representation of a InvoiceError object */ -struct LDKPayee Payee_blinded(struct LDKCVec_BlindedPaymentPathZ route_hints, struct LDKBolt12InvoiceFeatures features); +struct LDKStr InvoiceError_to_str(const struct LDKInvoiceError *NONNULL_PTR o); /** - * Utility method to constructs a new Clear-variant Payee + * Serialize the InvoiceError object into a byte array which can be read by InvoiceError_read */ -struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta); +struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the Payee. + * Read a InvoiceError from a byte array, created by InvoiceError_write */ -uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); +struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); /** - * Checks if two Payees contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Build a InvoiceError from a Bolt12SemanticError */ -bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); +struct LDKInvoiceError InvoiceError_from_Bolt12SemanticError(enum LDKBolt12SemanticError f); /** - * Serialize the RouteHint object into a byte array which can be read by RouteHint_read + * Build a InvoiceError from a SignError */ -struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); +struct LDKInvoiceError InvoiceError_from_SignError(struct LDKSignError f); /** - * Read a RouteHint from a byte array, created by RouteHint_write + * Frees any resources used by the InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); +void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_obj); /** - * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read + * Builds a signed [`InvoiceRequest`] after checking for valid semantics. */ -struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg); /** - * Read a RouteHintHop from a byte array, created by RouteHintHop_write + * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not + * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported + * by the offer. + * + * Successive calls to this method will override the previous setting. */ -struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, enum LDKNetwork network); /** - * Frees any resources used by the FirstHopCandidate, if is_owned is set and inner is non-NULL. + * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is + * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). + * + * Successive calls to this method will override the previous setting. + * + * [`quantity`]: Self::quantity */ -void FirstHopCandidate_free(struct LDKFirstHopCandidate this_obj); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t amount_msats); /** - * Creates a copy of the FirstHopCandidate + * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` + * does not conform to [`Offer::is_valid_quantity`]. + * + * Successive calls to this method will override the previous setting. */ -struct LDKFirstHopCandidate FirstHopCandidate_clone(const struct LDKFirstHopCandidate *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t quantity); /** - * Frees any resources used by the PublicHopCandidate, if is_owned is set and inner is non-NULL. + * Sets the [`InvoiceRequest::payer_note`]. + * + * Successive calls to this method will override the previous setting. */ -void PublicHopCandidate_free(struct LDKPublicHopCandidate this_obj); +MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKStr payer_note); /** - * The short channel ID of the channel, i.e. the identifier by which we refer to this - * channel. + * Sets the [`InvoiceRequest::offer_from_hrn`]. + * + * Successive calls to this method will override the previous setting. */ -uint64_t PublicHopCandidate_get_short_channel_id(const struct LDKPublicHopCandidate *NONNULL_PTR this_ptr); +MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_sourced_from_human_readable_name(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKHumanReadableName hrn); /** - * The short channel ID of the channel, i.e. the identifier by which we refer to this - * channel. + * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. */ -void PublicHopCandidate_set_short_channel_id(struct LDKPublicHopCandidate *NONNULL_PTR this_ptr, uint64_t val); +void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj); /** - * Creates a copy of the PublicHopCandidate + * Creates a copy of the UnsignedInvoiceRequest */ -struct LDKPublicHopCandidate PublicHopCandidate_clone(const struct LDKPublicHopCandidate *NONNULL_PTR orig); +struct LDKUnsignedInvoiceRequest UnsignedInvoiceRequest_clone(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR orig); /** - * Frees any resources used by the PrivateHopCandidate, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void PrivateHopCandidate_free(struct LDKPrivateHopCandidate this_obj); +void SignInvoiceRequestFn_free(struct LDKSignInvoiceRequestFn this_ptr); /** - * Creates a copy of the PrivateHopCandidate + * Returns the [`TaggedHash`] of the invoice to sign. */ -struct LDKPrivateHopCandidate PrivateHopCandidate_clone(const struct LDKPrivateHopCandidate *NONNULL_PTR orig); +MUST_USE_RES struct LDKTaggedHash UnsignedInvoiceRequest_tagged_hash(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the BlindedPathCandidate, if is_owned is set and inner is non-NULL. + * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL. */ -void BlindedPathCandidate_free(struct LDKBlindedPathCandidate this_obj); +void InvoiceRequest_free(struct LDKInvoiceRequest this_obj); /** - * Creates a copy of the BlindedPathCandidate + * Creates a copy of the InvoiceRequest */ -struct LDKBlindedPathCandidate BlindedPathCandidate_clone(const struct LDKBlindedPathCandidate *NONNULL_PTR orig); +struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig); /** - * Frees any resources used by the OneHopBlindedPathCandidate, if is_owned is set and inner is non-NULL. + * Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL. */ -void OneHopBlindedPathCandidate_free(struct LDKOneHopBlindedPathCandidate this_obj); +void VerifiedInvoiceRequest_free(struct LDKVerifiedInvoiceRequest this_obj); /** - * Creates a copy of the OneHopBlindedPathCandidate + * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. */ -struct LDKOneHopBlindedPathCandidate OneHopBlindedPathCandidate_clone(const struct LDKOneHopBlindedPathCandidate *NONNULL_PTR orig); +struct LDKOfferId VerifiedInvoiceRequest_get_offer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr); /** - * Frees any resources used by the CandidateRouteHop + * The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. */ -void CandidateRouteHop_free(struct LDKCandidateRouteHop this_ptr); +void VerifiedInvoiceRequest_set_offer_id(struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_ptr, struct LDKOfferId val); /** - * Creates a copy of the CandidateRouteHop + * Creates a copy of the VerifiedInvoiceRequest */ -struct LDKCandidateRouteHop CandidateRouteHop_clone(const struct LDKCandidateRouteHop *NONNULL_PTR orig); +struct LDKVerifiedInvoiceRequest VerifiedInvoiceRequest_clone(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR orig); /** - * Utility method to constructs a new FirstHop-variant CandidateRouteHop + * 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. */ -struct LDKCandidateRouteHop CandidateRouteHop_first_hop(struct LDKFirstHopCandidate a); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ UnsignedInvoiceRequest_chains(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PublicHop-variant CandidateRouteHop + * 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`. */ -struct LDKCandidateRouteHop CandidateRouteHop_public_hop(struct LDKPublicHopCandidate a); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedInvoiceRequest_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PrivateHop-variant CandidateRouteHop + * The minimum amount required for a successful payment of a single item. */ -struct LDKCandidateRouteHop CandidateRouteHop_private_hop(struct LDKPrivateHopCandidate a); +MUST_USE_RES struct LDKCOption_AmountZ UnsignedInvoiceRequest_amount(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Blinded-variant CandidateRouteHop + * 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. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCandidateRouteHop CandidateRouteHop_blinded(struct LDKBlindedPathCandidate a); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_description(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OneHopBlinded-variant CandidateRouteHop + * Features pertaining to the offer. */ -struct LDKCandidateRouteHop CandidateRouteHop_one_hop_blinded(struct LDKOneHopBlindedPathCandidate a); +MUST_USE_RES struct LDKOfferFeatures UnsignedInvoiceRequest_offer_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the globally unique short channel ID for this hop, if one is known. + * Duration since the Unix epoch when an invoice should no longer be requested. * - * This only returns `Some` if the channel is public (either our own, or one we've learned - * from the public network graph), and thus the short channel ID we have for this channel is - * globally unique and identifies this channel in a global namespace. + * If `None`, the offer does not expire. */ -MUST_USE_RES struct LDKCOption_u64Z CandidateRouteHop_globally_unique_short_channel_id(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_absolute_expiry(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the required difference in HTLC CLTV expiry between the [`Self::source`] and the - * next-hop for an HTLC taking this hop. + * 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. * - * This is the time that the node(s) in this hop have to claim the HTLC on-chain if the - * next-hop goes on chain with a payment preimage. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES uint32_t CandidateRouteHop_cltv_expiry_delta(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_issuer(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the minimum amount that can be sent over this hop, in millisatoshis. + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -MUST_USE_RES uint64_t CandidateRouteHop_htlc_minimum_msat(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedInvoiceRequest_paths(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the fees that must be paid to route an HTLC over this channel. + * The quantity of items supported. */ -MUST_USE_RES struct LDKRoutingFees CandidateRouteHop_fees(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the source node id of current hop. + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. * - * Source node id refers to the node forwarding the HTLC through this hop. + * See also [`Bolt12Invoice::signing_pubkey`]. * - * For [`Self::FirstHop`] we return payer's node id. + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKNodeId CandidateRouteHop_source(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_issuer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Returns the target node id of this hop, if known. - * - * Target node id refers to the node receiving the HTLC after this hop. - * - * For [`Self::Blinded`] we return `None` because the ultimate destination after the blinded - * path is unknown. - * - * For [`Self::OneHopBlinded`] we return `None` because the target is the same as the source, - * and such a return value would be somewhat nonsensical. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_signing_pubkey`]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ -MUST_USE_RES struct LDKNodeId CandidateRouteHop_target(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Finds a route from us (payer) to the given target node (payee). - * - * If the payee provided features in their invoice, they should be provided via the `payee` field - * in the given [`RouteParameters::payment_params`]. - * Without this, MPP will only be used if the payee's features are available in the network graph. - * - * Private routing paths between a public node and the target may be included in the `payee` field - * of [`RouteParameters::payment_params`]. - * - * If some channels aren't announced, it may be useful to fill in `first_hops` with the results - * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels - * from `network_graph` will be ignored, and only those in `first_hops` will be used. - * - * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. - * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / - * `htlc_maximum_msat` *are* checked as they may change based on the receiving node. - * - * # Panics - * - * Panics if first_hops contains channels without `short_channel_id`s; - * [`ChannelManager::list_usable_channels`] will never include such channels. - * - * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels - * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * 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. * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`chain`]: Self::chain */ -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]); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Construct a route from us (payer) to the target node (payee) via the given hops (which should - * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path. + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. * - * Re-uses logic from `find_route`, so the restrictions described there also apply here. + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity */ -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]); +MUST_USE_RES bool UnsignedInvoiceRequest_has_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Features pertaining to requesting an invoice. */ -void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); +MUST_USE_RES struct LDKInvoiceRequestFeatures UnsignedInvoiceRequest_invoice_request_features(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); +MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * A possibly transient pubkey used to sign the invoice request. */ -void Score_free(struct LDKScore this_ptr); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * 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 */ -void LockableScore_free(struct LDKLockableScore this_ptr); +MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void WriteableScore_free(struct LDKWriteableScore this_ptr); +MUST_USE_RES struct LDKHumanReadableName UnsignedInvoiceRequest_offer_from_hrn(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. + * 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. */ -void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ InvoiceRequest_chains(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Constructs a new LockableScore which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is + * 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`. */ -struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read + * The minimum amount required for a successful payment of a single item. */ -struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_AmountZ InvoiceRequest_amount(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Constructs a new WriteableScore which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is + * 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. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_description(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + * Features pertaining to the offer. */ -MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); +MUST_USE_RES struct LDKOfferFeatures InvoiceRequest_offer_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. + * Duration since the Unix epoch when an invoice should no longer be requested. + * + * If `None`, the offer does not expire. */ -void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_absolute_expiry(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. + * 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 */ -void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_issuer(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * 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 + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ InvoiceRequest_paths(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read + * The quantity of items supported. */ -struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); +MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *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 + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. + * + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_issuer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_signing_pubkey`]. + * + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ -void ChannelUsage_free(struct LDKChannelUsage this_obj); +MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * The amount to send through the channel, denominated in millisatoshis. + * A chain from [`Offer::chains`] that the offer is valid for. */ -uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * The amount to send through the channel, denominated in millisatoshis. + * 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 */ -void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Total amount, denominated in millisatoshis, already allocated to send through the channel - * as part of a multi-path payment. + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity */ -uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +MUST_USE_RES bool InvoiceRequest_has_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Total amount, denominated in millisatoshis, already allocated to send through the channel - * as part of a multi-path payment. + * Features pertaining to requesting an invoice. */ -void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_invoice_request_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * The effective capacity of the channel. + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * The effective capacity of the channel. + * A possibly transient pubkey used to sign the invoice request. */ -void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Constructs a new ChannelUsage given each field + * 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 LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); +MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * Creates a copy of the ChannelUsage + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKHumanReadableName InvoiceRequest_offer_from_hrn(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + +/** + * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the + * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. + * + * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned + * creation time is used for the `created_at` parameter. + * + * [`Duration`]: core::time::Duration */ -struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. + * Creates an [`InvoiceBuilder`] for the request with the given required fields. + * + * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. + *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. + * + * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment + * for the invoice. + * + * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It + * must contain one or more elements ordered from most-preferred to least-preferred, if there's + * a preference. Note, however, that any privacy is lost if a public node id was used for + * [`Offer::issuer_signing_pubkey`]. + * + * Errors if the request contains unknown required features. + * + * # Note + * + * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], + * then first use [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods + * instead. + * + * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at + * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey */ -void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ InvoiceRequest_respond_with_no_std(const struct LDKInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * Creates a copy of the FixedPenaltyScorer + * Verifies that the request was for an offer created using the given key by checking the + * metadata from the offer. + * + * 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 LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_metadata(struct LDKInvoiceRequest this_arg, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Creates a new scorer using `penalty_msat`. + * Verifies that the request was for an offer created using the given key by checking a nonce + * included with the [`BlindedMessagePath`] for which the request was sent through. + * + * 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_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); +MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_recipient_data(struct LDKInvoiceRequest this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); /** - * 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 + * Signature of the invoice request using [`payer_signing_pubkey`]. + * + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ -struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *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 + * 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. */ -struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_ThirtyTwoBytesZ VerifiedInvoiceRequest_chains(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read + * 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`. */ -struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ VerifiedInvoiceRequest_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write + * The minimum amount required for a successful payment of a single item. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); +MUST_USE_RES struct LDKCOption_AmountZ VerifiedInvoiceRequest_amount(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. + * 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. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_description(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL. + * Features pertaining to the offer. */ -void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj); +MUST_USE_RES struct LDKOfferFeatures VerifiedInvoiceRequest_offer_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A fixed penalty in msats to apply to each channel. - * - * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] - * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the - * most accurate total success probabilities. - * - * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * Duration since the Unix epoch when an invoice should no longer be requested. * - * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat + * If `None`, the offer does not expire. */ -uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_absolute_expiry(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A fixed penalty in msats to apply to each channel. - * - * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] - * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the - * most accurate total success probabilities. - * - * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * 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. * - * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_issuer(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used with the payment amount 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. - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * In testing, a value of roughly ~100x (1/10th * 2^10) of - * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated - * probabilities down by a factor of ~79%) resulted in the most accurate total success - * probabilities. - * - * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional - * hop). - * - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat + * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide + * recipient privacy by obfuscating its node id. */ -uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ VerifiedInvoiceRequest_paths(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used with the payment amount 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. - * - * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` - * - * In testing, a value of roughly ~100x (1/10th * 2^10) of - * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated - * probabilities down by a factor of ~79%) resulted in the most accurate total success - * probabilities. - * - * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional - * hop). - * - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat + * The quantity of items supported. */ -void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for a payment, as determined by our latest estimates of the channel's - * liquidity, to determine the liquidity penalty. - * - * The penalty is based in part on the knowledge learned from prior successful and unsuccessful - * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The - * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to - * lower bounding the success probability to `0.01`) when the amount falls within the - * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will - * result in a `u64::max_value` penalty, however. - * - * `-log10(success_probability) * liquidity_penalty_multiplier_msat` + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. * - * In testing, this scoring model performs much worse than the historical scoring model - * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled - * by default. + * See also [`Bolt12Invoice::signing_pubkey`]. * - * Default value: 0 msat + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * - * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life - * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_issuer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the negative `log10` of the channel's success - * probability for a payment, as determined by our latest estimates of the channel's - * liquidity, to determine the liquidity penalty. - * - * The penalty is based in part on the knowledge learned from prior successful and unsuccessful - * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The - * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to - * lower bounding the success probability to `0.01`) when the amount falls within the - * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will - * result in a `u64::max_value` penalty, however. - * - * `-log10(success_probability) * liquidity_penalty_multiplier_msat` - * - * In testing, this scoring model performs much worse than the historical scoring model - * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled - * by default. - * - * Default value: 0 msat + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_signing_pubkey`]. * - * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life - * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ -void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the total amount flowing over a channel, 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. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of - * the amount will result in a penalty of the multiplier. And, as the success probability - * decreases, the negative `log10` weighting will increase dramatically. For higher success - * probabilities, the multiplier will have a decreasing effect as the negative `log10` will - * fall below `1`. - * - * In testing, this scoring model performs much worse than the historical scoring model - * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is - * disabled by default. - * - * Default value: 0 msat - * - * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat + * A chain from [`Offer::chains`] that the offer is valid for. */ -uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the total amount flowing over a channel, 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. - * - * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` - * - * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of - * the amount will result in a penalty of the multiplier. And, as the success probability - * decreases, the negative `log10` weighting will increase dramatically. For higher success - * probabilities, the multiplier will have a decreasing effect as the negative `log10` will - * fall below `1`. - * - * In testing, this scoring model performs much worse than the historical scoring model - * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is - * disabled by default. - * - * Default value: 0 msat + * 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. * - * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat + * [`chain`]: Self::chain */ -void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with 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. - * - * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using - * only our latest estimate for the current liquidity available in the channel, it estimates - * success probability based on the estimated liquidity available in the channel through - * history. Specifically, every time we update our liquidity bounds on a given channel, we - * track which of several buckets those bounds fall into, exponentially decaying the - * probability of each bucket as new samples are added. - * - * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, - * or 6 sats to avoid a 25% probability channel). + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity */ -uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES bool VerifiedInvoiceRequest_has_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with 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. - * - * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using - * only our latest estimate for the current liquidity available in the channel, it estimates - * success probability based on the estimated liquidity available in the channel through - * history. Specifically, every time we update our liquidity bounds on a given channel, we - * track which of several buckets those bounds fall into, exponentially decaying the - * probability of each bucket as new samples are added. - * - * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, - * or 6 sats to avoid a 25% probability channel). - * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * Features pertaining to requesting an invoice. */ -void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKInvoiceRequestFeatures VerifiedInvoiceRequest_invoice_request_features(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the total amount flowing over a channel, 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 `2^20`ths - * of the payment amount, 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 - * estimates success probability based on the estimated liquidity available in the channel - * through history. Specifically, every time we update our liquidity bounds on a given - * channel, we track which of several buckets those bounds fall into, exponentially decaying - * the probability of each bucket as new samples are added. - * - * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% - * probability channels, or 0.5bps to avoid a 38% probability - * channel). - * - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * A multiplier used in conjunction with the payment amount and the negative `log10` of the - * channel's success probability for the total amount flowing over a channel, 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 `2^20`ths - * of the payment amount, 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 - * estimates success probability based on the estimated liquidity available in the channel - * through history. Specifically, every time we update our liquidity bounds on a given - * channel, we track which of several buckets those bounds fall into, exponentially decaying - * the probability of each bucket as new samples are added. - * - * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% - * probability channels, or 0.5bps to avoid a 38% probability - * channel). - * - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * A possibly transient pubkey used to sign the invoice request. */ -void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * 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 - * 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. + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. * - * Default value: 250 msat + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * 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 - * 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. + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. * - * Default value: 250 msat + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKHumanReadableName VerifiedInvoiceRequest_offer_from_hrn(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * 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 - * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if - * applicable, are still included in the overall penalty. - * - * If you wish to avoid creating paths with such channels entirely, setting this to a value of - * `u64::max_value()` will guarantee that. + * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the + * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. * - * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * See [`InvoiceRequest::respond_with_no_std`] for further details where the aforementioned + * creation time is used for the `created_at` parameter. * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + * [`Duration`]: core::time::Duration */ -uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * 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 - * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if - * applicable, are still included in the overall penalty. + * Creates an [`InvoiceBuilder`] for the request with the given required fields. * - * If you wish to avoid creating paths with such channels entirely, setting this to a value of - * `u64::max_value()` will guarantee that. + * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. + *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. * - * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment + * for the invoice. * - * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat - * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat - * [`base_penalty_msat`]: Self::base_penalty_msat - * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat - */ -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. + * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It + * must contain one or more elements ordered from most-preferred to least-preferred, if there's + * a preference. Note, however, that any privacy is lost if a public node id was used for + * [`Offer::issuer_signing_pubkey`]. * - * 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. + * Errors if the request contains unknown required features. * - * 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. + * # Note * - * 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. + * If the originating [`Offer`] was created using [`OfferBuilder::deriving_signing_pubkey`], + * then first use [`InvoiceRequest::verify_using_metadata`] or + * [`InvoiceRequest::verify_using_recipient_data`] and then [`VerifiedInvoiceRequest`] methods + * instead. * - * Default value: false + * [`Bolt12Invoice::created_at`]: crate::offers::invoice::Bolt12Invoice::created_at + * [`OfferBuilder::deriving_signing_pubkey`]: crate::offers::offer::OfferBuilder::deriving_signing_pubkey */ -bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_with_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * 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. + * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses + * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use + * the same [`ExpandedKey`] as the one used to create the offer. * - * 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. + * See [`InvoiceRequest::respond_with`] for further details. * - * Default value: false - */ -void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); - -/** - * Creates a copy of the ProbabilisticScoringFeeParameters + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash); /** - * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used. + * Creates an [`InvoiceBuilder`] for the request using the given required fields and that uses + * derived signing keys from the originating [`Offer`] to sign the [`Bolt12Invoice`]. Must use + * the same [`ExpandedKey`] as the one used to create the offer. + * + * See [`InvoiceRequest::respond_with_no_std`] for further details. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void); +MUST_USE_RES struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ VerifiedInvoiceRequest_respond_using_derived_keys_no_std(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg, struct LDKCVec_BlindedPaymentPathZ payment_paths, struct LDKThirtyTwoBytes payment_hash, uint64_t created_at); /** - * Marks the node with the given `node_id` as banned, - * i.e it will be avoided during path finding. + * Fetch the [`InvoiceRequestFields`] for this verified invoice. + * + * These are fields which we expect to be useful when receiving a payment for this invoice + * request, and include the returned [`InvoiceRequestFields`] in the + * [`PaymentContext::Bolt12Offer`]. + * + * [`PaymentContext::Bolt12Offer`]: crate::blinded_path::payment::PaymentContext::Bolt12Offer */ -void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +MUST_USE_RES struct LDKInvoiceRequestFields VerifiedInvoiceRequest_fields(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * Marks all nodes in the given list as banned, i.e., - * they will be avoided during path finding. + * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read */ -void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); +struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR obj); /** - * Removes the node with the given `node_id` from the list of nodes to avoid. + * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read */ -void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); /** - * Sets a manual penalty for the given node. + * Read a InvoiceRequest from a byte array, created by InvoiceRequest_write */ -void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); +struct LDKCResult_InvoiceRequestDecodeErrorZ InvoiceRequest_read(struct LDKu8slice ser); /** - * Removes the node with the given `node_id` from the list of manual penalties. + * Frees any resources used by the InvoiceRequestFields, if is_owned is set and inner is non-NULL. */ -void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); +void InvoiceRequestFields_free(struct LDKInvoiceRequestFields this_obj); /** - * Clears the list of manual penalties that are applied during path finding. + * A possibly transient pubkey used to sign the invoice request. */ -void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg); +struct LDKPublicKey InvoiceRequestFields_get_payer_signing_pubkey(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL. + * A possibly transient pubkey used to sign the invoice request. */ -void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj); +void InvoiceRequestFields_set_payer_signing_pubkey(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * If we aren't learning any new datapoints for a channel, the historical liquidity bounds - * tracking can simply live on with increasingly stale data. Instead, when a channel has not - * seen a liquidity estimate update for this amount of time, the historical datapoints are - * decayed by half. - * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days - * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z InvoiceRequestFields_get_quantity(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * If we aren't learning any new datapoints for a channel, the historical liquidity bounds - * tracking can simply live on with increasingly stale data. Instead, when a channel has not - * seen a liquidity estimate update for this amount of time, the historical datapoints are - * decayed by half. - * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] - * - * Note that after 16 or more half lives all historical data will be completely gone. - * - * Default value: 14 days - * - * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities + * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ -void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); +void InvoiceRequestFields_set_quantity(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, - * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on - * the available liquidity is halved and the upper-bound moves half-way to the channel's total - * capacity. - * - * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, - * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] - * struct documentation for more info on the way the liquidity bounds are used. - * - * For example, if the channel's capacity is 1 million sats, and the current upper and lower - * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper - * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. - * - * Default value: 30 minutes - * - * # Note + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. * - * When not built with the `std` feature, time will never elapse. Therefore, the channel - * liquidity knowledge will never decay except when the bounds cross. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); +struct LDKUntrustedString InvoiceRequestFields_get_payer_note_truncated(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, - * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on - * the available liquidity is halved and the upper-bound moves half-way to the channel's total - * capacity. - * - * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, - * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] - * struct documentation for more info on the way the liquidity bounds are used. - * - * For example, if the channel's capacity is 1 million sats, and the current upper and lower - * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper - * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. - * - * Default value: 30 minutes - * - * # Note + * A payer-provided note which will be seen by the recipient and reflected back in the invoice + * response. Truncated to [`PAYER_NOTE_LIMIT`] characters. * - * When not built with the `std` feature, time will never elapse. Therefore, the channel - * liquidity knowledge will never decay except when the bounds cross. + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); +void InvoiceRequestFields_set_payer_note_truncated(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKUntrustedString val); /** - * Constructs a new ProbabilisticScoringDecayParameters given each field + * The Human Readable Name which the sender indicated they were paying to. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg); +struct LDKHumanReadableName InvoiceRequestFields_get_human_readable_name(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** - * Creates a copy of the ProbabilisticScoringDecayParameters + * The Human Readable Name which the sender indicated they were paying to. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig); +void InvoiceRequestFields_set_human_readable_name(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKHumanReadableName val); /** - * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used. + * Constructs a new InvoiceRequestFields given each field + * + * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that human_readable_name_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void); +MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_signing_pubkey_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_arg, struct LDKHumanReadableName human_readable_name_arg); /** - * Creates a new scorer using the given scoring parameters for sending payments from a node - * through a network graph. + * Creates a copy of the InvoiceRequestFields */ -MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); +struct LDKInvoiceRequestFields InvoiceRequestFields_clone(const struct LDKInvoiceRequestFields *NONNULL_PTR orig); /** - * Dump the contents of this scorer into the configured logger. - * - * Note that this writes roughly one line per channel for which we have a liquidity estimate, - * which may be a substantial amount of log output. + * Checks if two InvoiceRequestFieldss 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. */ -void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +bool InvoiceRequestFields_eq(const struct LDKInvoiceRequestFields *NONNULL_PTR a, const struct LDKInvoiceRequestFields *NONNULL_PTR b); /** - * Query the estimated minimum and maximum liquidity available for sending a payment over the - * channel with `scid` towards the given `target` node. + * Serialize the InvoiceRequestFields object into a byte array which can be read by InvoiceRequestFields_read */ -MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); +struct LDKCVec_u8Z InvoiceRequestFields_write(const struct LDKInvoiceRequestFields *NONNULL_PTR obj); /** - * 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 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. - * - * 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. - * - * 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; 32], [0; 32]))` or `None` if no data remains for a channel. - * - * 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`]. + * Read a InvoiceRequestFields from a byte array, created by InvoiceRequestFields_write */ -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); +struct LDKCResult_InvoiceRequestFieldsDecodeErrorZ InvoiceRequestFields_read(struct LDKu8slice ser); /** - * 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. - * - * Returns `None` if: - * - the given channel is not in the network graph, the provided `target` is not a party to - * the channel, or we don't have forwarding parameters for either direction in the channel. - * - `allow_fallback_estimation` is *not* set and there is no (or insufficient) historical - * data for the given channel. - * - * These are the same bounds as returned by - * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by - * [`Self::estimated_channel_liquidity_range`]). + * Frees any resources used by the TaggedHash, if is_owned is set and inner is non-NULL. */ -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, bool allow_fallback_estimation); +void TaggedHash_free(struct LDKTaggedHash this_obj); /** - * Query the probability of payment success sending the given `amount_msat` over the channel - * with `scid` towards the given `target` node, based on the live estimated liquidity bounds. - * - * This will return `Some` for any channel which is present in the [`NetworkGraph`], including - * if we have no bound information beside the channel's capacity. + * Creates a copy of the TaggedHash */ -MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_live_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); +struct LDKTaggedHash TaggedHash_clone(const struct LDKTaggedHash *NONNULL_PTR orig); /** - * 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 + * Returns the digest to sign. */ -struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +MUST_USE_RES const uint8_t (*TaggedHash_as_digest(const struct LDKTaggedHash *NONNULL_PTR this_arg))[32]; /** - * 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 + * Returns the tag used in the tagged hash. */ -struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKStr TaggedHash_tag(const struct LDKTaggedHash *NONNULL_PTR this_arg); /** - * 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 + * Returns the merkle root used in the tagged hash. */ -struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes TaggedHash_merkle_root(const struct LDKTaggedHash *NONNULL_PTR this_arg); /** - * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read + * Frees any resources used by the SignError */ -struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); +void SignError_free(struct LDKSignError this_ptr); /** - * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write + * Creates a copy of the SignError */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); +struct LDKSignError SignError_clone(const struct LDKSignError *NONNULL_PTR orig); /** - * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Signing-variant SignError */ -void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); +struct LDKSignError SignError_signing(void); /** - * The outpoint which is spendable. + * Utility method to constructs a new Verification-variant SignError */ -struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKSignError SignError_verification(enum LDKSecp256k1Error a); /** - * The outpoint which is spendable. + * Verifies the signature with a pubkey over the given message using a tagged hash as the message + * digest. */ -void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKCResult_NoneSecp256k1ErrorZ verify_signature(struct LDKSchnorrSignature signature, const struct LDKTaggedHash *NONNULL_PTR message, struct LDKPublicKey pubkey); /** - * Per commitment point to derive the delayed payment key by key holder. + * Frees any resources used by the Nonce, if is_owned is set and inner is non-NULL. */ -struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +void Nonce_free(struct LDKNonce this_obj); /** - * Per commitment point to derive the delayed payment key by key holder. + * Creates a copy of the Nonce */ -void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +struct LDKNonce Nonce_clone(const struct LDKNonce *NONNULL_PTR orig); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * Checks if two Nonces 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. */ -uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +bool Nonce_eq(const struct LDKNonce *NONNULL_PTR a, const struct LDKNonce *NONNULL_PTR b); /** - * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in - * the witness_script. + * Creates a `Nonce` from the given [`EntropySource`]. */ -void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES struct LDKNonce Nonce_from_entropy_source(struct LDKEntropySource entropy_source); /** - * The output which is referenced by the given outpoint. + * Returns a slice of the underlying bytes of size [`Nonce::LENGTH`]. */ -struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKu8slice Nonce_as_slice(const struct LDKNonce *NONNULL_PTR this_arg); /** - * The output which is referenced by the given outpoint. + * Serialize the Nonce object into a byte array which can be read by Nonce_read */ -void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +struct LDKCVec_u8Z Nonce_write(const struct LDKNonce *NONNULL_PTR obj); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Read a Nonce from a byte array, created by Nonce_write */ -struct LDKRevocationKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +struct LDKCResult_NonceDecodeErrorZ Nonce_read(struct LDKu8slice ser); /** - * The revocation point specific to the commitment transaction which was broadcast. Used to - * derive the witnessScript for this output. + * Frees any resources used by the Bolt12ParseError, if is_owned is set and inner is non-NULL. */ -void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKRevocationKey val); +void Bolt12ParseError_free(struct LDKBolt12ParseError this_obj); /** - * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Creates a copy of the Bolt12ParseError */ -const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +struct LDKBolt12ParseError Bolt12ParseError_clone(const struct LDKBolt12ParseError *NONNULL_PTR orig); /** - * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Creates a copy of the Bolt12SemanticError */ -void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +enum LDKBolt12SemanticError Bolt12SemanticError_clone(const enum LDKBolt12SemanticError *NONNULL_PTR orig); /** - * The value of the channel which this output originated from, possibly indirectly. + * Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError */ -uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_already_expired(void); /** - * The value of the channel which this output originated from, possibly indirectly. + * Utility method to constructs a new UnsupportedChain-variant Bolt12SemanticError */ -void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_chain(void); /** - * The channel public keys and other parameters needed to generate a spending transaction or - * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. - * - * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new UnexpectedChain-variant Bolt12SemanticError */ -struct LDKChannelTransactionParameters DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_chain(void); /** - * The channel public keys and other parameters needed to generate a spending transaction or - * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. - * - * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new MissingAmount-variant Bolt12SemanticError */ -void DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_amount(void); /** - * Constructs a new DelayedPaymentOutputDescriptor given each field - * - * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new InvalidAmount-variant Bolt12SemanticError */ -MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKRevocationKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_amount(void); /** - * Creates a copy of the DelayedPaymentOutputDescriptor + * Utility method to constructs a new InvalidCurrencyCode-variant Bolt12SemanticError */ -struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_currency_code(void); /** - * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. + * Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError */ -uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); +enum LDKBolt12SemanticError Bolt12SemanticError_insufficient_amount(void); /** - * 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. + * Utility method to constructs a new UnexpectedAmount-variant Bolt12SemanticError */ -bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_amount(void); /** - * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read + * Utility method to constructs a new UnsupportedCurrency-variant Bolt12SemanticError */ -struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); +enum LDKBolt12SemanticError Bolt12SemanticError_unsupported_currency(void); /** - * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write + * Utility method to constructs a new UnknownRequiredFeatures-variant Bolt12SemanticError */ -struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); +enum LDKBolt12SemanticError Bolt12SemanticError_unknown_required_features(void); /** - * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new UnexpectedFeatures-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void); /** - * The outpoint which is spendable. + * Utility method to constructs a new MissingDescription-variant Bolt12SemanticError */ -struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void); /** - * The outpoint which is spendable. + * Utility method to constructs a new MissingIssuerSigningPubkey-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_issuer_signing_pubkey(void); /** - * The output which is referenced by the given outpoint. + * Utility method to constructs a new UnexpectedIssuerSigningPubkey-variant Bolt12SemanticError */ -struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_issuer_signing_pubkey(void); /** - * The output which is referenced by the given outpoint. + * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_quantity(void); /** - * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Utility method to constructs a new InvalidQuantity-variant Bolt12SemanticError */ -const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_quantity(void); /** - * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. - * This may be useful in re-deriving keys used in the channel to spend the output. + * Utility method to constructs a new UnexpectedQuantity-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_quantity(void); /** - * The value of the channel which this transactions spends. + * Utility method to constructs a new InvalidMetadata-variant Bolt12SemanticError */ -uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_metadata(void); /** - * The value of the channel which this transactions spends. + * Utility method to constructs a new UnexpectedMetadata-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void); /** - * 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 + * Utility method to constructs a new MissingPayerMetadata-variant Bolt12SemanticError */ -struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); /** - * 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 + * Utility method to constructs a new MissingPayerSigningPubkey-variant Bolt12SemanticError */ -void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_signing_pubkey(void); /** - * 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 + * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError */ -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); +enum LDKBolt12SemanticError Bolt12SemanticError_duplicate_payment_id(void); /** - * Creates a copy of the StaticPaymentOutputDescriptor + * Utility method to constructs a new MissingPaths-variant Bolt12SemanticError */ -struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_paths(void); /** - * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. + * Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError */ -uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_paths(void); /** - * 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. + * Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError */ -bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_pay_info(void); /** - * 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. + * Utility method to constructs a new MissingCreationTime-variant Bolt12SemanticError */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_creation_time(void); /** - * 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. + * Utility method to constructs a new MissingPaymentHash-variant Bolt12SemanticError */ -MUST_USE_RES uint64_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void); /** - * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read + * Utility method to constructs a new UnexpectedPaymentHash-variant Bolt12SemanticError */ -struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_payment_hash(void); /** - * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write + * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError */ -struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); /** - * Frees any resources used by the SpendableOutputDescriptor + * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError */ -void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); /** - * Creates a copy of the SpendableOutputDescriptor + * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void); /** - * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor + * Utility method to constructs a new UnexpectedHumanReadableName-variant Bolt12SemanticError */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output, struct LDKThirtyTwoBytes channel_keys_id); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_human_readable_name(void); /** - * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor + * Build a Bolt12ParseError from a DecodeError */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); +struct LDKBolt12ParseError Bolt12ParseError_from_DecodeError(struct LDKDecodeError f); /** - * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor + * Build a Bolt12ParseError from a Bolt12SemanticError */ -struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); +struct LDKBolt12ParseError Bolt12ParseError_from_Bolt12SemanticError(enum LDKBolt12SemanticError f); /** - * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. + * Build a Bolt12ParseError from a Secp256k1Error */ -uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); +struct LDKBolt12ParseError Bolt12ParseError_from_Secp256k1Error(enum LDKSecp256k1Error f); /** - * Checks if two SpendableOutputDescriptors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the RefundMaybeWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. */ -bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); +void RefundMaybeWithDerivedMetadataBuilder_free(struct LDKRefundMaybeWithDerivedMetadataBuilder this_obj); /** - * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read + * Creates a copy of the RefundMaybeWithDerivedMetadataBuilder */ -struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); +struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBuilder_clone(const struct LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write + * Creates a new builder for a refund using the `signing_pubkey` for the public node id to send + * to if no [`Refund::paths`] are set. Otherwise, `signing_pubkey` may be a transient pubkey. + * + * Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], + * and [`Refund::amount_msats`]. + * + * # Note + * + * If constructing a [`Refund`] for use with a [`ChannelManager`], use + * [`ChannelManager::create_refund_builder`] instead of [`RefundBuilder::new`]. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder */ -struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey signing_pubkey, uint64_t amount_msats); /** - * Creates an unsigned [`Psbt`] which spends the given descriptors to - * the given outputs, plus an output to the given change destination (if sufficient - * change value remains). The PSBT will have a feerate, at least, of the given value. + * Similar to [`RefundBuilder::new`] except, if [`RefundBuilder::path`] is called, the payer id + * is derived from the given [`ExpandedKey`] and nonce. This provides sender privacy by using a + * different payer id for each refund, assuming a different nonce is used. Otherwise, the + * provided `node_id` is used for the payer id. * - * The `locktime` argument is used to set the transaction's locktime. If `None`, the - * transaction will have a locktime of 0. It it recommended to set this to the current block - * height to avoid fee sniping, unless you have some specific reason to use a different - * locktime. + * Also, sets the metadata when [`RefundBuilder::build`] is called such that it can be used by + * [`Bolt12Invoice::verify_using_metadata`] to determine if the invoice was produced for the + * refund given an [`ExpandedKey`]. However, if [`RefundBuilder::path`] is called, then the + * metadata must be included in each [`BlindedMessagePath`] instead. In this case, use + * [`Bolt12Invoice::verify_using_payer_data`]. * - * Returns the PSBT and expected max transaction weight. + * The `payment_id` is encrypted in the metadata and should be unique. This ensures that only + * one invoice will be paid for the refund and that payments can be uniquely identified. * - * Returns `Err(())` if the output value is greater than the input value minus required fee, - * if a descriptor was duplicated, or if an output descriptor `script_pubkey` - * does not match the one we can spend. + * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata + * [`Bolt12Invoice::verify_using_payer_data`]: crate::offers::invoice::Bolt12Invoice::verify_using_payer_data + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey + */ +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); + +/** + * Sets the [`Refund::description`]. * - * We do not enforce that outputs meet the dust limit or that any output scripts are standard. + * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ 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); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_description(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr description); /** - * Returns the outpoint of the spendable output. + * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Refund::is_expired`]. + * + * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKOutPoint SpendableOutputDescriptor_spendable_outpoint(const struct LDKSpendableOutputDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_absolute_expiry(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t absolute_expiry); /** - * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. + * Sets the [`Refund::issuer`]. + * + * Successive calls to this method will override the previous setting. */ -void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_issuer(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr issuer); /** - * The value in satoshis of the channel we're attempting to spend the anchor output of. + * Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected + * by private channels or if [`Refund::payer_signing_pubkey`] is not a public node id. + * + * Successive calls to this method will add another blinded path. Caller is responsible for not + * adding duplicate paths. */ -uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_path(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKBlindedMessagePath path); /** - * The value in satoshis of the channel we're attempting to spend the anchor output of. + * Sets the [`Refund::chain`] of the given [`Network`] for paying an invoice. If not + * called, [`Network::Bitcoin`] is assumed. + * + * Successive calls to this method will override the previous setting. */ -void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_chain(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, enum LDKNetwork network); /** - * The unique identifier to re-derive the signer for the associated channel. + * Sets [`Refund::quantity`] of items. This is purely for informational purposes. It is useful + * when the refund pertains to a [`Bolt12Invoice`] that paid for more than one item from an + * [`Offer`] as specified by [`InvoiceRequest::quantity`]. + * + * Successive calls to this method will override the previous setting. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity + * [`Offer`]: crate::offers::offer::Offer */ -const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_quantity(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, uint64_t quantity); /** - * The unique identifier to re-derive the signer for the associated channel. + * Sets the [`Refund::payer_note`]. + * + * Successive calls to this method will override the previous setting. */ -void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_payer_note(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr payer_note); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. + * Builds a [`Refund`] after checking for valid semantics. */ -struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_RefundBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_build(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg); /** - * The necessary channel parameters that need to be provided to the re-derived signer through - * [`ChannelSigner::provide_channel_parameters`]. + * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL. */ -void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); +void Refund_free(struct LDKRefund this_obj); /** - * Constructs a new ChannelDerivationParameters given each field + * Creates a copy of the Refund */ -MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); +struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig); /** - * Creates a copy of the ChannelDerivationParameters + * A complete description of the purpose of the refund. Intended to be displayed to the user + * but with the caveat that it has not been verified in any way. */ -struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Checks if two ChannelDerivationParameterss 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. + * Duration since the Unix epoch when an invoice should no longer be sent. + * + * If `None`, the refund does not expire. */ -bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); +MUST_USE_RES struct LDKCOption_u64Z Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read + * Whether the refund has expired. */ -struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); +MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg); /** - * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write + * Whether the refund has expired given the duration since the Unix epoch. */ -struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); +MUST_USE_RES bool Refund_is_expired_no_std(const struct LDKRefund *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. + * The issuer of the refund, 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 */ -void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); +MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The parameters required to derive the signer for the HTLC input. + * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender + * privacy by obfuscating its node id. */ -struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The parameters required to derive the signer for the HTLC input. + * An unpredictable series of bytes, typically containing information about the derivation of + * [`payer_signing_pubkey`]. + * + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ -void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); +MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The txid of the commitment transaction in which the HTLC output lives. + * A chain that the refund is valid for. */ -const uint8_t (*HTLCDescriptor_get_commitment_txid(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The txid of the commitment transaction in which the HTLC output lives. + * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]). + * + * [`chain`]: Self::chain */ -void HTLCDescriptor_set_commitment_txid(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The number of the commitment transaction in which the HTLC output lives. + * Features pertaining to requesting an invoice. */ -uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The number of the commitment transaction in which the HTLC output lives. + * The quantity of an item that refund is for. */ -void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. + * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly + * transient pubkey. * - * See for more info. + * [`paths`]: Self::paths */ -struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPublicKey Refund_payer_signing_pubkey(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The key tweak corresponding to the number of the commitment transaction in which the HTLC - * output lives. This tweak is applied to all the basepoints for both parties in the channel to - * arrive at unique keys per commitment. + * Payer provided note to include in the invoice. * - * See for more info. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg); /** - * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs - * originating from a channel supporting anchor outputs, otherwise it is the channel's - * negotiated feerate at the time the commitment transaction was built. + * Generates a non-cryptographic 64-bit hash of the Refund. */ -uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +uint64_t Refund_hash(const struct LDKRefund *NONNULL_PTR o); /** - * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs - * originating from a channel supporting anchor outputs, otherwise it is the channel's - * negotiated feerate at the time the commitment transaction was built. + * Read a Refund from a byte array, created by Refund_write */ -void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); +struct LDKCResult_RefundDecodeErrorZ Refund_read(struct LDKu8slice ser); /** - * The details of the HTLC as it appears in the commitment transaction. + * Serialize the Refund object into a byte array which can be read by Refund_read */ -struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj); /** - * The details of the HTLC as it appears in the commitment transaction. + * Read a Refund object from a string */ -void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); +struct LDKCResult_RefundBolt12ParseErrorZ Refund_from_str(struct LDKStr s); /** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. + * Get the string representation of a Refund object */ -struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKStr Refund_to_str(const struct LDKRefund *NONNULL_PTR o); /** - * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be - * taken. + * Frees any resources used by the StaticInvoice, if is_owned is set and inner is non-NULL. */ -void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); +void StaticInvoice_free(struct LDKStaticInvoice this_obj); /** - * The counterparty's signature required to spend the HTLC output. + * Creates a copy of the StaticInvoice */ -struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); +struct LDKStaticInvoice StaticInvoice_clone(const struct LDKStaticInvoice *NONNULL_PTR orig); /** - * The counterparty's signature required to spend the HTLC output. + * Generates a non-cryptographic 64-bit hash of the StaticInvoice. */ -void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); +uint64_t StaticInvoice_hash(const struct LDKStaticInvoice *NONNULL_PTR o); /** - * Constructs a new HTLCDescriptor given each field + * Frees any resources used by the UnsignedStaticInvoice, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKHTLCDescriptor HTLCDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKThirtyTwoBytes commitment_txid_arg, uint64_t per_commitment_number_arg, struct LDKPublicKey per_commitment_point_arg, uint32_t feerate_per_kw_arg, struct LDKHTLCOutputInCommitment htlc_arg, struct LDKCOption_ThirtyTwoBytesZ preimage_arg, struct LDKECDSASignature counterparty_sig_arg); +void UnsignedStaticInvoice_free(struct LDKUnsignedStaticInvoice this_obj); /** - * Creates a copy of the HTLCDescriptor + * Signs the [`TaggedHash`] of the invoice using the given function. + * + * Note: The hash computation may have included unknown, odd TLV records. */ -struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_StaticInvoiceSignErrorZ UnsignedStaticInvoice_sign(struct LDKUnsignedStaticInvoice this_arg, struct LDKSignStaticInvoiceFn sign); /** - * Checks if two HTLCDescriptors 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. + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. + * + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`UnsignedStaticInvoice::signing_pubkey`]. */ -bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ UnsignedStaticInvoice_payment_paths(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read + * Duration since the Unix epoch when the invoice was created. */ -struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); +MUST_USE_RES uint64_t UnsignedStaticInvoice_created_at(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write + * Duration since + *[`UnsignedStaticInvoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); +MUST_USE_RES uint64_t UnsignedStaticInvoice_relative_expiry(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * 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. + * Whether the invoice has expired. */ -MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES bool UnsignedStaticInvoice_is_expired(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Returns the UTXO to be spent by the HTLC input, which can be obtained via - * [`Self::unsigned_tx_input`]. + * Whether the invoice has expired given the current time as duration since the Unix epoch. */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES bool UnsignedStaticInvoice_is_expired_no_std(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Returns the unsigned transaction input spending the HTLC output in the commitment - * transaction. + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_AddressZ UnsignedStaticInvoice_fallbacks(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Returns the delayed output created as a result of spending the HTLC output in the commitment - * transaction. + * Features pertaining to paying an invoice. */ -MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedStaticInvoice_invoice_features(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Returns the witness script of the HTLC output in the commitment transaction. + * The public key corresponding to the key used to sign the invoice. + * + * This will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedStaticInvoice_signing_pubkey(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Returns the fully signed witness required to spend the HTLC output in the commitment - * transaction. + * The chain that must be used when paying the invoice. [`StaticInvoice`]s currently can only be + * created from offers that support a single chain. */ -MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); +MUST_USE_RES struct LDKThirtyTwoBytes UnsignedStaticInvoice_chain(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Derives the channel signer required to sign the HTLC input. + * Opaque bytes set by the originating [`Offer::metadata`]. + * + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ -MUST_USE_RES struct LDKEcdsaChannelSigner HTLCDescriptor_derive_channel_signer(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ UnsignedStaticInvoice_metadata(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]. + * + * [`Offer::amount`]: crate::offers::offer::Offer::amount */ -void ChannelSigner_free(struct LDKChannelSigner this_ptr); +MUST_USE_RES struct LDKCOption_AmountZ UnsignedStaticInvoice_amount(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Creates a copy of the Recipient + * Features pertaining to the originating [`Offer`], from [`Offer::offer_features`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features */ -enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); +MUST_USE_RES struct LDKOfferFeatures UnsignedStaticInvoice_offer_features(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Node-variant Recipient + * A complete description of the purpose of the originating offer, from [`Offer::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -enum LDKRecipient Recipient_node(void); +MUST_USE_RES struct LDKPrintableString UnsignedStaticInvoice_description(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PhantomNode-variant Recipient + * Duration since the Unix epoch when an invoice should no longer be requested, from + * [`Offer::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry */ -enum LDKRecipient Recipient_phantom_node(void); +MUST_USE_RES struct LDKCOption_u64Z UnsignedStaticInvoice_absolute_expiry(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * The issuer of the offer, from [`Offer::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 */ -void EntropySource_free(struct LDKEntropySource this_ptr); +MUST_USE_RES struct LDKPrintableString UnsignedStaticInvoice_issuer(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Paths to the node that may supply the invoice on the recipient's behalf, originating from + * publicly reachable nodes. Taken from [`Offer::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -void NodeSigner_free(struct LDKNodeSigner this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedStaticInvoice_offer_message_paths(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * Paths to the recipient for indicating that a held HTLC is available to claim when they next + * come online. */ -void OutputSpender_free(struct LDKOutputSpender this_ptr); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedStaticInvoice_message_paths(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * The quantity of items supported, from [`Offer::supported_quantity`]. + * + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity */ -void SignerProvider_free(struct LDKSignerProvider this_ptr); +MUST_USE_RES struct LDKQuantity UnsignedStaticInvoice_supported_quantity(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Calls the free function if one is set + * The public key used by the recipient to sign invoices, from + * [`Offer::issuer_signing_pubkey`]. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChangeDestinationSource_free(struct LDKChangeDestinationSource this_ptr); +MUST_USE_RES struct LDKPublicKey UnsignedStaticInvoice_issuer_signing_pubkey(const struct LDKUnsignedStaticInvoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void InMemorySigner_free(struct LDKInMemorySigner this_obj); +void SignStaticInvoiceFn_free(struct LDKSignStaticInvoiceFn this_ptr); /** - * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the - * holder's anchor output in a commitment transaction, if one is present. + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. + * + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`StaticInvoice::signing_pubkey`]. */ -const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ StaticInvoice_payment_paths(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the - * holder's anchor output in a commitment transaction, if one is present. + * Duration since the Unix epoch when the invoice was created. */ -void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES uint64_t StaticInvoice_created_at(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key for blinded revocation pubkey. + * Duration since + *[`StaticInvoice::created_at`] + * when the invoice has expired and therefore should no longer be paid. */ -const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES uint64_t StaticInvoice_relative_expiry(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key for blinded revocation pubkey. + * Whether the invoice has expired. */ -void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES bool StaticInvoice_is_expired(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * Whether the invoice has expired given the current time as duration since the Unix epoch. */ -const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES bool StaticInvoice_is_expired_no_std(const struct LDKStaticInvoice *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. + * Fallback addresses for paying the invoice on-chain, in order of most-preferred to + * least-preferred. */ -void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES struct LDKCVec_AddressZ StaticInvoice_fallbacks(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key used in an HTLC transaction. + * Features pertaining to paying an invoice. */ -const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKBolt12InvoiceFeatures StaticInvoice_invoice_features(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder secret key used in an HTLC transaction. + * The public key corresponding to the key used to sign the invoice. + * + * This will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES struct LDKPublicKey StaticInvoice_signing_pubkey(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * The chain that must be used when paying the invoice. [`StaticInvoice`]s currently can only be + * created from offers that support a single chain. */ -const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKThirtyTwoBytes StaticInvoice_chain(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Holder HTLC secret key used in commitment transaction HTLC outputs. + * Opaque bytes set by the originating [`Offer::metadata`]. + * + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ -void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticInvoice_metadata(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Commitment seed. + * The minimum amount required for a successful payment of a single item. + * + * From [`Offer::amount`]. + * + * [`Offer::amount`]: crate::offers::offer::Offer::amount */ -const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; +MUST_USE_RES struct LDKCOption_AmountZ StaticInvoice_amount(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Commitment seed. + * Features pertaining to the originating [`Offer`], from [`Offer::offer_features`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features */ -void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +MUST_USE_RES struct LDKOfferFeatures StaticInvoice_offer_features(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Creates a copy of the InMemorySigner + * A complete description of the purpose of the originating offer, from [`Offer::description`]. + * + * [`Offer::description`]: crate::offers::offer::Offer::description + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString StaticInvoice_description(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Creates a new [`InMemorySigner`]. + * Duration since the Unix epoch when an invoice should no longer be requested, from + * [`Offer::absolute_expiry`]. + * + * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry */ -MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id, struct LDKThirtyTwoBytes rand_bytes_unique_start); +MUST_USE_RES struct LDKCOption_u64Z StaticInvoice_absolute_expiry(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Returns the counterparty's pubkeys. + * The issuer of the offer, from [`Offer::issuer`]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * [`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 LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPrintableString StaticInvoice_issuer(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * 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. + * Paths to the node that may supply the invoice on the recipient's behalf, originating from + * publicly reachable nodes. Taken from [`Offer::paths`]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ StaticInvoice_offer_message_paths(const struct LDKStaticInvoice *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 return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * Paths to the recipient for indicating that a held HTLC is available to claim when they next + * come online. */ -MUST_USE_RES struct LDKCOption_u16Z InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_BlindedMessagePathZ StaticInvoice_message_paths(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Returns whether the holder is the initiator. + * The quantity of items supported, from [`Offer::supported_quantity`]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity */ -MUST_USE_RES struct LDKCOption_boolZ InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKQuantity StaticInvoice_supported_quantity(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Funding outpoint + * The public key used by the recipient to sign invoices, from + * [`Offer::issuer_signing_pubkey`]. * - * Will return `None` if [`ChannelSigner::provide_channel_parameters`] has not been called. - * In general, this is safe to `unwrap` only in [`ChannelSigner`] implementation. + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey * * 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); +MUST_USE_RES struct LDKPublicKey StaticInvoice_issuer_signing_pubkey(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or - * building transactions. - * - * 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 + * Signature of the invoice verified using [`StaticInvoice::signing_pubkey`]. */ -MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSchnorrSignature StaticInvoice_signature(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * 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 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 + * Whether the [`Offer`] that this invoice is based on is expired. */ -MUST_USE_RES struct LDKChannelTypeFeatures InMemorySigner_channel_type_features(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +MUST_USE_RES bool StaticInvoice_is_offer_expired(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described - * by `descriptor`, returning the witness stack for the input. - * - * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, - * is not spending the outpoint described by [`descriptor.outpoint`], - * or if an output descriptor `script_pubkey` does not match the one we can spend. - * - * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint + * Whether the [`Offer`] that this invoice is based on is expired, given the current time as + * duration since the Unix epoch. */ -MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES bool StaticInvoice_is_offer_expired_no_std(const struct LDKStaticInvoice *NONNULL_PTR this_arg, uint64_t duration_since_epoch); /** - * Sign the single input of `spend_tx` at index `input_idx` which spends the output - * described by `descriptor`, returning the witness stack for the input. - * - * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, - * is not spending the outpoint described by [`descriptor.outpoint`], does not have a - * sequence set to [`descriptor.to_self_delay`], or if an output descriptor - * `script_pubkey` does not match the one we can spend. + * Returns the [`OfferId`] corresponding to the originating [`Offer`]. * - * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint - * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay + * [`Offer`]: crate::offers::offer::Offer */ -MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); +MUST_USE_RES struct LDKOfferId StaticInvoice_offer_id(const struct LDKStaticInvoice *NONNULL_PTR this_arg); /** - * Constructs a new EntropySource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + * Serialize the StaticInvoice object into a byte array which can be read by StaticInvoice_read */ -struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKCVec_u8Z StaticInvoice_write(const struct LDKStaticInvoice *NONNULL_PTR obj); /** - * Constructs a new ChannelSigner which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is + * Read a StaticInvoice from a byte array, created by StaticInvoice_write */ -struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +struct LDKCResult_StaticInvoiceDecodeErrorZ StaticInvoice_read(struct LDKu8slice ser); /** - * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is + * Calls the free function if one is set */ -struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); +void AsyncPaymentsMessageHandler_free(struct LDKAsyncPaymentsMessageHandler this_ptr); /** - * Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read + * Frees any resources used by the AsyncPaymentsMessage */ -struct LDKCVec_u8Z InMemorySigner_write(const struct LDKInMemorySigner *NONNULL_PTR obj); +void AsyncPaymentsMessage_free(struct LDKAsyncPaymentsMessage this_ptr); /** - * Read a InMemorySigner from a byte array, created by InMemorySigner_write + * Creates a copy of the AsyncPaymentsMessage */ -struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_clone(const struct LDKAsyncPaymentsMessage *NONNULL_PTR orig); /** - * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new OfferPathsRequest-variant AsyncPaymentsMessage */ -void KeysManager_free(struct LDKKeysManager this_obj); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_offer_paths_request(struct LDKOfferPathsRequest a); /** - * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g., - * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). - * `starting_time` isn't strictly required to actually be a time, but it must absolutely, - * without a doubt, be unique to this instance. ie if you start multiple times with the same - * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this - * is to simply use the current time (with very high precision). - * - * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however, - * obviously, `starting_time` should be unique every time you reload the library - it is only - * used to generate new ephemeral key data (which will be stored by the individual channel if - * necessary). - * - * Note that the seed is required to recover certain on-chain funds independent of - * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required - * for any channel, and some on-chain during-closing funds. - * - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * Utility method to constructs a new OfferPaths-variant AsyncPaymentsMessage */ -MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_offer_paths(struct LDKOfferPaths a); /** - * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + * Utility method to constructs a new ServeStaticInvoice-variant AsyncPaymentsMessage */ -MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_serve_static_invoice(struct LDKServeStaticInvoice a); /** - * Derive an old [`EcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. + * Utility method to constructs a new StaticInvoicePersisted-variant AsyncPaymentsMessage */ -MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_static_invoice_persisted(struct LDKStaticInvoicePersisted a); /** - * Signs the given [`Psbt`] which spends the given [`SpendableOutputDescriptor`]s. - * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there - * are no other inputs that need signing. - * - * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to 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`]. + * Utility method to constructs a new HeldHtlcAvailable-variant AsyncPaymentsMessage */ -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); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_held_htlc_available(struct LDKHeldHtlcAvailable a); /** - * Constructs a new EntropySource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + * Utility method to constructs a new ReleaseHeldHtlc-variant AsyncPaymentsMessage */ -struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); +struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_release_held_htlc(struct LDKReleaseHeldHtlc a); /** - * Constructs a new NodeSigner which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + * Frees any resources used by the OfferPathsRequest, if is_owned is set and inner is non-NULL. */ -struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); +void OfferPathsRequest_free(struct LDKOfferPathsRequest this_obj); /** - * Constructs a new OutputSpender which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is + * The \"slot\" in the static invoice server's database that this invoice should go into. This + * allows us as the recipient to replace a specific invoice that is stored by the server, which + * is useful for limiting the number of invoices stored by the server while also keeping all the + * invoices persisted with the server fresh. */ -struct LDKOutputSpender KeysManager_as_OutputSpender(const struct LDKKeysManager *NONNULL_PTR this_arg); +uint16_t OfferPathsRequest_get_invoice_slot(const struct LDKOfferPathsRequest *NONNULL_PTR this_ptr); /** - * Constructs a new SignerProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + * The \"slot\" in the static invoice server's database that this invoice should go into. This + * allows us as the recipient to replace a specific invoice that is stored by the server, which + * is useful for limiting the number of invoices stored by the server while also keeping all the + * invoices persisted with the server fresh. */ -struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); +void OfferPathsRequest_set_invoice_slot(struct LDKOfferPathsRequest *NONNULL_PTR this_ptr, uint16_t val); /** - * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. + * Constructs a new OfferPathsRequest given each field */ -void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); +MUST_USE_RES struct LDKOfferPathsRequest OfferPathsRequest_new(uint16_t invoice_slot_arg); /** - * Constructs a new EntropySource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + * Creates a copy of the OfferPathsRequest */ -struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +struct LDKOfferPathsRequest OfferPathsRequest_clone(const struct LDKOfferPathsRequest *NONNULL_PTR orig); /** - * Constructs a new NodeSigner which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is + * Frees any resources used by the OfferPaths, if is_owned is set and inner is non-NULL. */ -struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +void OfferPaths_free(struct LDKOfferPaths this_obj); /** - * Constructs a new OutputSpender which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is + * The paths that should be included in the async recipient's [`Offer::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -struct LDKOutputSpender PhantomKeysManager_as_OutputSpender(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +struct LDKCVec_BlindedMessagePathZ OfferPaths_get_paths(const struct LDKOfferPaths *NONNULL_PTR this_ptr); /** - * Constructs a new SignerProvider which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is + * The paths that should be included in the async recipient's [`Offer::paths`]. + * + * [`Offer::paths`]: crate::offers::offer::Offer::paths */ -struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +void OfferPaths_set_paths(struct LDKOfferPaths *NONNULL_PTR this_ptr, struct LDKCVec_BlindedMessagePathZ val); /** - * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` - * that is shared across all nodes that intend to participate in [phantom node payments] - * together. - * - * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and - * `starting_time_nanos`. - * - * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the - * same across restarts, or else inbound payments may fail. - * - * [phantom node payments]: PhantomKeysManager + * The time as seconds since the Unix epoch at which the [`Self::paths`] expire. */ -MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32]); +struct LDKCOption_u64Z OfferPaths_get_paths_absolute_expiry(const struct LDKOfferPaths *NONNULL_PTR this_ptr); /** - * See [`KeysManager::derive_channel_keys`] for documentation on this method. + * The time as seconds since the Unix epoch at which the [`Self::paths`] expire. */ -MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); +void OfferPaths_set_paths_absolute_expiry(struct LDKOfferPaths *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. + * Constructs a new OfferPaths given each field */ -MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferPaths OfferPaths_new(struct LDKCVec_BlindedMessagePathZ paths_arg, struct LDKCOption_u64Z paths_absolute_expiry_arg); /** - * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the - * last-hop onion data, etc. + * Creates a copy of the OfferPaths */ -MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); +struct LDKOfferPaths OfferPaths_clone(const struct LDKOfferPaths *NONNULL_PTR orig); /** - * Frees any resources used by the RandomBytes, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ServeStaticInvoice, if is_owned is set and inner is non-NULL. */ -void RandomBytes_free(struct LDKRandomBytes this_obj); +void ServeStaticInvoice_free(struct LDKServeStaticInvoice this_obj); /** - * Creates a new instance using the given seed. + * The invoice that should be served by the static invoice server. Once this invoice has been + * persisted, the [`Responder`] accompanying this message should be used to send + * [`StaticInvoicePersisted`] to the recipient to confirm that the offer corresponding to the + * invoice is ready to receive async payments. */ -MUST_USE_RES struct LDKRandomBytes RandomBytes_new(struct LDKThirtyTwoBytes seed); +struct LDKStaticInvoice ServeStaticInvoice_get_invoice(const struct LDKServeStaticInvoice *NONNULL_PTR this_ptr); /** - * Constructs a new EntropySource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is + * The invoice that should be served by the static invoice server. Once this invoice has been + * persisted, the [`Responder`] accompanying this message should be used to send + * [`StaticInvoicePersisted`] to the recipient to confirm that the offer corresponding to the + * invoice is ready to receive async payments. */ -struct LDKEntropySource RandomBytes_as_EntropySource(const struct LDKRandomBytes *NONNULL_PTR this_arg); +void ServeStaticInvoice_set_invoice(struct LDKServeStaticInvoice *NONNULL_PTR this_ptr, struct LDKStaticInvoice val); /** - * Creates a copy of a EcdsaChannelSigner + * If a static invoice server receives an [`InvoiceRequest`] for a [`StaticInvoice`], they should + * also forward the [`InvoiceRequest`] to the async recipient so they can respond with a fresh + * [`Bolt12Invoice`] if the recipient is online at the time. Use this path to forward the + * [`InvoiceRequest`] to the async recipient. + * + * This path's [`BlindedMessagePath::introduction_node`] MUST be set to the static invoice server + * node or one of its peers. This is because, for DoS protection, invoice requests forwarded over + * this path are treated by the server node like any other onion message forward and the server + * will not directly connect to the introduction node if they are not already peers. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -struct LDKEcdsaChannelSigner EcdsaChannelSigner_clone(const struct LDKEcdsaChannelSigner *NONNULL_PTR orig); +struct LDKBlindedMessagePath ServeStaticInvoice_get_forward_invoice_request_path(const struct LDKServeStaticInvoice *NONNULL_PTR this_ptr); /** - * Calls the free function if one is set + * If a static invoice server receives an [`InvoiceRequest`] for a [`StaticInvoice`], they should + * also forward the [`InvoiceRequest`] to the async recipient so they can respond with a fresh + * [`Bolt12Invoice`] if the recipient is online at the time. Use this path to forward the + * [`InvoiceRequest`] to the async recipient. + * + * This path's [`BlindedMessagePath::introduction_node`] MUST be set to the static invoice server + * node or one of its peers. This is because, for DoS protection, invoice requests forwarded over + * this path are treated by the server node like any other onion message forward and the server + * will not directly connect to the introduction node if they are not already peers. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice */ -void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); +void ServeStaticInvoice_set_forward_invoice_request_path(struct LDKServeStaticInvoice *NONNULL_PTR this_ptr, struct LDKBlindedMessagePath val); /** - * Calls the free function if one is set + * Constructs a new ServeStaticInvoice given each field */ -void AsyncPaymentsMessageHandler_free(struct LDKAsyncPaymentsMessageHandler this_ptr); +MUST_USE_RES struct LDKServeStaticInvoice ServeStaticInvoice_new(struct LDKStaticInvoice invoice_arg, struct LDKBlindedMessagePath forward_invoice_request_path_arg); /** - * Frees any resources used by the AsyncPaymentsMessage + * Creates a copy of the ServeStaticInvoice */ -void AsyncPaymentsMessage_free(struct LDKAsyncPaymentsMessage this_ptr); +struct LDKServeStaticInvoice ServeStaticInvoice_clone(const struct LDKServeStaticInvoice *NONNULL_PTR orig); /** - * Creates a copy of the AsyncPaymentsMessage + * Frees any resources used by the StaticInvoicePersisted, if is_owned is set and inner is non-NULL. */ -struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_clone(const struct LDKAsyncPaymentsMessage *NONNULL_PTR orig); +void StaticInvoicePersisted_free(struct LDKStaticInvoicePersisted this_obj); /** - * Utility method to constructs a new HeldHtlcAvailable-variant AsyncPaymentsMessage + * Constructs a new StaticInvoicePersisted given each field */ -struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_held_htlc_available(struct LDKHeldHtlcAvailable a); +MUST_USE_RES struct LDKStaticInvoicePersisted StaticInvoicePersisted_new(void); /** - * Utility method to constructs a new ReleaseHeldHtlc-variant AsyncPaymentsMessage + * Creates a copy of the StaticInvoicePersisted */ -struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_release_held_htlc(struct LDKReleaseHeldHtlc a); +struct LDKStaticInvoicePersisted StaticInvoicePersisted_clone(const struct LDKStaticInvoicePersisted *NONNULL_PTR orig); /** * Frees any resources used by the HeldHtlcAvailable, if is_owned is set and inner is non-NULL. @@ -58927,12 +64390,64 @@ MUST_USE_RES struct LDKReleaseHeldHtlc ReleaseHeldHtlc_new(void); */ struct LDKReleaseHeldHtlc ReleaseHeldHtlc_clone(const struct LDKReleaseHeldHtlc *NONNULL_PTR orig); +/** + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + */ +struct LDKOnionMessageContents OfferPaths_as_OnionMessageContents(const struct LDKOfferPaths *NONNULL_PTR this_arg); + +/** + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + */ +struct LDKOnionMessageContents ServeStaticInvoice_as_OnionMessageContents(const struct LDKServeStaticInvoice *NONNULL_PTR this_arg); + /** * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is */ struct LDKOnionMessageContents ReleaseHeldHtlc_as_OnionMessageContents(const struct LDKReleaseHeldHtlc *NONNULL_PTR this_arg); +/** + * Serialize the OfferPathsRequest object into a byte array which can be read by OfferPathsRequest_read + */ +struct LDKCVec_u8Z OfferPathsRequest_write(const struct LDKOfferPathsRequest *NONNULL_PTR obj); + +/** + * Read a OfferPathsRequest from a byte array, created by OfferPathsRequest_write + */ +struct LDKCResult_OfferPathsRequestDecodeErrorZ OfferPathsRequest_read(struct LDKu8slice ser); + +/** + * Serialize the OfferPaths object into a byte array which can be read by OfferPaths_read + */ +struct LDKCVec_u8Z OfferPaths_write(const struct LDKOfferPaths *NONNULL_PTR obj); + +/** + * Read a OfferPaths from a byte array, created by OfferPaths_write + */ +struct LDKCResult_OfferPathsDecodeErrorZ OfferPaths_read(struct LDKu8slice ser); + +/** + * Serialize the ServeStaticInvoice object into a byte array which can be read by ServeStaticInvoice_read + */ +struct LDKCVec_u8Z ServeStaticInvoice_write(const struct LDKServeStaticInvoice *NONNULL_PTR obj); + +/** + * Read a ServeStaticInvoice from a byte array, created by ServeStaticInvoice_write + */ +struct LDKCResult_ServeStaticInvoiceDecodeErrorZ ServeStaticInvoice_read(struct LDKu8slice ser); + +/** + * Serialize the StaticInvoicePersisted object into a byte array which can be read by StaticInvoicePersisted_read + */ +struct LDKCVec_u8Z StaticInvoicePersisted_write(const struct LDKStaticInvoicePersisted *NONNULL_PTR obj); + +/** + * Read a StaticInvoicePersisted from a byte array, created by StaticInvoicePersisted_write + */ +struct LDKCResult_StaticInvoicePersistedDecodeErrorZ StaticInvoicePersisted_read(struct LDKu8slice ser); + /** * Serialize the HeldHtlcAvailable object into a byte array which can be read by HeldHtlcAvailable_read */ @@ -59147,6 +64662,11 @@ struct LDKCVec_u8Z HumanReadableName_write(const struct LDKHumanReadableName *NO */ struct LDKCResult_HumanReadableNameDecodeErrorZ HumanReadableName_read(struct LDKu8slice ser); +/** + * Get the string representation of a HumanReadableName object + */ +struct LDKStr HumanReadableName_to_str(const struct LDKHumanReadableName *NONNULL_PTR o); + /** * Frees any resources used by the OMNameResolver, if is_owned is set and inner is non-NULL. */ @@ -59157,14 +64677,38 @@ void OMNameResolver_free(struct LDKOMNameResolver this_obj); */ MUST_USE_RES struct LDKOMNameResolver OMNameResolver_new(uint32_t latest_block_time, uint32_t latest_block_height); +/** + * Builds a new [`OMNameResolver`] which will not validate the time limits on DNSSEC proofs + * (for builds without the \"std\" feature and until [`Self::new_best_block`] is called). + * + * If possible, you should prefer [`Self::new`] so that providing stale proofs is not + * possible, however in no-std environments where there is some trust in the resolver used and + * no time source is available, this may be acceptable. + * + * Note that not calling [`Self::new_best_block`] will result in requests not timing out and + * unresolved requests leaking memory. You must instead call + * [`Self::expire_pending_resolution`] as unresolved requests expire. + */ +MUST_USE_RES struct LDKOMNameResolver OMNameResolver_new_without_no_std_expiry_validation(void); + /** * Informs the [`OMNameResolver`] of the passage of time in the form of a new best Bitcoin * block. * - * This will call back to resolve some pending queries which have timed out. + * This is used to prune stale requests (by block height) and keep track of the current time + * to validate that DNSSEC proofs are current. */ void OMNameResolver_new_best_block(const struct LDKOMNameResolver *NONNULL_PTR this_arg, uint32_t height, uint32_t time); +/** + * Removes any pending resolutions for the given `name` and `payment_id`. + * + * Any future calls to [`Self::handle_dnssec_proof_for_offer`] or + * [`Self::handle_dnssec_proof_for_uri`] will no longer return a result for the given + * resolution. + */ +void OMNameResolver_expire_pending_resolution(const struct LDKOMNameResolver *NONNULL_PTR this_arg, const struct LDKHumanReadableName *NONNULL_PTR name, struct LDKThirtyTwoBytes payment_id); + /** * Begins the process of resolving a BIP 353 Human Readable Name. * @@ -59295,6 +64839,11 @@ struct LDKMessageSendInstructions MessageSendInstructions_without_reply_path(str */ struct LDKMessageSendInstructions MessageSendInstructions_for_reply(struct LDKResponseInstruction instructions); +/** + * Utility method to constructs a new ForwardedMessage-variant MessageSendInstructions + */ +struct LDKMessageSendInstructions MessageSendInstructions_forwarded_message(struct LDKDestination destination, struct LDKBlindedMessagePath reply_path); + /** * Calls the free function if one is set */ @@ -59306,15 +64855,47 @@ void MessageRouter_free(struct LDKMessageRouter this_ptr); void DefaultMessageRouter_free(struct LDKDefaultMessageRouter this_obj); /** - * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`]. + * Creates a [`DefaultMessageRouter`] using the given [`NetworkGraph`]. + */ +MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source); + +/** + * Constructs a new MessageRouter which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is + */ +struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the NodeIdMessageRouter, if is_owned is set and inner is non-NULL. + */ +void NodeIdMessageRouter_free(struct LDKNodeIdMessageRouter this_obj); + +/** + * Creates a [`NodeIdMessageRouter`] using the given [`NetworkGraph`]. + */ +MUST_USE_RES struct LDKNodeIdMessageRouter NodeIdMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source); + +/** + * Constructs a new MessageRouter which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is + */ +struct LDKMessageRouter NodeIdMessageRouter_as_MessageRouter(const struct LDKNodeIdMessageRouter *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the NullMessageRouter, if is_owned is set and inner is non-NULL. + */ +void NullMessageRouter_free(struct LDKNullMessageRouter this_obj); + +/** + * Constructs a new NullMessageRouter given each field */ -MUST_USE_RES struct LDKDefaultMessageRouter DefaultMessageRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKEntropySource entropy_source); +MUST_USE_RES struct LDKNullMessageRouter NullMessageRouter_new(void); /** * Constructs a new MessageRouter which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is */ -struct LDKMessageRouter DefaultMessageRouter_as_MessageRouter(const struct LDKDefaultMessageRouter *NONNULL_PTR this_arg); +struct LDKMessageRouter NullMessageRouter_as_MessageRouter(const struct LDKNullMessageRouter *NONNULL_PTR this_arg); /** * Frees any resources used by the OnionMessagePath, if is_owned is set and inner is non-NULL. @@ -59346,25 +64927,25 @@ void OnionMessagePath_set_destination(struct LDKOnionMessagePath *NONNULL_PTR th /** * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. * - * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use - * this to initiate such a connection. + * Only needs to be filled in if a connection to the node is required and it is not a known peer. + * [`OnionMessenger`] may use this to initiate such a connection. * * Returns a copy of the field. */ -struct LDKCOption_CVec_SocketAddressZZ OnionMessagePath_get_first_node_addresses(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); +struct LDKCVec_SocketAddressZ OnionMessagePath_get_first_node_addresses(const struct LDKOnionMessagePath *NONNULL_PTR this_ptr); /** * Addresses that may be used to connect to [`OnionMessagePath::first_node`]. * - * Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use - * this to initiate such a connection. + * Only needs to be filled in if a connection to the node is required and it is not a known peer. + * [`OnionMessenger`] may use this to initiate such a connection. */ -void OnionMessagePath_set_first_node_addresses(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCOption_CVec_SocketAddressZZ val); +void OnionMessagePath_set_first_node_addresses(struct LDKOnionMessagePath *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** * Constructs a new OnionMessagePath given each field */ -MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg, struct LDKCOption_CVec_SocketAddressZZ first_node_addresses_arg); +MUST_USE_RES struct LDKOnionMessagePath OnionMessagePath_new(struct LDKCVec_PublicKeyZ intermediate_nodes_arg, struct LDKDestination destination_arg, struct LDKCVec_SocketAddressZ first_node_addresses_arg); /** * Creates a copy of the OnionMessagePath @@ -59539,9 +65120,24 @@ struct LDKPeeledOnion PeeledOnion_clone(const struct LDKPeeledOnion *NONNULL_PTR struct LDKPeeledOnion PeeledOnion_forward(struct LDKNextMessageHop a, struct LDKOnionMessage b); /** - * Utility method to constructs a new Receive-variant PeeledOnion + * Utility method to constructs a new Offers-variant PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_offers(struct LDKOffersMessage a, struct LDKCOption_OffersContextZ b, struct LDKBlindedMessagePath c); + +/** + * Utility method to constructs a new AsyncPayments-variant PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_async_payments(struct LDKAsyncPaymentsMessage a, struct LDKAsyncPaymentsContext b, struct LDKBlindedMessagePath c); + +/** + * Utility method to constructs a new DNSResolver-variant PeeledOnion + */ +struct LDKPeeledOnion PeeledOnion_dnsresolver(struct LDKDNSResolverMessage a, struct LDKDNSResolverContext b, struct LDKBlindedMessagePath c); + +/** + * Utility method to constructs a new Custom-variant PeeledOnion */ -struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a, struct LDKCOption_MessageContextZ b, struct LDKBlindedMessagePath c); +struct LDKPeeledOnion PeeledOnion_custom(struct LDKOnionMessageContents a, struct LDKCOption_CVec_u8ZZ b, struct LDKBlindedMessagePath c); /** * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of @@ -59553,7 +65149,7 @@ struct LDKPeeledOnion PeeledOnion_receive(struct LDKParsedOnionMessageContents a * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message_resolving_destination(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ create_onion_message_resolving_destination(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); /** * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of @@ -59570,7 +65166,7 @@ struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSend * * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); +struct LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ create_onion_message(const struct LDKEntropySource *NONNULL_PTR entropy_source, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup, struct LDKOnionMessagePath path, struct LDKOnionMessageContents contents, struct LDKBlindedMessagePath reply_path); /** * Decode one layer of an incoming [`OnionMessage`]. @@ -59653,6 +65249,12 @@ MUST_USE_RES struct LDKFuture OnionMessenger_get_update_future(const struct LDKO */ struct LDKEventsProvider OnionMessenger_as_EventsProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +/** + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is + */ +struct LDKBaseMessageHandler OnionMessenger_as_BaseMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg); + /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is @@ -59684,6 +65286,11 @@ struct LDKOffersMessage OffersMessage_invoice_request(struct LDKInvoiceRequest a */ struct LDKOffersMessage OffersMessage_invoice(struct LDKBolt12Invoice a); +/** + * Utility method to constructs a new StaticInvoice-variant OffersMessage + */ +struct LDKOffersMessage OffersMessage_static_invoice(struct LDKStaticInvoice a); + /** * Utility method to constructs a new InvoiceError-variant OffersMessage */ @@ -59784,6 +65391,11 @@ bool Packet_eq(const struct LDKPacket *NONNULL_PTR a, const struct LDKPacket *NO */ struct LDKCVec_u8Z Packet_write(const struct LDKPacket *NONNULL_PTR obj); +/** + * Read a Packet from a byte array, created by Packet_write + */ +struct LDKCResult_PacketDecodeErrorZ Packet_read(struct LDKu8slice ser); + /** * Frees any resources used by the ParsedOnionMessageContents */ @@ -59799,6 +65411,11 @@ struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const stru */ struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); +/** + * Utility method to constructs a new AsyncPayments-variant ParsedOnionMessageContents + */ +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_async_payments(struct LDKAsyncPaymentsMessage a); + /** * Utility method to constructs a new DNSResolver-variant ParsedOnionMessageContents */ @@ -59831,7974 +65448,8297 @@ struct LDKOnionMessageContents OnionMessageContents_clone(const struct LDKOnionM void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); /** - * Frees any resources used by the IntroductionNode - */ -void IntroductionNode_free(struct LDKIntroductionNode this_ptr); - -/** - * Creates a copy of the IntroductionNode - */ -struct LDKIntroductionNode IntroductionNode_clone(const struct LDKIntroductionNode *NONNULL_PTR orig); - -/** - * Utility method to constructs a new NodeId-variant IntroductionNode - */ -struct LDKIntroductionNode IntroductionNode_node_id(struct LDKPublicKey a); - -/** - * Utility method to constructs a new DirectedShortChannelId-variant IntroductionNode - */ -struct LDKIntroductionNode IntroductionNode_directed_short_channel_id(enum LDKDirection a, uint64_t b); - -/** - * Generates a non-cryptographic 64-bit hash of the IntroductionNode. - */ -uint64_t IntroductionNode_hash(const struct LDKIntroductionNode *NONNULL_PTR o); - -/** - * Checks if two IntroductionNodes contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool IntroductionNode_eq(const struct LDKIntroductionNode *NONNULL_PTR a, const struct LDKIntroductionNode *NONNULL_PTR b); - -/** - * Creates a copy of the Direction - */ -enum LDKDirection Direction_clone(const enum LDKDirection *NONNULL_PTR orig); - -/** - * Utility method to constructs a new NodeOne-variant Direction - */ -enum LDKDirection Direction_node_one(void); - -/** - * Utility method to constructs a new NodeTwo-variant Direction - */ -enum LDKDirection Direction_node_two(void); - -/** - * Generates a non-cryptographic 64-bit hash of the Direction. - */ -uint64_t Direction_hash(const enum LDKDirection *NONNULL_PTR o); - -/** - * Checks if two Directions contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool Direction_eq(const enum LDKDirection *NONNULL_PTR a, const enum LDKDirection *NONNULL_PTR b); - -/** - * Calls the free function if one is set - */ -void NodeIdLookUp_free(struct LDKNodeIdLookUp this_ptr); - -/** - * Frees any resources used by the EmptyNodeIdLookUp, if is_owned is set and inner is non-NULL. - */ -void EmptyNodeIdLookUp_free(struct LDKEmptyNodeIdLookUp this_obj); - -/** - * Constructs a new EmptyNodeIdLookUp given each field - */ -MUST_USE_RES struct LDKEmptyNodeIdLookUp EmptyNodeIdLookUp_new(void); - -/** - * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is - */ -struct LDKNodeIdLookUp EmptyNodeIdLookUp_as_NodeIdLookUp(const struct LDKEmptyNodeIdLookUp *NONNULL_PTR this_arg); - -/** - * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. - */ -void BlindedHop_free(struct LDKBlindedHop this_obj); - -/** - * The blinded node id of this hop in a blinded path. - */ -struct LDKPublicKey BlindedHop_get_blinded_node_id(const struct LDKBlindedHop *NONNULL_PTR this_ptr); - -/** - * The blinded node id of this hop in a blinded path. - */ -void BlindedHop_set_blinded_node_id(struct LDKBlindedHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); - -/** - * The encrypted payload intended for this hop in a blinded path. - * - * 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 blinded path. - */ -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 + * Frees any resources used by the NodeId, if is_owned is set and inner is non-NULL. */ -struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); +void NodeId_free(struct LDKNodeId this_obj); /** - * Generates a non-cryptographic 64-bit hash of the BlindedHop. + * Creates a copy of the NodeId */ -uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o); +struct LDKNodeId NodeId_clone(const struct LDKNodeId *NONNULL_PTR orig); /** - * Checks if two BlindedHops contain equal inner contents. + * Checks if two NodeIds 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 BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b); - -/** - * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read - */ -struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); - -/** - * Read a BlindedHop from a byte array, created by BlindedHop_write - */ -struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser); - -/** - * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL. - */ -void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj); - -/** - * Base fee charged (in millisatoshi) for the entire blinded path. - */ -uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); - -/** - * Base fee charged (in millisatoshi) for the entire blinded path. - */ -void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); - -/** - * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path - * (i.e., 10,000 is 1%). - */ -uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); - -/** - * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path - * (i.e., 10,000 is 1%). - */ -void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val); - -/** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded - * path. - */ -uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); - -/** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded - * path. - */ -void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val); - -/** - * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the - * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as - * seen by the recipient. - */ -uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +bool NodeId_eq(const struct LDKNodeId *NONNULL_PTR a, const struct LDKNodeId *NONNULL_PTR b); /** - * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the - * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as - * seen by the recipient. + * Create a new NodeId from a public key */ -void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKNodeId NodeId_from_pubkey(struct LDKPublicKey pubkey); /** - * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the - * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as - * seen by the recipient. + * Create a new NodeId from a slice of bytes */ -uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NodeIdDecodeErrorZ NodeId_from_slice(struct LDKu8slice bytes); /** - * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the - * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as - * seen by the recipient. + * Get the public key slice from this NodeId */ -void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an - * onion payload. + * Get the public key as an array from this NodeId */ -struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr); +MUST_USE_RES const uint8_t (*NodeId_as_array(const struct LDKNodeId *NONNULL_PTR this_arg))[33]; /** - * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an - * onion payload. + * Get the public key from this NodeId */ -void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); +MUST_USE_RES struct LDKCResult_PublicKeySecp256k1ErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg); /** - * Constructs a new BlindedPayInfo given each field + * Get the string representation of a NodeId object */ -MUST_USE_RES struct LDKBlindedPayInfo BlindedPayInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKBlindedHopFeatures features_arg); +struct LDKStr NodeId_to_str(const struct LDKNodeId *NONNULL_PTR o); /** - * Creates a copy of the BlindedPayInfo + * Generates a non-cryptographic 64-bit hash of the NodeId. */ -struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig); +uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o); /** - * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo. + * Serialize the NodeId object into a byte array which can be read by NodeId_read */ -uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o); +struct LDKCVec_u8Z NodeId_write(const struct LDKNodeId *NONNULL_PTR obj); /** - * Checks if two BlindedPayInfos 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. + * Read a NodeId from a byte array, created by NodeId_write */ -bool BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b); +struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); /** - * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read + * Build a NodeId from a PublicKey */ -struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj); +struct LDKNodeId NodeId_from_PublicKey(struct LDKPublicKey f); /** - * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write + * Frees any resources used by the NetworkGraph, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser); +void NetworkGraph_free(struct LDKNetworkGraph this_obj); /** - * Frees any resources used by the BlindedPaymentPath, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. */ -void BlindedPaymentPath_free(struct LDKBlindedPaymentPath this_obj); +void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj); /** - * The [`BlindedPayInfo`] used to pay this blinded path. + * Frees any resources used by the NetworkUpdate */ -struct LDKBlindedPayInfo BlindedPaymentPath_get_payinfo(const struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr); +void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr); /** - * The [`BlindedPayInfo`] used to pay this blinded path. + * Creates a copy of the NetworkUpdate */ -void BlindedPaymentPath_set_payinfo(struct LDKBlindedPaymentPath *NONNULL_PTR this_ptr, struct LDKBlindedPayInfo val); +struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig); /** - * Creates a copy of the BlindedPaymentPath + * Utility method to constructs a new ChannelFailure-variant NetworkUpdate */ -struct LDKBlindedPaymentPath BlindedPaymentPath_clone(const struct LDKBlindedPaymentPath *NONNULL_PTR orig); +struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); /** - * Generates a non-cryptographic 64-bit hash of the BlindedPaymentPath. + * Utility method to constructs a new NodeFailure-variant NetworkUpdate */ -uint64_t BlindedPaymentPath_hash(const struct LDKBlindedPaymentPath *NONNULL_PTR o); +struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent); /** - * Checks if two BlindedPaymentPaths contain equal inner contents. + * Checks if two NetworkUpdates 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 BlindedPaymentPath_eq(const struct LDKBlindedPaymentPath *NONNULL_PTR a, const struct LDKBlindedPaymentPath *NONNULL_PTR b); - -/** - * Create a one-hop blinded path for a payment. - */ -MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_one_hop(struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); - -/** - * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. - * - * Errors if: - * * a provided node id is invalid - * * [`BlindedPayInfo`] calculation results in an integer overflow - * * any unknown features are required in the provided [`ForwardTlvs`] - */ -MUST_USE_RES struct LDKCResult_BlindedPaymentPathNoneZ BlindedPaymentPath_new(struct LDKCVec_PaymentForwardNodeZ intermediate_nodes, struct LDKPublicKey payee_node_id, struct LDKReceiveTlvs payee_tlvs, uint64_t htlc_maximum_msat, uint16_t min_final_cltv_expiry_delta, struct LDKEntropySource entropy_source); - -/** - * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., - * it is found in the network graph). - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -MUST_USE_RES struct LDKNodeId BlindedPaymentPath_public_introduction_node_id(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); - -/** - * The [`IntroductionNode`] of the blinded path. - */ -MUST_USE_RES struct LDKIntroductionNode BlindedPaymentPath_introduction_node(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); - -/** - * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the payment. - * - * [`encrypted_payload`]: BlindedHop::encrypted_payload - */ -MUST_USE_RES struct LDKPublicKey BlindedPaymentPath_blinding_point(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); - -/** - * The [`BlindedHop`]s within the blinded path. - */ -MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedPaymentPath_blinded_hops(const struct LDKBlindedPaymentPath *NONNULL_PTR this_arg); - -/** - * Advance the blinded onion payment path by one hop, making the second hop into the new - * introduction node. - * - * Will only modify `self` when returning `Ok`. - */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedPaymentPath_advance_path_by_one(struct LDKBlindedPaymentPath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); - -/** - * Frees any resources used by the PaymentForwardNode, if is_owned is set and inner is non-NULL. - */ -void PaymentForwardNode_free(struct LDKPaymentForwardNode this_obj); - -/** - * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also - * used for [`BlindedPayInfo`] construction. - */ -struct LDKForwardTlvs PaymentForwardNode_get_tlvs(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); - -/** - * The TLVs for this node's [`BlindedHop`], where the fee parameters contained within are also - * used for [`BlindedPayInfo`] construction. - */ -void PaymentForwardNode_set_tlvs(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKForwardTlvs val); - -/** - * This node's pubkey. - */ -struct LDKPublicKey PaymentForwardNode_get_node_id(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); - -/** - * This node's pubkey. - */ -void PaymentForwardNode_set_node_id(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); - -/** - * The maximum value, in msat, that may be accepted by this node. - */ -uint64_t PaymentForwardNode_get_htlc_maximum_msat(const struct LDKPaymentForwardNode *NONNULL_PTR this_ptr); - -/** - * The maximum value, in msat, that may be accepted by this node. - */ -void PaymentForwardNode_set_htlc_maximum_msat(struct LDKPaymentForwardNode *NONNULL_PTR this_ptr, uint64_t val); - -/** - * Constructs a new PaymentForwardNode given each field - */ -MUST_USE_RES struct LDKPaymentForwardNode PaymentForwardNode_new(struct LDKForwardTlvs tlvs_arg, struct LDKPublicKey node_id_arg, uint64_t htlc_maximum_msat_arg); - -/** - * Creates a copy of the PaymentForwardNode - */ -struct LDKPaymentForwardNode PaymentForwardNode_clone(const struct LDKPaymentForwardNode *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); +bool NetworkUpdate_eq(const struct LDKNetworkUpdate *NONNULL_PTR a, const struct LDKNetworkUpdate *NONNULL_PTR b); /** - * Payment parameters for relaying over [`Self::short_channel_id`]. + * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read */ -void ForwardTlvs_set_payment_relay(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentRelay val); +struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj); /** - * Payment constraints for relaying over [`Self::short_channel_id`]. + * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write */ -struct LDKPaymentConstraints ForwardTlvs_get_payment_constraints(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); /** - * Payment constraints for relaying over [`Self::short_channel_id`]. + * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. */ -void ForwardTlvs_set_payment_constraints(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); +void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); /** - * 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 + * Creates a new tracker of the actual state of the network of channels and nodes, + * assuming an existing [`NetworkGraph`]. + * UTXO lookup is used to make sure announced channels exist on-chain, channel data is + * correct, and the announcement is signed with channel owners' keys. */ -struct LDKBlindedHopFeatures ForwardTlvs_get_features(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_UtxoLookupZ utxo_lookup, struct LDKLogger logger); /** - * 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 + * Adds a provider used to check new announcements. Does not affect + * existing announcements unless they are updated. + * Add, update or remove the provider would replace the current one. */ -void ForwardTlvs_set_features(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val); +void P2PGossipSync_add_utxo_lookup(const struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the - * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. + * Handles any network updates originating from [`Event`]s. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`Event`]: crate::events::Event */ -struct LDKPublicKey ForwardTlvs_get_next_blinding_override(const struct LDKForwardTlvs *NONNULL_PTR this_ptr); +void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** - * Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the - * [`BlindedPaymentPath::blinding_point`] of the appended blinded path. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Gets the chain hash for this network graph. */ -void ForwardTlvs_set_next_blinding_override(struct LDKForwardTlvs *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKThirtyTwoBytes NetworkGraph_get_chain_hash(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Constructs a new ForwardTlvs given each field + * Verifies the signature of a [`NodeAnnouncement`]. * - * Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -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, struct LDKPublicKey next_blinding_override_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); - -/** - * Creates a copy of the ReceiveTlvs - */ -struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); - -/** - * Returns the underlying TLVs. - */ -MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs ReceiveTlvs_tlvs(const struct LDKReceiveTlvs *NONNULL_PTR this_arg); - -/** - * Frees any resources used by the UnauthenticatedReceiveTlvs, if is_owned is set and inner is non-NULL. - */ -void UnauthenticatedReceiveTlvs_free(struct LDKUnauthenticatedReceiveTlvs this_obj); - -/** - * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. - */ -const uint8_t (*UnauthenticatedReceiveTlvs_get_payment_secret(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr))[32]; - -/** - * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. - */ -void UnauthenticatedReceiveTlvs_set_payment_secret(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - -/** - * Constraints for the receiver of this payment. - */ -struct LDKPaymentConstraints UnauthenticatedReceiveTlvs_get_payment_constraints(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); - -/** - * Constraints for the receiver of this payment. - */ -void UnauthenticatedReceiveTlvs_set_payment_constraints(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); - -/** - * Context for the receiver of this payment. - */ -struct LDKPaymentContext UnauthenticatedReceiveTlvs_get_payment_context(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); - -/** - * Context for the receiver of this payment. - */ -void UnauthenticatedReceiveTlvs_set_payment_context(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext val); - -/** - * Constructs a new UnauthenticatedReceiveTlvs given each field - */ -MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg); - -/** - * Creates a copy of the UnauthenticatedReceiveTlvs - */ -struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_clone(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR orig); - -/** - * Creates an authenticated [`ReceiveTlvs`], which includes an HMAC and the provide [`Nonce`] - * that can be use later to verify it authenticity. + * Returns an error if it is invalid. */ -MUST_USE_RES struct LDKReceiveTlvs UnauthenticatedReceiveTlvs_authenticate(struct LDKUnauthenticatedReceiveTlvs this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); +struct LDKCResult_NoneLightningErrorZ verify_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. + * Verifies all signatures included in a [`ChannelAnnouncement`]. + * + * Returns an error if one of the signatures is invalid. */ -void PaymentRelay_free(struct LDKPaymentRelay this_obj); +struct LDKCResult_NoneLightningErrorZ verify_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -uint16_t PaymentRelay_get_cltv_expiry_delta(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. + * Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is */ -void PaymentRelay_set_cltv_expiry_delta(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint16_t val); +struct LDKBaseMessageHandler P2PGossipSync_as_BaseMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** - * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over - * this [`BlindedHop`], (i.e., 10,000 is 1%). + * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. */ -uint32_t PaymentRelay_get_fee_proportional_millionths(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +void ChannelUpdateInfo_free(struct LDKChannelUpdateInfo this_obj); /** - * Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over - * this [`BlindedHop`], (i.e., 10,000 is 1%). + * The minimum value, which must be relayed to the next hop via the channel */ -void PaymentRelay_set_fee_proportional_millionths(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); +uint64_t ChannelUpdateInfo_get_htlc_minimum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + * The minimum value, which must be relayed to the next hop via the channel */ -uint32_t PaymentRelay_get_fee_base_msat(const struct LDKPaymentRelay *NONNULL_PTR this_ptr); +void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. + * The maximum value which may be relayed to the next hop via the channel. */ -void PaymentRelay_set_fee_base_msat(struct LDKPaymentRelay *NONNULL_PTR this_ptr, uint32_t val); +uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Constructs a new PaymentRelay given each field + * The maximum value which may be relayed to the next hop via the channel. */ -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); +void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** - * Creates a copy of the PaymentRelay + * Fees charged when the channel is used for routing */ -struct LDKPaymentRelay PaymentRelay_clone(const struct LDKPaymentRelay *NONNULL_PTR orig); +struct LDKRoutingFees ChannelUpdateInfo_get_fees(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Frees any resources used by the PaymentConstraints, if is_owned is set and inner is non-NULL. + * Fees charged when the channel is used for routing */ -void PaymentConstraints_free(struct LDKPaymentConstraints this_obj); +void ChannelUpdateInfo_set_fees(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -uint32_t PaymentConstraints_get_max_cltv_expiry(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); +uint32_t ChannelUpdateInfo_get_last_update(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. + * When the last update to the channel direction was issued. + * Value is opaque, as set in the announcement. */ -void PaymentConstraints_set_max_cltv_expiry(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint32_t val); +void ChannelUpdateInfo_set_last_update(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint32_t val); /** - * The minimum value, in msat, that may be accepted by the node corresponding to this - * [`BlindedHop`]. + * The difference in CLTV values that you must have when routing through this channel. */ -uint64_t PaymentConstraints_get_htlc_minimum_msat(const struct LDKPaymentConstraints *NONNULL_PTR this_ptr); +uint16_t ChannelUpdateInfo_get_cltv_expiry_delta(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * The minimum value, in msat, that may be accepted by the node corresponding to this - * [`BlindedHop`]. + * The difference in CLTV values that you must have when routing through this channel. */ -void PaymentConstraints_set_htlc_minimum_msat(struct LDKPaymentConstraints *NONNULL_PTR this_ptr, uint64_t val); +void ChannelUpdateInfo_set_cltv_expiry_delta(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint16_t val); /** - * Constructs a new PaymentConstraints given each field + * Whether the channel can be currently used for payments (in this one direction). */ -MUST_USE_RES struct LDKPaymentConstraints PaymentConstraints_new(uint32_t max_cltv_expiry_arg, uint64_t htlc_minimum_msat_arg); +bool ChannelUpdateInfo_get_enabled(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the PaymentConstraints + * Whether the channel can be currently used for payments (in this one direction). */ -struct LDKPaymentConstraints PaymentConstraints_clone(const struct LDKPaymentConstraints *NONNULL_PTR orig); +void ChannelUpdateInfo_set_enabled(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the PaymentContext + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void PaymentContext_free(struct LDKPaymentContext this_ptr); +struct LDKChannelUpdate ChannelUpdateInfo_get_last_update_message(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** - * Creates a copy of the PaymentContext + * Most recent update for the channel received from the network + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKPaymentContext PaymentContext_clone(const struct LDKPaymentContext *NONNULL_PTR orig); +void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdate val); /** - * Utility method to constructs a new Bolt12Offer-variant PaymentContext + * 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 */ -struct LDKPaymentContext PaymentContext_bolt12_offer(struct LDKBolt12OfferContext a); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, uint32_t last_update_arg, uint16_t cltv_expiry_delta_arg, bool enabled_arg, struct LDKChannelUpdate last_update_message_arg); /** - * Utility method to constructs a new Bolt12Refund-variant PaymentContext + * Creates a copy of the ChannelUpdateInfo */ -struct LDKPaymentContext PaymentContext_bolt12_refund(struct LDKBolt12RefundContext a); +struct LDKChannelUpdateInfo ChannelUpdateInfo_clone(const struct LDKChannelUpdateInfo *NONNULL_PTR orig); /** - * Checks if two PaymentContexts contain equal inner contents. + * Checks if two ChannelUpdateInfos 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 PaymentContext_eq(const struct LDKPaymentContext *NONNULL_PTR a, const struct LDKPaymentContext *NONNULL_PTR b); +bool ChannelUpdateInfo_eq(const struct LDKChannelUpdateInfo *NONNULL_PTR a, const struct LDKChannelUpdateInfo *NONNULL_PTR b); /** - * Frees any resources used by the Bolt12OfferContext, if is_owned is set and inner is non-NULL. + * Get the string representation of a ChannelUpdateInfo object */ -void Bolt12OfferContext_free(struct LDKBolt12OfferContext this_obj); +struct LDKStr ChannelUpdateInfo_to_str(const struct LDKChannelUpdateInfo *NONNULL_PTR o); /** - * The identifier of the [`Offer`]. - * - * [`Offer`]: crate::offers::offer::Offer + * Serialize the ChannelUpdateInfo object into a byte array which can be read by ChannelUpdateInfo_read */ -struct LDKOfferId Bolt12OfferContext_get_offer_id(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z ChannelUpdateInfo_write(const struct LDKChannelUpdateInfo *NONNULL_PTR obj); /** - * The identifier of the [`Offer`]. - * - * [`Offer`]: crate::offers::offer::Offer + * Read a ChannelUpdateInfo from a byte array, created by ChannelUpdateInfo_write */ -void Bolt12OfferContext_set_offer_id(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKOfferId val); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ ChannelUpdateInfo_read(struct LDKu8slice ser); /** - * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Frees any resources used by the ChannelInfo, if is_owned is set and inner is non-NULL. */ -struct LDKInvoiceRequestFields Bolt12OfferContext_get_invoice_request(const struct LDKBolt12OfferContext *NONNULL_PTR this_ptr); +void ChannelInfo_free(struct LDKChannelInfo this_obj); /** - * Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * Protocol features of a channel communicated during its announcement */ -void Bolt12OfferContext_set_invoice_request(struct LDKBolt12OfferContext *NONNULL_PTR this_ptr, struct LDKInvoiceRequestFields val); +struct LDKChannelFeatures ChannelInfo_get_features(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Constructs a new Bolt12OfferContext given each field + * Protocol features of a channel communicated during its announcement */ -MUST_USE_RES struct LDKBolt12OfferContext Bolt12OfferContext_new(struct LDKOfferId offer_id_arg, struct LDKInvoiceRequestFields invoice_request_arg); +void ChannelInfo_set_features(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Creates a copy of the Bolt12OfferContext + * Source node of the first direction of a channel */ -struct LDKBolt12OfferContext Bolt12OfferContext_clone(const struct LDKBolt12OfferContext *NONNULL_PTR orig); +struct LDKNodeId ChannelInfo_get_node_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if two Bolt12OfferContexts 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. + * Source node of the first direction of a channel */ -bool Bolt12OfferContext_eq(const struct LDKBolt12OfferContext *NONNULL_PTR a, const struct LDKBolt12OfferContext *NONNULL_PTR b); +void ChannelInfo_set_node_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Frees any resources used by the Bolt12RefundContext, if is_owned is set and inner is non-NULL. + * Source node of the second direction of a channel */ -void Bolt12RefundContext_free(struct LDKBolt12RefundContext this_obj); +struct LDKNodeId ChannelInfo_get_node_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Constructs a new Bolt12RefundContext given each field + * Source node of the second direction of a channel */ -MUST_USE_RES struct LDKBolt12RefundContext Bolt12RefundContext_new(void); +void ChannelInfo_set_node_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKNodeId val); /** - * Creates a copy of the Bolt12RefundContext + * The channel capacity as seen on-chain, if chain lookup is available. */ -struct LDKBolt12RefundContext Bolt12RefundContext_clone(const struct LDKBolt12RefundContext *NONNULL_PTR orig); +struct LDKCOption_u64Z ChannelInfo_get_capacity_sats(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Checks if two Bolt12RefundContexts 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. + * The channel capacity as seen on-chain, if chain lookup is available. */ -bool Bolt12RefundContext_eq(const struct LDKBolt12RefundContext *NONNULL_PTR a, const struct LDKBolt12RefundContext *NONNULL_PTR b); +void ChannelInfo_set_capacity_sats(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Serialize the ForwardTlvs object into a byte array which can be read by ForwardTlvs_read + * Details about the first direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR obj); +struct LDKChannelUpdateInfo ChannelInfo_get_one_to_two(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read + * Details about the first direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); +void ChannelInfo_set_one_to_two(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Serialize the UnauthenticatedReceiveTlvs object into a byte array which can be read by UnauthenticatedReceiveTlvs_read + * Details about the second direction of a channel + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z UnauthenticatedReceiveTlvs_write(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR obj); +struct LDKChannelUpdateInfo ChannelInfo_get_two_to_one(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read + * Details about the second direction of a channel + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z PaymentRelay_write(const struct LDKPaymentRelay *NONNULL_PTR obj); +void ChannelInfo_set_two_to_one(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelUpdateInfo val); /** - * Read a PaymentRelay from a byte array, created by PaymentRelay_write + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PaymentRelayDecodeErrorZ PaymentRelay_read(struct LDKu8slice ser); +struct LDKChannelAnnouncement ChannelInfo_get_announcement_message(const struct LDKChannelInfo *NONNULL_PTR this_ptr); /** - * Serialize the PaymentConstraints object into a byte array which can be read by PaymentConstraints_read + * An initial announcement of the channel + * Mostly redundant with the data we store in fields explicitly. + * Everything else is useful only for sending out for initial routing sync. + * Not stored if contains excess data to prevent DoS. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCVec_u8Z PaymentConstraints_write(const struct LDKPaymentConstraints *NONNULL_PTR obj); +void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR this_ptr, struct LDKChannelAnnouncement val); /** - * Read a PaymentConstraints from a byte array, created by PaymentConstraints_write + * Creates a copy of the ChannelInfo */ -struct LDKCResult_PaymentConstraintsDecodeErrorZ PaymentConstraints_read(struct LDKu8slice ser); +struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); /** - * Serialize the PaymentContext object into a byte array which can be read by PaymentContext_read + * Checks if two ChannelInfos 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. */ -struct LDKCVec_u8Z PaymentContext_write(const struct LDKPaymentContext *NONNULL_PTR obj); +bool ChannelInfo_eq(const struct LDKChannelInfo *NONNULL_PTR a, const struct LDKChannelInfo *NONNULL_PTR b); /** - * Read a PaymentContext from a byte array, created by PaymentContext_write + * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_PaymentContextDecodeErrorZ PaymentContext_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); /** - * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read + * Get the string representation of a ChannelInfo object */ -struct LDKCVec_u8Z Bolt12OfferContext_write(const struct LDKBolt12OfferContext *NONNULL_PTR obj); +struct LDKStr ChannelInfo_to_str(const struct LDKChannelInfo *NONNULL_PTR o); /** - * Read a Bolt12OfferContext from a byte array, created by Bolt12OfferContext_write + * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ -struct LDKCResult_Bolt12OfferContextDecodeErrorZ Bolt12OfferContext_read(struct LDKu8slice ser); +struct LDKCVec_u8Z ChannelInfo_write(const struct LDKChannelInfo *NONNULL_PTR obj); /** - * Serialize the Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read + * Read a ChannelInfo from a byte array, created by ChannelInfo_write */ -struct LDKCVec_u8Z Bolt12RefundContext_write(const struct LDKBolt12RefundContext *NONNULL_PTR obj); +struct LDKCResult_ChannelInfoDecodeErrorZ ChannelInfo_read(struct LDKu8slice ser); /** - * Read a Bolt12RefundContext from a byte array, created by Bolt12RefundContext_write + * Frees any resources used by the DirectedChannelInfo, if is_owned is set and inner is non-NULL. */ -struct LDKCResult_Bolt12RefundContextDecodeErrorZ Bolt12RefundContext_read(struct LDKu8slice ser); +void DirectedChannelInfo_free(struct LDKDirectedChannelInfo this_obj); /** - * Frees any resources used by the BlindedMessagePath, if is_owned is set and inner is non-NULL. + * Creates a copy of the DirectedChannelInfo */ -void BlindedMessagePath_free(struct LDKBlindedMessagePath this_obj); +struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirectedChannelInfo *NONNULL_PTR orig); /** - * Creates a copy of the BlindedMessagePath + * Returns information for the channel. */ -struct LDKBlindedMessagePath BlindedMessagePath_clone(const struct LDKBlindedMessagePath *NONNULL_PTR orig); +MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the BlindedMessagePath. + * Returns the [`EffectiveCapacity`] of the channel in the direction. + * + * This is either the total capacity from the funding transaction, if known, or the + * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, + * otherwise. */ -uint64_t BlindedMessagePath_hash(const struct LDKBlindedMessagePath *NONNULL_PTR o); +MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Checks if two BlindedMessagePaths 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. + * Returns the `node_id` of the source hop. + * + * Refers to the `node_id` forwarding the payment to the next hop. */ -bool BlindedMessagePath_eq(const struct LDKBlindedMessagePath *NONNULL_PTR a, const struct LDKBlindedMessagePath *NONNULL_PTR b); +MUST_USE_RES struct LDKNodeId DirectedChannelInfo_source(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Serialize the BlindedMessagePath object into a byte array which can be read by BlindedMessagePath_read + * Returns the `node_id` of the target hop. + * + * Refers to the `node_id` receiving the payment from the previous hop. */ -struct LDKCVec_u8Z BlindedMessagePath_write(const struct LDKBlindedMessagePath *NONNULL_PTR obj); +MUST_USE_RES struct LDKNodeId DirectedChannelInfo_target(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); /** - * Read a BlindedMessagePath from a byte array, created by BlindedMessagePath_write + * Frees any resources used by the EffectiveCapacity */ -struct LDKCResult_BlindedMessagePathDecodeErrorZ BlindedMessagePath_read(struct LDKu8slice ser); +void EffectiveCapacity_free(struct LDKEffectiveCapacity this_ptr); /** - * Create a one-hop blinded path for a message. + * Creates a copy of the EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_BlindedMessagePathNoneZ BlindedMessagePath_one_hop(struct LDKPublicKey recipient_node_id, struct LDKMessageContext context, struct LDKEntropySource entropy_source); +struct LDKEffectiveCapacity EffectiveCapacity_clone(const struct LDKEffectiveCapacity *NONNULL_PTR orig); /** - * Create a path for an onion message, to be forwarded along `node_pks`. The last node - * pubkey in `node_pks` will be the destination node. - * - * Errors if no hops are provided or if `node_pk`(s) are invalid. + * Utility method to constructs a new ExactLiquidity-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCResult_BlindedMessagePathNoneZ BlindedMessagePath_new(struct LDKCVec_MessageForwardNodeZ intermediate_nodes, struct LDKPublicKey recipient_node_id, struct LDKMessageContext context, struct LDKEntropySource entropy_source); +struct LDKEffectiveCapacity EffectiveCapacity_exact_liquidity(uint64_t liquidity_msat); /** - * Attempts to a use a compact representation for the [`IntroductionNode`] by using a directed - * short channel id from a channel in `network_graph` leading to the introduction node. - * - * While this may result in a smaller encoding, there is a trade off in that the path may - * become invalid if the channel is closed or hasn't been propagated via gossip. Therefore, - * calling this may not be suitable for long-lived blinded paths. + * Utility method to constructs a new AdvertisedMaxHTLC-variant EffectiveCapacity */ -void BlindedMessagePath_use_compact_introduction_node(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); +struct LDKEffectiveCapacity EffectiveCapacity_advertised_max_htlc(uint64_t amount_msat); /** - * Returns the introduction [`NodeId`] of the blinded path, if it is publicly reachable (i.e., - * it is found in the network graph). - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new Total-variant EffectiveCapacity */ -MUST_USE_RES struct LDKNodeId BlindedMessagePath_public_introduction_node_id(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKReadOnlyNetworkGraph *NONNULL_PTR network_graph); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); /** - * The [`IntroductionNode`] of the blinded path. + * Utility method to constructs a new Infinite-variant EffectiveCapacity */ -MUST_USE_RES struct LDKIntroductionNode BlindedMessagePath_introduction_node(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_infinite(void); /** - * Used by the [`IntroductionNode`] to decrypt its [`encrypted_payload`] to forward the message. - * - * [`encrypted_payload`]: BlindedHop::encrypted_payload + * Utility method to constructs a new HintMaxHTLC-variant EffectiveCapacity */ -MUST_USE_RES struct LDKPublicKey BlindedMessagePath_blinding_point(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_hint_max_htlc(uint64_t amount_msat); /** - * The [`BlindedHop`]s within the blinded path. + * Utility method to constructs a new Unknown-variant EffectiveCapacity */ -MUST_USE_RES struct LDKCVec_BlindedHopZ BlindedMessagePath_blinded_hops(const struct LDKBlindedMessagePath *NONNULL_PTR this_arg); +struct LDKEffectiveCapacity EffectiveCapacity_unknown(void); /** - * Advance the blinded onion message path by one hop, making the second hop into the new - * introduction node. - * - * Will only modify `self` when returning `Ok`. + * Returns the effective capacity denominated in millisatoshi. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedMessagePath_advance_path_by_one(struct LDKBlindedMessagePath *NONNULL_PTR this_arg, const struct LDKNodeSigner *NONNULL_PTR node_signer, const struct LDKNodeIdLookUp *NONNULL_PTR node_id_lookup); +MUST_USE_RES uint64_t EffectiveCapacity_as_msat(const struct LDKEffectiveCapacity *NONNULL_PTR this_arg); /** - * Frees any resources used by the NextMessageHop + * Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read */ -void NextMessageHop_free(struct LDKNextMessageHop this_ptr); +struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj); /** - * Creates a copy of the NextMessageHop + * Read a RoutingFees from a byte array, created by RoutingFees_write */ -struct LDKNextMessageHop NextMessageHop_clone(const struct LDKNextMessageHop *NONNULL_PTR orig); +struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser); /** - * Utility method to constructs a new NodeId-variant NextMessageHop + * Frees any resources used by the NodeAnnouncementDetails, if is_owned is set and inner is non-NULL. */ -struct LDKNextMessageHop NextMessageHop_node_id(struct LDKPublicKey a); +void NodeAnnouncementDetails_free(struct LDKNodeAnnouncementDetails this_obj); /** - * Utility method to constructs a new ShortChannelId-variant NextMessageHop + * Protocol features the node announced support for */ -struct LDKNextMessageHop NextMessageHop_short_channel_id(uint64_t a); +struct LDKNodeFeatures NodeAnnouncementDetails_get_features(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the NextMessageHop. + * Protocol features the node announced support for */ -uint64_t NextMessageHop_hash(const struct LDKNextMessageHop *NONNULL_PTR o); +void NodeAnnouncementDetails_set_features(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Checks if two NextMessageHops contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -bool NextMessageHop_eq(const struct LDKNextMessageHop *NONNULL_PTR a, const struct LDKNextMessageHop *NONNULL_PTR b); +uint32_t NodeAnnouncementDetails_get_last_update(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Frees any resources used by the MessageForwardNode, if is_owned is set and inner is non-NULL. + * When the last known update to the node state was issued. + * Value is opaque, as set in the announcement. */ -void MessageForwardNode_free(struct LDKMessageForwardNode this_obj); +void NodeAnnouncementDetails_set_last_update(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, uint32_t val); /** - * This node's pubkey. + * Color assigned to the node */ -struct LDKPublicKey MessageForwardNode_get_node_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); +const uint8_t (*NodeAnnouncementDetails_get_rgb(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr))[3]; /** - * This node's pubkey. + * Color assigned to the node */ -void MessageForwardNode_set_node_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void NodeAnnouncementDetails_set_rgb(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKThreeBytes val); /** - * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s - * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a - * more compact representation. + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -struct LDKCOption_u64Z MessageForwardNode_get_short_channel_id(const struct LDKMessageForwardNode *NONNULL_PTR this_ptr); +struct LDKNodeAlias NodeAnnouncementDetails_get_alias(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * The channel between `node_id` and the next hop. If set, the constructed [`BlindedHop`]'s - * `encrypted_payload` will use this instead of the next [`MessageForwardNode::node_id`] for a - * more compact representation. + * Moniker assigned to the node. + * May be invalid or malicious (eg control chars), + * should not be exposed to the user. */ -void MessageForwardNode_set_short_channel_id(struct LDKMessageForwardNode *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void NodeAnnouncementDetails_set_alias(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKNodeAlias val); /** - * Constructs a new MessageForwardNode given each field + * Internet-level addresses via which one can connect to the node + * + * Returns a copy of the field. */ -MUST_USE_RES struct LDKMessageForwardNode MessageForwardNode_new(struct LDKPublicKey node_id_arg, struct LDKCOption_u64Z short_channel_id_arg); +struct LDKCVec_SocketAddressZ NodeAnnouncementDetails_get_addresses(const struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr); /** - * Creates a copy of the MessageForwardNode + * Internet-level addresses via which one can connect to the node */ -struct LDKMessageForwardNode MessageForwardNode_clone(const struct LDKMessageForwardNode *NONNULL_PTR orig); +void NodeAnnouncementDetails_set_addresses(struct LDKNodeAnnouncementDetails *NONNULL_PTR this_ptr, struct LDKCVec_SocketAddressZ val); /** - * Generates a non-cryptographic 64-bit hash of the MessageForwardNode. + * Constructs a new NodeAnnouncementDetails given each field */ -uint64_t MessageForwardNode_hash(const struct LDKMessageForwardNode *NONNULL_PTR o); +MUST_USE_RES struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_SocketAddressZ addresses_arg); /** - * Checks if two MessageForwardNodes 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. + * Creates a copy of the NodeAnnouncementDetails */ -bool MessageForwardNode_eq(const struct LDKMessageForwardNode *NONNULL_PTR a, const struct LDKMessageForwardNode *NONNULL_PTR b); +struct LDKNodeAnnouncementDetails NodeAnnouncementDetails_clone(const struct LDKNodeAnnouncementDetails *NONNULL_PTR orig); /** - * Frees any resources used by the MessageContext + * Checks if two NodeAnnouncementDetailss 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. */ -void MessageContext_free(struct LDKMessageContext this_ptr); +bool NodeAnnouncementDetails_eq(const struct LDKNodeAnnouncementDetails *NONNULL_PTR a, const struct LDKNodeAnnouncementDetails *NONNULL_PTR b); /** - * Creates a copy of the MessageContext + * Frees any resources used by the NodeAnnouncementInfo */ -struct LDKMessageContext MessageContext_clone(const struct LDKMessageContext *NONNULL_PTR orig); +void NodeAnnouncementInfo_free(struct LDKNodeAnnouncementInfo this_ptr); /** - * Utility method to constructs a new Offers-variant MessageContext + * Creates a copy of the NodeAnnouncementInfo */ -struct LDKMessageContext MessageContext_offers(struct LDKOffersContext a); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_clone(const struct LDKNodeAnnouncementInfo *NONNULL_PTR orig); /** - * Utility method to constructs a new AsyncPayments-variant MessageContext + * Utility method to constructs a new Relayed-variant NodeAnnouncementInfo */ -struct LDKMessageContext MessageContext_async_payments(struct LDKAsyncPaymentsContext a); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_relayed(struct LDKNodeAnnouncement a); /** - * Utility method to constructs a new DNSResolver-variant MessageContext + * Utility method to constructs a new Local-variant NodeAnnouncementInfo */ -struct LDKMessageContext MessageContext_dnsresolver(struct LDKDNSResolverContext a); +struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_local(struct LDKNodeAnnouncementDetails a); /** - * Utility method to constructs a new Custom-variant MessageContext + * Checks if two NodeAnnouncementInfos contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKMessageContext MessageContext_custom(struct LDKCVec_u8Z a); +bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b); /** - * Frees any resources used by the OffersContext + * Protocol features the node announced support for */ -void OffersContext_free(struct LDKOffersContext this_ptr); +MUST_USE_RES struct LDKNodeFeatures NodeAnnouncementInfo_features(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Creates a copy of the OffersContext + * When the last known update to the node state was issued. + * + * Value may or may not be a timestamp, depending on the policy of the origin node. */ -struct LDKOffersContext OffersContext_clone(const struct LDKOffersContext *NONNULL_PTR orig); +MUST_USE_RES uint32_t NodeAnnouncementInfo_last_update(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvoiceRequest-variant OffersContext + * Color assigned to the node */ -struct LDKOffersContext OffersContext_invoice_request(struct LDKNonce nonce); +MUST_USE_RES struct LDKThreeBytes NodeAnnouncementInfo_rgb(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OutboundPayment-variant OffersContext + * Moniker assigned to the node. + * + * May be invalid or malicious (eg control chars), should not be exposed to the user. */ -struct LDKOffersContext OffersContext_outbound_payment(struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); +MUST_USE_RES struct LDKNodeAlias NodeAnnouncementInfo_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InboundPayment-variant OffersContext + * Internet-level addresses via which one can connect to the node */ -struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes payment_hash, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); +MUST_USE_RES struct LDKCVec_SocketAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Checks if two OffersContexts contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * An initial announcement of the node + * + * Not stored if contains excess data to prevent DoS. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool OffersContext_eq(const struct LDKOffersContext *NONNULL_PTR a, const struct LDKOffersContext *NONNULL_PTR b); +MUST_USE_RES struct LDKNodeAnnouncement NodeAnnouncementInfo_announcement_message(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg); /** - * Frees any resources used by the AsyncPaymentsContext + * Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read */ -void AsyncPaymentsContext_free(struct LDKAsyncPaymentsContext this_ptr); +struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementInfo *NONNULL_PTR obj); /** - * Creates a copy of the AsyncPaymentsContext + * Read a NodeAnnouncementInfo from a byte array, created by NodeAnnouncementInfo_write */ -struct LDKAsyncPaymentsContext AsyncPaymentsContext_clone(const struct LDKAsyncPaymentsContext *NONNULL_PTR orig); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); /** - * Utility method to constructs a new OutboundPayment-variant AsyncPaymentsContext + * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. */ -struct LDKAsyncPaymentsContext AsyncPaymentsContext_outbound_payment(struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); +void NodeAlias_free(struct LDKNodeAlias this_obj); -/** - * Serialize the MessageContext object into a byte array which can be read by MessageContext_read - */ -struct LDKCVec_u8Z MessageContext_write(const struct LDKMessageContext *NONNULL_PTR obj); +const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; -/** - * Read a MessageContext from a byte array, created by MessageContext_write - */ -struct LDKCResult_MessageContextDecodeErrorZ MessageContext_read(struct LDKu8slice ser); +void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Serialize the OffersContext object into a byte array which can be read by OffersContext_read + * Constructs a new NodeAlias given each field */ -struct LDKCVec_u8Z OffersContext_write(const struct LDKOffersContext *NONNULL_PTR obj); +MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); /** - * Read a OffersContext from a byte array, created by OffersContext_write + * Creates a copy of the NodeAlias */ -struct LDKCResult_OffersContextDecodeErrorZ OffersContext_read(struct LDKu8slice ser); +struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); /** - * Serialize the AsyncPaymentsContext object into a byte array which can be read by AsyncPaymentsContext_read + * Generates a non-cryptographic 64-bit hash of the NodeAlias. */ -struct LDKCVec_u8Z AsyncPaymentsContext_write(const struct LDKAsyncPaymentsContext *NONNULL_PTR obj); +uint64_t NodeAlias_hash(const struct LDKNodeAlias *NONNULL_PTR o); /** - * Read a AsyncPaymentsContext from a byte array, created by AsyncPaymentsContext_write + * Checks if two NodeAliass 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. */ -struct LDKCResult_AsyncPaymentsContextDecodeErrorZ AsyncPaymentsContext_read(struct LDKu8slice ser); +bool NodeAlias_eq(const struct LDKNodeAlias *NONNULL_PTR a, const struct LDKNodeAlias *NONNULL_PTR b); /** - * Frees any resources used by the DNSResolverContext, if is_owned is set and inner is non-NULL. + * Get the string representation of a NodeAlias object */ -void DNSResolverContext_free(struct LDKDNSResolverContext this_obj); +struct LDKStr NodeAlias_to_str(const struct LDKNodeAlias *NONNULL_PTR o); /** - * A nonce which uniquely describes a DNS resolution. - * - * When we receive a DNSSEC proof message, we should check that it was sent over the blinded - * path we included in the request by comparing a stored nonce with this one. + * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read */ -const uint8_t (*DNSResolverContext_get_nonce(const struct LDKDNSResolverContext *NONNULL_PTR this_ptr))[16]; +struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); /** - * A nonce which uniquely describes a DNS resolution. - * - * When we receive a DNSSEC proof message, we should check that it was sent over the blinded - * path we included in the request by comparing a stored nonce with this one. + * Read a NodeAlias from a byte array, created by NodeAlias_write */ -void DNSResolverContext_set_nonce(struct LDKDNSResolverContext *NONNULL_PTR this_ptr, struct LDKSixteenBytes val); +struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); /** - * Constructs a new DNSResolverContext given each field + * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKDNSResolverContext DNSResolverContext_new(struct LDKSixteenBytes nonce_arg); +void NodeInfo_free(struct LDKNodeInfo this_obj); /** - * Creates a copy of the DNSResolverContext + * All valid channels a node has announced + * + * Returns a copy of the field. */ -struct LDKDNSResolverContext DNSResolverContext_clone(const struct LDKDNSResolverContext *NONNULL_PTR orig); +struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the DNSResolverContext. + * All valid channels a node has announced */ -uint64_t DNSResolverContext_hash(const struct LDKDNSResolverContext *NONNULL_PTR o); +void NodeInfo_set_channels(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Checks if two DNSResolverContexts 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. + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. + * + * Returns a copy of the field. */ -bool DNSResolverContext_eq(const struct LDKDNSResolverContext *NONNULL_PTR a, const struct LDKDNSResolverContext *NONNULL_PTR b); +struct LDKCOption_NodeAnnouncementInfoZ NodeInfo_get_announcement_info(const struct LDKNodeInfo *NONNULL_PTR this_ptr); /** - * Serialize the DNSResolverContext object into a byte array which can be read by DNSResolverContext_read + * More information about a node from node_announcement. + * Optional because we store a Node entry after learning about it from + * a channel announcement, but before receiving a node announcement. */ -struct LDKCVec_u8Z DNSResolverContext_write(const struct LDKDNSResolverContext *NONNULL_PTR obj); +void NodeInfo_set_announcement_info(struct LDKNodeInfo *NONNULL_PTR this_ptr, struct LDKCOption_NodeAnnouncementInfoZ val); /** - * Read a DNSResolverContext from a byte array, created by DNSResolverContext_write + * Creates a copy of the NodeInfo */ -struct LDKCResult_DNSResolverContextDecodeErrorZ DNSResolverContext_read(struct LDKu8slice ser); +struct LDKNodeInfo NodeInfo_clone(const struct LDKNodeInfo *NONNULL_PTR orig); /** - * Frees any resources used by the FundingInfo + * Checks if two NodeInfos 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. */ -void FundingInfo_free(struct LDKFundingInfo this_ptr); +bool NodeInfo_eq(const struct LDKNodeInfo *NONNULL_PTR a, const struct LDKNodeInfo *NONNULL_PTR b); /** - * Creates a copy of the FundingInfo + * Returns whether the node has only announced Tor addresses. */ -struct LDKFundingInfo FundingInfo_clone(const struct LDKFundingInfo *NONNULL_PTR orig); +MUST_USE_RES bool NodeInfo_is_tor_only(const struct LDKNodeInfo *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Tx-variant FundingInfo + * Get the string representation of a NodeInfo object */ -struct LDKFundingInfo FundingInfo_tx(struct LDKTransaction transaction); +struct LDKStr NodeInfo_to_str(const struct LDKNodeInfo *NONNULL_PTR o); /** - * Utility method to constructs a new OutPoint-variant FundingInfo + * Serialize the NodeInfo object into a byte array which can be read by NodeInfo_read */ -struct LDKFundingInfo FundingInfo_out_point(struct LDKOutPoint outpoint); +struct LDKCVec_u8Z NodeInfo_write(const struct LDKNodeInfo *NONNULL_PTR obj); /** - * Checks if two FundingInfos contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Read a NodeInfo from a byte array, created by NodeInfo_write */ -bool FundingInfo_eq(const struct LDKFundingInfo *NONNULL_PTR a, const struct LDKFundingInfo *NONNULL_PTR b); +struct LDKCResult_NodeInfoDecodeErrorZ NodeInfo_read(struct LDKu8slice ser); /** - * Serialize the FundingInfo object into a byte array which can be read by FundingInfo_read + * Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read */ -struct LDKCVec_u8Z FundingInfo_write(const struct LDKFundingInfo *NONNULL_PTR obj); +struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR obj); /** - * Read a FundingInfo from a byte array, created by FundingInfo_write + * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ -struct LDKCResult_FundingInfoDecodeErrorZ FundingInfo_read(struct LDKu8slice ser); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); /** - * Frees any resources used by the PaymentPurpose + * Get the string representation of a NetworkGraph object */ -void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr); +struct LDKStr NetworkGraph_to_str(const struct LDKNetworkGraph *NONNULL_PTR o); /** - * Creates a copy of the PaymentPurpose + * Creates a new, empty, network graph. */ -struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(enum LDKNetwork network, struct LDKLogger logger); /** - * Utility method to constructs a new Bolt11InvoicePayment-variant PaymentPurpose + * Returns a read-only view of the network graph. */ -struct LDKPaymentPurpose PaymentPurpose_bolt11_invoice_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Bolt12OfferPayment-variant PaymentPurpose + * The unix timestamp provided by the most recent rapid gossip sync. + * It will be set by the rapid sync process after every sync completion. */ -struct LDKPaymentPurpose PaymentPurpose_bolt12_offer_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12OfferContext payment_context); +MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Bolt12RefundPayment-variant PaymentPurpose + * Update the unix timestamp provided by the most recent rapid gossip sync. + * This should be done automatically by the rapid sync process after every sync completion. */ -struct LDKPaymentPurpose PaymentPurpose_bolt12_refund_payment(struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKThirtyTwoBytes payment_secret, struct LDKBolt12RefundContext payment_context); +void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); /** - * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement. + * + * You probably don't want to call this directly, instead relying on a P2PGossipSync's + * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. */ -struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** - * Checks if two PaymentPurposes contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * For an already known node (from channel announcements), update its stored properties from a + * given node announcement without verifying the associated signatures. Because we aren't + * given the associated signatures here we cannot relay the node announcement to any of our + * peers. */ -bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg); /** - * Returns the preimage for this payment, if it is known. + * Store or update channel info from a channel announcement. + * + * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s + * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -MUST_USE_RES struct LDKCOption_ThirtyTwoBytesZ PaymentPurpose_preimage(const struct LDKPaymentPurpose *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read + * Store or update channel info from a channel announcement. + * + * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s + * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * This will skip verification of if the channel is actually on-chain. */ -struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement_no_lookup(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** - * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write + * Store or update channel info from a channel announcement without verifying the associated + * signatures. Because we aren't given the associated signatures here we cannot relay the + * channel announcement to any of our peers. + * + * If a [`UtxoLookup`] object is provided via `utxo_lookup`, it will be called to verify + * the corresponding UTXO exists on chain and is correctly-formatted. */ -struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_UtxoLookupZ utxo_lookup); /** - * Frees any resources used by the ClaimedHTLC, if is_owned is set and inner is non-NULL. + * Update channel from partial announcement data received via rapid gossip sync + * + * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the + * rapid gossip sync server) + * + * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. */ -void ClaimedHTLC_free(struct LDKClaimedHTLC this_obj); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, struct LDKCOption_u64Z capacity_sats, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKNodeId node_id_1, struct LDKNodeId node_id_2); /** - * The `channel_id` of the channel over which the HTLC was received. + * Marks a channel in the graph as failed permanently. + * + * The channel and any node for which this was their last channel are removed from the graph. */ -struct LDKChannelId ClaimedHTLC_get_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * The `channel_id` of the channel over which the HTLC was received. + * Marks a node in the graph as permanently failed, effectively removing it and its channels + * from local storage. */ -void ClaimedHTLC_set_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKChannelId val); +void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey node_id); /** - * 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. + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. * - * 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.) + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. * - * [`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 + * Note that for users of the `lightning-background-processor` crate this method may be + * automatically called regularly for you. + * + * This method will also cause us to stop tracking removed nodes and channels if they have been + * in the map for a while so that these can be resynced from gossip in the future. + * + * This method is only available with the `std` feature. See + * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for non-`std` use. */ -struct LDKU128 ClaimedHTLC_get_user_channel_id(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** - * 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. + * Removes information about channels that we haven't heard any updates about in some time. + * This can be used regularly to prune the network graph of channels that likely no longer + * exist. * - * 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.) + * While there is no formal requirement that nodes regularly re-broadcast their channel + * updates every two weeks, the non-normative section of BOLT 7 currently suggests that + * pruning occur for updates which are at least two weeks old, which we implement here. * - * [`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 + * This method will also cause us to stop tracking removed nodes and channels if they have been + * in the map for a while so that these can be resynced from gossip in the future. + * + *This function takes the current unix time as an argument. For users with the `std` feature + *enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. */ -void ClaimedHTLC_set_user_channel_id(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, struct LDKU128 val); +void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); /** - * The block height at which this HTLC expires. + * For an already known (from announcement) channel, update info about one of the directions + * of the channel. + * + * You probably don't want to call this directly, instead relying on a [`P2PGossipSync`]'s + * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept + * routing messages from a source using a protocol other than the lightning P2P protocol. + * + * If not built with `std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -uint32_t ClaimedHTLC_get_cltv_expiry(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * The block height at which this HTLC expires. + * For an already known (from announcement) channel, update info about one of the directions + * of the channel without verifying the associated signatures. Because we aren't given the + * associated signatures here we cannot relay the channel update to any of our peers. + * + * If not built with `std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -void ClaimedHTLC_set_cltv_expiry(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); /** - * The amount (in msats) of this part of an MPP. + * For an already known (from announcement) channel, verify the given [`ChannelUpdate`]. + * + * This checks whether the update currently is applicable by [`Self::update_channel`]. + * + * If not built with `std`, any updates with a timestamp more than two weeks in the past or + * materially in the future will be rejected. */ -uint64_t ClaimedHTLC_get_value_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * The amount (in msats) of this part of an MPP. + * Returns information on a channel with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ClaimedHTLC_set_value_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); /** - * The extra fee our counterparty skimmed off the top of this HTLC, if any. - * - * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to - * 0.0.119. + * Returns the list of channels in the graph */ -uint64_t ClaimedHTLC_get_counterparty_skimmed_fee_msat(const struct LDKClaimedHTLC *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * The extra fee our counterparty skimmed off the top of this HTLC, if any. + * Returns information on a node with the given id. * - * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to - * 0.0.119. + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ClaimedHTLC_set_counterparty_skimmed_fee_msat(struct LDKClaimedHTLC *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Constructs a new ClaimedHTLC given each field + * Returns the list of nodes in the graph */ -MUST_USE_RES struct LDKClaimedHTLC ClaimedHTLC_new(struct LDKChannelId channel_id_arg, struct LDKU128 user_channel_id_arg, uint32_t cltv_expiry_arg, uint64_t value_msat_arg, uint64_t counterparty_skimmed_fee_msat_arg); +MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); /** - * Creates a copy of the ClaimedHTLC + * Get network addresses by node id. + * Returns None if the requested node is completely unknown, + * or if node announcement for the node was never received. */ -struct LDKClaimedHTLC ClaimedHTLC_clone(const struct LDKClaimedHTLC *NONNULL_PTR orig); +MUST_USE_RES struct LDKCOption_CVec_SocketAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); /** - * 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. + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. */ -bool ClaimedHTLC_eq(const struct LDKClaimedHTLC *NONNULL_PTR a, const struct LDKClaimedHTLC *NONNULL_PTR b); +void DefaultRouter_free(struct LDKDefaultRouter this_obj); /** - * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read + * Creates a new router. */ -struct LDKCVec_u8Z ClaimedHTLC_write(const struct LDKClaimedHTLC *NONNULL_PTR obj); +MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKLockableScore scorer, struct LDKProbabilisticScoringFeeParameters score_params); /** - * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write + * Constructs a new Router which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is */ -struct LDKCResult_ClaimedHTLCDecodeErrorZ ClaimedHTLC_read(struct LDKu8slice ser); +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); /** - * Frees any resources used by the PathFailure + * Calls the free function if one is set */ -void PathFailure_free(struct LDKPathFailure this_ptr); +void Router_free(struct LDKRouter this_ptr); /** - * Creates a copy of the PathFailure + * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. */ -struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig); +void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); /** - * Utility method to constructs a new InitialSend-variant PathFailure + * Initialize a new `ScorerAccountingForInFlightHtlcs`. */ -struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err); +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScoreLookUp scorer, const struct LDKInFlightHtlcs *NONNULL_PTR inflight_htlcs); /** - * Utility method to constructs a new OnPath-variant PathFailure + * 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 LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update); +struct LDKScoreLookUp ScorerAccountingForInFlightHtlcs_as_ScoreLookUp(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR this_arg); /** - * Checks if two PathFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. */ -bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b); +void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); /** - * Serialize the PathFailure object into a byte array which can be read by PathFailure_read + * Creates a copy of the InFlightHtlcs */ -struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj); +struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); /** - * Read a PathFailure from a byte array, created by PathFailure_write + * Constructs an empty `InFlightHtlcs`. */ -struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser); +MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); /** - * Frees any resources used by the ClosureReason + * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`. */ -void ClosureReason_free(struct LDKClosureReason this_ptr); +void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id); /** - * Creates a copy of the ClosureReason + * Adds a known HTLC given the public key of the HTLC source, target, and short channel + * id. */ -struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig); +void InFlightHtlcs_add_inflight_htlc(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid, uint64_t used_msat); /** - * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason + * Returns liquidity in msat given the public key of the HTLC source, target, and short channel + * id. */ -struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKUntrustedString peer_msg); +MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid); /** - * Utility method to constructs a new HolderForceClosed-variant ClosureReason + * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read */ -struct LDKClosureReason ClosureReason_holder_force_closed(struct LDKCOption_boolZ broadcasted_latest_txn); +struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); /** - * Utility method to constructs a new LegacyCooperativeClosure-variant ClosureReason + * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write */ -struct LDKClosureReason ClosureReason_legacy_cooperative_closure(void); +struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); /** - * Utility method to constructs a new CounterpartyInitiatedCooperativeClosure-variant ClosureReason + * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. */ -struct LDKClosureReason ClosureReason_counterparty_initiated_cooperative_closure(void); +void RouteHop_free(struct LDKRouteHop this_obj); /** - * Utility method to constructs a new LocallyInitiatedCooperativeClosure-variant ClosureReason + * The node_id of the node at this hop. */ -struct LDKClosureReason ClosureReason_locally_initiated_cooperative_closure(void); +struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason + * The node_id of the node at this hop. */ -struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void); +void RouteHop_set_pubkey(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Utility method to constructs a new FundingTimedOut-variant ClosureReason + * The node_announcement features of the node at this hop. For the last hop, these may be + * amended to match the features present in the invoice this node generated. */ -struct LDKClosureReason ClosureReason_funding_timed_out(void); +struct LDKNodeFeatures RouteHop_get_node_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ProcessingError-variant ClosureReason + * The node_announcement features of the node at this hop. For the last hop, these may be + * amended to match the features present in the invoice this node generated. */ -struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err); +void RouteHop_set_node_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Utility method to constructs a new DisconnectedPeer-variant ClosureReason + * The channel that should be used from the previous hop to reach this node. */ -struct LDKClosureReason ClosureReason_disconnected_peer(void); +uint64_t RouteHop_get_short_channel_id(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason + * The channel that should be used from the previous hop to reach this node. */ -struct LDKClosureReason ClosureReason_outdated_channel_manager(void); +void RouteHop_set_short_channel_id(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new CounterpartyCoopClosedUnfundedChannel-variant ClosureReason + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -struct LDKClosureReason ClosureReason_counterparty_coop_closed_unfunded_channel(void); +struct LDKChannelFeatures RouteHop_get_channel_features(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new FundingBatchClosure-variant ClosureReason + * The channel_announcement features of the channel that should be used from the previous hop + * to reach this node. */ -struct LDKClosureReason ClosureReason_funding_batch_closure(void); +void RouteHop_set_channel_features(struct LDKRouteHop *NONNULL_PTR this_ptr, struct LDKChannelFeatures val); /** - * Utility method to constructs a new HTLCsTimedOut-variant ClosureReason + * The fee taken on this hop (for paying for the use of the *next* channel in the path). + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire + * blinded path (including any Trampoline hops) + * * otherwise, this is the full value of this [`Path`]'s part of the payment */ -struct LDKClosureReason ClosureReason_htlcs_timed_out(void); +uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PeerFeerateTooLow-variant ClosureReason + * The fee taken on this hop (for paying for the use of the *next* channel in the path). + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire + * blinded path (including any Trampoline hops) + * * otherwise, this is the full value of this [`Path`]'s part of the payment */ -struct LDKClosureReason ClosureReason_peer_feerate_too_low(uint32_t peer_feerate_sat_per_kw, uint32_t required_feerate_sat_per_kw); +void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if two ClosureReasons contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded + * path (including any Trampoline hops) + * * otherwise, this is the CLTV delta expected at the destination */ -bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b); +uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Get the string representation of a ClosureReason object + * The CLTV delta added for this hop. + * If this is the last hop in [`Path::hops`]: + * * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded + * path (including any Trampoline hops) + * * otherwise, this is the CLTV delta expected at the destination */ -struct LDKStr ClosureReason_to_str(const struct LDKClosureReason *NONNULL_PTR o); +void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val); /** - * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read + * 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. */ -struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj); +bool RouteHop_get_maybe_announced_channel(const struct LDKRouteHop *NONNULL_PTR this_ptr); /** - * Read a ClosureReason from a byte array, created by ClosureReason_write + * 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. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); +void RouteHop_set_maybe_announced_channel(struct LDKRouteHop *NONNULL_PTR this_ptr, bool val); /** - * Frees any resources used by the HTLCDestination + * Constructs a new RouteHop given each field */ -void HTLCDestination_free(struct LDKHTLCDestination this_ptr); +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 HTLCDestination + * Creates a copy of the RouteHop */ -struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); +struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig); /** - * Utility method to constructs a new NextHopChannel-variant HTLCDestination + * Generates a non-cryptographic 64-bit hash of the RouteHop. */ -struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKChannelId channel_id); +uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o); /** - * Utility method to constructs a new UnknownNextHop-variant HTLCDestination + * Checks if two RouteHops 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. */ -struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); +bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b); /** - * Utility method to constructs a new InvalidForward-variant HTLCDestination + * Serialize the RouteHop object into a byte array which can be read by RouteHop_read */ -struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); +struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj); /** - * Utility method to constructs a new InvalidOnion-variant HTLCDestination + * Read a RouteHop from a byte array, created by RouteHop_write */ -struct LDKHTLCDestination HTLCDestination_invalid_onion(void); +struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser); /** - * Utility method to constructs a new FailedPayment-variant HTLCDestination + * Frees any resources used by the TrampolineHop, if is_owned is set and inner is non-NULL. */ -struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); +void TrampolineHop_free(struct LDKTrampolineHop this_obj); /** - * Checks if two HTLCDestinations contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * The node_id of the node at this hop. */ -bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b); +struct LDKPublicKey TrampolineHop_get_pubkey(const struct LDKTrampolineHop *NONNULL_PTR this_ptr); /** - * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read + * The node_id of the node at this hop. */ -struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj); +void TrampolineHop_set_pubkey(struct LDKTrampolineHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Read a HTLCDestination from a byte array, created by HTLCDestination_write + * The node_announcement features of the node at this hop. */ -struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser); +struct LDKNodeFeatures TrampolineHop_get_node_features(const struct LDKTrampolineHop *NONNULL_PTR this_ptr); /** - * Creates a copy of the PaymentFailureReason + * The node_announcement features of the node at this hop. */ -enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig); +void TrampolineHop_set_node_features(struct LDKTrampolineHop *NONNULL_PTR this_ptr, struct LDKNodeFeatures val); /** - * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason + * The fee this hop should use to pay for routing towards the next Trampoline hop, or to the + * recipient if this is the last Trampoline hop. + * If this is the last Trampoline hop within [`BlindedTail`], this is the fee paid for the use of + * the entire blinded path. */ -enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void); +uint64_t TrampolineHop_get_fee_msat(const struct LDKTrampolineHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason + * The fee this hop should use to pay for routing towards the next Trampoline hop, or to the + * recipient if this is the last Trampoline hop. + * If this is the last Trampoline hop within [`BlindedTail`], this is the fee paid for the use of + * the entire blinded path. */ -enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void); +void TrampolineHop_set_fee_msat(struct LDKTrampolineHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason + * The CLTV delta added for this hop. + * If this is the last Trampoline hop within [`BlindedTail`], this is the CLTV delta for the entire + * blinded path. */ -enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void); +uint32_t TrampolineHop_get_cltv_expiry_delta(const struct LDKTrampolineHop *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason + * The CLTV delta added for this hop. + * If this is the last Trampoline hop within [`BlindedTail`], this is the CLTV delta for the entire + * blinded path. */ -enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void); +void TrampolineHop_set_cltv_expiry_delta(struct LDKTrampolineHop *NONNULL_PTR this_ptr, uint32_t val); /** - * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason + * Constructs a new TrampolineHop given each field */ -enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void); +MUST_USE_RES struct LDKTrampolineHop TrampolineHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg); /** - * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason + * Creates a copy of the TrampolineHop */ -enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void); +struct LDKTrampolineHop TrampolineHop_clone(const struct LDKTrampolineHop *NONNULL_PTR orig); /** - * Utility method to constructs a new UnknownRequiredFeatures-variant PaymentFailureReason + * Generates a non-cryptographic 64-bit hash of the TrampolineHop. */ -enum LDKPaymentFailureReason PaymentFailureReason_unknown_required_features(void); +uint64_t TrampolineHop_hash(const struct LDKTrampolineHop *NONNULL_PTR o); /** - * Utility method to constructs a new InvoiceRequestExpired-variant PaymentFailureReason + * Checks if two TrampolineHops 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. */ -enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_expired(void); +bool TrampolineHop_eq(const struct LDKTrampolineHop *NONNULL_PTR a, const struct LDKTrampolineHop *NONNULL_PTR b); /** - * Utility method to constructs a new InvoiceRequestRejected-variant PaymentFailureReason + * Serialize the TrampolineHop object into a byte array which can be read by TrampolineHop_read */ -enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_rejected(void); +struct LDKCVec_u8Z TrampolineHop_write(const struct LDKTrampolineHop *NONNULL_PTR obj); /** - * Utility method to constructs a new BlindedPathCreationFailed-variant PaymentFailureReason + * Read a TrampolineHop from a byte array, created by TrampolineHop_write */ -enum LDKPaymentFailureReason PaymentFailureReason_blinded_path_creation_failed(void); +struct LDKCResult_TrampolineHopDecodeErrorZ TrampolineHop_read(struct LDKu8slice ser); /** - * Checks if two PaymentFailureReasons contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL. */ -bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b); +void BlindedTail_free(struct LDKBlindedTail this_obj); /** - * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read + * The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop. + * + * Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node, + * where the [`RouteHop`]'s fee_msat is the fee paid for use of the entire blinded path, including + * any Trampoline hops. */ -struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj); +struct LDKCVec_TrampolineHopZ BlindedTail_get_trampoline_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write + * The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop. + * + * Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node, + * where the [`RouteHop`]'s fee_msat is the fee paid for use of the entire blinded path, including + * any Trampoline hops. */ -struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser); +void BlindedTail_set_trampoline_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_TrampolineHopZ val); /** - * Frees any resources used by the InboundChannelFunds + * The hops of the [`BlindedPaymentPath`] provided by the recipient. */ -void InboundChannelFunds_free(struct LDKInboundChannelFunds this_ptr); +struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Creates a copy of the InboundChannelFunds + * The hops of the [`BlindedPaymentPath`] provided by the recipient. */ -struct LDKInboundChannelFunds InboundChannelFunds_clone(const struct LDKInboundChannelFunds *NONNULL_PTR orig); +void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val); /** - * Utility method to constructs a new PushMsat-variant InboundChannelFunds + * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. */ -struct LDKInboundChannelFunds InboundChannelFunds_push_msat(uint64_t a); +struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new DualFunded-variant InboundChannelFunds + * The blinding point of the [`BlindedPaymentPath`] provided by the recipient. */ -struct LDKInboundChannelFunds InboundChannelFunds_dual_funded(void); +void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Checks if two InboundChannelFundss contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -bool InboundChannelFunds_eq(const struct LDKInboundChannelFunds *NONNULL_PTR a, const struct LDKInboundChannelFunds *NONNULL_PTR b); +uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Frees any resources used by the Event + * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from + * inferring the destination. May be 0. */ -void Event_free(struct LDKEvent this_ptr); +void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the Event + * The total amount paid on this [`Path`], excluding the fees. */ -struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); +uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new FundingGenerationReady-variant Event + * The total amount paid on this [`Path`], excluding the fees. */ -struct LDKEvent Event_funding_generation_ready(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id); +void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new FundingTxBroadcastSafe-variant Event + * Constructs a new BlindedTail given each field */ -struct LDKEvent Event_funding_tx_broadcast_safe(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKOutPoint funding_txo, struct LDKPublicKey counterparty_node_id, struct LDKChannelId former_temporary_channel_id); +MUST_USE_RES struct LDKBlindedTail BlindedTail_new(struct LDKCVec_TrampolineHopZ trampoline_hops_arg, struct LDKCVec_BlindedHopZ hops_arg, struct LDKPublicKey blinding_point_arg, uint32_t excess_final_cltv_expiry_delta_arg, uint64_t final_value_msat_arg); /** - * Utility method to constructs a new PaymentClaimable-variant Event + * Creates a copy of the BlindedTail */ -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 LDKChannelId via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline, struct LDKCOption_ThirtyTwoBytesZ payment_id); +struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig); /** - * Utility method to constructs a new PaymentClaimed-variant Event + * Generates a non-cryptographic 64-bit hash of the BlindedTail. */ -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, struct LDKRecipientOnionFields onion_fields, struct LDKCOption_ThirtyTwoBytesZ payment_id); +uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o); /** - * Utility method to constructs a new ConnectionNeeded-variant Event + * Checks if two BlindedTails 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. */ -struct LDKEvent Event_connection_needed(struct LDKPublicKey node_id, struct LDKCVec_SocketAddressZ addresses); +bool BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b); /** - * Utility method to constructs a new InvoiceReceived-variant Event + * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read */ -struct LDKEvent Event_invoice_received(struct LDKThirtyTwoBytes payment_id, struct LDKBolt12Invoice invoice, struct LDKCOption_OffersContextZ context, struct LDKResponder responder); +struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj); /** - * Utility method to constructs a new PaymentSent-variant Event + * Read a BlindedTail from a byte array, created by BlindedTail_write */ -struct LDKEvent Event_payment_sent(struct LDKCOption_ThirtyTwoBytesZ payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat); +struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser); /** - * Utility method to constructs a new PaymentFailed-variant Event + * Frees any resources used by the Path, if is_owned is set and inner is non-NULL. */ -struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKCOption_PaymentFailureReasonZ reason); +void Path_free(struct LDKPath this_obj); /** - * Utility method to constructs a new PaymentPathSuccessful-variant Event + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKPath path); +struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new PaymentPathFailed-variant Event + * The list of unblinded hops in this [`Path`]. Must be at least length one. */ -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); +void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val); /** - * Utility method to constructs a new ProbeSuccessful-variant Event + * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path); +struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new ProbeFailed-variant Event + * The blinded path at which this path terminates, if we're sending to one, and its metadata. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id); +void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val); /** - * Utility method to constructs a new PendingHTLCsForwardable-variant Event + * 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 */ -struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg); /** - * Utility method to constructs a new HTLCIntercepted-variant Event + * Creates a copy of the Path */ -struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat); +struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig); /** - * Utility method to constructs a new SpendableOutputs-variant Event + * Generates a non-cryptographic 64-bit hash of the Path. */ -struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs, struct LDKChannelId channel_id); +uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o); /** - * Utility method to constructs a new PaymentForwarded-variant Event + * Checks if two Paths 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. */ -struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKPublicKey prev_node_id, struct LDKPublicKey next_node_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); +bool Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b); /** - * Utility method to constructs a new ChannelPending-variant Event + * Gets the fees for a given path, excluding any excess paid to the recipient. */ -struct LDKEvent Event_channel_pending(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKChannelId former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo, struct LDKChannelTypeFeatures channel_type); +MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelReady-variant Event + * Gets the total amount paid on this [`Path`], excluding the fees. */ -struct LDKEvent Event_channel_ready(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); +MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ChannelClosed-variant Event + * Gets the final hop's CLTV expiry delta. */ -struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo, struct LDKCOption_u64Z last_local_balance_msat); +MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DiscardFunding-variant Event + * True if this [`Path`] has at least one Trampoline hop. */ -struct LDKEvent Event_discard_funding(struct LDKChannelId channel_id, struct LDKFundingInfo funding_info); +MUST_USE_RES bool Path_has_trampoline_hops(const struct LDKPath *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OpenChannelRequest-variant Event + * Frees any resources used by the Route, if is_owned is set and inner is non-NULL. */ -struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, struct LDKInboundChannelFunds channel_negotiation_type, struct LDKChannelTypeFeatures channel_type, bool is_announced, struct LDKChannelParameters params); +void Route_free(struct LDKRoute this_obj); /** - * Utility method to constructs a new HTLCHandlingFailed-variant Event + * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no + * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be + * the same. */ -struct LDKEvent Event_htlchandling_failed(struct LDKChannelId prev_channel_id, struct LDKHTLCDestination failed_next_destination); +struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BumpTransaction-variant Event + * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no + * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be + * the same. */ -struct LDKEvent Event_bump_transaction(struct LDKBumpTransactionEvent a); +void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val); /** - * Utility method to constructs a new OnionMessageIntercepted-variant Event + * 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 LDKEvent Event_onion_message_intercepted(struct LDKPublicKey peer_node_id, struct LDKOnionMessage message); +struct LDKRouteParameters Route_get_route_params(const struct LDKRoute *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new OnionMessagePeerConnected-variant Event + * 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 */ -struct LDKEvent Event_onion_message_peer_connected(struct LDKPublicKey peer_node_id); +void Route_set_route_params(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKRouteParameters val); /** - * Checks if two Events contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * 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 */ -bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b); +MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKRouteParameters route_params_arg); /** - * Serialize the Event object into a byte array which can be read by Event_read + * Creates a copy of the Route */ -struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj); +struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig); /** - * Read a Event from a byte array, created by Event_write + * Generates a non-cryptographic 64-bit hash of the Route. */ -struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser); +uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o); /** - * Frees any resources used by the MessageSendEvent + * Checks if two Routes 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. */ -void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr); +bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b); /** - * Creates a copy of the MessageSendEvent + * Returns the total amount of fees paid on this [`Route`]. + * + * 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 */ -struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig); +MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent + * 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 */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg); +MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent + * Get the string representation of a Route object */ -struct LDKMessageSendEvent MessageSendEvent_send_accept_channel_v2(struct LDKPublicKey node_id, struct LDKAcceptChannelV2 msg); +struct LDKStr Route_to_str(const struct LDKRoute *NONNULL_PTR o); /** - * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent + * Serialize the Route object into a byte array which can be read by Route_read */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg); +struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj); /** - * Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent + * Read a Route from a byte array, created by Route_write */ -struct LDKMessageSendEvent MessageSendEvent_send_open_channel_v2(struct LDKPublicKey node_id, struct LDKOpenChannelV2 msg); +struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent + * Frees any resources used by the RouteParameters, if is_owned is set and inner is non-NULL. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg); +void RouteParameters_free(struct LDKRouteParameters this_obj); /** - * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent + * The parameters of the failed payment path. */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); +struct LDKPaymentParameters RouteParameters_get_payment_params(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendStfu-variant MessageSendEvent + * The parameters of the failed payment path. */ -struct LDKMessageSendEvent MessageSendEvent_send_stfu(struct LDKPublicKey node_id, struct LDKStfu msg); +void RouteParameters_set_payment_params(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKPaymentParameters val); /** - * Utility method to constructs a new SendSpliceInit-variant MessageSendEvent + * The amount in msats sent on the failed payment path. */ -struct LDKMessageSendEvent MessageSendEvent_send_splice_init(struct LDKPublicKey node_id, struct LDKSpliceInit msg); +uint64_t RouteParameters_get_final_value_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendSpliceAck-variant MessageSendEvent + * The amount in msats sent on the failed payment path. */ -struct LDKMessageSendEvent MessageSendEvent_send_splice_ack(struct LDKPublicKey node_id, struct LDKSpliceAck msg); +void RouteParameters_set_final_value_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent + * 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 LDKMessageSendEvent MessageSendEvent_send_splice_locked(struct LDKPublicKey node_id, struct LDKSpliceLocked msg); +struct LDKCOption_u64Z RouteParameters_get_max_total_routing_fee_msat(const struct LDKRouteParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendTxAddInput-variant MessageSendEvent + * 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 LDKMessageSendEvent MessageSendEvent_send_tx_add_input(struct LDKPublicKey node_id, struct LDKTxAddInput msg); +void RouteParameters_set_max_total_routing_fee_msat(struct LDKRouteParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent + * Constructs a new RouteParameters given each field */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_add_output(struct LDKPublicKey node_id, struct LDKTxAddOutput msg); +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); /** - * Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent + * Creates a copy of the RouteParameters */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_input(struct LDKPublicKey node_id, struct LDKTxRemoveInput msg); +struct LDKRouteParameters RouteParameters_clone(const struct LDKRouteParameters *NONNULL_PTR orig); /** - * Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent + * Generates a non-cryptographic 64-bit hash of the RouteParameters. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_remove_output(struct LDKPublicKey node_id, struct LDKTxRemoveOutput msg); +uint64_t RouteParameters_hash(const struct LDKRouteParameters *NONNULL_PTR o); /** - * Utility method to constructs a new SendTxComplete-variant MessageSendEvent + * 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. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_complete(struct LDKPublicKey node_id, struct LDKTxComplete msg); +bool RouteParameters_eq(const struct LDKRouteParameters *NONNULL_PTR a, const struct LDKRouteParameters *NONNULL_PTR b); /** - * Utility method to constructs a new SendTxSignatures-variant MessageSendEvent + * 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 */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_signatures(struct LDKPublicKey node_id, struct LDKTxSignatures msg); +MUST_USE_RES struct LDKRouteParameters RouteParameters_from_payment_params_and_value(struct LDKPaymentParameters payment_params, uint64_t final_value_msat); /** - * Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent + * Sets the maximum number of hops that can be included in a payment path, based on the provided + * [`RecipientOnionFields`] and blinded paths. */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_init_rbf(struct LDKPublicKey node_id, struct LDKTxInitRbf msg); +MUST_USE_RES struct LDKCResult_NoneNoneZ RouteParameters_set_max_path_length(struct LDKRouteParameters *NONNULL_PTR this_arg, const struct LDKRecipientOnionFields *NONNULL_PTR recipient_onion, bool is_keysend, uint32_t best_block_height); /** - * Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent + * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_ack_rbf(struct LDKPublicKey node_id, struct LDKTxAckRbf msg); +struct LDKCVec_u8Z RouteParameters_write(const struct LDKRouteParameters *NONNULL_PTR obj); /** - * Utility method to constructs a new SendTxAbort-variant MessageSendEvent + * Read a RouteParameters from a byte array, created by RouteParameters_write */ -struct LDKMessageSendEvent MessageSendEvent_send_tx_abort(struct LDKPublicKey node_id, struct LDKTxAbort msg); +struct LDKCResult_RouteParametersDecodeErrorZ RouteParameters_read(struct LDKu8slice ser); /** - * Utility method to constructs a new SendChannelReady-variant MessageSendEvent + * Frees any resources used by the PaymentParameters, if is_owned is set and inner is non-NULL. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); +void PaymentParameters_free(struct LDKPaymentParameters this_obj); /** - * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent + * Information about the payee, such as their features and route hints for their channels. */ -struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg); +struct LDKPayee PaymentParameters_get_payee(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent + * Information about the payee, such as their features and route hints for their channels. */ -struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates); +void PaymentParameters_set_payee(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKPayee val); /** - * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg); +struct LDKCOption_u64Z PaymentParameters_get_expiry_time(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent + * Expiration of a payment to the payee, in seconds relative to the UNIX epoch. */ -struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg); +void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Utility method to constructs a new SendShutdown-variant MessageSendEvent + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg); +uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); +void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); /** - * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent + * The maximum number of [`Path::hops`] in any returned path. + * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg); +uint8_t PaymentParameters_get_max_path_length(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + * The maximum number of [`Path::hops`] in any returned path. + * Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); +void PaymentParameters_set_max_path_length(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg); +uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new HandleError-variant MessageSendEvent + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action); +void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); /** - * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. + * + * Returns a copy of the field. */ -struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg); +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. */ -struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg); +void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. + * + * Returns a copy of the field. */ -struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg); +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_blinded_path_idxs(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** - * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent + * A list of indices corresponding to blinded paths in [`Payee::Blinded::route_hints`] which this + * payment was previously attempted over and which caused the payment to fail. Future attempts + * for the same payment shouldn't be relayed through any of these blinded paths. */ -struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg); +void PaymentParameters_set_previously_failed_blinded_path_idxs(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); /** - * Calls the free function if one is set + * Constructs a new PaymentParameters given each field */ -void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPayee payee_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_path_length_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, struct LDKCVec_u64Z previously_failed_blinded_path_idxs_arg); /** - * Calls the free function if one is set + * Creates a copy of the PaymentParameters */ -void EventsProvider_free(struct LDKEventsProvider this_ptr); +struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig); /** - * Frees any resources used by the ReplayEvent, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the PaymentParameters. */ -void ReplayEvent_free(struct LDKReplayEvent this_obj); +uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o); /** - * Constructs a new ReplayEvent given each field + * Checks if two PaymentParameterss 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. */ -MUST_USE_RES struct LDKReplayEvent ReplayEvent_new(void); +bool PaymentParameters_eq(const struct LDKPaymentParameters *NONNULL_PTR a, const struct LDKPaymentParameters *NONNULL_PTR b); /** - * Creates a copy of the ReplayEvent + * Serialize the PaymentParameters object into a byte array which can be read by PaymentParameters_read */ -struct LDKReplayEvent ReplayEvent_clone(const struct LDKReplayEvent *NONNULL_PTR orig); +struct LDKCVec_u8Z PaymentParameters_write(const struct LDKPaymentParameters *NONNULL_PTR obj); /** - * Calls the free function if one is set + * Read a PaymentParameters from a byte array, created by PaymentParameters_write */ -void EventHandler_free(struct LDKEventHandler this_ptr); +struct LDKCResult_PaymentParametersDecodeErrorZ PaymentParameters_read(struct LDKu8slice ser, uint32_t arg); /** - * Frees any resources used by the AnchorDescriptor, if is_owned is set and inner is non-NULL. + * Creates a payee with the node id of the given `pubkey`. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. */ -void AnchorDescriptor_free(struct LDKAnchorDescriptor this_obj); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_node_id(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta); /** - * The parameters required to derive the signer for the anchor input. + * Creates a payee with the node id of the given `pubkey` to use for keysend payments. + * + * The `final_cltv_expiry_delta` should match the expected final CLTV delta the recipient has + * provided. + * + * Note that MPP keysend is not widely supported yet. The `allow_mpp` lets you choose + * whether your router will be allowed to find a multi-part route for this payment. If you + * set `allow_mpp` to true, you should ensure a payment secret is set on send, likely via + * [`RecipientOnionFields::secret_only`]. + * + * [`RecipientOnionFields::secret_only`]: crate::ln::channelmanager::RecipientOnionFields::secret_only */ -struct LDKChannelDerivationParameters AnchorDescriptor_get_channel_derivation_parameters(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta, bool allow_mpp); /** - * The parameters required to derive the signer for the anchor input. + * Creates parameters for paying to a blinded payee from the provided invoice. Sets + * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and + * [`PaymentParameters::expiry_time`]. */ -void AnchorDescriptor_set_channel_derivation_parameters(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt11_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice); /** - * The transaction input's outpoint corresponding to the commitment transaction's anchor - * output. + * Creates parameters for paying to a blinded payee from the provided invoice. Sets + * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and + * [`PaymentParameters::expiry_time`]. */ -struct LDKOutPoint AnchorDescriptor_get_outpoint(const struct LDKAnchorDescriptor *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_bolt12_invoice(const struct LDKBolt12Invoice *NONNULL_PTR invoice); /** - * The transaction input's outpoint corresponding to the commitment transaction's anchor - * output. + * Creates parameters for paying to a blinded payee from the provided invoice. Sets + * [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and + * [`PaymentParameters::expiry_time`]. */ -void AnchorDescriptor_set_outpoint(struct LDKAnchorDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_from_static_invoice(const struct LDKStaticInvoice *NONNULL_PTR invoice); /** - * Constructs a new AnchorDescriptor given each field + * Creates parameters for paying to a blinded payee from the provided blinded route hints. */ -MUST_USE_RES struct LDKAnchorDescriptor AnchorDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKOutPoint outpoint_arg); +MUST_USE_RES struct LDKPaymentParameters PaymentParameters_blinded(struct LDKCVec_BlindedPaymentPathZ blinded_route_hints); /** - * Creates a copy of the AnchorDescriptor + * Frees any resources used by the RouteParametersConfig, if is_owned is set and inner is non-NULL. */ -struct LDKAnchorDescriptor AnchorDescriptor_clone(const struct LDKAnchorDescriptor *NONNULL_PTR orig); +void RouteParametersConfig_free(struct LDKRouteParametersConfig this_obj); /** - * Checks if two AnchorDescriptors 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. + * 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. + * + * Defaults to 1% of the payment amount + 50 sats */ -bool AnchorDescriptor_eq(const struct LDKAnchorDescriptor *NONNULL_PTR a, const struct LDKAnchorDescriptor *NONNULL_PTR b); +struct LDKCOption_u64Z RouteParametersConfig_get_max_total_routing_fee_msat(const struct LDKRouteParametersConfig *NONNULL_PTR this_ptr); /** - * Returns the UTXO to be spent by the anchor input, which can be obtained via - * [`Self::unsigned_tx_input`]. + * 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. + * + * Defaults to 1% of the payment amount + 50 sats */ -MUST_USE_RES struct LDKTxOut AnchorDescriptor_previous_utxo(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +void RouteParametersConfig_set_max_total_routing_fee_msat(struct LDKRouteParametersConfig *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Returns the unsigned transaction input spending the anchor output in the commitment - * transaction. + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES struct LDKTxIn AnchorDescriptor_unsigned_tx_input(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +uint32_t RouteParametersConfig_get_max_total_cltv_expiry_delta(const struct LDKRouteParametersConfig *NONNULL_PTR this_ptr); /** - * Returns the witness script of the anchor output in the commitment transaction. + * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ -MUST_USE_RES struct LDKCVec_u8Z AnchorDescriptor_witness_script(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg); +void RouteParametersConfig_set_max_total_cltv_expiry_delta(struct LDKRouteParametersConfig *NONNULL_PTR this_ptr, uint32_t val); /** - * Returns the fully signed witness required to spend the anchor output in the commitment - * transaction. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -MUST_USE_RES struct LDKWitness AnchorDescriptor_tx_input_witness(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature); +uint8_t RouteParametersConfig_get_max_path_count(const struct LDKRouteParametersConfig *NONNULL_PTR this_ptr); /** - * Derives the channel signer required to sign the anchor input. + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. */ -MUST_USE_RES struct LDKEcdsaChannelSigner AnchorDescriptor_derive_channel_signer(const struct LDKAnchorDescriptor *NONNULL_PTR this_arg, const struct LDKSignerProvider *NONNULL_PTR signer_provider); +void RouteParametersConfig_set_max_path_count(struct LDKRouteParametersConfig *NONNULL_PTR this_ptr, uint8_t val); /** - * Frees any resources used by the BumpTransactionEvent + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -void BumpTransactionEvent_free(struct LDKBumpTransactionEvent this_ptr); +uint8_t RouteParametersConfig_get_max_channel_saturation_power_of_half(const struct LDKRouteParametersConfig *NONNULL_PTR this_ptr); /** - * Creates a copy of the BumpTransactionEvent + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 */ -struct LDKBumpTransactionEvent BumpTransactionEvent_clone(const struct LDKBumpTransactionEvent *NONNULL_PTR orig); +void RouteParametersConfig_set_max_channel_saturation_power_of_half(struct LDKRouteParametersConfig *NONNULL_PTR this_ptr, uint8_t val); /** - * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent + * Constructs a new RouteParametersConfig given each field */ -struct LDKBumpTransactionEvent BumpTransactionEvent_channel_close(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t package_target_feerate_sat_per_1000_weight, struct LDKTransaction commitment_tx, uint64_t commitment_tx_fee_satoshis, struct LDKAnchorDescriptor anchor_descriptor, struct LDKCVec_HTLCOutputInCommitmentZ pending_htlcs); +MUST_USE_RES struct LDKRouteParametersConfig RouteParametersConfig_new(struct LDKCOption_u64Z max_total_routing_fee_msat_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg); /** - * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent + * Creates a copy of the RouteParametersConfig */ -struct LDKBumpTransactionEvent BumpTransactionEvent_htlcresolution(struct LDKChannelId channel_id, struct LDKPublicKey counterparty_node_id, struct LDKThirtyTwoBytes claim_id, uint32_t target_feerate_sat_per_1000_weight, struct LDKCVec_HTLCDescriptorZ htlc_descriptors, uint32_t tx_lock_time); +struct LDKRouteParametersConfig RouteParametersConfig_clone(const struct LDKRouteParametersConfig *NONNULL_PTR orig); /** - * Checks if two BumpTransactionEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Serialize the RouteParametersConfig object into a byte array which can be read by RouteParametersConfig_read */ -bool BumpTransactionEvent_eq(const struct LDKBumpTransactionEvent *NONNULL_PTR a, const struct LDKBumpTransactionEvent *NONNULL_PTR b); +struct LDKCVec_u8Z RouteParametersConfig_write(const struct LDKRouteParametersConfig *NONNULL_PTR obj); /** - * Frees any resources used by the Input, if is_owned is set and inner is non-NULL. + * Read a RouteParametersConfig from a byte array, created by RouteParametersConfig_write */ -void Input_free(struct LDKInput this_obj); +struct LDKCResult_RouteParametersConfigDecodeErrorZ RouteParametersConfig_read(struct LDKu8slice ser); /** - * The unique identifier of the input. + * Creates a "default" RouteParametersConfig. See struct and individual field documentaiton for details on which values are used. */ -struct LDKOutPoint Input_get_outpoint(const struct LDKInput *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRouteParametersConfig RouteParametersConfig_default(void); /** - * The unique identifier of the input. + * Frees any resources used by the Payee */ -void Input_set_outpoint(struct LDKInput *NONNULL_PTR this_ptr, struct LDKOutPoint val); +void Payee_free(struct LDKPayee this_ptr); /** - * The UTXO being spent by the input. + * Creates a copy of the Payee */ -struct LDKTxOut Input_get_previous_utxo(const struct LDKInput *NONNULL_PTR this_ptr); +struct LDKPayee Payee_clone(const struct LDKPayee *NONNULL_PTR orig); /** - * The UTXO being spent by the input. + * Utility method to constructs a new Blinded-variant Payee */ -void Input_set_previous_utxo(struct LDKInput *NONNULL_PTR this_ptr, struct LDKTxOut val); +struct LDKPayee Payee_blinded(struct LDKCVec_BlindedPaymentPathZ route_hints, struct LDKBolt12InvoiceFeatures features); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and - * [`TxIn::witness`], each with their lengths included, required to satisfy the output's - * script. + * Utility method to constructs a new Clear-variant Payee */ -uint64_t Input_get_satisfaction_weight(const struct LDKInput *NONNULL_PTR this_ptr); +struct LDKPayee Payee_clear(struct LDKPublicKey node_id, struct LDKCVec_RouteHintZ route_hints, struct LDKBolt11InvoiceFeatures features, uint32_t final_cltv_expiry_delta); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and - * [`TxIn::witness`], each with their lengths included, required to satisfy the output's - * script. + * Generates a non-cryptographic 64-bit hash of the Payee. */ -void Input_set_satisfaction_weight(struct LDKInput *NONNULL_PTR this_ptr, uint64_t val); +uint64_t Payee_hash(const struct LDKPayee *NONNULL_PTR o); /** - * Constructs a new Input given each field + * Checks if two Payees contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKInput Input_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut previous_utxo_arg, uint64_t satisfaction_weight_arg); +bool Payee_eq(const struct LDKPayee *NONNULL_PTR a, const struct LDKPayee *NONNULL_PTR b); /** - * Creates a copy of the Input + * Serialize the RouteHint object into a byte array which can be read by RouteHint_read */ -struct LDKInput Input_clone(const struct LDKInput *NONNULL_PTR orig); +struct LDKCVec_u8Z RouteHint_write(const struct LDKRouteHint *NONNULL_PTR obj); /** - * Generates a non-cryptographic 64-bit hash of the Input. + * Read a RouteHint from a byte array, created by RouteHint_write */ -uint64_t Input_hash(const struct LDKInput *NONNULL_PTR o); +struct LDKCResult_RouteHintDecodeErrorZ RouteHint_read(struct LDKu8slice ser); /** - * Checks if two Inputs 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. + * Serialize the RouteHintHop object into a byte array which can be read by RouteHintHop_read */ -bool Input_eq(const struct LDKInput *NONNULL_PTR a, const struct LDKInput *NONNULL_PTR b); +struct LDKCVec_u8Z RouteHintHop_write(const struct LDKRouteHintHop *NONNULL_PTR obj); /** - * Frees any resources used by the Utxo, if is_owned is set and inner is non-NULL. + * Read a RouteHintHop from a byte array, created by RouteHintHop_write */ -void Utxo_free(struct LDKUtxo this_obj); +struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice ser); /** - * The unique identifier of the output. + * Frees any resources used by the FirstHopCandidate, if is_owned is set and inner is non-NULL. */ -struct LDKOutPoint Utxo_get_outpoint(const struct LDKUtxo *NONNULL_PTR this_ptr); +void FirstHopCandidate_free(struct LDKFirstHopCandidate this_obj); /** - * The unique identifier of the output. + * Creates a copy of the FirstHopCandidate */ -void Utxo_set_outpoint(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKOutPoint val); +struct LDKFirstHopCandidate FirstHopCandidate_clone(const struct LDKFirstHopCandidate *NONNULL_PTR orig); /** - * The output to spend. + * Frees any resources used by the PublicHopCandidate, if is_owned is set and inner is non-NULL. */ -struct LDKTxOut Utxo_get_output(const struct LDKUtxo *NONNULL_PTR this_ptr); +void PublicHopCandidate_free(struct LDKPublicHopCandidate this_obj); /** - * The output to spend. + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. */ -void Utxo_set_output(struct LDKUtxo *NONNULL_PTR this_ptr, struct LDKTxOut val); +uint64_t PublicHopCandidate_get_short_channel_id(const struct LDKPublicHopCandidate *NONNULL_PTR this_ptr); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each - * with their lengths included, required to satisfy the output's script. The weight consumed by - * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. + * The short channel ID of the channel, i.e. the identifier by which we refer to this + * channel. */ -uint64_t Utxo_get_satisfaction_weight(const struct LDKUtxo *NONNULL_PTR this_ptr); +void PublicHopCandidate_set_short_channel_id(struct LDKPublicHopCandidate *NONNULL_PTR this_ptr, uint64_t val); /** - * The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each - * with their lengths included, required to satisfy the output's script. The weight consumed by - * the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. + * Creates a copy of the PublicHopCandidate */ -void Utxo_set_satisfaction_weight(struct LDKUtxo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKPublicHopCandidate PublicHopCandidate_clone(const struct LDKPublicHopCandidate *NONNULL_PTR orig); /** - * Constructs a new Utxo given each field + * Frees any resources used by the PrivateHopCandidate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKUtxo Utxo_new(struct LDKOutPoint outpoint_arg, struct LDKTxOut output_arg, uint64_t satisfaction_weight_arg); +void PrivateHopCandidate_free(struct LDKPrivateHopCandidate this_obj); /** - * Creates a copy of the Utxo + * Creates a copy of the PrivateHopCandidate */ -struct LDKUtxo Utxo_clone(const struct LDKUtxo *NONNULL_PTR orig); +struct LDKPrivateHopCandidate PrivateHopCandidate_clone(const struct LDKPrivateHopCandidate *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the Utxo. + * Frees any resources used by the BlindedPathCandidate, if is_owned is set and inner is non-NULL. */ -uint64_t Utxo_hash(const struct LDKUtxo *NONNULL_PTR o); +void BlindedPathCandidate_free(struct LDKBlindedPathCandidate this_obj); /** - * Checks if two Utxos 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. + * Creates a copy of the BlindedPathCandidate */ -bool Utxo_eq(const struct LDKUtxo *NONNULL_PTR a, const struct LDKUtxo *NONNULL_PTR b); +struct LDKBlindedPathCandidate BlindedPathCandidate_clone(const struct LDKBlindedPathCandidate *NONNULL_PTR orig); /** - * Returns a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output. + * Frees any resources used by the OneHopBlindedPathCandidate, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKUtxo Utxo_new_p2pkh(struct LDKOutPoint outpoint, uint64_t value, const uint8_t (*pubkey_hash)[20]); +void OneHopBlindedPathCandidate_free(struct LDKOneHopBlindedPathCandidate this_obj); /** - * Frees any resources used by the CoinSelection, if is_owned is set and inner is non-NULL. + * Creates a copy of the OneHopBlindedPathCandidate */ -void CoinSelection_free(struct LDKCoinSelection this_obj); +struct LDKOneHopBlindedPathCandidate OneHopBlindedPathCandidate_clone(const struct LDKOneHopBlindedPathCandidate *NONNULL_PTR orig); /** - * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction - * requiring additional fees. + * Frees any resources used by the CandidateRouteHop */ -struct LDKCVec_UtxoZ CoinSelection_get_confirmed_utxos(const struct LDKCoinSelection *NONNULL_PTR this_ptr); +void CandidateRouteHop_free(struct LDKCandidateRouteHop this_ptr); /** - * The set of UTXOs (with at least 1 confirmation) to spend and use within a transaction - * requiring additional fees. + * Creates a copy of the CandidateRouteHop */ -void CoinSelection_set_confirmed_utxos(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCVec_UtxoZ val); +struct LDKCandidateRouteHop CandidateRouteHop_clone(const struct LDKCandidateRouteHop *NONNULL_PTR orig); /** - * An additional output tracking whether any change remained after coin selection. This output - * should always have a value above dust for its given `script_pubkey`. It should not be - * spent until the transaction it belongs to confirms to ensure mempool descendant limits are - * not met. This implies no other party should be able to spend it except us. + * Utility method to constructs a new FirstHop-variant CandidateRouteHop */ -struct LDKCOption_TxOutZ CoinSelection_get_change_output(const struct LDKCoinSelection *NONNULL_PTR this_ptr); +struct LDKCandidateRouteHop CandidateRouteHop_first_hop(struct LDKFirstHopCandidate a); /** - * An additional output tracking whether any change remained after coin selection. This output - * should always have a value above dust for its given `script_pubkey`. It should not be - * spent until the transaction it belongs to confirms to ensure mempool descendant limits are - * not met. This implies no other party should be able to spend it except us. + * Utility method to constructs a new PublicHop-variant CandidateRouteHop */ -void CoinSelection_set_change_output(struct LDKCoinSelection *NONNULL_PTR this_ptr, struct LDKCOption_TxOutZ val); +struct LDKCandidateRouteHop CandidateRouteHop_public_hop(struct LDKPublicHopCandidate a); /** - * Constructs a new CoinSelection given each field + * Utility method to constructs a new PrivateHop-variant CandidateRouteHop */ -MUST_USE_RES struct LDKCoinSelection CoinSelection_new(struct LDKCVec_UtxoZ confirmed_utxos_arg, struct LDKCOption_TxOutZ change_output_arg); +struct LDKCandidateRouteHop CandidateRouteHop_private_hop(struct LDKPrivateHopCandidate a); /** - * Creates a copy of the CoinSelection + * Utility method to constructs a new Blinded-variant CandidateRouteHop */ -struct LDKCoinSelection CoinSelection_clone(const struct LDKCoinSelection *NONNULL_PTR orig); +struct LDKCandidateRouteHop CandidateRouteHop_blinded(struct LDKBlindedPathCandidate a); /** - * Calls the free function if one is set + * Utility method to constructs a new OneHopBlinded-variant CandidateRouteHop */ -void CoinSelectionSource_free(struct LDKCoinSelectionSource this_ptr); +struct LDKCandidateRouteHop CandidateRouteHop_one_hop_blinded(struct LDKOneHopBlindedPathCandidate a); /** - * Calls the free function if one is set + * Returns the globally unique short channel ID for this hop, if one is known. + * + * This only returns `Some` if the channel is public (either our own, or one we've learned + * from the public network graph), and thus the short channel ID we have for this channel is + * globally unique and identifies this channel in a global namespace. */ -void WalletSource_free(struct LDKWalletSource this_ptr); +MUST_USE_RES struct LDKCOption_u64Z CandidateRouteHop_globally_unique_short_channel_id(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL. + * Returns the required difference in HTLC CLTV expiry between the [`Self::source`] and the + * next-hop for an HTLC taking this hop. + * + * This is the time that the node(s) in this hop have to claim the HTLC on-chain if the + * next-hop goes on chain with a payment preimage. */ -void Wallet_free(struct LDKWallet this_obj); +MUST_USE_RES uint32_t CandidateRouteHop_cltv_expiry_delta(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Returns a new instance backed by the given [`WalletSource`] that serves as an implementation - * of [`CoinSelectionSource`]. + * Returns the minimum amount that can be sent over this hop, in millisatoshis. */ -MUST_USE_RES struct LDKWallet Wallet_new(struct LDKWalletSource source, struct LDKLogger logger); +MUST_USE_RES uint64_t CandidateRouteHop_htlc_minimum_msat(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Constructs a new CoinSelectionSource which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is + * Returns the fees that must be paid to route an HTLC over this channel. */ -struct LDKCoinSelectionSource Wallet_as_CoinSelectionSource(const struct LDKWallet *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRoutingFees CandidateRouteHop_fees(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL. + * Returns the source node id of current hop. + * + * Source node id refers to the node forwarding the HTLC through this hop. + * + * For [`Self::FirstHop`] we return payer's node id. */ -void BumpTransactionEventHandler_free(struct LDKBumpTransactionEventHandler this_obj); +MUST_USE_RES struct LDKNodeId CandidateRouteHop_source(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Returns a new instance capable of handling [`Event::BumpTransaction`] events. + * Returns the target node id of this hop, if known. * - * [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction + * Target node id refers to the node receiving the HTLC after this hop. + * + * For [`Self::Blinded`] we return `None` because the ultimate destination after the blinded + * path is unknown. + * + * For [`Self::OneHopBlinded`] we return `None` because the target is the same as the source, + * and such a return value would be somewhat nonsensical. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKBumpTransactionEventHandler BumpTransactionEventHandler_new(struct LDKBroadcasterInterface broadcaster, struct LDKCoinSelectionSource utxo_source, struct LDKSignerProvider signer_provider, struct LDKLogger logger); +MUST_USE_RES struct LDKNodeId CandidateRouteHop_target(const struct LDKCandidateRouteHop *NONNULL_PTR this_arg); /** - * Handles all variants of [`BumpTransactionEvent`]. + * Finds a route from us (payer) to the given target node (payee). + * + * If the payee provided features in their invoice, they should be provided via the `payee` field + * in the given [`RouteParameters::payment_params`]. + * Without this, MPP will only be used if the payee's features are available in the network graph. + * + * Private routing paths between a public node and the target may be included in the `payee` field + * of [`RouteParameters::payment_params`]. + * + * If some channels aren't announced, it may be useful to fill in `first_hops` with the results + * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels + * from `network_graph` will be ignored, and only those in `first_hops` will be used. + * + * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. + * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / + * `htlc_maximum_msat` *are* checked as they may change based on the receiving node. + * + * # Panics + * + * Panics if first_hops contains channels without `short_channel_id`s; + * [`ChannelManager::list_usable_channels`] will never include such channels. + * + * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels + * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void BumpTransactionEventHandler_handle_event(const struct LDKBumpTransactionEventHandler *NONNULL_PTR this_arg, const struct LDKBumpTransactionEvent *NONNULL_PTR event); +struct LDKCResult_RouteStrZ 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]); /** - * Checks if two InitFeaturess 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. + * Construct a route from us (payer) to the target node (payee) via the given hops (which should + * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path. + * + * Re-uses logic from `find_route`, so the restrictions described there also apply here. */ -bool InitFeatures_eq(const struct LDKInitFeatures *NONNULL_PTR a, const struct LDKInitFeatures *NONNULL_PTR b); +struct LDKCResult_RouteStrZ 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]); /** - * Checks if two NodeFeaturess 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. + * Calls the free function if one is set */ -bool NodeFeatures_eq(const struct LDKNodeFeatures *NONNULL_PTR a, const struct LDKNodeFeatures *NONNULL_PTR b); +void ScoreLookUp_free(struct LDKScoreLookUp this_ptr); /** - * Checks if two ChannelFeaturess 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. + * Calls the free function if one is set */ -bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const struct LDKChannelFeatures *NONNULL_PTR b); +void ScoreUpdate_free(struct LDKScoreUpdate this_ptr); /** - * Checks if two Bolt11InvoiceFeaturess 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. + * Calls the free function if one is set */ -bool Bolt11InvoiceFeatures_eq(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR b); +void Score_free(struct LDKScore this_ptr); /** - * Checks if two OfferFeaturess 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. + * Calls the free function if one is set */ -bool OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); +void LockableScore_free(struct LDKLockableScore this_ptr); /** - * Checks if two InvoiceRequestFeaturess 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. + * Calls the free function if one is set */ -bool InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); +void WriteableScore_free(struct LDKWriteableScore this_ptr); /** - * Checks if two Bolt12InvoiceFeaturess 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. + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. */ -bool Bolt12InvoiceFeatures_eq(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR a, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR b); +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); /** - * Checks if two BlindedHopFeaturess 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. + * Constructs a new LockableScore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is */ -bool BlindedHopFeatures_eq(const struct LDKBlindedHopFeatures *NONNULL_PTR a, const struct LDKBlindedHopFeatures *NONNULL_PTR b); +struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * Checks if two ChannelTypeFeaturess 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. + * Serialize the MultiThreadedLockableScore object into a byte array which can be read by MultiThreadedLockableScore_read */ -bool ChannelTypeFeatures_eq(const struct LDKChannelTypeFeatures *NONNULL_PTR a, const struct LDKChannelTypeFeatures *NONNULL_PTR b); +struct LDKCVec_u8Z MultiThreadedLockableScore_write(const struct LDKMultiThreadedLockableScore *NONNULL_PTR obj); /** - * Creates a copy of the InitFeatures + * Constructs a new WriteableScore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned WriteableScore must be freed before this_arg is */ -struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); +struct LDKWriteableScore MultiThreadedLockableScore_as_WriteableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * Creates a copy of the NodeFeatures + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ -struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * Creates a copy of the ChannelFeatures + * Frees any resources used by the MultiThreadedScoreLockRead, if is_owned is set and inner is non-NULL. */ -struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); +void MultiThreadedScoreLockRead_free(struct LDKMultiThreadedScoreLockRead this_obj); /** - * Creates a copy of the Bolt11InvoiceFeatures + * Frees any resources used by the MultiThreadedScoreLockWrite, if is_owned is set and inner is non-NULL. */ -struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig); +void MultiThreadedScoreLockWrite_free(struct LDKMultiThreadedScoreLockWrite this_obj); /** - * Creates a copy of the OfferFeatures + * 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 LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); +struct LDKScoreLookUp MultiThreadedScoreLockRead_as_ScoreLookUp(const struct LDKMultiThreadedScoreLockRead *NONNULL_PTR this_arg); /** - * Creates a copy of the InvoiceRequestFeatures + * Serialize the MultiThreadedScoreLockWrite object into a byte array which can be read by MultiThreadedScoreLockWrite_read */ -struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); +struct LDKCVec_u8Z MultiThreadedScoreLockWrite_write(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR obj); /** - * Creates a copy of the Bolt12InvoiceFeatures + * 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 LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); +struct LDKScoreUpdate MultiThreadedScoreLockWrite_as_ScoreUpdate(const struct LDKMultiThreadedScoreLockWrite *NONNULL_PTR this_arg); /** - * Creates a copy of the BlindedHopFeatures + * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. */ -struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); +void ChannelUsage_free(struct LDKChannelUsage this_obj); /** - * Creates a copy of the ChannelTypeFeatures + * The amount to send through the channel, denominated in millisatoshis. */ -struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); +uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the InitFeatures. + * The amount to send through the channel, denominated in millisatoshis. */ -uint64_t InitFeatures_hash(const struct LDKInitFeatures *NONNULL_PTR o); +void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Generates a non-cryptographic 64-bit hash of the NodeFeatures. + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -uint64_t NodeFeatures_hash(const struct LDKNodeFeatures *NONNULL_PTR o); +uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the ChannelFeatures. + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -uint64_t ChannelFeatures_hash(const struct LDKChannelFeatures *NONNULL_PTR o); +void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures. + * The effective capacity of the channel. */ -uint64_t Bolt11InvoiceFeatures_hash(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR o); +struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Generates a non-cryptographic 64-bit hash of the OfferFeatures. + * The effective capacity of the channel. */ -uint64_t OfferFeatures_hash(const struct LDKOfferFeatures *NONNULL_PTR o); +void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); /** - * Generates a non-cryptographic 64-bit hash of the InvoiceRequestFeatures. + * Constructs a new ChannelUsage given each field */ -uint64_t InvoiceRequestFeatures_hash(const struct LDKInvoiceRequestFeatures *NONNULL_PTR o); +MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); /** - * Generates a non-cryptographic 64-bit hash of the Bolt12InvoiceFeatures. + * Creates a copy of the ChannelUsage */ -uint64_t Bolt12InvoiceFeatures_hash(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR o); +struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); /** - * Generates a non-cryptographic 64-bit hash of the BlindedHopFeatures. + * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. */ -uint64_t BlindedHopFeatures_hash(const struct LDKBlindedHopFeatures *NONNULL_PTR o); +void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); /** - * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures. + * Creates a copy of the FixedPenaltyScorer */ -uint64_t ChannelTypeFeatures_hash(const struct LDKChannelTypeFeatures *NONNULL_PTR o); +struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); /** - * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. + * Creates a new scorer using `penalty_msat`. */ -void InitFeatures_free(struct LDKInitFeatures this_obj); +MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** - * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. + * 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 */ -void NodeFeatures_free(struct LDKNodeFeatures this_obj); +struct LDKScoreLookUp FixedPenaltyScorer_as_ScoreLookUp(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. + * 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 */ -void ChannelFeatures_free(struct LDKChannelFeatures this_obj); +struct LDKScoreUpdate FixedPenaltyScorer_as_ScoreUpdate(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL. + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read */ -void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj); +struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); /** - * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write */ -void OfferFeatures_free(struct LDKOfferFeatures this_obj); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); /** - * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. */ -void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); +void ProbabilisticScorer_free(struct LDKProbabilisticScorer this_obj); /** - * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelLiquidities, if is_owned is set and inner is non-NULL. */ -void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); +void ChannelLiquidities_free(struct LDKChannelLiquidities this_obj); /** - * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. + * Creates a copy of the ChannelLiquidities */ -void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); +struct LDKChannelLiquidities ChannelLiquidities_clone(const struct LDKChannelLiquidities *NONNULL_PTR orig); /** - * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. + * Read a ChannelLiquidities from a byte array, created by ChannelLiquidities_write */ -void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); +struct LDKCResult_ChannelLiquiditiesDecodeErrorZ ChannelLiquidities_read(struct LDKu8slice ser); /** - * Getting a route for a keysend payment to a private node requires providing the payee's - * features (since they were not announced in a node announcement). However, keysend payments - * don't have an invoice to pull the payee's features from, so this method is provided for use - * when a [`Bolt11InvoiceFeatures`] is required in a route. - * - * MPP keysend is not widely supported yet, so we parameterize support to allow the user to - * choose whether their router should find multi-part routes. + * Serialize the ChannelLiquidities object into a byte array which can be read by ChannelLiquidities_read */ -MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_for_keysend(bool allow_mpp); +struct LDKCVec_u8Z ChannelLiquidities_write(const struct LDKChannelLiquidities *NONNULL_PTR obj); /** - * Constructs a ChannelTypeFeatures with only static_remotekey set + * Frees any resources used by the ProbabilisticScoringFeeParameters, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_only_static_remote_key(void); +void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeeParameters this_obj); /** - * Constructs a ChannelTypeFeatures with anchors support + * A fixed penalty in msats to apply to each channel. + * + * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] + * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the + * most accurate total success probabilities. + * + * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_anchors_zero_htlc_fee_and_dependencies(void); +uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Create a blank Features with no features set + * A fixed penalty in msats to apply to each channel. + * + * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] + * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the + * most accurate total success probabilities. + * + * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); +void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * A multiplier used with the payment amount 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. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * In testing, a value of roughly ~100x (1/10th * 2^10) of + * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated + * probabilities down by a factor of ~79%) resulted in the most accurate total success + * probabilities. + * + * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional + * hop). + * + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES struct LDKu8slice InitFeatures_le_flags(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` has any optional flags set + * A multiplier used with the payment amount 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. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * In testing, a value of roughly ~100x (1/10th * 2^10) of + * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated + * probabilities down by a factor of ~79%) resulted in the most accurate total success + * probabilities. + * + * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional + * hop). + * + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES bool InitFeatures_supports_any_optional_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment, as determined by our latest estimates of the channel's + * liquidity, to determine the liquidity penalty. + * + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. + * + * `-log10(success_probability) * liquidity_penalty_multiplier_msat` + * + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled + * by default. + * + * Default value: 0 msat + * + * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ -MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); +uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns the set of required features unknown by `other`, as their bit position. + * A multiplier used in conjunction with the negative `log10` of the channel's success + * probability for a payment, as determined by our latest estimates of the channel's + * liquidity, to determine the liquidity penalty. + * + * The penalty is based in part on the knowledge learned from prior successful and unsuccessful + * payments. This knowledge is decayed over time based on [`liquidity_offset_half_life`]. The + * penalty is effectively limited to `2 * liquidity_penalty_multiplier_msat` (corresponding to + * lower bounding the success probability to `0.01`) when the amount falls within the + * uncertainty bounds of the channel liquidity balance. Amounts above the upper bound will + * result in a `u64::max_value` penalty, however. + * + * `-log10(success_probability) * liquidity_penalty_multiplier_msat` + * + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled + * by default. + * + * Default value: 0 msat + * + * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ -MUST_USE_RES struct LDKCVec_u64Z InitFeatures_required_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); +void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, 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. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is + * disabled by default. + * + * Default value: 0 msat + * + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` supports any bits which we do not know of + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, 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. + * + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` + * + * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of + * the amount will result in a penalty of the multiplier. And, as the success probability + * decreases, the negative `log10` weighting will increase dramatically. For higher success + * probabilities, the multiplier will have a decreasing effect as the negative `log10` will + * fall below `1`. + * + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is + * disabled by default. + * + * Default value: 0 msat + * + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES bool InitFeatures_supports_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * A multiplier used in conjunction with 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. + * + * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using + * only our latest estimate for the current liquidity available in the channel, it estimates + * success probability based on the estimated liquidity available in the channel through + * history. Specifically, every time we update our liquidity bounds on a given channel, we + * track which of several buckets those bounds fall into, exponentially decaying the + * probability of each bucket as new samples are added. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, + * or 6 sats to avoid a 25% probability channel). * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * A multiplier used in conjunction with 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. * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * This penalty is similar to [`liquidity_penalty_multiplier_msat`], however, instead of using + * only our latest estimate for the current liquidity available in the channel, it estimates + * success probability based on the estimated liquidity available in the channel through + * history. Specifically, every time we update our liquidity bounds on a given channel, we + * track which of several buckets those bounds fall into, exponentially decaying the + * probability of each bucket as new samples are added. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, + * or 6 sats to avoid a 25% probability channel). + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, as determined + * based on the history of our estimates of the channel's available liquidity, to determine a + * penalty. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * 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 `2^20`ths + * of the payment amount, weighted by the negative `log10` of the success probability. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits - */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); - -/** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. + * 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 + * estimates success probability based on the estimated liquidity available in the channel + * through history. Specifically, every time we update our liquidity bounds on a given + * channel, we track which of several buckets those bounds fall into, exponentially decaying + * the probability of each bucket as new samples are added. * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% + * probability channels, or 0.5bps to avoid a 38% probability + * channel). * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Create a blank Features with no features set + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, 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 `2^20`ths + * of the payment amount, 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 + * estimates success probability based on the estimated liquidity available in the channel + * through history. Specifically, every time we update our liquidity bounds on a given + * channel, we track which of several buckets those bounds fall into, exponentially decaying + * the probability of each bucket as new samples are added. + * + * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% + * probability channels, or 0.5bps to avoid a 38% probability + * channel). + * + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); +void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * 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 + * 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. + * + * Default value: 250 msat */ -MUST_USE_RES struct LDKu8slice NodeFeatures_le_flags(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` has any optional flags set + * 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 + * 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. + * + * Default value: 250 msat */ -MUST_USE_RES bool NodeFeatures_supports_any_optional_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * 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 + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat */ -MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); +uint64_t ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns the set of required features unknown by `other`, as their bit position. + * 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 + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat */ -MUST_USE_RES struct LDKCVec_u64Z NodeFeatures_required_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); +void ProbabilisticScoringFeeParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * 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 */ -MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool ProbabilisticScoringFeeParameters_get_linear_success_probability(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` supports any bits which we do not know of + * 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 */ -MUST_USE_RES bool NodeFeatures_supports_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_set_linear_success_probability(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, bool val); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * In order to ensure we have knowledge for as many paths as possible, when probing it makes + * sense to bias away from channels for which we have very recent data. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * This value is a penalty that is applied based on the last time that we updated the bounds + * on the available liquidity in a channel. The specified value is the maximum penalty that + * will be applied. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * It obviously does not make sense to assign a non-0 value here unless you are using the + * pathfinding result for background probing. + * + * Specifically, the following penalty is applied + * `probing_diversity_penalty_msat * max(0, (86400 - current time + last update))^2 / 86400^2` is + * + * As this is a maximum value, when setting this you should consider it in relation to the + * other values set to ensure that, at maximum, we strongly avoid paths which we recently + * tried (similar to if they have a low success probability). For example, you might set this + * to be the sum of [`Self::base_penalty_msat`] and + * [`Self::historical_liquidity_penalty_multiplier_msat`] (plus some multiple of their + * corresponding `amount_multiplier`s). + * + * Default value: 0 */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t ProbabilisticScoringFeeParameters_get_probing_diversity_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * In order to ensure we have knowledge for as many paths as possible, when probing it makes + * sense to bias away from channels for which we have very recent data. * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * This value is a penalty that is applied based on the last time that we updated the bounds + * on the available liquidity in a channel. The specified value is the maximum penalty that + * will be applied. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * It obviously does not make sense to assign a non-0 value here unless you are using the + * pathfinding result for background probing. + * + * Specifically, the following penalty is applied + * `probing_diversity_penalty_msat * max(0, (86400 - current time + last update))^2 / 86400^2` is + * + * As this is a maximum value, when setting this you should consider it in relation to the + * other values set to ensure that, at maximum, we strongly avoid paths which we recently + * tried (similar to if they have a low success probability). For example, you might set this + * to be the sum of [`Self::base_penalty_msat`] and + * [`Self::historical_liquidity_penalty_multiplier_msat`] (plus some multiple of their + * corresponding `amount_multiplier`s). + * + * Default value: 0 */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void ProbabilisticScoringFeeParameters_set_probing_diversity_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Creates a copy of the ProbabilisticScoringFeeParameters */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_clone(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR orig); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKProbabilisticScoringFeeParameters ProbabilisticScoringFeeParameters_default(void); /** - * Create a blank Features with no features set + * Marks the node with the given `node_id` as banned, + * i.e it will be avoided during path finding. */ -MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); +void ProbabilisticScoringFeeParameters_add_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * Marks all nodes in the given list as banned, i.e., + * they will be avoided during path finding. */ -MUST_USE_RES struct LDKu8slice ChannelFeatures_le_flags(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_add_banned_from_list(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); /** - * Returns true if this `Features` has any optional flags set + * Removes the node with the given `node_id` from the list of nodes to avoid. */ -MUST_USE_RES bool ChannelFeatures_supports_any_optional_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_remove_banned(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Sets a manual penalty for the given node. */ -MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); +void ProbabilisticScoringFeeParameters_set_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); /** - * Returns the set of required features unknown by `other`, as their bit position. + * Removes the node with the given `node_id` from the list of manual penalties. */ -MUST_USE_RES struct LDKCVec_u64Z ChannelFeatures_required_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); +void ProbabilisticScoringFeeParameters_remove_manual_penalty(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Clears the list of manual penalties that are applied during path finding. */ -MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringFeeParameters_clear_manual_penalties(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_arg); /** - * Returns true if this `Features` supports any bits which we do not know of + * Frees any resources used by the ProbabilisticScoringDecayParameters, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool ChannelFeatures_supports_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); +void ProbabilisticScoringDecayParameters_free(struct LDKProbabilisticScoringDecayParameters this_obj); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * If we aren't learning any new datapoints for a channel, the historical liquidity bounds + * tracking can simply live on with increasingly stale data. Instead, when a channel has not + * seen a liquidity estimate update for this amount of time, the historical datapoints are + * decayed by half. + * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Note that after 16 or more half lives all historical data will be completely gone. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Default value: 14 days + * + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * If we aren't learning any new datapoints for a channel, the historical liquidity bounds + * tracking can simply live on with increasingly stale data. Instead, when a channel has not + * seen a liquidity estimate update for this amount of time, the historical datapoints are + * decayed by half. + * For an example of historical_no_updates_half_life being used see [`historical_estimated_channel_liquidity_probabilities`] * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Note that after 16 or more half lives all historical data will be completely gone. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Default value: 14 days + * + * [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * 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. + * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, + * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on + * the available liquidity is halved and the upper-bound moves half-way to the channel's total + * capacity. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, + * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] + * struct documentation for more info on the way the liquidity bounds are used. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * For example, if the channel's capacity is 1 million sats, and the current upper and lower + * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper + * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. + * + * Default value: 30 minutes + * + * # Note + * + * When not built with the `std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. + * Whenever this amount of time elapses since the last update to a channel's liquidity bounds, + * the distance from the bounds to \"zero\" is cut in half. In other words, the lower-bound on + * the available liquidity is halved and the upper-bound moves half-way to the channel's total + * capacity. * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Because halving the liquidity bounds grows the uncertainty on the channel's liquidity, + * the penalty for an amount within the new bounds may change. See the [`ProbabilisticScorer`] + * struct documentation for more info on the way the liquidity bounds are used. * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * For example, if the channel's capacity is 1 million sats, and the current upper and lower + * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper + * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. + * + * Default value: 30 minutes + * + * # Note + * + * When not built with the `std` feature, time will never elapse. Therefore, the channel + * liquidity knowledge will never decay except when the bounds cross. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Create a blank Features with no features set + * Constructs a new ProbabilisticScoringDecayParameters given each field */ -MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void); +MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_new(uint64_t historical_no_updates_half_life_arg, uint64_t liquidity_offset_half_life_arg); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * Creates a copy of the ProbabilisticScoringDecayParameters */ -MUST_USE_RES struct LDKu8slice Bolt11InvoiceFeatures_le_flags(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_clone(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR orig); /** - * Returns true if this `Features` has any optional flags set + * Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKProbabilisticScoringDecayParameters ProbabilisticScoringDecayParameters_default(void); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Creates a new scorer using the given scoring parameters for sending payments from a node + * through a network graph. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); +MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringDecayParameters decay_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); /** - * Returns the set of required features unknown by `other`, as their bit position. + * Dump the contents of this scorer into the configured logger. + * + * Note that this writes roughly one line per channel for which we have a liquidity estimate, + * which may be a substantial amount of log output. */ -MUST_USE_RES struct LDKCVec_u64Z Bolt11InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); +void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Query the estimated minimum and maximum liquidity available for sending a payment over the + * channel with `scid` towards the given `target` node. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); /** - * Returns true if this `Features` supports any bits which we do not know of + * 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 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. + * + * 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. + * + * 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; 32], [0; 32]))` or `None` if no data remains for a channel. + * + * 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 bool Bolt11InvoiceFeatures_supports_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +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); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * 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. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Returns `None` if: + * - the given channel is not in the network graph, the provided `target` is not a party to + * the channel, or we don't have forwarding parameters for either direction in the channel. + * - `allow_fallback_estimation` is *not* set and there is no (or insufficient) historical + * data for the given channel. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * 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 LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +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, bool allow_fallback_estimation); /** - * 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`). + * Query the probability of payment success sending the given `amount_msat` over the channel + * with `scid` towards the given `target` node, based on the live estimated liquidity bounds. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * This will return `Some` for any channel which is present in the [`NetworkGraph`], including + * if we have no bound information beside the channel's capacity. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_live_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); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Overwrite the scorer state with the given external scores. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void ProbabilisticScorer_set_scores(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, struct LDKChannelLiquidities external_scores); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Returns the current scores. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKChannelLiquidities ProbabilisticScorer_scores(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Create a blank Features with no features set + * 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 */ -MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); +struct LDKScoreLookUp ProbabilisticScorer_as_ScoreLookUp(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * 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 */ -MUST_USE_RES struct LDKu8slice OfferFeatures_le_flags(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +struct LDKScoreUpdate ProbabilisticScorer_as_ScoreUpdate(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Returns true if this `Features` has any optional flags set + * Frees any resources used by the CombinedScorer, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool OfferFeatures_supports_any_optional_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +void CombinedScorer_free(struct LDKCombinedScorer this_obj); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Create a new combined scorer with the given local scorer. */ -MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); +MUST_USE_RES struct LDKCombinedScorer CombinedScorer_new(struct LDKProbabilisticScorer local_scorer); /** - * Returns the set of required features unknown by `other`, as their bit position. + * Merge external channel liquidity information into the scorer. */ -MUST_USE_RES struct LDKCVec_u64Z OfferFeatures_required_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); +void CombinedScorer_merge(struct LDKCombinedScorer *NONNULL_PTR this_arg, struct LDKChannelLiquidities external_scores, uint64_t duration_since_epoch); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Overwrite the scorer state with the given external scores. */ -MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +void CombinedScorer_set_scores(struct LDKCombinedScorer *NONNULL_PTR this_arg, struct LDKChannelLiquidities external_scores); /** - * Returns true if this `Features` supports any bits which we do not know of + * 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 */ -MUST_USE_RES bool OfferFeatures_supports_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); +struct LDKScoreLookUp CombinedScorer_as_ScoreLookUp(const struct LDKCombinedScorer *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 + * 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 */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKScoreUpdate CombinedScorer_as_ScoreUpdate(const struct LDKCombinedScorer *NONNULL_PTR this_arg); /** - * 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 + * Serialize the CombinedScorer object into a byte array which can be read by CombinedScorer_read */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCVec_u8Z CombinedScorer_write(const struct LDKCombinedScorer *NONNULL_PTR obj); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * 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 */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKScore ProbabilisticScorer_as_Score(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Serialize the ProbabilisticScorer object into a byte array which can be read by ProbabilisticScorer_read */ -MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer *NONNULL_PTR obj); /** - * Create a blank Features with no features set + * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ -MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); +struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringDecayParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * Creates a copy of the UtxoLookupError */ -MUST_USE_RES struct LDKu8slice InvoiceRequestFeatures_le_flags(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +enum LDKUtxoLookupError UtxoLookupError_clone(const enum LDKUtxoLookupError *NONNULL_PTR orig); /** - * Returns true if this `Features` has any optional flags set + * Utility method to constructs a new UnknownChain-variant UtxoLookupError */ -MUST_USE_RES bool InvoiceRequestFeatures_supports_any_optional_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +enum LDKUtxoLookupError UtxoLookupError_unknown_chain(void); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Utility method to constructs a new UnknownTx-variant UtxoLookupError */ -MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); +enum LDKUtxoLookupError UtxoLookupError_unknown_tx(void); /** - * Returns the set of required features unknown by `other`, as their bit position. + * Frees any resources used by the UtxoResult */ -MUST_USE_RES struct LDKCVec_u64Z InvoiceRequestFeatures_required_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); +void UtxoResult_free(struct LDKUtxoResult this_ptr); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * Creates a copy of the UtxoResult */ -MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +struct LDKUtxoResult UtxoResult_clone(const struct LDKUtxoResult *NONNULL_PTR orig); /** - * Returns true if this `Features` supports any bits which we do not know of + * Utility method to constructs a new Sync-variant UtxoResult */ -MUST_USE_RES bool InvoiceRequestFeatures_supports_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); +struct LDKUtxoResult UtxoResult_sync(struct LDKCResult_TxOutUtxoLookupErrorZ a); /** - * 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 + * Utility method to constructs a new Async-variant UtxoResult */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKUtxoResult UtxoResult_async(struct LDKUtxoFuture a); /** - * 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 + * Calls the free function if one is set */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void UtxoLookup_free(struct LDKUtxoLookup this_ptr); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Frees any resources used by the UtxoFuture, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void UtxoFuture_free(struct LDKUtxoFuture this_obj); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Creates a copy of the UtxoFuture */ -MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKUtxoFuture UtxoFuture_clone(const struct LDKUtxoFuture *NONNULL_PTR orig); /** - * Create a blank Features with no features set + * Builds a new future for later resolution. */ -MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); +MUST_USE_RES struct LDKUtxoFuture UtxoFuture_new(void); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * Resolves this future against the given `graph` and with the given `result`. + * + * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling + * forwarding the validated gossip message onwards to peers. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events */ -MUST_USE_RES struct LDKu8slice Bolt12InvoiceFeatures_le_flags(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void UtxoFuture_resolve_without_forwarding(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** - * Returns true if this `Features` has any optional flags set + * Resolves this future against the given `graph` and with the given `result`. + * + * The given `gossip` is used to broadcast any validated messages onwards to all peers which + * have available buffer space. + * + * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order + * to allow us to interact with peers again, you should call [`PeerManager::process_events`] + * after this. + * + * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events */ -MUST_USE_RES bool Bolt12InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void UtxoFuture_resolve(const struct LDKUtxoFuture *NONNULL_PTR this_arg, const struct LDKNetworkGraph *NONNULL_PTR graph, const struct LDKP2PGossipSync *NONNULL_PTR gossip, struct LDKCResult_TxOutUtxoLookupErrorZ result); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Frees any resources used by the DelayedPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); +void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); /** - * Returns the set of required features unknown by `other`, as their bit position. + * The outpoint which is spendable. */ -MUST_USE_RES struct LDKCVec_u64Z Bolt12InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); +struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * The outpoint which is spendable. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Returns true if this `Features` supports any bits which we do not know of + * Per commitment point to derive the delayed payment key by key holder. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_supports_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * 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 + * Per commitment point to derive the delayed payment key by key holder. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * 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 + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in + * the witness_script. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * The output which is referenced by the given outpoint. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Create a blank Features with no features set + * The output which is referenced by the given outpoint. */ -MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); +void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -MUST_USE_RES struct LDKu8slice BlindedHopFeatures_le_flags(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +struct LDKRevocationKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` has any optional flags set + * The revocation point specific to the commitment transaction which was broadcast. Used to + * derive the witnessScript for this output. */ -MUST_USE_RES bool BlindedHopFeatures_supports_any_optional_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKRevocationKey val); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ -MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); +const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Returns the set of required features unknown by `other`, as their bit position. + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ -MUST_USE_RES struct LDKCVec_u64Z BlindedHopFeatures_required_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); +void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * The value of the channel which this output originated from, possibly indirectly. */ -MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +uint64_t DelayedPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` supports any bits which we do not know of + * The value of the channel which this output originated from, possibly indirectly. */ -MUST_USE_RES bool BlindedHopFeatures_supports_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); +void DelayedPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Sets a required feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * The channel public keys and other parameters needed to generate a spending transaction or + * to provide to a signer. * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKChannelTransactionParameters DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Sets an optional feature bit. Errors if `bit` is outside the feature range as defined - * by [BOLT 9]. + * The channel public keys and other parameters needed to generate a spending transaction or + * to provide to a signer. * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). + * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. * - * [BOLT 9]: https://github.com/lightning/bolts/blob/master/09-features.md + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). + * Constructs a new DelayedPaymentOutputDescriptor given each field * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +MUST_USE_RES struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_new(struct LDKOutPoint outpoint_arg, struct LDKPublicKey per_commitment_point_arg, uint16_t to_self_delay_arg, struct LDKTxOut output_arg, struct LDKRevocationKey revocation_pubkey_arg, struct LDKThirtyTwoBytes channel_keys_id_arg, uint64_t channel_value_satoshis_arg, struct LDKChannelTransactionParameters channel_transaction_parameters_arg); /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Creates a copy of the DelayedPaymentOutputDescriptor */ -MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKDelayedPaymentOutputDescriptor DelayedPaymentOutputDescriptor_clone(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR orig); /** - * Create a blank Features with no features set + * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor. */ -MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); +uint64_t DelayedPaymentOutputDescriptor_hash(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR o); /** - * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order - * from most on-the-wire encodings. + * 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. */ -MUST_USE_RES struct LDKu8slice ChannelTypeFeatures_le_flags(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +bool DelayedPaymentOutputDescriptor_eq(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR b); /** - * Returns true if this `Features` has any optional flags set + * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read */ -MUST_USE_RES bool ChannelTypeFeatures_supports_any_optional_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z DelayedPaymentOutputDescriptor_write(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR obj); /** - * Returns true if this `Features` object contains required features unknown by `other`. + * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write */ -MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); +struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * Returns the set of required features unknown by `other`, as their bit position. + * Frees any resources used by the StaticPaymentOutputDescriptor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCVec_u64Z ChannelTypeFeatures_required_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); +void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); /** - * Returns true if this `Features` object contains unknown feature flags which are set as - * \"required\". + * The outpoint which is spendable. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Returns true if this `Features` supports any bits which we do not know of + * The outpoint which is spendable. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * 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 + * The output which is referenced by the given outpoint. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * 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 + * The output which is referenced by the given outpoint. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * 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. - * - * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will - * be set instead (i.e., `bit - 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined - * by [bLIP 2] or if it is a known `T` feature. - * - * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be - * set instead (i.e., `bit + 1`). - * - * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits + * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); +void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Unsets the `upfront_shutdown_script` feature + * The value of the channel which this transactions spends. */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_clear_upfront_shutdown_script(struct LDKInitFeatures this_arg); +uint64_t StaticPaymentOutputDescriptor_get_channel_value_satoshis(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Unsets the `upfront_shutdown_script` feature + * The value of the channel which this transactions spends. */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_upfront_shutdown_script(struct LDKNodeFeatures this_arg); +void StaticPaymentOutputDescriptor_set_channel_value_satoshis(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Unsets the `shutdown_anysegwit` feature + * The necessary channel parameters that need to be provided to the signer. + * + * 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 */ -MUST_USE_RES struct LDKInitFeatures InitFeatures_clear_shutdown_anysegwit(struct LDKInitFeatures this_arg); +struct LDKChannelTransactionParameters StaticPaymentOutputDescriptor_get_channel_transaction_parameters(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Unsets the `shutdown_anysegwit` feature + * The necessary channel parameters that need to be provided to the signer. + * + * 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 */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_shutdown_anysegwit(struct LDKNodeFeatures this_arg); +void StaticPaymentOutputDescriptor_set_channel_transaction_parameters(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * Unsets the `wumbo` feature + * 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 LDKInitFeatures InitFeatures_clear_wumbo(struct LDKInitFeatures this_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); /** - * Unsets the `wumbo` feature + * Creates a copy of the StaticPaymentOutputDescriptor */ -MUST_USE_RES struct LDKNodeFeatures NodeFeatures_clear_wumbo(struct LDKNodeFeatures this_arg); +struct LDKStaticPaymentOutputDescriptor StaticPaymentOutputDescriptor_clone(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR orig); /** - * Unsets the `scid_privacy` feature + * Generates a non-cryptographic 64-bit hash of the StaticPaymentOutputDescriptor. */ -void InitFeatures_clear_scid_privacy(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t StaticPaymentOutputDescriptor_hash(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR o); /** - * Unsets the `scid_privacy` feature + * 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. */ -void NodeFeatures_clear_scid_privacy(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool StaticPaymentOutputDescriptor_eq(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR a, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR b); /** - * Unsets the `scid_privacy` feature + * 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. */ -void ChannelTypeFeatures_clear_scid_privacy(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ StaticPaymentOutputDescriptor_witness_script(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); /** - * Unsets the `anchors_zero_fee_htlc_tx` feature + * 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. */ -void InitFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t StaticPaymentOutputDescriptor_max_witness_length(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); /** - * Unsets the `anchors_zero_fee_htlc_tx` feature + * Returns true if spending this output requires a transaction with a CheckSequenceVerify + * value of at least 1. */ -void NodeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool StaticPaymentOutputDescriptor_needs_csv_1_for_spend(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_arg); /** - * Unsets the `anchors_zero_fee_htlc_tx` feature + * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read */ -void ChannelTypeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z StaticPaymentOutputDescriptor_write(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR obj); /** - * Unsets the `route_blinding` feature + * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write */ -void InitFeatures_clear_route_blinding(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ StaticPaymentOutputDescriptor_read(struct LDKu8slice ser); /** - * Unsets the `route_blinding` feature + * Frees any resources used by the SpendableOutputDescriptor */ -void NodeFeatures_clear_route_blinding(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void SpendableOutputDescriptor_free(struct LDKSpendableOutputDescriptor this_ptr); /** - * Set this feature as optional. + * Creates a copy of the SpendableOutputDescriptor */ -void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_clone(const struct LDKSpendableOutputDescriptor *NONNULL_PTR orig); /** - * Set this feature as required. + * Utility method to constructs a new StaticOutput-variant SpendableOutputDescriptor */ -void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_output(struct LDKOutPoint outpoint, struct LDKTxOut output, struct LDKThirtyTwoBytes channel_keys_id); /** - * Checks if this feature is supported. + * Utility method to constructs a new DelayedPaymentOutput-variant SpendableOutputDescriptor */ -MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_delayed_payment_output(struct LDKDelayedPaymentOutputDescriptor a); /** - * Set this feature as optional. + * Utility method to constructs a new StaticPaymentOutput-variant SpendableOutputDescriptor */ -void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKSpendableOutputDescriptor SpendableOutputDescriptor_static_payment_output(struct LDKStaticPaymentOutputDescriptor a); /** - * Set this feature as required. + * Generates a non-cryptographic 64-bit hash of the SpendableOutputDescriptor. */ -void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t SpendableOutputDescriptor_hash(const struct LDKSpendableOutputDescriptor *NONNULL_PTR o); /** - * Checks if this feature is supported. + * Checks if two SpendableOutputDescriptors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool SpendableOutputDescriptor_eq(const struct LDKSpendableOutputDescriptor *NONNULL_PTR a, const struct LDKSpendableOutputDescriptor *NONNULL_PTR b); /** - * Checks if this feature is required. + * Serialize the SpendableOutputDescriptor object into a byte array which can be read by SpendableOutputDescriptor_read */ -MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z SpendableOutputDescriptor_write(const struct LDKSpendableOutputDescriptor *NONNULL_PTR obj); /** - * Checks if this feature is required. + * Read a SpendableOutputDescriptor from a byte array, created by SpendableOutputDescriptor_write */ -MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescriptor_read(struct LDKu8slice ser); /** - * Set this feature as optional. + * Creates an unsigned [`Psbt`] which spends the given descriptors to + * the given outputs, plus an output to the given change destination (if sufficient + * change value remains). The PSBT will have a feerate, at least, of the given value. + * + * The `locktime` argument is used to set the transaction's locktime. If `None`, the + * transaction will have a locktime of 0. It it recommended to set this to the current block + * height to avoid fee sniping, unless you have some specific reason to use a different + * locktime. + * + * Returns the PSBT and expected max transaction weight. + * + * Returns `Err(())` if the output value is greater than the input value minus required fee, + * if a descriptor was duplicated, or if an output descriptor `script_pubkey` + * does not match the one we can spend. + * + * We do not enforce that outputs meet the dust limit or that any output scripts are standard. */ -void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ 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); /** - * Set this feature as required. + * Returns the outpoint of the spendable output. */ -void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint SpendableOutputDescriptor_spendable_outpoint(const struct LDKSpendableOutputDescriptor *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Frees any resources used by the ChannelDerivationParameters, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelDerivationParameters_free(struct LDKChannelDerivationParameters this_obj); /** - * Set this feature as optional. + * The value in satoshis of the channel we're attempting to spend the anchor output of. */ -void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t ChannelDerivationParameters_get_value_satoshis(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The value in satoshis of the channel we're attempting to spend the anchor output of. */ -void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelDerivationParameters_set_value_satoshis(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if this feature is supported. + * The unique identifier to re-derive the signer for the associated channel. */ -MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +const uint8_t (*ChannelDerivationParameters_get_keys_id(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr))[32]; /** - * Set this feature as optional. + * The unique identifier to re-derive the signer for the associated channel. */ -void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelDerivationParameters_set_keys_id(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Set this feature as required. + * The necessary channel parameters that need to be provided to the signer. */ -void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelTransactionParameters ChannelDerivationParameters_get_transaction_parameters(const struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The necessary channel parameters that need to be provided to the signer. */ -MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelDerivationParameters_set_transaction_parameters(struct LDKChannelDerivationParameters *NONNULL_PTR this_ptr, struct LDKChannelTransactionParameters val); /** - * Checks if this feature is required. + * Constructs a new ChannelDerivationParameters given each field */ -MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelDerivationParameters ChannelDerivationParameters_new(uint64_t value_satoshis_arg, struct LDKThirtyTwoBytes keys_id_arg, struct LDKChannelTransactionParameters transaction_parameters_arg); /** - * Checks if this feature is required. + * Creates a copy of the ChannelDerivationParameters */ -MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelDerivationParameters ChannelDerivationParameters_clone(const struct LDKChannelDerivationParameters *NONNULL_PTR orig); /** - * Set this feature as optional. + * Checks if two ChannelDerivationParameterss 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. */ -void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool ChannelDerivationParameters_eq(const struct LDKChannelDerivationParameters *NONNULL_PTR a, const struct LDKChannelDerivationParameters *NONNULL_PTR b); /** - * Set this feature as required. + * Serialize the ChannelDerivationParameters object into a byte array which can be read by ChannelDerivationParameters_read */ -void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z ChannelDerivationParameters_write(const struct LDKChannelDerivationParameters *NONNULL_PTR obj); /** - * Checks if this feature is supported. + * Read a ChannelDerivationParameters from a byte array, created by ChannelDerivationParameters_write */ -MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCResult_ChannelDerivationParametersDecodeErrorZ ChannelDerivationParameters_read(struct LDKu8slice ser); /** - * Set this feature as optional. + * Frees any resources used by the HTLCDescriptor, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_free(struct LDKHTLCDescriptor this_obj); /** - * Set this feature as required. + * The parameters required to derive the signer for the HTLC input. */ -void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelDerivationParameters HTLCDescriptor_get_channel_derivation_parameters(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The parameters required to derive the signer for the HTLC input. */ -MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_channel_derivation_parameters(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKChannelDerivationParameters val); /** - * Checks if this feature is required. + * The txid of the commitment transaction in which the HTLC output lives. */ -MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); +const uint8_t (*HTLCDescriptor_get_commitment_txid(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Checks if this feature is required. + * The txid of the commitment transaction in which the HTLC output lives. */ -MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_commitment_txid(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Set this feature as optional. + * The number of the commitment transaction in which the HTLC output lives. */ -void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t HTLCDescriptor_get_per_commitment_number(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The number of the commitment transaction in which the HTLC output lives. */ -void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_per_commitment_number(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint64_t val); /** - * Checks if this feature is supported. + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. */ -MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKPublicKey HTLCDescriptor_get_per_commitment_point(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The key tweak corresponding to the number of the commitment transaction in which the HTLC + * output lives. This tweak is applied to all the basepoints for both parties in the channel to + * arrive at unique keys per commitment. + * + * See for more info. + */ +void HTLCDescriptor_set_per_commitment_point(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. */ -void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint32_t HTLCDescriptor_get_feerate_per_kw(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Set this feature as required. + * The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs + * originating from a channel supporting anchor outputs, otherwise it is the channel's + * negotiated feerate at the time the commitment transaction was built. */ -void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_feerate_per_kw(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, uint32_t val); /** - * Checks if this feature is supported. + * The details of the HTLC as it appears in the commitment transaction. */ -MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKHTLCOutputInCommitment HTLCDescriptor_get_htlc(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Set this feature as optional. + * The details of the HTLC as it appears in the commitment transaction. */ -void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_htlc(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKHTLCOutputInCommitment val); /** - * Set this feature as required. + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. */ -void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKCOption_ThirtyTwoBytesZ HTLCDescriptor_get_preimage(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Checks if this feature is supported. + * The preimage, if `Some`, to claim the HTLC output with. If `None`, the timeout path must be + * taken. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_preimage(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); /** - * Checks if this feature is required. + * The counterparty's signature required to spend the HTLC output. */ -MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKECDSASignature HTLCDescriptor_get_counterparty_sig(const struct LDKHTLCDescriptor *NONNULL_PTR this_ptr); /** - * Checks if this feature is required. + * The counterparty's signature required to spend the HTLC output. */ -MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void HTLCDescriptor_set_counterparty_sig(struct LDKHTLCDescriptor *NONNULL_PTR this_ptr, struct LDKECDSASignature val); /** - * Checks if this feature is required. + * Constructs a new HTLCDescriptor given each field */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKHTLCDescriptor HTLCDescriptor_new(struct LDKChannelDerivationParameters channel_derivation_parameters_arg, struct LDKThirtyTwoBytes commitment_txid_arg, uint64_t per_commitment_number_arg, struct LDKPublicKey per_commitment_point_arg, uint32_t feerate_per_kw_arg, struct LDKHTLCOutputInCommitment htlc_arg, struct LDKCOption_ThirtyTwoBytesZ preimage_arg, struct LDKECDSASignature counterparty_sig_arg); /** - * Set this feature as optional. + * Creates a copy of the HTLCDescriptor */ -void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKHTLCDescriptor HTLCDescriptor_clone(const struct LDKHTLCDescriptor *NONNULL_PTR orig); /** - * Set this feature as required. + * Checks if two HTLCDescriptors 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. */ -void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +bool HTLCDescriptor_eq(const struct LDKHTLCDescriptor *NONNULL_PTR a, const struct LDKHTLCDescriptor *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Serialize the HTLCDescriptor object into a byte array which can be read by HTLCDescriptor_read */ -MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKCVec_u8Z HTLCDescriptor_write(const struct LDKHTLCDescriptor *NONNULL_PTR obj); /** - * Set this feature as optional. + * Read a HTLCDescriptor from a byte array, created by HTLCDescriptor_write */ -void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKCResult_HTLCDescriptorDecodeErrorZ HTLCDescriptor_read(struct LDKu8slice ser); /** - * Set this feature as required. + * 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. */ -void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOutPoint HTLCDescriptor_outpoint(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns the UTXO to be spent by the HTLC input, which can be obtained via + * [`Self::unsigned_tx_input`]. */ -MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxOut HTLCDescriptor_previous_utxo(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns the unsigned transaction input spending the HTLC output in the commitment + * transaction. */ -void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxIn HTLCDescriptor_unsigned_tx_input(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns the delayed output created as a result of spending the HTLC output in the commitment + * transaction. */ -void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKTxOut HTLCDescriptor_tx_output(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns the witness script of the HTLC output in the commitment transaction. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u8Z HTLCDescriptor_witness_script(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns the fully signed witness required to spend the HTLC output in the commitment + * transaction. */ -MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKWitness HTLCDescriptor_tx_input_witness(const struct LDKHTLCDescriptor *NONNULL_PTR this_arg, struct LDKECDSASignature signature, struct LDKu8slice witness_script); /** - * Checks if this feature is required. + * Calls the free function if one is set */ -MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelSigner_free(struct LDKChannelSigner this_ptr); /** - * Checks if this feature is required. + * Frees any resources used by the PeerStorageKey, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void PeerStorageKey_free(struct LDKPeerStorageKey this_obj); /** - * Set this feature as optional. + * Represents the key used to encrypt and decrypt Peer Storage. */ -void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +const uint8_t (*PeerStorageKey_get_inner(const struct LDKPeerStorageKey *NONNULL_PTR this_ptr))[32]; /** - * Set this feature as required. + * Represents the key used to encrypt and decrypt Peer Storage. */ -void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void PeerStorageKey_set_inner(struct LDKPeerStorageKey *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Checks if this feature is supported. + * Constructs a new PeerStorageKey given each field */ -MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPeerStorageKey PeerStorageKey_new(struct LDKThirtyTwoBytes inner_arg); /** - * Set this feature as optional. + * Creates a copy of the PeerStorageKey */ -void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKPeerStorageKey PeerStorageKey_clone(const struct LDKPeerStorageKey *NONNULL_PTR orig); /** - * Set this feature as required. + * Checks if two PeerStorageKeys 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. */ -void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +bool PeerStorageKey_eq(const struct LDKPeerStorageKey *NONNULL_PTR a, const struct LDKPeerStorageKey *NONNULL_PTR b); /** - * Checks if this feature is supported. + * Frees any resources used by the ReceiveAuthKey, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ReceiveAuthKey_free(struct LDKReceiveAuthKey this_obj); + +const uint8_t (*ReceiveAuthKey_get_a(const struct LDKReceiveAuthKey *NONNULL_PTR this_ptr))[32]; + +void ReceiveAuthKey_set_a(struct LDKReceiveAuthKey *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Set this feature as optional. + * Constructs a new ReceiveAuthKey given each field */ -void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKReceiveAuthKey ReceiveAuthKey_new(struct LDKThirtyTwoBytes a_arg); /** - * Set this feature as required. + * Creates a copy of the ReceiveAuthKey */ -void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKReceiveAuthKey ReceiveAuthKey_clone(const struct LDKReceiveAuthKey *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Checks if two ReceiveAuthKeys 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. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +bool ReceiveAuthKey_eq(const struct LDKReceiveAuthKey *NONNULL_PTR a, const struct LDKReceiveAuthKey *NONNULL_PTR b); /** - * Checks if this feature is required. + * Creates a copy of the Recipient */ -MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); +enum LDKRecipient Recipient_clone(const enum LDKRecipient *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Utility method to constructs a new Node-variant Recipient */ -MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +enum LDKRecipient Recipient_node(void); /** - * Checks if this feature is required. + * Utility method to constructs a new PhantomNode-variant Recipient */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +enum LDKRecipient Recipient_phantom_node(void); /** - * Set this feature as optional. + * Calls the free function if one is set */ -void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void EntropySource_free(struct LDKEntropySource this_ptr); /** - * Set this feature as required. + * Calls the free function if one is set */ -void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void NodeSigner_free(struct LDKNodeSigner this_ptr); /** - * Checks if this feature is supported. + * Calls the free function if one is set */ -MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void OutputSpender_free(struct LDKOutputSpender this_ptr); /** - * Set this feature as optional. + * Calls the free function if one is set */ -void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void SignerProvider_free(struct LDKSignerProvider this_ptr); /** - * Set this feature as required. + * Calls the free function if one is set */ -void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChangeDestinationSourceSync_free(struct LDKChangeDestinationSourceSync this_ptr); /** - * Checks if this feature is supported. + * Frees any resources used by the ChangeDestinationSourceSyncWrapper, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChangeDestinationSourceSyncWrapper_free(struct LDKChangeDestinationSourceSyncWrapper this_obj); /** - * Set this feature as optional. + * Creates a new [`ChangeDestinationSourceSyncWrapper`]. */ -void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChangeDestinationSourceSyncWrapper ChangeDestinationSourceSyncWrapper_new(struct LDKChangeDestinationSourceSync source); /** - * Set this feature as required. + * Computes the tweak to apply to the base funding key of a channel. + * + * The tweak is computed similar to existing tweaks used in + * [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation): + * + * 1. We use the txid of the funding transaction the splice transaction is spending instead of the + * `per_commitment_point` to guarantee uniqueness. + * 2. We include the private key instead of the public key to guarantee only those with knowledge + * of it can re-derive the new funding key. + * + * tweak = SHA256(splice_parent_funding_txid || base_funding_secret_key) + * tweaked_funding_key = base_funding_key + tweak + * + * While the use of this tweak is not required (signers may choose to compute a tweak of their + * choice), signers must ensure their tweak guarantees the two properties mentioned above: + * uniqueness and derivable only by one or both of the channel participants. */ -void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +struct LDKBigEndianScalar compute_funding_key_tweak(const uint8_t (*base_funding_secret_key)[32], const uint8_t (*splice_parent_funding_txid)[32]); /** - * Checks if this feature is supported. + * Frees any resources used by the InMemorySigner, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void InMemorySigner_free(struct LDKInMemorySigner this_obj); /** - * Set this feature as optional. + * Holder secret key for blinded revocation pubkey. */ -void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Set this feature as required. + * Holder secret key for blinded revocation pubkey. */ -void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Checks if this feature is supported. + * Holder secret key used in an HTLC transaction. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Checks if this feature is required. + * Holder secret key used in an HTLC transaction. */ -MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Checks if this feature is required. + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Checks if this feature is required. + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Checks if this feature is required. + * Commitment seed. */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Set this feature as optional. + * Commitment seed. */ -void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** - * Set this feature as required. + * Creates a copy of the InMemorySigner */ -void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the + * holder's anchor output in a commitment transaction, if one is present. */ -MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey InMemorySigner_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ splice_parent_funding_txid); /** - * Set this feature as optional. + * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described + * by `descriptor`, returning the witness stack for the input. + * + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], + * or if an output descriptor `script_pubkey` does not match the one we can spend. + * + * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint */ -void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * Set this feature as required. + * Sign the single input of `spend_tx` at index `input_idx` which spends the output + * described by `descriptor`, returning the witness stack for the input. + * + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], does not have a + * sequence set to [`descriptor.to_self_delay`], or if an output descriptor + * `script_pubkey` does not match the one we can spend. + * + * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint + * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay */ -void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_WitnessNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * Checks if this feature is supported. + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ -MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Constructs a new ChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is */ -MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelSigner InMemorySigner_as_ChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Constructs a new EcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EcdsaChannelSigner must be freed before this_arg is */ -MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEcdsaChannelSigner InMemorySigner_as_EcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Constructs a new BaseEcdsaChannelSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned BaseEcdsaChannelSigner must be freed before this_arg is */ -void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKBaseEcdsaChannelSigner InMemorySigner_as_BaseEcdsaChannelSigner(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void KeysManager_free(struct LDKKeysManager this_obj); /** - * Checks if this feature is supported. + * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g., + * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). + * `starting_time` isn't strictly required to actually be a time, but it must absolutely, + * without a doubt, be unique to this instance. ie if you start multiple times with the same + * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this + * is to simply use the current time (with very high precision). + * + * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however, + * obviously, `starting_time` should be unique every time you reload the library - it is only + * used to generate new ephemeral key data (which will be stored by the individual channel if + * necessary). + * + * Note that the seed is required to recover certain on-chain funds independent of + * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required + * for any channel, and some on-chain during-closing funds. + * + * If `v2_remote_key_derivation` is set, the `script_pubkey`s which receive funds on-chain when + * our counterparty force-closes will be one of a static set of [`STATIC_PAYMENT_KEY_COUNT`]*2 + * possible `script_pubkey`s. This only applies to new or spliced channels, however if this is + * set you *MUST NOT* downgrade to a version of LDK prior to 0.2. + * + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ -MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, bool v2_remote_key_derivation); /** - * Set this feature as optional. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey KeysManager_get_node_secret_key(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Gets the set of possible `script_pubkey`s which can appear on chain for our + * non-HTLC-encumbered balance if our counterparty force-closes a channel. + * + * If you've lost all data except your seed, asking your peers nicely to force-close the + * chanels they had with you (and hoping they don't broadcast a stale state and that there are + * no pending HTLCs in the latest state) and scanning the chain for these `script_pubkey`s can + * allow you to recover (some of) your funds. + * + * Only channels opened when using a [`KeysManager`] with the `v2_remote_key_derivation` + * argument to [`KeysManager::new`] set, or any spliced channels will close to such scripts, + * other channels will close to a randomly-generated `script_pubkey`. */ -void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_CVec_u8ZZ KeysManager_possible_v2_counterparty_closed_balance_spks(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Derive an old [`EcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ -MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, const uint8_t (*params)[32]); /** - * Set this feature as optional. + * Signs the given [`Psbt`] which spends the given [`SpendableOutputDescriptor`]s. + * The resulting inputs will be finalized and the PSBT will be ready for broadcast if there + * are no other inputs that need signing. + * + * Returns `Err(())` if the PSBT is missing a descriptor or if we fail to 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`]. */ -void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +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); /** - * Set this feature as required. + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ -void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKEntropySource KeysManager_as_EntropySource(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is */ -MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKNodeSigner KeysManager_as_NodeSigner(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Constructs a new OutputSpender which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is */ -MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKOutputSpender KeysManager_as_OutputSpender(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is */ -MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKSignerProvider KeysManager_as_SignerProvider(const struct LDKKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Frees any resources used by the PhantomKeysManager, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); /** - * Set this feature as optional. + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ -void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKEntropySource PhantomKeysManager_as_EntropySource(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Constructs a new NodeSigner which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned NodeSigner must be freed before this_arg is */ -void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKNodeSigner PhantomKeysManager_as_NodeSigner(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Constructs a new OutputSpender which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OutputSpender must be freed before this_arg is */ -MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKOutputSpender PhantomKeysManager_as_OutputSpender(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Constructs a new SignerProvider which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned SignerProvider must be freed before this_arg is */ -void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKSignerProvider PhantomKeysManager_as_SignerProvider(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` + * that is shared across all nodes that intend to participate in [phantom node payments] + * together. + * + * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, + * `starting_time_nanos`, and `v2_remote_key_derivation`. + * + * `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the + * same across restarts, or else inbound payments may fail. + * + * [phantom node payments]: PhantomKeysManager */ -void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPhantomKeysManager PhantomKeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos, const uint8_t (*cross_node_seed)[32], bool v2_remote_key_derivation); /** - * Checks if this feature is supported. + * See [`KeysManager::derive_channel_keys`] for documentation on this method. */ -MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInMemorySigner PhantomKeysManager_derive_channel_keys(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg, const uint8_t (*params)[32]); /** - * Set this feature as optional. + * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ -void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Gets the \"node_id\" secret key of the phantom node used to sign invoices, decode the + * last-hop onion data, etc. */ -void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKSecretKey PhantomKeysManager_get_phantom_node_secret_key(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Frees any resources used by the RandomBytes, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +void RandomBytes_free(struct LDKRandomBytes this_obj); /** - * Checks if this feature is required. + * Creates a new instance using the given seed. */ -MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKRandomBytes RandomBytes_new(struct LDKThirtyTwoBytes seed); /** - * Checks if this feature is required. + * Constructs a new EntropySource which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is */ -MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKEntropySource RandomBytes_as_EntropySource(const struct LDKRandomBytes *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Creates a copy of a EcdsaChannelSigner */ -MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +struct LDKEcdsaChannelSigner EcdsaChannelSigner_clone(const struct LDKEcdsaChannelSigner *NONNULL_PTR orig); /** - * Set this feature as optional. + * Calls the free function if one is set */ -void InitFeatures_set_route_blinding_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void EcdsaChannelSigner_free(struct LDKEcdsaChannelSigner this_ptr); /** - * Set this feature as required. + * Calls the free function if one is set */ -void InitFeatures_set_route_blinding_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void BaseEcdsaChannelSigner_free(struct LDKBaseEcdsaChannelSigner this_ptr); /** - * Checks if this feature is supported. + * Creates a copy of the InitFeatures */ -MUST_USE_RES bool InitFeatures_supports_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKInitFeatures InitFeatures_clone(const struct LDKInitFeatures *NONNULL_PTR orig); /** - * Set this feature as optional. + * Creates a copy of the NodeFeatures */ -void NodeFeatures_set_route_blinding_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKNodeFeatures NodeFeatures_clone(const struct LDKNodeFeatures *NONNULL_PTR orig); /** - * Set this feature as required. + * Creates a copy of the ChannelFeatures */ -void NodeFeatures_set_route_blinding_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Creates a copy of the Bolt11InvoiceFeatures */ -MUST_USE_RES bool NodeFeatures_supports_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_clone(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Creates a copy of the OfferFeatures */ -MUST_USE_RES bool InitFeatures_requires_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); /** - * Checks if this feature is required. + * Creates a copy of the InvoiceRequestFeatures */ -MUST_USE_RES bool NodeFeatures_requires_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); /** - * Set this feature as optional. + * Creates a copy of the Bolt12InvoiceFeatures */ -void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_clone(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR orig); /** - * Set this feature as required. + * Creates a copy of the BlindedHopFeatures */ -void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKBlindedHopFeatures BlindedHopFeatures_clone(const struct LDKBlindedHopFeatures *NONNULL_PTR orig); /** - * Checks if this feature is supported. + * Creates a copy of the ChannelTypeFeatures */ -MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +struct LDKChannelTypeFeatures ChannelTypeFeatures_clone(const struct LDKChannelTypeFeatures *NONNULL_PTR orig); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the InitFeatures. */ -void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t InitFeatures_hash(const struct LDKInitFeatures *NONNULL_PTR o); /** - * Set this feature as required. + * Generates a non-cryptographic 64-bit hash of the NodeFeatures. */ -void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t NodeFeatures_hash(const struct LDKNodeFeatures *NONNULL_PTR o); /** - * Checks if this feature is supported. + * Generates a non-cryptographic 64-bit hash of the ChannelFeatures. */ -MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t ChannelFeatures_hash(const struct LDKChannelFeatures *NONNULL_PTR o); /** - * Checks if this feature is required. + * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceFeatures. */ -MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t Bolt11InvoiceFeatures_hash(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR o); /** - * Checks if this feature is required. + * Generates a non-cryptographic 64-bit hash of the OfferFeatures. */ -MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t OfferFeatures_hash(const struct LDKOfferFeatures *NONNULL_PTR o); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the InvoiceRequestFeatures. */ -void InitFeatures_set_dual_fund_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t InvoiceRequestFeatures_hash(const struct LDKInvoiceRequestFeatures *NONNULL_PTR o); /** - * Set this feature as required. + * Generates a non-cryptographic 64-bit hash of the Bolt12InvoiceFeatures. */ -void InitFeatures_set_dual_fund_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t Bolt12InvoiceFeatures_hash(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR o); /** - * Checks if this feature is supported. + * Generates a non-cryptographic 64-bit hash of the BlindedHopFeatures. */ -MUST_USE_RES bool InitFeatures_supports_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); +uint64_t BlindedHopFeatures_hash(const struct LDKBlindedHopFeatures *NONNULL_PTR o); /** - * Set this feature as optional. + * Generates a non-cryptographic 64-bit hash of the ChannelTypeFeatures. */ -void NodeFeatures_set_dual_fund_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +uint64_t ChannelTypeFeatures_hash(const struct LDKChannelTypeFeatures *NONNULL_PTR o); /** - * Set this feature as required. + * Frees any resources used by the InitFeatures, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_dual_fund_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void InitFeatures_free(struct LDKInitFeatures this_obj); /** - * Checks if this feature is supported. + * Frees any resources used by the NodeFeatures, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_supports_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeFeatures_free(struct LDKNodeFeatures this_obj); /** - * Checks if this feature is required. + * Frees any resources used by the ChannelFeatures, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_requires_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void ChannelFeatures_free(struct LDKChannelFeatures this_obj); /** - * Checks if this feature is required. + * Frees any resources used by the Bolt11InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool NodeFeatures_requires_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +void Bolt11InvoiceFeatures_free(struct LDKBolt11InvoiceFeatures this_obj); /** - * Set this feature as optional. + * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void OfferFeatures_free(struct LDKOfferFeatures this_obj); /** - * Set this feature as required. + * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. */ -void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); /** - * Checks if this feature is supported. + * Frees any resources used by the Bolt12InvoiceFeatures, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); +void Bolt12InvoiceFeatures_free(struct LDKBolt12InvoiceFeatures this_obj); /** - * Set this feature as optional. + * Frees any resources used by the BlindedHopFeatures, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void BlindedHopFeatures_free(struct LDKBlindedHopFeatures this_obj); /** - * Set this feature as required. + * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ -void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); /** - * Checks if this feature is supported. + * Getting a route for a keysend payment to a private node requires providing the payee's + * features (since they were not announced in a node announcement). However, keysend payments + * don't have an invoice to pull the payee's features from, so this method is provided for use + * when a [`Bolt11InvoiceFeatures`] is required in a route. + * + * MPP keysend is not widely supported yet, so we parameterize support to allow the user to + * choose whether their router should find multi-part routes. */ -MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_for_keysend(bool allow_mpp); /** - * Set this feature as optional. + * Constructs a ChannelTypeFeatures with only static_remotekey set */ -void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_only_static_remote_key(void); /** - * Set this feature as required. + * Constructs a ChannelTypeFeatures with anchors support */ -void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_anchors_zero_htlc_fee_and_dependencies(void); /** - * Checks if this feature is supported. + * Constructs a ChannelTypeFeatures with zero fee commitment anchors support. */ -MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_anchors_zero_fee_commitments(void); /** - * Checks if this feature is required. + * Create a blank Features with no features set */ -MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInitFeatures InitFeatures_empty(void); /** - * Checks if this feature is required. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice InitFeatures_le_flags(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns true if this `Features` has any optional flags set */ -MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_any_optional_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); /** - * Set this feature as required. + * Returns the set of required features unknown by `other`, as their bit position. */ -void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z InitFeatures_required_unknown_bits_from(const struct LDKInitFeatures *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` supports any bits which we do not know of */ -void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * 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 */ -void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is supported. + * 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 bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_feature_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_required_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InitFeatures_set_optional_custom_bit(struct LDKInitFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * Create a blank Features with no features set */ -void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void); /** - * Set this feature as required. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice NodeFeatures_le_flags(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns true if this `Features` has any optional flags set */ -MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_any_optional_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); /** - * Set this feature as required. + * Returns the set of required features unknown by `other`, as their bit position. */ -void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z NodeFeatures_required_unknown_bits_from(const struct LDKNodeFeatures *NONNULL_PTR this_arg, const struct LDKNodeFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns true if this `Features` supports any bits which we do not know of */ -MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * 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 bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * 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 */ -void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_feature_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as required. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_required_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is supported. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ NodeFeatures_set_optional_custom_bit(struct LDKNodeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * Create a blank Features with no features set */ -void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void); /** - * Set this feature as required. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice ChannelFeatures_le_flags(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns true if this `Features` has any optional flags set */ -MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_supports_any_optional_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); /** - * Set this feature as required. + * Returns the set of required features unknown by `other`, as their bit position. */ -void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z ChannelFeatures_required_unknown_bits_from(const struct LDKChannelFeatures *NONNULL_PTR this_arg, const struct LDKChannelFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns true if this `Features` supports any bits which we do not know of */ -MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelFeatures_supports_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * 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 bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * 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 bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_feature_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_required_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as required. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelFeatures_set_optional_custom_bit(struct LDKChannelFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is supported. + * Create a blank Features with no features set */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11InvoiceFeatures_empty(void); /** - * Checks if this feature is required. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Bolt11InvoiceFeatures_le_flags(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` has any optional flags set */ -void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z Bolt11InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt11InvoiceFeatures *NONNULL_PTR other); /** - * Set this feature as optional. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns true if this `Features` supports any bits which we do not know of */ -void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_unknown_bits(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * 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 bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * 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 */ -void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_feature_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as required. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_required_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is supported. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt11InvoiceFeatures_set_optional_custom_bit(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * Create a blank Features with no features set */ -MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); /** - * Checks if this feature is required. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice OfferFeatures_le_flags(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns true if this `Features` has any optional flags set */ -MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool OfferFeatures_supports_any_optional_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool OfferFeatures_requires_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); /** - * Set this feature as required. + * Returns the set of required features unknown by `other`, as their bit position. */ -void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z OfferFeatures_required_unknown_bits_from(const struct LDKOfferFeatures *NONNULL_PTR this_arg, const struct LDKOfferFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is required. + * Returns true if this `Features` supports any bits which we do not know of */ -MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool OfferFeatures_supports_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * 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 */ -void InitFeatures_set_trampoline_routing_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as required. + * 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 */ -void InitFeatures_set_trampoline_routing_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_feature_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is supported. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool InitFeatures_supports_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_required_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as optional. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void NodeFeatures_set_trampoline_routing_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ OfferFeatures_set_optional_custom_bit(struct LDKOfferFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Set this feature as required. + * Create a blank Features with no features set */ -void NodeFeatures_set_trampoline_routing_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); /** - * Checks if this feature is supported. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -MUST_USE_RES bool NodeFeatures_supports_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice InvoiceRequestFeatures_le_flags(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Set this feature as optional. + * Returns true if this `Features` has any optional flags set */ -void Bolt11InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InvoiceRequestFeatures_supports_any_optional_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void Bolt11InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); /** - * Checks if this feature is supported. + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES bool Bolt11InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z InvoiceRequestFeatures_required_unknown_bits_from(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, const struct LDKInvoiceRequestFeatures *NONNULL_PTR other); /** - * Set this feature as optional. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void Bolt12InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns true if this `Features` supports any bits which we do not know of */ -void Bolt12InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InvoiceRequestFeatures_supports_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * 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 bool Bolt12InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * 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 bool InitFeatures_requires_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_feature_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool NodeFeatures_requires_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_required_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES bool Bolt11InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ InvoiceRequestFeatures_set_optional_custom_bit(struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if this feature is required. + * Create a blank Features with no features set */ -MUST_USE_RES bool Bolt12InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12InvoiceFeatures_empty(void); /** - * Set this feature as optional. + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void NodeFeatures_set_dns_resolution_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKu8slice Bolt12InvoiceFeatures_le_flags(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Set this feature as required. + * Returns true if this `Features` has any optional flags set */ -void NodeFeatures_set_dns_resolution_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_any_optional_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if this feature is supported. + * Returns true if this `Features` object contains required features unknown by `other`. */ -MUST_USE_RES bool NodeFeatures_supports_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); /** - * Checks if this feature is required. + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES bool NodeFeatures_requires_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_u64Z Bolt12InvoiceFeatures_required_unknown_bits_from(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, const struct LDKBolt12InvoiceFeatures *NONNULL_PTR other); /** - * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void RoutingFees_free(struct LDKRoutingFees this_obj); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Flat routing fee in millisatoshis. + * Returns true if this `Features` supports any bits which we do not know of */ -uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_unknown_bits(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Flat routing fee in millisatoshis. + * 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 */ -void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * 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 */ -uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_feature_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Liquidity-based routing fee in millionths of a routed amount. - * In other words, 10000 is 1%. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_required_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Constructs a new RoutingFees given each field + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ Bolt12InvoiceFeatures_set_optional_custom_bit(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Checks if two RoutingFeess 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. + * Create a blank Features with no features set */ -bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); +MUST_USE_RES struct LDKBlindedHopFeatures BlindedHopFeatures_empty(void); /** - * Creates a copy of the RoutingFees + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); +MUST_USE_RES struct LDKu8slice BlindedHopFeatures_le_flags(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RoutingFees. + * Returns true if this `Features` has any optional flags set */ -uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); +MUST_USE_RES bool BlindedHopFeatures_supports_any_optional_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. + * Returns true if this `Features` object contains required features unknown by `other`. */ -void RouteHint_free(struct LDKRouteHint this_obj); - -struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); - -void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); /** - * Constructs a new RouteHint given each field + * Returns the set of required features unknown by `other`, as their bit position. */ -MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); +MUST_USE_RES struct LDKCVec_u64Z BlindedHopFeatures_required_unknown_bits_from(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, const struct LDKBlindedHopFeatures *NONNULL_PTR other); /** - * Creates a copy of the RouteHint + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); +MUST_USE_RES bool BlindedHopFeatures_requires_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RouteHint. + * Returns true if this `Features` supports any bits which we do not know of */ -uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); +MUST_USE_RES bool BlindedHopFeatures_supports_unknown_bits(const struct LDKBlindedHopFeatures *NONNULL_PTR this_arg); /** - * Checks if two RouteHints 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. + * 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 */ -bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. + * 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 */ -void RouteHintHop_free(struct LDKRouteHintHop this_obj); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_feature_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * The node_id of the non-target end of the route + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_required_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * The node_id of the non-target end of the route + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); +MUST_USE_RES struct LDKCResult_NoneNoneZ BlindedHopFeatures_set_optional_custom_bit(struct LDKBlindedHopFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * The short_channel_id of this channel + * Create a blank Features with no features set */ -uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKChannelTypeFeatures ChannelTypeFeatures_empty(void); /** - * The short_channel_id of this channel + * Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order + * from most on-the-wire encodings. */ -void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKu8slice ChannelTypeFeatures_le_flags(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The fees which must be paid to use this channel + * Returns true if this `Features` has any optional flags set */ -struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES bool ChannelTypeFeatures_supports_any_optional_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The fees which must be paid to use this channel + * Returns true if this `Features` object contains required features unknown by `other`. */ -void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); /** - * The difference in CLTV values between this node and the next node. + * Returns the set of required features unknown by `other`, as their bit position. */ -uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_u64Z ChannelTypeFeatures_required_unknown_bits_from(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, const struct LDKChannelTypeFeatures *NONNULL_PTR other); /** - * The difference in CLTV values between this node and the next node. + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". */ -void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); +MUST_USE_RES bool ChannelTypeFeatures_requires_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The minimum value, in msat, which must be relayed to the next hop. + * Returns true if this `Features` supports any bits which we do not know of */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES bool ChannelTypeFeatures_supports_unknown_bits(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The minimum value, in msat, which must be relayed to the next hop. + * 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 */ -void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * The maximum value in msat available for routing with a single HTLC. + * 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 */ -struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_feature_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * The maximum value in msat available for routing with a single HTLC. + * 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. + * + * Note: Required bits are even. If an odd bit is given, then the corresponding even bit will + * be set instead (i.e., `bit - 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_required_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Constructs a new RouteHintHop given each field + * Sets an optional custom feature bit. Errors if `bit` is outside the custom range as defined + * by [bLIP 2] or if it is a known `T` feature. + * + * Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be + * set instead (i.e., `bit + 1`). + * + * [bLIP 2]: https://github.com/lightning/blips/blob/master/blip-0002.md#feature-bits */ -MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelTypeFeatures_set_optional_custom_bit(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg, uintptr_t bit); /** - * Creates a copy of the RouteHintHop + * Set this feature as optional. */ -struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); +void InitFeatures_set_data_loss_protect_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RouteHintHop. + * Set this feature as required. */ -uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); +void InitFeatures_set_data_loss_protect_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two RouteHintHops 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. + * Unsets this feature. */ -bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); +void InitFeatures_clear_data_loss_protect(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void UntrustedString_free(struct LDKUntrustedString this_obj); - -struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr); - -void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES bool InitFeatures_supports_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new UntrustedString given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg); +void NodeFeatures_set_data_loss_protect_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the UntrustedString + * Set this feature as required. */ -struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig); +void NodeFeatures_set_data_loss_protect_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two UntrustedStrings 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. + * Unsets this feature. */ -bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); +void NodeFeatures_clear_data_loss_protect(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the UntrustedString. + * Checks if this feature is supported. */ -uint64_t UntrustedString_hash(const struct LDKUntrustedString *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_supports_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a UntrustedString object + * Checks if this feature is required. */ -struct LDKStr UntrustedString_to_str(const struct LDKUntrustedString *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_data_loss_protect(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void PrintableString_free(struct LDKPrintableString this_obj); - -struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr); - -void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES bool NodeFeatures_requires_data_loss_protect(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new PrintableString given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); +void InitFeatures_set_initial_routing_sync_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a PrintableString object + * Set this feature as required. */ -struct LDKStr PrintableString_to_str(const struct LDKPrintableString *NONNULL_PTR o); +void InitFeatures_set_initial_routing_sync_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the FilesystemStore, if is_owned is set and inner is non-NULL. + * Unsets this feature. */ -void FilesystemStore_free(struct LDKFilesystemStore this_obj); +void InitFeatures_clear_initial_routing_sync(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new [`FilesystemStore`]. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKFilesystemStore FilesystemStore_new(struct LDKStr data_dir); +MUST_USE_RES bool InitFeatures_initial_routing_sync(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the data directory. + * Set this feature as optional. */ -MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesystemStore *NONNULL_PTR this_arg); +void InitFeatures_set_upfront_shutdown_script_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * 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 + * Set this feature as required. */ -struct LDKKVStore FilesystemStore_as_KVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); +void InitFeatures_set_upfront_shutdown_script_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new MigratableKVStore which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MigratableKVStore must be freed before this_arg is + * Unsets this feature. */ -struct LDKMigratableKVStore FilesystemStore_as_MigratableKVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); +void InitFeatures_clear_upfront_shutdown_script(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); +MUST_USE_RES bool InitFeatures_supports_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the GossipSync + * Set this feature as optional. */ -void GossipSync_free(struct LDKGossipSync this_ptr); +void NodeFeatures_set_upfront_shutdown_script_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new P2P-variant GossipSync + * Set this feature as required. */ -struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a); +void NodeFeatures_set_upfront_shutdown_script_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Rapid-variant GossipSync + * Unsets this feature. */ -struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a); +void NodeFeatures_clear_upfront_shutdown_script(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new None-variant GossipSync + * Checks if this feature is supported. */ -struct LDKGossipSync GossipSync_none(void); +MUST_USE_RES bool NodeFeatures_supports_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Start a background thread that takes care of responsibilities enumerated in the [top-level - * documentation]. - * - * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or - * [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling - * either [`join`] or [`stop`]. - * - * # Data Persistence - * - * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or - * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a - * [`ChannelManager`]. See the `lightning-persister` crate for LDK's - * provided implementation. - * - * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if - * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. - * See the `lightning-persister` crate for LDK's provided implementation. - * - * Typically, users should either implement [`Persister::persist_manager`] to never return an - * error or call [`join`] and handle any error that may arise. For the latter case, - * `BackgroundProcessor` must be restarted by calling `start` again after handling the error. - * - * # Event Handling - * - * `event_handler` is responsible for handling events that users should be notified of (e.g., - * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common - * functionality implemented by other handlers. - * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures. - * - * # Rapid Gossip Sync - * - * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync` - * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance - * until the [`RapidGossipSync`] instance completes its first sync. - * - * [top-level documentation]: BackgroundProcessor - * [`join`]: Self::join - * [`stop`]: Self::stop - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager - * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable - * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager - * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph - * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph - * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable + * Checks if this feature is required. */ -MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKOnionMessenger *NONNULL_PTR onion_messenger, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer); +MUST_USE_RES bool InitFeatures_requires_upfront_shutdown_script(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting - * [`ChannelManager`]. - * - * # Panics - * - * This function panics if the background thread has panicked such as while persisting or - * handling events. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * Checks if this feature is required. */ -MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); +MUST_USE_RES bool NodeFeatures_requires_upfront_shutdown_script(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting - * [`ChannelManager`]. - * - * # Panics - * - * This function panics if the background thread has panicked such as while persisting or - * handling events. - * - * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); +void InitFeatures_set_gossip_queries_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Bolt11ParseError, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void Bolt11ParseError_free(struct LDKBolt11ParseError this_obj); +void InitFeatures_set_gossip_queries_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two Bolt11ParseErrors 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. + * Unsets this feature. */ -bool Bolt11ParseError_eq(const struct LDKBolt11ParseError *NONNULL_PTR a, const struct LDKBolt11ParseError *NONNULL_PTR b); +void InitFeatures_clear_gossip_queries(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Bolt11ParseError + * Checks if this feature is supported. */ -struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_supports_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ParseOrSemanticError + * Set this feature as optional. */ -void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr); +void NodeFeatures_set_gossip_queries_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ParseOrSemanticError + * Set this feature as required. */ -struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig); +void NodeFeatures_set_gossip_queries_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ParseError-variant ParseOrSemanticError + * Unsets this feature. */ -struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKBolt11ParseError a); +void NodeFeatures_clear_gossip_queries(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SemanticError-variant ParseOrSemanticError + * Checks if this feature is supported. */ -struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKBolt11SemanticError a); +MUST_USE_RES bool NodeFeatures_supports_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two ParseOrSemanticErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b); +MUST_USE_RES bool InitFeatures_requires_gossip_queries(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Bolt11Invoice, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void Bolt11Invoice_free(struct LDKBolt11Invoice this_obj); +MUST_USE_RES bool NodeFeatures_requires_gossip_queries(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two Bolt11Invoices 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. + * Set this feature as optional. */ -bool Bolt11Invoice_eq(const struct LDKBolt11Invoice *NONNULL_PTR a, const struct LDKBolt11Invoice *NONNULL_PTR b); +void InitFeatures_set_variable_length_onion_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Bolt11Invoice + * Set this feature as required. */ -struct LDKBolt11Invoice Bolt11Invoice_clone(const struct LDKBolt11Invoice *NONNULL_PTR orig); +void InitFeatures_set_variable_length_onion_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Bolt11Invoice. + * Unsets this feature. */ -uint64_t Bolt11Invoice_hash(const struct LDKBolt11Invoice *NONNULL_PTR o); +void InitFeatures_clear_variable_length_onion(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Bolt11InvoiceDescription + * Checks if this feature is supported. */ -void Bolt11InvoiceDescription_free(struct LDKBolt11InvoiceDescription this_ptr); +MUST_USE_RES bool InitFeatures_supports_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Bolt11InvoiceDescription + * Set this feature as optional. */ -struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_clone(const struct LDKBolt11InvoiceDescription *NONNULL_PTR orig); +void NodeFeatures_set_variable_length_onion_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Direct-variant Bolt11InvoiceDescription + * Set this feature as required. */ -struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_direct(struct LDKDescription a); +void NodeFeatures_set_variable_length_onion_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Hash-variant Bolt11InvoiceDescription + * Unsets this feature. */ -struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_hash(struct LDKSha256 a); +void NodeFeatures_clear_variable_length_onion(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two Bolt11InvoiceDescriptions contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is supported. */ -bool Bolt11InvoiceDescription_eq(const struct LDKBolt11InvoiceDescription *NONNULL_PTR a, const struct LDKBolt11InvoiceDescription *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Bolt11InvoiceDescription object + * Set this feature as optional. */ -struct LDKStr Bolt11InvoiceDescription_to_str(const struct LDKBolt11InvoiceDescription *NONNULL_PTR o); +void Bolt11InvoiceFeatures_set_variable_length_onion_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the SignedRawBolt11Invoice, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void SignedRawBolt11Invoice_free(struct LDKSignedRawBolt11Invoice this_obj); +void Bolt11InvoiceFeatures_set_variable_length_onion_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two SignedRawBolt11Invoices 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. + * Unsets this feature. */ -bool SignedRawBolt11Invoice_eq(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR a, const struct LDKSignedRawBolt11Invoice *NONNULL_PTR b); +void Bolt11InvoiceFeatures_clear_variable_length_onion(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the SignedRawBolt11Invoice + * Checks if this feature is supported. */ -struct LDKSignedRawBolt11Invoice SignedRawBolt11Invoice_clone(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR orig); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice. + * Checks if this feature is required. */ -uint64_t SignedRawBolt11Invoice_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_variable_length_onion(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the RawBolt11Invoice, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void RawBolt11Invoice_free(struct LDKRawBolt11Invoice this_obj); +MUST_USE_RES bool NodeFeatures_requires_variable_length_onion(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * data part + * Checks if this feature is required. */ -struct LDKRawDataPart RawBolt11Invoice_get_data(const struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_variable_length_onion(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * data part + * Set this feature as optional. */ -void RawBolt11Invoice_set_data(struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val); +void InitFeatures_set_static_remote_key_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two RawBolt11Invoices 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. + * Set this feature as required. */ -bool RawBolt11Invoice_eq(const struct LDKRawBolt11Invoice *NONNULL_PTR a, const struct LDKRawBolt11Invoice *NONNULL_PTR b); +void InitFeatures_set_static_remote_key_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the RawBolt11Invoice + * Unsets this feature. */ -struct LDKRawBolt11Invoice RawBolt11Invoice_clone(const struct LDKRawBolt11Invoice *NONNULL_PTR orig); +void InitFeatures_clear_static_remote_key(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice. + * Checks if this feature is supported. */ -uint64_t RawBolt11Invoice_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_supports_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void RawDataPart_free(struct LDKRawDataPart this_obj); +void NodeFeatures_set_static_remote_key_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * generation time of the invoice + * Set this feature as required. */ -struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr); +void NodeFeatures_set_static_remote_key_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * generation time of the invoice + * Unsets this feature. */ -void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val); +void NodeFeatures_clear_static_remote_key(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two RawDataParts 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. + * Checks if this feature is supported. */ -bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the RawDataPart + * Set this feature as optional. */ -struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig); +void ChannelTypeFeatures_set_static_remote_key_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the RawDataPart. + * Set this feature as required. */ -uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o); +void ChannelTypeFeatures_set_static_remote_key_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL. + * Unsets this feature. */ -void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj); +void ChannelTypeFeatures_clear_static_remote_key(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two PositiveTimestamps 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. + * Checks if this feature is supported. */ -bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b); +MUST_USE_RES bool ChannelTypeFeatures_supports_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PositiveTimestamp + * Checks if this feature is required. */ -struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_requires_static_remote_key(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp. + * Checks if this feature is required. */ -uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_requires_static_remote_key(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the SiPrefix + * Checks if this feature is required. */ -enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig); +MUST_USE_RES bool ChannelTypeFeatures_requires_static_remote_key(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Milli-variant SiPrefix + * Set this feature as optional. */ -enum LDKSiPrefix SiPrefix_milli(void); +void InitFeatures_set_payment_secret_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Micro-variant SiPrefix + * Set this feature as required. */ -enum LDKSiPrefix SiPrefix_micro(void); +void InitFeatures_set_payment_secret_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Nano-variant SiPrefix + * Unsets this feature. */ -enum LDKSiPrefix SiPrefix_nano(void); +void InitFeatures_clear_payment_secret(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Pico-variant SiPrefix + * Checks if this feature is supported. */ -enum LDKSiPrefix SiPrefix_pico(void); +MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two SiPrefixs contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b); +void NodeFeatures_set_payment_secret_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the SiPrefix. + * Set this feature as required. */ -uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o); +void NodeFeatures_set_payment_secret_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix. - * This is effectively 10^12 * the prefix multiplier + * Unsets this feature. */ -MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg); +void NodeFeatures_clear_payment_secret(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Currency + * Checks if this feature is supported. */ -enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Bitcoin-variant Currency + * Set this feature as optional. */ -enum LDKCurrency Currency_bitcoin(void); +void Bolt11InvoiceFeatures_set_payment_secret_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BitcoinTestnet-variant Currency + * Set this feature as required. */ -enum LDKCurrency Currency_bitcoin_testnet(void); +void Bolt11InvoiceFeatures_set_payment_secret_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Regtest-variant Currency + * Unsets this feature. */ -enum LDKCurrency Currency_regtest(void); +void Bolt11InvoiceFeatures_clear_payment_secret(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Simnet-variant Currency + * Checks if this feature is supported. */ -enum LDKCurrency Currency_simnet(void); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Signet-variant Currency + * Checks if this feature is required. */ -enum LDKCurrency Currency_signet(void); +MUST_USE_RES bool InitFeatures_requires_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Currency. + * Checks if this feature is required. */ -uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_requires_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two Currencys contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_secret(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void Sha256_free(struct LDKSha256 this_obj); +void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Sha256 + * Set this feature as required. */ -struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig); +void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Sha256. + * Unsets this feature. */ -uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o); +void InitFeatures_clear_basic_mpp(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two Sha256s 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. + * Checks if this feature is supported. */ -bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b); +MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a - * single sha256 hash. + * Set this feature as optional. */ -MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]); +void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Description, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void Description_free(struct LDKDescription this_obj); +void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Description + * Unsets this feature. */ -struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig); +void NodeFeatures_clear_basic_mpp(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Description. + * Checks if this feature is supported. */ -uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two Descriptions 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. + * Set this feature as optional. */ -bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b); +void Bolt11InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void PayeePubKey_free(struct LDKPayeePubKey this_obj); - -struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr); - -void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void Bolt11InvoiceFeatures_set_basic_mpp_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new PayeePubKey given each field + * Unsets this feature. */ -MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg); +void Bolt11InvoiceFeatures_clear_basic_mpp(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PayeePubKey + * Checks if this feature is supported. */ -struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the PayeePubKey. + * Set this feature as optional. */ -uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o); +void Bolt12InvoiceFeatures_set_basic_mpp_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two PayeePubKeys 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. + * Set this feature as required. */ -bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b); +void Bolt12InvoiceFeatures_set_basic_mpp_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL. + * Unsets this feature. */ -void ExpiryTime_free(struct LDKExpiryTime this_obj); +void Bolt12InvoiceFeatures_clear_basic_mpp(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the ExpiryTime + * Checks if this feature is supported. */ -struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the ExpiryTime. + * Checks if this feature is required. */ -uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two ExpiryTimes 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. + * Checks if this feature is required. */ -bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj); - -uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr); - -void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_basic_mpp(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new MinFinalCltvExpiryDelta given each field + * Checks if this feature is required. */ -MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_basic_mpp(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the MinFinalCltvExpiryDelta + * Set this feature as optional. */ -struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig); +void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta. + * Set this feature as required. */ -uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o); +void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two MinFinalCltvExpiryDeltas 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. + * Unsets this feature. */ -bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b); +void InitFeatures_clear_wumbo(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Fallback + * Checks if this feature is supported. */ -void Fallback_free(struct LDKFallback this_ptr); +MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Fallback + * Set this feature as optional. */ -struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig); +void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SegWitProgram-variant Fallback + * Set this feature as required. */ -struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); +void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new PubKeyHash-variant Fallback + * Unsets this feature. */ -struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a); +void NodeFeatures_clear_wumbo(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ScriptHash-variant Fallback + * Checks if this feature is supported. */ -struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a); +MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Fallback. + * Checks if this feature is required. */ -uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two Fallbacks contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the Bolt11InvoiceSignature, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void Bolt11InvoiceSignature_free(struct LDKBolt11InvoiceSignature this_obj); - -struct LDKRecoverableSignature Bolt11InvoiceSignature_get_a(const struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr); - -void Bolt11InvoiceSignature_set_a(struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr, struct LDKRecoverableSignature val); +void InitFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new Bolt11InvoiceSignature given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_new(struct LDKRecoverableSignature a_arg); +void InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Bolt11InvoiceSignature + * Unsets this feature. */ -struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_clone(const struct LDKBolt11InvoiceSignature *NONNULL_PTR orig); +void InitFeatures_clear_anchors_nonzero_fee_htlc_tx(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceSignature. + * Checks if this feature is supported. */ -uint64_t Bolt11InvoiceSignature_hash(const struct LDKBolt11InvoiceSignature *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two Bolt11InvoiceSignatures 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. + * Set this feature as optional. */ -bool Bolt11InvoiceSignature_eq(const struct LDKBolt11InvoiceSignature *NONNULL_PTR a, const struct LDKBolt11InvoiceSignature *NONNULL_PTR b); +void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void PrivateRoute_free(struct LDKPrivateRoute this_obj); +void NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the PrivateRoute + * Unsets this feature. */ -struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig); +void NodeFeatures_clear_anchors_nonzero_fee_htlc_tx(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the PrivateRoute. + * Checks if this feature is supported. */ -uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two PrivateRoutes 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. + * Set this feature as optional. */ -bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b); +void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Disassembles the `SignedRawBolt11Invoice` into its three parts: - * 1. raw invoice - * 2. hash of the raw invoice - * 3. signature + * Set this feature as required. */ -MUST_USE_RES struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ SignedRawBolt11Invoice_into_parts(struct LDKSignedRawBolt11Invoice this_arg); +void ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The [`RawBolt11Invoice`] which was signed. + * Unsets this feature. */ -MUST_USE_RES struct LDKRawBolt11Invoice SignedRawBolt11Invoice_raw_invoice(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +void ChannelTypeFeatures_clear_anchors_nonzero_fee_htlc_tx(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The hash of the [`RawBolt11Invoice`] that was signed. + * Checks if this feature is supported. */ -MUST_USE_RES const uint8_t (*SignedRawBolt11Invoice_signable_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg))[32]; +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Signature for the invoice. + * Checks if this feature is required. */ -MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Recovers the public key used for signing the invoice from the recoverable signature. + * Checks if this feature is required. */ -MUST_USE_RES struct LDKCResult_PayeePubKeySecp256k1ErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if the signature is valid for the included payee public key or if none exists if it's - * valid for the recovered signature (which should always be true?). + * Checks if this feature is required. */ -MUST_USE_RES bool SignedRawBolt11Invoice_check_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_nonzero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Calculate the hash of the encoded `RawBolt11Invoice` which should be signed. + * Set this feature as optional. */ -MUST_USE_RES struct LDKThirtyTwoBytes RawBolt11Invoice_signable_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as required. */ -MUST_USE_RES struct LDKSha256 RawBolt11Invoice_payment_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Unsets this feature. */ -MUST_USE_RES struct LDKDescription RawBolt11Invoice_description(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKPayeePubKey RawBolt11Invoice_payee_pub_key(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as optional. */ -MUST_USE_RES struct LDKSha256 RawBolt11Invoice_description_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as required. */ -MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Unsets this feature. */ -MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(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); +void NodeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKBolt11InvoiceFeatures RawBolt11Invoice_features(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); - -MUST_USE_RES struct LDKCVec_PrivateRouteZ RawBolt11Invoice_private_routes(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns `None` if no amount is set or on overflow. + * Set this feature as optional. */ -MUST_USE_RES struct LDKCOption_u64Z RawBolt11Invoice_amount_pico_btc(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); - -MUST_USE_RES enum LDKCurrency RawBolt11Invoice_currency(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`. - * - * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. + * Set this feature as required. */ -MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds); +void ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in - * the range `0..=MAX_TIMESTAMP`. - * - * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. - * - * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. + * Unsets this feature. */ -MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time); +void ChannelTypeFeatures_clear_anchors_zero_fee_htlc_tx(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range - * `0..=MAX_TIMESTAMP`. - * - * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. - * - * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration); +MUST_USE_RES bool ChannelTypeFeatures_supports_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Returns the Unix timestamp representing the stored time + * Checks if this feature is required. */ -MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the duration of the stored time since the Unix epoch + * Checks if this feature is required. */ -MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the [`SystemTime`] representing the stored time + * Checks if this feature is required. */ -MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); +MUST_USE_RES bool ChannelTypeFeatures_requires_anchors_zero_fee_htlc_tx(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * The hash of the [`RawBolt11Invoice`] that was signed. + * Set this feature as optional. */ -MUST_USE_RES struct LDKThirtyTwoBytes Bolt11Invoice_signable_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_route_blinding_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Transform the `Bolt11Invoice` into its unchecked version. + * Set this feature as required. */ -MUST_USE_RES struct LDKSignedRawBolt11Invoice Bolt11Invoice_into_signed_raw(struct LDKBolt11Invoice this_arg); +void InitFeatures_set_route_blinding_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Check that the invoice is signed correctly and that key recovery works + * Unsets this feature. */ -MUST_USE_RES struct LDKCResult_NoneBolt11SemanticErrorZ Bolt11Invoice_check_signature(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_clear_route_blinding(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a `Bolt11Invoice` from a [`SignedRawBolt11Invoice`] by checking all its invariants. - * ``` - * use lightning_invoice::*; - * - * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\ - * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\ - * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\ - * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\ - * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\ - * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\ - * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\ - * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\ - * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\ - * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\ - * j5r6drg6k6zcqj0fcwg\"; - * - * let signed = invoice.parse::().unwrap(); - * - * assert!(Bolt11Invoice::from_signed(signed).is_ok()); - * ``` + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ Bolt11Invoice_from_signed(struct LDKSignedRawBolt11Invoice signed_invoice); +MUST_USE_RES bool InitFeatures_supports_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the `Bolt11Invoice`'s timestamp (should equal its creation time) + * Set this feature as optional. */ -MUST_USE_RES uint64_t Bolt11Invoice_timestamp(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_route_blinding_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the `Bolt11Invoice`'s timestamp as a duration since the Unix epoch + * Set this feature as required. */ -MUST_USE_RES uint64_t Bolt11Invoice_duration_since_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_route_blinding_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the hash to which we will receive the preimage on completion of the payment + * Unsets this feature. */ -MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32]; +void NodeFeatures_clear_route_blinding(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the payee's public key if one was included in the invoice - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKPublicKey Bolt11Invoice_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the payment secret if one was included in the invoice + * Checks if this feature is required. */ -MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_secret(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32]; +MUST_USE_RES bool InitFeatures_requires_route_blinding(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the payment metadata blob if one was included in the invoice + * Checks if this feature is required. */ -MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt11Invoice_payment_metadata(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_route_blinding(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the invoice features if they were included in the invoice - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Set this feature as optional. */ -MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Recover the payee's public key (only to be used if none was included in the invoice) + * Set this feature as required. */ -MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Recover the payee's public key if one was included in the invoice, otherwise return the - * recovered public key from the signature + * Unsets this feature. */ -MUST_USE_RES struct LDKPublicKey Bolt11Invoice_get_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_clear_shutdown_anysegwit(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the Duration since the Unix epoch at which the invoice expires. - * Returning None if overflow occurred. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. + * Set this feature as optional. */ -MUST_USE_RES uint64_t Bolt11Invoice_expiry_time(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns whether the invoice has expired. + * Set this feature as required. */ -MUST_USE_RES bool Bolt11Invoice_is_expired(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the Duration remaining until the invoice expires. + * Unsets this feature. */ -MUST_USE_RES uint64_t Bolt11Invoice_duration_until_expiry(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_clear_shutdown_anysegwit(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the Duration remaining until the invoice expires given the current time. - * `time` is the timestamp as a duration since the Unix epoch. + * Checks if this feature is supported. */ -MUST_USE_RES uint64_t Bolt11Invoice_expiration_remaining_from_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t time); +MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns whether the expiry time would pass at the given point in time. - * `at_time` is the timestamp as a duration since the Unix epoch. + * Checks if this feature is required. */ -MUST_USE_RES bool Bolt11Invoice_would_expire(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t at_time); +MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise - * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * Checks if this feature is required. */ -MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns a list of all fallback addresses as [`Address`]es + * Set this feature as optional. */ -MUST_USE_RES struct LDKCVec_AddressZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_dual_fund_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns a list of all routes included in the invoice + * Set this feature as required. */ -MUST_USE_RES struct LDKCVec_PrivateRouteZ Bolt11Invoice_private_routes(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_set_dual_fund_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns a list of all routes included in the invoice as the underlying hints + * Unsets this feature. */ -MUST_USE_RES struct LDKCVec_RouteHintZ Bolt11Invoice_route_hints(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void InitFeatures_clear_dual_fund(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the currency for which the invoice was issued + * Checks if this feature is supported. */ -MUST_USE_RES enum LDKCurrency Bolt11Invoice_currency(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the amount if specified in the invoice as millisatoshis. + * Set this feature as optional. */ -MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); +void NodeFeatures_set_dual_fund_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a new `Description` if `description` is at most 1023 * 5 bits (i.e., 639 bytes) - * long, and returns [`CreationError::DescriptionTooLong`] otherwise. - * - * Please note that single characters may use more than one byte due to UTF8 encoding. + * Set this feature as required. */ -MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description); +void NodeFeatures_set_dual_fund_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates an empty `Description`. + * Unsets this feature. */ -MUST_USE_RES struct LDKDescription Description_empty(void); +void NodeFeatures_clear_dual_fund(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the underlying description [`UntrustedString`] + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKUntrustedString Description_into_inner(struct LDKDescription this_arg); +MUST_USE_RES bool NodeFeatures_supports_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get a reference to the underlying description [`UntrustedString`] + * Checks if this feature is required. */ -MUST_USE_RES struct LDKUntrustedString Description_as_inner(const struct LDKDescription *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Description object + * Checks if this feature is required. */ -struct LDKStr Description_to_str(const struct LDKDescription *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_requires_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Construct an `ExpiryTime` from seconds. + * Set this feature as optional. */ -MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds); +void InitFeatures_set_taproot_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part. + * Set this feature as required. */ -MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration); +void InitFeatures_set_taproot_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the expiry time in seconds + * Unsets this feature. */ -MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg); +void InitFeatures_clear_taproot(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns a reference to the underlying [`Duration`] (=expiry time) + * Checks if this feature is supported. */ -MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a new (partial) route from a list of hops + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops); +void NodeFeatures_set_taproot_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the underlying list of hops + * Set this feature as required. */ -MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg); +void NodeFeatures_set_taproot_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the CreationError + * Unsets this feature. */ -enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig); +void NodeFeatures_clear_taproot(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DescriptionTooLong-variant CreationError + * Checks if this feature is supported. */ -enum LDKCreationError CreationError_description_too_long(void); +MUST_USE_RES bool NodeFeatures_supports_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new RouteTooLong-variant CreationError + * Set this feature as optional. */ -enum LDKCreationError CreationError_route_too_long(void); +void ChannelTypeFeatures_set_taproot_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new TimestampOutOfBounds-variant CreationError + * Set this feature as required. */ -enum LDKCreationError CreationError_timestamp_out_of_bounds(void); +void ChannelTypeFeatures_set_taproot_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidAmount-variant CreationError + * Unsets this feature. */ -enum LDKCreationError CreationError_invalid_amount(void); +void ChannelTypeFeatures_clear_taproot(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MissingRouteHints-variant CreationError + * Checks if this feature is supported. */ -enum LDKCreationError CreationError_missing_route_hints(void); +MUST_USE_RES bool ChannelTypeFeatures_supports_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError + * Checks if this feature is required. */ -enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void); +MUST_USE_RES bool InitFeatures_requires_taproot(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two CreationErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_requires_taproot(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a CreationError object + * Checks if this feature is required. */ -struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o); +MUST_USE_RES bool ChannelTypeFeatures_requires_taproot(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the Bolt11SemanticError + * Set this feature as optional. */ -enum LDKBolt11SemanticError Bolt11SemanticError_clone(const enum LDKBolt11SemanticError *NONNULL_PTR orig); +void InitFeatures_set_quiescence_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new NoPaymentHash-variant Bolt11SemanticError + * Set this feature as required. */ -enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_hash(void); +void InitFeatures_set_quiescence_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MultiplePaymentHashes-variant Bolt11SemanticError + * Unsets this feature. */ -enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_hashes(void); +void InitFeatures_clear_quiescence(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new NoDescription-variant Bolt11SemanticError + * Checks if this feature is supported. */ -enum LDKBolt11SemanticError Bolt11SemanticError_no_description(void); +MUST_USE_RES bool InitFeatures_supports_quiescence(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MultipleDescriptions-variant Bolt11SemanticError + * Set this feature as optional. */ -enum LDKBolt11SemanticError Bolt11SemanticError_multiple_descriptions(void); +void NodeFeatures_set_quiescence_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new NoPaymentSecret-variant Bolt11SemanticError + * Set this feature as required. */ -enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_secret(void); +void NodeFeatures_set_quiescence_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new MultiplePaymentSecrets-variant Bolt11SemanticError + * Unsets this feature. */ -enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_secrets(void); +void NodeFeatures_clear_quiescence(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidFeatures-variant Bolt11SemanticError + * Checks if this feature is supported. */ -enum LDKBolt11SemanticError Bolt11SemanticError_invalid_features(void); +MUST_USE_RES bool NodeFeatures_supports_quiescence(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidRecoveryId-variant Bolt11SemanticError + * Checks if this feature is required. */ -enum LDKBolt11SemanticError Bolt11SemanticError_invalid_recovery_id(void); +MUST_USE_RES bool InitFeatures_requires_quiescence(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvalidSignature-variant Bolt11SemanticError + * Checks if this feature is required. */ -enum LDKBolt11SemanticError Bolt11SemanticError_invalid_signature(void); +MUST_USE_RES bool NodeFeatures_requires_quiescence(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ImpreciseAmount-variant Bolt11SemanticError + * Set this feature as optional. */ -enum LDKBolt11SemanticError Bolt11SemanticError_imprecise_amount(void); +void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two Bolt11SemanticErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as required. */ -bool Bolt11SemanticError_eq(const enum LDKBolt11SemanticError *NONNULL_PTR a, const enum LDKBolt11SemanticError *NONNULL_PTR b); +void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Bolt11SemanticError object + * Unsets this feature. */ -struct LDKStr Bolt11SemanticError_to_str(const enum LDKBolt11SemanticError *NONNULL_PTR o); +void InitFeatures_clear_onion_messages(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the SignOrCreationError + * Checks if this feature is supported. */ -void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr); +MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the SignOrCreationError + * Set this feature as optional. */ -struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig); +void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SignError-variant SignOrCreationError + * Set this feature as required. */ -struct LDKSignOrCreationError SignOrCreationError_sign_error(void); +void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new CreationError-variant SignOrCreationError + * Unsets this feature. */ -struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a); +void NodeFeatures_clear_onion_messages(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two SignOrCreationErrors contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is supported. */ -bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a SignOrCreationError object + * Checks if this feature is required. */ -struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a SiPrefix object from a string + * Checks if this feature is required. */ -struct LDKCResult_SiPrefixBolt11ParseErrorZ SiPrefix_from_str(struct LDKStr s); +MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a Bolt11Invoice object from a string + * Set this feature as optional. */ -struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ Bolt11Invoice_from_str(struct LDKStr s); +void InitFeatures_set_provide_storage_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Read a SignedRawBolt11Invoice object from a string + * Set this feature as required. */ -struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ SignedRawBolt11Invoice_from_str(struct LDKStr s); +void InitFeatures_set_provide_storage_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Bolt11ParseError object + * Unsets this feature. */ -struct LDKStr Bolt11ParseError_to_str(const struct LDKBolt11ParseError *NONNULL_PTR o); +void InitFeatures_clear_provide_storage(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a ParseOrSemanticError object + * Checks if this feature is supported. */ -struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_supports_provide_storage(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Bolt11Invoice object + * Set this feature as optional. */ -struct LDKStr Bolt11Invoice_to_str(const struct LDKBolt11Invoice *NONNULL_PTR o); +void NodeFeatures_set_provide_storage_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a SignedRawBolt11Invoice object + * Set this feature as required. */ -struct LDKStr SignedRawBolt11Invoice_to_str(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o); +void NodeFeatures_set_provide_storage_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a Currency object + * Unsets this feature. */ -struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o); +void NodeFeatures_clear_provide_storage(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a SiPrefix object + * Checks if this feature is supported. */ -struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o); +MUST_USE_RES bool NodeFeatures_supports_provide_storage(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the GraphSyncError + * Checks if this feature is required. */ -void GraphSyncError_free(struct LDKGraphSyncError this_ptr); +MUST_USE_RES bool InitFeatures_requires_provide_storage(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the GraphSyncError + * Checks if this feature is required. */ -struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_provide_storage(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new DecodeError-variant GraphSyncError + * Set this feature as optional. */ -struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); +void InitFeatures_set_channel_type_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LightningError-variant GraphSyncError + * Set this feature as required. */ -struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); +void InitFeatures_set_channel_type_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL. + * Unsets this feature. */ -void RapidGossipSync_free(struct LDKRapidGossipSync this_obj); +void InitFeatures_clear_channel_type(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Instantiate a new [`RapidGossipSync`] instance. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); +MUST_USE_RES bool InitFeatures_supports_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Sync gossip data from a file. - * Returns the last sync timestamp to be used the next time rapid sync data is queried. - * - * `network_graph`: The network graph to apply the updates to - * - * `sync_path`: Path to the file where the gossip update data is located - * + * Set this feature as optional. */ -MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path); +void NodeFeatures_set_channel_type_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Update network graph from binary data. - * Returns the last sync timestamp to be used the next time rapid sync data is queried. - * - * `update_data`: `&[u8]` binary stream that comprises the update data + * Set this feature as required. */ -MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data); +void NodeFeatures_set_channel_type_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Update network graph from binary data. - * Returns the last sync timestamp to be used the next time rapid sync data is queried. - * - * `update_data`: `&[u8]` binary stream that comprises the update data - * `current_time_unix`: `Option` optional current timestamp to verify data age + * Unsets this feature. */ -MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix); +void NodeFeatures_clear_channel_type(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns whether a rapid gossip sync has completed at least once. + * Checks if this feature is supported. */ -MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LiquidityEvent + * Checks if this feature is required. */ -void LiquidityEvent_free(struct LDKLiquidityEvent this_ptr); +MUST_USE_RES bool InitFeatures_requires_channel_type(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LiquidityEvent + * Checks if this feature is required. */ -struct LDKLiquidityEvent LiquidityEvent_clone(const struct LDKLiquidityEvent *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_channel_type(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS0Client-variant LiquidityEvent + * Set this feature as optional. */ -struct LDKLiquidityEvent LiquidityEvent_lsps0_client(struct LDKLSPS0ClientEvent a); +void InitFeatures_set_scid_privacy_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS1Client-variant LiquidityEvent + * Set this feature as required. */ -struct LDKLiquidityEvent LiquidityEvent_lsps1_client(struct LDKLSPS1ClientEvent a); +void InitFeatures_set_scid_privacy_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS2Client-variant LiquidityEvent + * Unsets this feature. */ -struct LDKLiquidityEvent LiquidityEvent_lsps2_client(struct LDKLSPS2ClientEvent a); +void InitFeatures_clear_scid_privacy(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS2Service-variant LiquidityEvent + * Checks if this feature is supported. */ -struct LDKLiquidityEvent LiquidityEvent_lsps2_service(struct LDKLSPS2ServiceEvent a); +MUST_USE_RES bool InitFeatures_supports_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two LiquidityEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool LiquidityEvent_eq(const struct LDKLiquidityEvent *NONNULL_PTR a, const struct LDKLiquidityEvent *NONNULL_PTR b); +void NodeFeatures_set_scid_privacy_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0ClientHandler, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void LSPS0ClientHandler_free(struct LDKLSPS0ClientHandler this_obj); +void NodeFeatures_set_scid_privacy_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Calls bLIP-50 / LSPS0's `list_protocols`. - * - * Please refer to the [bLIP-50 / LSPS0 - * specifcation](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) - * for more information. + * Unsets this feature. */ -void LSPS0ClientHandler_list_protocols(const struct LDKLSPS0ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); +void NodeFeatures_clear_scid_privacy(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0ClientEvent + * Checks if this feature is supported. */ -void LSPS0ClientEvent_free(struct LDKLSPS0ClientEvent this_ptr); +MUST_USE_RES bool NodeFeatures_supports_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0ClientEvent + * Set this feature as optional. */ -struct LDKLSPS0ClientEvent LSPS0ClientEvent_clone(const struct LDKLSPS0ClientEvent *NONNULL_PTR orig); +void ChannelTypeFeatures_set_scid_privacy_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ListProtocolsResponse-variant LSPS0ClientEvent + * Set this feature as required. */ -struct LDKLSPS0ClientEvent LSPS0ClientEvent_list_protocols_response(struct LDKPublicKey counterparty_node_id, struct LDKCVec_u16Z protocols); +void ChannelTypeFeatures_set_scid_privacy_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0ClientEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Unsets this feature. */ -bool LSPS0ClientEvent_eq(const struct LDKLSPS0ClientEvent *NONNULL_PTR a, const struct LDKLSPS0ClientEvent *NONNULL_PTR b); +void ChannelTypeFeatures_clear_scid_privacy(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0ListProtocolsRequest, if is_owned is set and inner is non-NULL. + * Checks if this feature is supported. */ -void LSPS0ListProtocolsRequest_free(struct LDKLSPS0ListProtocolsRequest this_obj); +MUST_USE_RES bool ChannelTypeFeatures_supports_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPS0ListProtocolsRequest given each field + * Checks if this feature is required. */ -MUST_USE_RES struct LDKLSPS0ListProtocolsRequest LSPS0ListProtocolsRequest_new(void); +MUST_USE_RES bool InitFeatures_requires_scid_privacy(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0ListProtocolsRequest + * Checks if this feature is required. */ -struct LDKLSPS0ListProtocolsRequest LSPS0ListProtocolsRequest_clone(const struct LDKLSPS0ListProtocolsRequest *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0ListProtocolsRequests 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. + * Checks if this feature is required. */ -bool LSPS0ListProtocolsRequest_eq(const struct LDKLSPS0ListProtocolsRequest *NONNULL_PTR a, const struct LDKLSPS0ListProtocolsRequest *NONNULL_PTR b); +MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0ListProtocolsResponse, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void LSPS0ListProtocolsResponse_free(struct LDKLSPS0ListProtocolsResponse this_obj); +void Bolt11InvoiceFeatures_set_payment_metadata_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * A list of supported protocols. - * - * Returns a copy of the field. + * Set this feature as required. */ -struct LDKCVec_u16Z LSPS0ListProtocolsResponse_get_protocols(const struct LDKLSPS0ListProtocolsResponse *NONNULL_PTR this_ptr); +void Bolt11InvoiceFeatures_set_payment_metadata_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * A list of supported protocols. + * Unsets this feature. */ -void LSPS0ListProtocolsResponse_set_protocols(struct LDKLSPS0ListProtocolsResponse *NONNULL_PTR this_ptr, struct LDKCVec_u16Z val); +void Bolt11InvoiceFeatures_clear_payment_metadata(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPS0ListProtocolsResponse given each field + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKLSPS0ListProtocolsResponse LSPS0ListProtocolsResponse_new(struct LDKCVec_u16Z protocols_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0ListProtocolsResponse + * Checks if this feature is required. */ -struct LDKLSPS0ListProtocolsResponse LSPS0ListProtocolsResponse_clone(const struct LDKLSPS0ListProtocolsResponse *NONNULL_PTR orig); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_payment_metadata(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0ListProtocolsResponses 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. + * Set this feature as optional. */ -bool LSPS0ListProtocolsResponse_eq(const struct LDKLSPS0ListProtocolsResponse *NONNULL_PTR a, const struct LDKLSPS0ListProtocolsResponse *NONNULL_PTR b); +void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0Request + * Set this feature as required. */ -void LSPS0Request_free(struct LDKLSPS0Request this_ptr); +void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0Request + * Unsets this feature. */ -struct LDKLSPS0Request LSPS0Request_clone(const struct LDKLSPS0Request *NONNULL_PTR orig); +void InitFeatures_supports_zero_conf(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ListProtocols-variant LSPS0Request + * Checks if this feature is supported. */ -struct LDKLSPS0Request LSPS0Request_list_protocols(struct LDKLSPS0ListProtocolsRequest a); +MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0Requests contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool LSPS0Request_eq(const struct LDKLSPS0Request *NONNULL_PTR a, const struct LDKLSPS0Request *NONNULL_PTR b); +void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns the method name associated with the given request variant. + * Set this feature as required. */ -MUST_USE_RES struct LDKStr LSPS0Request_method(const struct LDKLSPS0Request *NONNULL_PTR this_arg); +void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0Response + * Unsets this feature. */ -void LSPS0Response_free(struct LDKLSPS0Response this_ptr); +void NodeFeatures_supports_zero_conf(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0Response + * Checks if this feature is supported. */ -struct LDKLSPS0Response LSPS0Response_clone(const struct LDKLSPS0Response *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ListProtocols-variant LSPS0Response + * Set this feature as optional. */ -struct LDKLSPS0Response LSPS0Response_list_protocols(struct LDKLSPS0ListProtocolsResponse a); +void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new ListProtocolsError-variant LSPS0Response + * Set this feature as required. */ -struct LDKLSPS0Response LSPS0Response_list_protocols_error(struct LDKLSPSResponseError a); +void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0Responses contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Unsets this feature. */ -bool LSPS0Response_eq(const struct LDKLSPS0Response *NONNULL_PTR a, const struct LDKLSPS0Response *NONNULL_PTR b); +void ChannelTypeFeatures_supports_zero_conf(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0Message + * Checks if this feature is supported. */ -void LSPS0Message_free(struct LDKLSPS0Message this_ptr); +MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS0Message + * Set this feature as optional. */ -struct LDKLSPS0Message LSPS0Message_clone(const struct LDKLSPS0Message *NONNULL_PTR orig); +void NodeFeatures_set_keysend_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Request-variant LSPS0Message + * Set this feature as required. */ -struct LDKLSPS0Message LSPS0Message_request(struct LDKLSPSRequestId a, struct LDKLSPS0Request b); +void NodeFeatures_set_keysend_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Response-variant LSPS0Message + * Unsets this feature. */ -struct LDKLSPS0Message LSPS0Message_response(struct LDKLSPSRequestId a, struct LDKLSPS0Response b); +void NodeFeatures_clear_keysend(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS0Messages contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is supported. */ -bool LSPS0Message_eq(const struct LDKLSPS0Message *NONNULL_PTR a, const struct LDKLSPS0Message *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the RawLSPSMessage, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void RawLSPSMessage_free(struct LDKRawLSPSMessage this_obj); +MUST_USE_RES bool NodeFeatures_requires_keysend(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The raw string payload that holds the actual message. + * Set this feature as optional. */ -struct LDKStr RawLSPSMessage_get_payload(const struct LDKRawLSPSMessage *NONNULL_PTR this_ptr); +void InitFeatures_set_trampoline_routing_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The raw string payload that holds the actual message. + * Set this feature as required. */ -void RawLSPSMessage_set_payload(struct LDKRawLSPSMessage *NONNULL_PTR this_ptr, struct LDKStr val); +void InitFeatures_set_trampoline_routing_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new RawLSPSMessage given each field + * Unsets this feature. */ -MUST_USE_RES struct LDKRawLSPSMessage RawLSPSMessage_new(struct LDKStr payload_arg); +void InitFeatures_clear_trampoline_routing(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the RawLSPSMessage + * Checks if this feature is supported. */ -struct LDKRawLSPSMessage RawLSPSMessage_clone(const struct LDKRawLSPSMessage *NONNULL_PTR orig); +MUST_USE_RES bool InitFeatures_supports_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two RawLSPSMessages 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. + * Set this feature as optional. */ -bool RawLSPSMessage_eq(const struct LDKRawLSPSMessage *NONNULL_PTR a, const struct LDKRawLSPSMessage *NONNULL_PTR b); +void NodeFeatures_set_trampoline_routing_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Serialize the RawLSPSMessage object into a byte array which can be read by RawLSPSMessage_read + * Set this feature as required. */ -struct LDKCVec_u8Z RawLSPSMessage_write(const struct LDKRawLSPSMessage *NONNULL_PTR obj); +void NodeFeatures_set_trampoline_routing_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Read a RawLSPSMessage from a byte array, created by RawLSPSMessage_write + * Unsets this feature. */ -struct LDKCResult_RawLSPSMessageDecodeErrorZ RawLSPSMessage_read(struct LDKu8slice ser); +void NodeFeatures_clear_trampoline_routing(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new Type which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Type must be freed before this_arg is + * Checks if this feature is supported. */ -struct LDKType RawLSPSMessage_as_Type(const struct LDKRawLSPSMessage *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPSRequestId, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void LSPSRequestId_free(struct LDKLSPSRequestId this_obj); - -struct LDKStr LSPSRequestId_get_a(const struct LDKLSPSRequestId *NONNULL_PTR this_ptr); - -void LSPSRequestId_set_a(struct LDKLSPSRequestId *NONNULL_PTR this_ptr, struct LDKStr val); +void Bolt11InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPSRequestId given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKLSPSRequestId LSPSRequestId_new(struct LDKStr a_arg); +void Bolt11InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPSRequestId + * Unsets this feature. */ -struct LDKLSPSRequestId LSPSRequestId_clone(const struct LDKLSPSRequestId *NONNULL_PTR orig); +void Bolt11InvoiceFeatures_clear_trampoline_routing(struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPSRequestIds 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. + * Checks if this feature is supported. */ -bool LSPSRequestId_eq(const struct LDKLSPSRequestId *NONNULL_PTR a, const struct LDKLSPSRequestId *NONNULL_PTR b); +MUST_USE_RES bool Bolt11InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the LSPSRequestId. + * Set this feature as optional. */ -uint64_t LSPSRequestId_hash(const struct LDKLSPSRequestId *NONNULL_PTR o); +void Bolt12InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPSDateTime, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void LSPSDateTime_free(struct LDKLSPSDateTime this_obj); +void Bolt12InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPSDateTime + * Unsets this feature. */ -struct LDKLSPSDateTime LSPSDateTime_clone(const struct LDKLSPSDateTime *NONNULL_PTR orig); +void Bolt12InvoiceFeatures_clear_trampoline_routing(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPSDateTimes 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. + * Checks if this feature is supported. */ -bool LSPSDateTime_eq(const struct LDKLSPSDateTime *NONNULL_PTR a, const struct LDKLSPSDateTime *NONNULL_PTR b); +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the LSPSDateTime. + * Checks if this feature is required. */ -uint64_t LSPSDateTime_hash(const struct LDKLSPSDateTime *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_requires_trampoline_routing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Returns the LSPSDateTime as RFC3339 formatted string. + * Checks if this feature is required. */ -MUST_USE_RES struct LDKStr LSPSDateTime_to_rfc3339(const struct LDKLSPSDateTime *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_trampoline_routing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Returns if the given time is in the past. + * Checks if this feature is required. */ -MUST_USE_RES bool LSPSDateTime_is_past(const struct LDKLSPSDateTime *NONNULL_PTR this_arg); +MUST_USE_RES bool Bolt11InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); /** - * Read a LSPSDateTime object from a string + * Checks if this feature is required. */ -struct LDKCResult_LSPSDateTimeNoneZ LSPSDateTime_from_str(struct LDKStr s); +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); /** - * Get the string representation of a LSPSDateTime object + * Set this feature as optional. */ -struct LDKStr LSPSDateTime_to_str(const struct LDKLSPSDateTime *NONNULL_PTR o); +void InitFeatures_set_simple_close_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPSResponseError, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void LSPSResponseError_free(struct LDKLSPSResponseError this_obj); +void InitFeatures_set_simple_close_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A string providing a short description of the error. + * Unsets this feature. */ -struct LDKStr LSPSResponseError_get_message(const struct LDKLSPSResponseError *NONNULL_PTR this_ptr); +void InitFeatures_clear_simple_close(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A string providing a short description of the error. + * Checks if this feature is supported. */ -void LSPSResponseError_set_message(struct LDKLSPSResponseError *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES bool InitFeatures_supports_simple_close(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * A primitive or structured value that contains additional information about the error. + * Set this feature as optional. */ -struct LDKCOption_StrZ LSPSResponseError_get_data(const struct LDKLSPSResponseError *NONNULL_PTR this_ptr); +void NodeFeatures_set_simple_close_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * A primitive or structured value that contains additional information about the error. + * Set this feature as required. */ -void LSPSResponseError_set_data(struct LDKLSPSResponseError *NONNULL_PTR this_ptr, struct LDKCOption_StrZ val); +void NodeFeatures_set_simple_close_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPSResponseError + * Unsets this feature. */ -struct LDKLSPSResponseError LSPSResponseError_clone(const struct LDKLSPSResponseError *NONNULL_PTR orig); +void NodeFeatures_clear_simple_close(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPSResponseErrors 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. + * Checks if this feature is supported. */ -bool LSPSResponseError_eq(const struct LDKLSPSResponseError *NONNULL_PTR a, const struct LDKLSPSResponseError *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_simple_close(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPSMessage + * Checks if this feature is required. */ -void LSPSMessage_free(struct LDKLSPSMessage this_ptr); +MUST_USE_RES bool InitFeatures_requires_simple_close(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPSMessage + * Checks if this feature is required. */ -struct LDKLSPSMessage LSPSMessage_clone(const struct LDKLSPSMessage *NONNULL_PTR orig); +MUST_USE_RES bool NodeFeatures_requires_simple_close(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Invalid-variant LSPSMessage + * Set this feature as optional. */ -struct LDKLSPSMessage LSPSMessage_invalid(struct LDKLSPSResponseError a); +void InitFeatures_set_splicing_production_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS0-variant LSPSMessage + * Set this feature as required. */ -struct LDKLSPSMessage LSPSMessage_lsps0(struct LDKLSPS0Message a); +void InitFeatures_set_splicing_production_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS1-variant LSPSMessage + * Unsets this feature. */ -struct LDKLSPSMessage LSPSMessage_lsps1(struct LDKLSPS1Message a); +void InitFeatures_clear_splicing_production(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new LSPS2-variant LSPSMessage + * Checks if this feature is supported. */ -struct LDKLSPSMessage LSPSMessage_lsps2(struct LDKLSPS2Message a); +MUST_USE_RES bool InitFeatures_supports_splicing_production(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPSMessages contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Set this feature as optional. */ -bool LSPSMessage_eq(const struct LDKLSPSMessage *NONNULL_PTR a, const struct LDKLSPSMessage *NONNULL_PTR b); +void NodeFeatures_set_splicing_production_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS0ServiceHandler, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void LSPS0ServiceHandler_free(struct LDKLSPS0ServiceHandler this_obj); +void NodeFeatures_set_splicing_production_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1ClientConfig, if is_owned is set and inner is non-NULL. + * Unsets this feature. */ -void LSPS1ClientConfig_free(struct LDKLSPS1ClientConfig this_obj); +void NodeFeatures_clear_splicing_production(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximally allowed channel fees. + * Checks if this feature is supported. */ -struct LDKCOption_u64Z LSPS1ClientConfig_get_max_channel_fees_msat(const struct LDKLSPS1ClientConfig *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_splicing_production(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximally allowed channel fees. + * Checks if this feature is required. */ -void LSPS1ClientConfig_set_max_channel_fees_msat(struct LDKLSPS1ClientConfig *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +MUST_USE_RES bool InitFeatures_requires_splicing_production(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPS1ClientConfig given each field + * Checks if this feature is required. */ -MUST_USE_RES struct LDKLSPS1ClientConfig LSPS1ClientConfig_new(struct LDKCOption_u64Z max_channel_fees_msat_arg); +MUST_USE_RES bool NodeFeatures_requires_splicing_production(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS1ClientConfig + * Set this feature as optional. */ -struct LDKLSPS1ClientConfig LSPS1ClientConfig_clone(const struct LDKLSPS1ClientConfig *NONNULL_PTR orig); +void InitFeatures_set_anchor_zero_fee_commitments_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1ClientHandler, if is_owned is set and inner is non-NULL. + * Set this feature as required. */ -void LSPS1ClientHandler_free(struct LDKLSPS1ClientHandler this_obj); +void InitFeatures_set_anchor_zero_fee_commitments_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Request the supported options from the LSP. - * - * The user will receive the LSP's response via an [`SupportedOptionsReady`] event. - * - * `counterparty_node_id` is the `node_id` of the LSP you would like to use. - * - * Returns the used [`LSPSRequestId`], which will be returned via [`SupportedOptionsReady`]. - * - * [`SupportedOptionsReady`]: crate::lsps1::event::LSPS1ClientEvent::SupportedOptionsReady + * Unsets this feature. */ -MUST_USE_RES struct LDKLSPSRequestId LSPS1ClientHandler_request_supported_options(const struct LDKLSPS1ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id); +void InitFeatures_clear_anchor_zero_fee_commitments(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Places an order with the connected LSP given its `counterparty_node_id`. - * - * The client agrees to paying channel fees according to the provided parameters. + * Checks if this feature is supported. */ -MUST_USE_RES struct LDKLSPSRequestId LSPS1ClientHandler_create_order(const struct LDKLSPS1ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKLSPS1OrderParams order, struct LDKCOption_AddressZ refund_onchain_address); +MUST_USE_RES bool InitFeatures_supports_anchor_zero_fee_commitments(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Queries the status of a pending payment, i.e., whether a payment has been received by the LSP. - * - * Upon success an [`LSPS1ClientEvent::OrderStatus`] event will be emitted. - * - * [`LSPS1ClientEvent::OrderStatus`]: crate::lsps1::event::LSPS1ClientEvent::OrderStatus + * Set this feature as optional. */ -MUST_USE_RES struct LDKLSPSRequestId LSPS1ClientHandler_check_order_status(const struct LDKLSPS1ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKLSPS1OrderId order_id); +void NodeFeatures_set_anchor_zero_fee_commitments_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1ClientEvent + * Set this feature as required. */ -void LSPS1ClientEvent_free(struct LDKLSPS1ClientEvent this_ptr); +void NodeFeatures_set_anchor_zero_fee_commitments_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS1ClientEvent + * Unsets this feature. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_clone(const struct LDKLSPS1ClientEvent *NONNULL_PTR orig); +void NodeFeatures_clear_anchor_zero_fee_commitments(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SupportedOptionsReady-variant LSPS1ClientEvent + * Checks if this feature is supported. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_supported_options_ready(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPS1Options supported_options); +MUST_USE_RES bool NodeFeatures_supports_anchor_zero_fee_commitments(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new SupportedOptionsRequestFailed-variant LSPS1ClientEvent + * Set this feature as optional. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_supported_options_request_failed(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPSResponseError error); +void ChannelTypeFeatures_set_anchor_zero_fee_commitments_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OrderCreated-variant LSPS1ClientEvent + * Set this feature as required. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_order_created(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPS1OrderId order_id, struct LDKLSPS1OrderParams order, struct LDKLSPS1PaymentInfo payment, struct LDKLSPS1ChannelInfo channel); +void ChannelTypeFeatures_set_anchor_zero_fee_commitments_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OrderStatus-variant LSPS1ClientEvent + * Unsets this feature. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_order_status(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPS1OrderId order_id, struct LDKLSPS1OrderParams order, struct LDKLSPS1PaymentInfo payment, struct LDKLSPS1ChannelInfo channel); +void ChannelTypeFeatures_clear_anchor_zero_fee_commitments(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OrderRequestFailed-variant LSPS1ClientEvent + * Checks if this feature is supported. */ -struct LDKLSPS1ClientEvent LSPS1ClientEvent_order_request_failed(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPSResponseError error); +MUST_USE_RES bool ChannelTypeFeatures_supports_anchor_zero_fee_commitments(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS1ClientEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Checks if this feature is required. */ -bool LSPS1ClientEvent_eq(const struct LDKLSPS1ClientEvent *NONNULL_PTR a, const struct LDKLSPS1ClientEvent *NONNULL_PTR b); +MUST_USE_RES bool InitFeatures_requires_anchor_zero_fee_commitments(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1OrderId, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void LSPS1OrderId_free(struct LDKLSPS1OrderId this_obj); - -struct LDKStr LSPS1OrderId_get_a(const struct LDKLSPS1OrderId *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_anchor_zero_fee_commitments(const struct LDKNodeFeatures *NONNULL_PTR this_arg); -void LSPS1OrderId_set_a(struct LDKLSPS1OrderId *NONNULL_PTR this_ptr, struct LDKStr val); +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_anchor_zero_fee_commitments(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPS1OrderId given each field + * Set this feature as optional. */ -MUST_USE_RES struct LDKLSPS1OrderId LSPS1OrderId_new(struct LDKStr a_arg); +void InitFeatures_set_htlc_hold_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS1OrderId + * Set this feature as required. */ -struct LDKLSPS1OrderId LSPS1OrderId_clone(const struct LDKLSPS1OrderId *NONNULL_PTR orig); +void InitFeatures_set_htlc_hold_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS1OrderIds 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. + * Unsets this feature. */ -bool LSPS1OrderId_eq(const struct LDKLSPS1OrderId *NONNULL_PTR a, const struct LDKLSPS1OrderId *NONNULL_PTR b); +void InitFeatures_clear_htlc_hold(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Generates a non-cryptographic 64-bit hash of the LSPS1OrderId. + * Checks if this feature is supported. */ -uint64_t LSPS1OrderId_hash(const struct LDKLSPS1OrderId *NONNULL_PTR o); +MUST_USE_RES bool InitFeatures_supports_htlc_hold(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1GetInfoRequest, if is_owned is set and inner is non-NULL. + * Set this feature as optional. */ -void LSPS1GetInfoRequest_free(struct LDKLSPS1GetInfoRequest this_obj); +void NodeFeatures_set_htlc_hold_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Constructs a new LSPS1GetInfoRequest given each field + * Set this feature as required. */ -MUST_USE_RES struct LDKLSPS1GetInfoRequest LSPS1GetInfoRequest_new(void); +void NodeFeatures_set_htlc_hold_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS1GetInfoRequest + * Unsets this feature. */ -struct LDKLSPS1GetInfoRequest LSPS1GetInfoRequest_clone(const struct LDKLSPS1GetInfoRequest *NONNULL_PTR orig); +void NodeFeatures_clear_htlc_hold(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Checks if two LSPS1GetInfoRequests 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. + * Checks if this feature is supported. */ -bool LSPS1GetInfoRequest_eq(const struct LDKLSPS1GetInfoRequest *NONNULL_PTR a, const struct LDKLSPS1GetInfoRequest *NONNULL_PTR b); +MUST_USE_RES bool NodeFeatures_supports_htlc_hold(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS1Options, if is_owned is set and inner is non-NULL. + * Checks if this feature is required. */ -void LSPS1Options_free(struct LDKLSPS1Options this_obj); +MUST_USE_RES bool InitFeatures_requires_htlc_hold(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The smallest number of confirmations needed for the LSP to accept a channel as confirmed. + * Checks if this feature is required. */ -uint16_t LSPS1Options_get_min_required_channel_confirmations(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_htlc_hold(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The smallest number of confirmations needed for the LSP to accept a channel as confirmed. + * Set this feature as optional. */ -void LSPS1Options_set_min_required_channel_confirmations(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint16_t val); +void InitFeatures_set_splicing_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The smallest number of blocks in which the LSP can confirm the funding transaction. + * Set this feature as required. */ -uint16_t LSPS1Options_get_min_funding_confirms_within_blocks(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +void InitFeatures_set_splicing_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The smallest number of blocks in which the LSP can confirm the funding transaction. + * Unsets this feature. */ -void LSPS1Options_set_min_funding_confirms_within_blocks(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint16_t val); +void InitFeatures_clear_splicing(struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Indicates if the LSP supports zero reserve. + * Checks if this feature is supported. */ -bool LSPS1Options_get_supports_zero_channel_reserve(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +MUST_USE_RES bool InitFeatures_supports_splicing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * Indicates if the LSP supports zero reserve. + * Set this feature as optional. */ -void LSPS1Options_set_supports_zero_channel_reserve(struct LDKLSPS1Options *NONNULL_PTR this_ptr, bool val); +void NodeFeatures_set_splicing_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum number of blocks a channel can be leased for. + * Set this feature as required. */ -uint32_t LSPS1Options_get_max_channel_expiry_blocks(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +void NodeFeatures_set_splicing_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum number of blocks a channel can be leased for. + * Unsets this feature. */ -void LSPS1Options_set_max_channel_expiry_blocks(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint32_t val); +void NodeFeatures_clear_splicing(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The minimum number of satoshi that the client MUST request. + * Checks if this feature is supported. */ -uint64_t LSPS1Options_get_min_initial_client_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_splicing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The minimum number of satoshi that the client MUST request. + * Checks if this feature is required. */ -void LSPS1Options_set_min_initial_client_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool InitFeatures_requires_splicing(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** - * The maximum number of satoshi that the client MUST request. + * Checks if this feature is required. */ -uint64_t LSPS1Options_get_max_initial_client_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_requires_splicing(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum number of satoshi that the client MUST request. + * Set this feature as optional. */ -void LSPS1Options_set_max_initial_client_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +void NodeFeatures_set_dns_resolution_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The minimum number of satoshi that the LSP will provide to the channel. + * Set this feature as required. */ -uint64_t LSPS1Options_get_min_initial_lsp_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +void NodeFeatures_set_dns_resolution_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The minimum number of satoshi that the LSP will provide to the channel. + * Unsets this feature. */ -void LSPS1Options_set_min_initial_lsp_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +void NodeFeatures_clear_dns_resolution(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum number of satoshi that the LSP will provide to the channel. + * Checks if this feature is supported. */ -uint64_t LSPS1Options_get_max_initial_lsp_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +MUST_USE_RES bool NodeFeatures_supports_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The maximum number of satoshi that the LSP will provide to the channel. + * Checks if this feature is required. */ -void LSPS1Options_set_max_initial_lsp_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool NodeFeatures_requires_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** - * The minimal channel size. + * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. */ -uint64_t LSPS1Options_get_min_channel_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +void RoutingFees_free(struct LDKRoutingFees this_obj); /** - * The minimal channel size. + * Flat routing fee in millisatoshis. */ -void LSPS1Options_set_min_channel_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +uint32_t RoutingFees_get_base_msat(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * The maximal channel size. + * Flat routing fee in millisatoshis. */ -uint64_t LSPS1Options_get_max_channel_balance_sat(const struct LDKLSPS1Options *NONNULL_PTR this_ptr); +void RoutingFees_set_base_msat(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * The maximal channel size. + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -void LSPS1Options_set_max_channel_balance_sat(struct LDKLSPS1Options *NONNULL_PTR this_ptr, uint64_t val); +uint32_t RoutingFees_get_proportional_millionths(const struct LDKRoutingFees *NONNULL_PTR this_ptr); /** - * Constructs a new LSPS1Options given each field + * Liquidity-based routing fee in millionths of a routed amount. + * In other words, 10000 is 1%. */ -MUST_USE_RES struct LDKLSPS1Options LSPS1Options_new(uint16_t min_required_channel_confirmations_arg, uint16_t min_funding_confirms_within_blocks_arg, bool supports_zero_channel_reserve_arg, uint32_t max_channel_expiry_blocks_arg, uint64_t min_initial_client_balance_sat_arg, uint64_t max_initial_client_balance_sat_arg, uint64_t min_initial_lsp_balance_sat_arg, uint64_t max_initial_lsp_balance_sat_arg, uint64_t min_channel_balance_sat_arg, uint64_t max_channel_balance_sat_arg); +void RoutingFees_set_proportional_millionths(struct LDKRoutingFees *NONNULL_PTR this_ptr, uint32_t val); /** - * Creates a copy of the LSPS1Options + * Constructs a new RoutingFees given each field */ -struct LDKLSPS1Options LSPS1Options_clone(const struct LDKLSPS1Options *NONNULL_PTR orig); +MUST_USE_RES struct LDKRoutingFees RoutingFees_new(uint32_t base_msat_arg, uint32_t proportional_millionths_arg); /** - * Checks if two LSPS1Optionss contain equal inner contents. + * Checks if two RoutingFeess 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 LSPS1Options_eq(const struct LDKLSPS1Options *NONNULL_PTR a, const struct LDKLSPS1Options *NONNULL_PTR b); +bool RoutingFees_eq(const struct LDKRoutingFees *NONNULL_PTR a, const struct LDKRoutingFees *NONNULL_PTR b); + +/** + * Creates a copy of the RoutingFees + */ +struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig); /** - * Frees any resources used by the LSPS1GetInfoResponse, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the RoutingFees. */ -void LSPS1GetInfoResponse_free(struct LDKLSPS1GetInfoResponse this_obj); +uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o); /** - * All options supported by the LSP. + * Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL. */ -struct LDKLSPS1Options LSPS1GetInfoResponse_get_options(const struct LDKLSPS1GetInfoResponse *NONNULL_PTR this_ptr); +void RouteHint_free(struct LDKRouteHint this_obj); + +struct LDKCVec_RouteHintHopZ RouteHint_get_a(const struct LDKRouteHint *NONNULL_PTR this_ptr); + +void RouteHint_set_a(struct LDKRouteHint *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintHopZ val); /** - * All options supported by the LSP. + * Constructs a new RouteHint given each field */ -void LSPS1GetInfoResponse_set_options(struct LDKLSPS1GetInfoResponse *NONNULL_PTR this_ptr, struct LDKLSPS1Options val); +MUST_USE_RES struct LDKRouteHint RouteHint_new(struct LDKCVec_RouteHintHopZ a_arg); /** - * Constructs a new LSPS1GetInfoResponse given each field + * Creates a copy of the RouteHint */ -MUST_USE_RES struct LDKLSPS1GetInfoResponse LSPS1GetInfoResponse_new(struct LDKLSPS1Options options_arg); +struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig); /** - * Creates a copy of the LSPS1GetInfoResponse + * Generates a non-cryptographic 64-bit hash of the RouteHint. */ -struct LDKLSPS1GetInfoResponse LSPS1GetInfoResponse_clone(const struct LDKLSPS1GetInfoResponse *NONNULL_PTR orig); +uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o); /** - * Checks if two LSPS1GetInfoResponses contain equal inner contents. + * Checks if two RouteHints 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 LSPS1GetInfoResponse_eq(const struct LDKLSPS1GetInfoResponse *NONNULL_PTR a, const struct LDKLSPS1GetInfoResponse *NONNULL_PTR b); +bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b); /** - * Frees any resources used by the LSPS1CreateOrderRequest, if is_owned is set and inner is non-NULL. + * Frees any resources used by the RouteHintHop, if is_owned is set and inner is non-NULL. */ -void LSPS1CreateOrderRequest_free(struct LDKLSPS1CreateOrderRequest this_obj); +void RouteHintHop_free(struct LDKRouteHintHop this_obj); /** - * The order made. + * The node_id of the non-target end of the route */ -struct LDKLSPS1OrderParams LSPS1CreateOrderRequest_get_order(const struct LDKLSPS1CreateOrderRequest *NONNULL_PTR this_ptr); +struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * The order made. + * The node_id of the non-target end of the route */ -void LSPS1CreateOrderRequest_set_order(struct LDKLSPS1CreateOrderRequest *NONNULL_PTR this_ptr, struct LDKLSPS1OrderParams val); +void RouteHintHop_set_src_node_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The address where the LSP will send the funds if the order fails. + * The short_channel_id of this channel */ -struct LDKCOption_AddressZ LSPS1CreateOrderRequest_get_refund_onchain_address(const struct LDKLSPS1CreateOrderRequest *NONNULL_PTR this_ptr); +uint64_t RouteHintHop_get_short_channel_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * The address where the LSP will send the funds if the order fails. + * The short_channel_id of this channel */ -void LSPS1CreateOrderRequest_set_refund_onchain_address(struct LDKLSPS1CreateOrderRequest *NONNULL_PTR this_ptr, struct LDKCOption_AddressZ val); +void RouteHintHop_set_short_channel_id(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new LSPS1CreateOrderRequest given each field + * The fees which must be paid to use this channel */ -MUST_USE_RES struct LDKLSPS1CreateOrderRequest LSPS1CreateOrderRequest_new(struct LDKLSPS1OrderParams order_arg, struct LDKCOption_AddressZ refund_onchain_address_arg); +struct LDKRoutingFees RouteHintHop_get_fees(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Creates a copy of the LSPS1CreateOrderRequest + * The fees which must be paid to use this channel */ -struct LDKLSPS1CreateOrderRequest LSPS1CreateOrderRequest_clone(const struct LDKLSPS1CreateOrderRequest *NONNULL_PTR orig); +void RouteHintHop_set_fees(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKRoutingFees val); /** - * Checks if two LSPS1CreateOrderRequests 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. + * The difference in CLTV values between this node and the next node. */ -bool LSPS1CreateOrderRequest_eq(const struct LDKLSPS1CreateOrderRequest *NONNULL_PTR a, const struct LDKLSPS1CreateOrderRequest *NONNULL_PTR b); +uint16_t RouteHintHop_get_cltv_expiry_delta(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Frees any resources used by the LSPS1OrderParams, if is_owned is set and inner is non-NULL. + * The difference in CLTV values between this node and the next node. */ -void LSPS1OrderParams_free(struct LDKLSPS1OrderParams this_obj); +void RouteHintHop_set_cltv_expiry_delta(struct LDKRouteHintHop *NONNULL_PTR this_ptr, uint16_t val); /** - * Indicates how many satoshi the LSP will provide on their side. + * The minimum value, in msat, which must be relayed to the next hop. */ -uint64_t LSPS1OrderParams_get_lsp_balance_sat(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z RouteHintHop_get_htlc_minimum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Indicates how many satoshi the LSP will provide on their side. + * The minimum value, in msat, which must be relayed to the next hop. */ -void LSPS1OrderParams_set_lsp_balance_sat(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, uint64_t val); +void RouteHintHop_set_htlc_minimum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Indicates how many satoshi the client will provide on their side. - * - * The client sends these funds to the LSP, who will push them back to the client upon opening - * the channel. + * The maximum value in msat available for routing with a single HTLC. */ -uint64_t LSPS1OrderParams_get_client_balance_sat(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z RouteHintHop_get_htlc_maximum_msat(const struct LDKRouteHintHop *NONNULL_PTR this_ptr); /** - * Indicates how many satoshi the client will provide on their side. - * - * The client sends these funds to the LSP, who will push them back to the client upon opening - * the channel. + * The maximum value in msat available for routing with a single HTLC. */ -void LSPS1OrderParams_set_client_balance_sat(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, uint64_t val); +void RouteHintHop_set_htlc_maximum_msat(struct LDKRouteHintHop *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The number of confirmations the funding tx must have before the LSP sends `channel_ready`. + * Constructs a new RouteHintHop given each field */ -uint16_t LSPS1OrderParams_get_required_channel_confirmations(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg); /** - * The number of confirmations the funding tx must have before the LSP sends `channel_ready`. + * Creates a copy of the RouteHintHop */ -void LSPS1OrderParams_set_required_channel_confirmations(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, uint16_t val); +struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig); /** - * The maximum number of blocks the client wants to wait until the funding transaction is confirmed. + * Generates a non-cryptographic 64-bit hash of the RouteHintHop. */ -uint16_t LSPS1OrderParams_get_funding_confirms_within_blocks(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o); /** - * The maximum number of blocks the client wants to wait until the funding transaction is confirmed. + * Checks if two RouteHintHops 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. */ -void LSPS1OrderParams_set_funding_confirms_within_blocks(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, uint16_t val); +bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b); /** - * Indicates how long the channel is leased for in block time. + * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL. */ -uint32_t LSPS1OrderParams_get_channel_expiry_blocks(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +void UntrustedString_free(struct LDKUntrustedString this_obj); + +struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr); + +void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Indicates how long the channel is leased for in block time. + * Constructs a new UntrustedString given each field */ -void LSPS1OrderParams_set_channel_expiry_blocks(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg); /** - * May contain arbitrary associated data like a coupon code or a authentication token. + * Creates a copy of the UntrustedString */ -struct LDKCOption_StrZ LSPS1OrderParams_get_token(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig); /** - * May contain arbitrary associated data like a coupon code or a authentication token. + * Checks if two UntrustedStrings 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. */ -void LSPS1OrderParams_set_token(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, struct LDKCOption_StrZ val); +bool UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b); /** - * Indicates if the channel should be announced to the network. + * Generates a non-cryptographic 64-bit hash of the UntrustedString. */ -bool LSPS1OrderParams_get_announce_channel(const struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr); +uint64_t UntrustedString_hash(const struct LDKUntrustedString *NONNULL_PTR o); /** - * Indicates if the channel should be announced to the network. + * Get the string representation of a UntrustedString object */ -void LSPS1OrderParams_set_announce_channel(struct LDKLSPS1OrderParams *NONNULL_PTR this_ptr, bool val); +struct LDKStr UntrustedString_to_str(const struct LDKUntrustedString *NONNULL_PTR o); /** - * Constructs a new LSPS1OrderParams given each field + * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKLSPS1OrderParams LSPS1OrderParams_new(uint64_t lsp_balance_sat_arg, uint64_t client_balance_sat_arg, uint16_t required_channel_confirmations_arg, uint16_t funding_confirms_within_blocks_arg, uint32_t channel_expiry_blocks_arg, struct LDKCOption_StrZ token_arg, bool announce_channel_arg); +void PrintableString_free(struct LDKPrintableString this_obj); + +struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr); + +void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val); /** - * Creates a copy of the LSPS1OrderParams + * Constructs a new PrintableString given each field */ -struct LDKLSPS1OrderParams LSPS1OrderParams_clone(const struct LDKLSPS1OrderParams *NONNULL_PTR orig); +MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); /** - * Checks if two LSPS1OrderParamss 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. + * Get the string representation of a PrintableString object */ -bool LSPS1OrderParams_eq(const struct LDKLSPS1OrderParams *NONNULL_PTR a, const struct LDKLSPS1OrderParams *NONNULL_PTR b); +struct LDKStr PrintableString_to_str(const struct LDKPrintableString *NONNULL_PTR o); /** - * Frees any resources used by the LSPS1CreateOrderResponse, 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 LSPS1CreateOrderResponse_free(struct LDKLSPS1CreateOrderResponse this_obj); +void FilesystemStore_free(struct LDKFilesystemStore this_obj); /** - * The id of the channel order. + * Creates a copy of the FilesystemStore */ -struct LDKLSPS1OrderId LSPS1CreateOrderResponse_get_order_id(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +struct LDKFilesystemStore FilesystemStore_clone(const struct LDKFilesystemStore *NONNULL_PTR orig); /** - * The id of the channel order. + * Constructs a new [`FilesystemStore`]. */ -void LSPS1CreateOrderResponse_set_order_id(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, struct LDKLSPS1OrderId val); +MUST_USE_RES struct LDKFilesystemStore FilesystemStore_new(struct LDKStr data_dir); /** - * The parameters of channel order. + * Returns the data directory. */ -struct LDKLSPS1OrderParams LSPS1CreateOrderResponse_get_order(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** - * The parameters of channel order. + * Constructs a new KVStoreSync which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned KVStoreSync must be freed before this_arg is */ -void LSPS1CreateOrderResponse_set_order(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, struct LDKLSPS1OrderParams val); +struct LDKKVStoreSync FilesystemStore_as_KVStoreSync(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** - * The datetime when the order was created + * Constructs a new MigratableKVStore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MigratableKVStore must be freed before this_arg is */ -struct LDKLSPSDateTime LSPS1CreateOrderResponse_get_created_at(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +struct LDKMigratableKVStore FilesystemStore_as_MigratableKVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); /** - * The datetime when the order was created + * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. */ -void LSPS1CreateOrderResponse_set_created_at(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); /** - * The current state of the order. + * Frees any resources used by the GossipSync */ -enum LDKLSPS1OrderState LSPS1CreateOrderResponse_get_order_state(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +void GossipSync_free(struct LDKGossipSync this_ptr); /** - * The current state of the order. + * Utility method to constructs a new P2P-variant GossipSync */ -void LSPS1CreateOrderResponse_set_order_state(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, enum LDKLSPS1OrderState val); +struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a); /** - * Contains details about how to pay for the order. + * Utility method to constructs a new Rapid-variant GossipSync */ -struct LDKLSPS1PaymentInfo LSPS1CreateOrderResponse_get_payment(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a); /** - * Contains details about how to pay for the order. + * Utility method to constructs a new None-variant GossipSync */ -void LSPS1CreateOrderResponse_set_payment(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, struct LDKLSPS1PaymentInfo val); +struct LDKGossipSync GossipSync_none(void); /** - * Contains information about the channel state. + * Start a background thread that takes care of responsibilities enumerated in the [top-level + * documentation]. * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * The thread runs indefinitely unless the object is dropped, [`stop`] is called, or + * [`KVStoreSync`] returns an error. In case of an error, the error is retrieved by calling + * either [`join`] or [`stop`]. + * + * # Data Persistence + * + * [`KVStoreSync`] is responsible for writing out the [`ChannelManager`] to disk, and/or + * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a + * [`ChannelManager`]. See the `lightning-persister` crate for LDK's + * provided implementation. + * + * [`KVStoreSync`] is also responsible for writing out the [`NetworkGraph`] to disk, if + * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. + * See the `lightning-persister` crate for LDK's provided implementation. + * + * Typically, users should either implement [`KVStoreSync`] to never return an + * error or call [`join`] and handle any error that may arise. For the latter case, + * `BackgroundProcessor` must be restarted by calling `start` again after handling the error. + * + * # Event Handling + * + * `event_handler` is responsible for handling events that users should be notified of (e.g., + * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common + * functionality implemented by other handlers. + * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures. + * + * # Rapid Gossip Sync + * + * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync` + * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance + * until the [`RapidGossipSync`] instance completes its first sync. + * + * [top-level documentation]: BackgroundProcessor + * [`join`]: Self::join + * [`stop`]: Self::stop + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager + * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable + * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph + * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable + * + * Note that sweeper (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKLSPS1ChannelInfo LSPS1CreateOrderResponse_get_channel(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKKVStoreSync kv_store, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKOnionMessenger *NONNULL_PTR onion_messenger, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKOutputSweeperSync sweeper, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer); /** - * Contains information about the channel state. + * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting + * [`ChannelManager`]. * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * # Panics + * + * This function panics if the background thread has panicked such as while persisting or + * handling events. + * + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -void LSPS1CreateOrderResponse_set_channel(struct LDKLSPS1CreateOrderResponse *NONNULL_PTR this_ptr, struct LDKLSPS1ChannelInfo val); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg); /** - * Constructs a new LSPS1CreateOrderResponse given each field + * Stop `BackgroundProcessor`'s thread, returning any error that occurred while persisting + * [`ChannelManager`]. * - * Note that channel_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * # Panics + * + * This function panics if the background thread has panicked such as while persisting or + * handling events. + * + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ -MUST_USE_RES struct LDKLSPS1CreateOrderResponse LSPS1CreateOrderResponse_new(struct LDKLSPS1OrderId order_id_arg, struct LDKLSPS1OrderParams order_arg, struct LDKLSPSDateTime created_at_arg, enum LDKLSPS1OrderState order_state_arg, struct LDKLSPS1PaymentInfo payment_arg, struct LDKLSPS1ChannelInfo channel_arg); +MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); /** - * Creates a copy of the LSPS1CreateOrderResponse + * Frees any resources used by the Bolt11ParseError, if is_owned is set and inner is non-NULL. */ -struct LDKLSPS1CreateOrderResponse LSPS1CreateOrderResponse_clone(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR orig); +void Bolt11ParseError_free(struct LDKBolt11ParseError this_obj); /** - * Checks if two LSPS1CreateOrderResponses contain equal inner contents. + * Checks if two Bolt11ParseErrors 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 LSPS1CreateOrderResponse_eq(const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR a, const struct LDKLSPS1CreateOrderResponse *NONNULL_PTR b); - -/** - * Creates a copy of the LSPS1OrderState - */ -enum LDKLSPS1OrderState LSPS1OrderState_clone(const enum LDKLSPS1OrderState *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Created-variant LSPS1OrderState - */ -enum LDKLSPS1OrderState LSPS1OrderState_created(void); - -/** - * Utility method to constructs a new Completed-variant LSPS1OrderState - */ -enum LDKLSPS1OrderState LSPS1OrderState_completed(void); +bool Bolt11ParseError_eq(const struct LDKBolt11ParseError *NONNULL_PTR a, const struct LDKBolt11ParseError *NONNULL_PTR b); /** - * Utility method to constructs a new Failed-variant LSPS1OrderState + * Creates a copy of the Bolt11ParseError */ -enum LDKLSPS1OrderState LSPS1OrderState_failed(void); +struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig); /** - * Checks if two LSPS1OrderStates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Frees any resources used by the ParseOrSemanticError */ -bool LSPS1OrderState_eq(const enum LDKLSPS1OrderState *NONNULL_PTR a, const enum LDKLSPS1OrderState *NONNULL_PTR b); +void ParseOrSemanticError_free(struct LDKParseOrSemanticError this_ptr); /** - * Frees any resources used by the LSPS1PaymentInfo, if is_owned is set and inner is non-NULL. + * Creates a copy of the ParseOrSemanticError */ -void LSPS1PaymentInfo_free(struct LDKLSPS1PaymentInfo this_obj); +struct LDKParseOrSemanticError ParseOrSemanticError_clone(const struct LDKParseOrSemanticError *NONNULL_PTR orig); /** - * A Lightning payment using BOLT 11. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new ParseError-variant ParseOrSemanticError */ -struct LDKLSPS1Bolt11PaymentInfo LSPS1PaymentInfo_get_bolt11(const struct LDKLSPS1PaymentInfo *NONNULL_PTR this_ptr); +struct LDKParseOrSemanticError ParseOrSemanticError_parse_error(struct LDKBolt11ParseError a); /** - * A Lightning payment using BOLT 11. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Utility method to constructs a new SemanticError-variant ParseOrSemanticError */ -void LSPS1PaymentInfo_set_bolt11(struct LDKLSPS1PaymentInfo *NONNULL_PTR this_ptr, struct LDKLSPS1Bolt11PaymentInfo val); +struct LDKParseOrSemanticError ParseOrSemanticError_semantic_error(enum LDKBolt11SemanticError a); /** - * An onchain payment. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two ParseOrSemanticErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKLSPS1OnchainPaymentInfo LSPS1PaymentInfo_get_onchain(const struct LDKLSPS1PaymentInfo *NONNULL_PTR this_ptr); +bool ParseOrSemanticError_eq(const struct LDKParseOrSemanticError *NONNULL_PTR a, const struct LDKParseOrSemanticError *NONNULL_PTR b); /** - * An onchain payment. - * - * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + * Frees any resources used by the Bolt11Invoice, if is_owned is set and inner is non-NULL. */ -void LSPS1PaymentInfo_set_onchain(struct LDKLSPS1PaymentInfo *NONNULL_PTR this_ptr, struct LDKLSPS1OnchainPaymentInfo val); +void Bolt11Invoice_free(struct LDKBolt11Invoice this_obj); /** - * Constructs a new LSPS1PaymentInfo given each field - * - * Note that bolt11_arg (or a relevant inner pointer) may be NULL or all-0s to represent None - * Note that onchain_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Checks if two Bolt11Invoices 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. */ -MUST_USE_RES struct LDKLSPS1PaymentInfo LSPS1PaymentInfo_new(struct LDKLSPS1Bolt11PaymentInfo bolt11_arg, struct LDKLSPS1OnchainPaymentInfo onchain_arg); +bool Bolt11Invoice_eq(const struct LDKBolt11Invoice *NONNULL_PTR a, const struct LDKBolt11Invoice *NONNULL_PTR b); /** - * Creates a copy of the LSPS1PaymentInfo + * Creates a copy of the Bolt11Invoice */ -struct LDKLSPS1PaymentInfo LSPS1PaymentInfo_clone(const struct LDKLSPS1PaymentInfo *NONNULL_PTR orig); +struct LDKBolt11Invoice Bolt11Invoice_clone(const struct LDKBolt11Invoice *NONNULL_PTR orig); /** - * Checks if two LSPS1PaymentInfos 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. + * Generates a non-cryptographic 64-bit hash of the Bolt11Invoice. */ -bool LSPS1PaymentInfo_eq(const struct LDKLSPS1PaymentInfo *NONNULL_PTR a, const struct LDKLSPS1PaymentInfo *NONNULL_PTR b); +uint64_t Bolt11Invoice_hash(const struct LDKBolt11Invoice *NONNULL_PTR o); /** - * Frees any resources used by the LSPS1Bolt11PaymentInfo, if is_owned is set and inner is non-NULL. + * Frees any resources used by the Bolt11InvoiceDescription */ -void LSPS1Bolt11PaymentInfo_free(struct LDKLSPS1Bolt11PaymentInfo this_obj); +void Bolt11InvoiceDescription_free(struct LDKBolt11InvoiceDescription this_ptr); /** - * Indicates the current state of the payment. + * Creates a copy of the Bolt11InvoiceDescription */ -enum LDKLSPS1PaymentState LSPS1Bolt11PaymentInfo_get_state(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr); +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_clone(const struct LDKBolt11InvoiceDescription *NONNULL_PTR orig); /** - * Indicates the current state of the payment. + * Utility method to constructs a new Direct-variant Bolt11InvoiceDescription */ -void LSPS1Bolt11PaymentInfo_set_state(struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr, enum LDKLSPS1PaymentState val); +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_direct(struct LDKDescription a); /** - * The datetime when the payment option expires. + * Utility method to constructs a new Hash-variant Bolt11InvoiceDescription */ -struct LDKLSPSDateTime LSPS1Bolt11PaymentInfo_get_expires_at(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr); +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_hash(struct LDKSha256 a); /** - * The datetime when the payment option expires. + * Checks if two Bolt11InvoiceDescriptions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -void LSPS1Bolt11PaymentInfo_set_expires_at(struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +bool Bolt11InvoiceDescription_eq(const struct LDKBolt11InvoiceDescription *NONNULL_PTR a, const struct LDKBolt11InvoiceDescription *NONNULL_PTR b); /** - * The total fee the LSP will charge to open this channel in satoshi. + * Get the string representation of a Bolt11InvoiceDescription object */ -uint64_t LSPS1Bolt11PaymentInfo_get_fee_total_sat(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr); +struct LDKStr Bolt11InvoiceDescription_to_str(const struct LDKBolt11InvoiceDescription *NONNULL_PTR o); /** - * The total fee the LSP will charge to open this channel in satoshi. + * Frees any resources used by the SignedRawBolt11Invoice, if is_owned is set and inner is non-NULL. */ -void LSPS1Bolt11PaymentInfo_set_fee_total_sat(struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr, uint64_t val); +void SignedRawBolt11Invoice_free(struct LDKSignedRawBolt11Invoice this_obj); /** - * The amount the client needs to pay to have the requested channel openend. + * Checks if two SignedRawBolt11Invoices 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. */ -uint64_t LSPS1Bolt11PaymentInfo_get_order_total_sat(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr); +bool SignedRawBolt11Invoice_eq(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR a, const struct LDKSignedRawBolt11Invoice *NONNULL_PTR b); /** - * The amount the client needs to pay to have the requested channel openend. + * Creates a copy of the SignedRawBolt11Invoice */ -void LSPS1Bolt11PaymentInfo_set_order_total_sat(struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKSignedRawBolt11Invoice SignedRawBolt11Invoice_clone(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR orig); /** - * A BOLT11 invoice the client can pay to have to channel opened. + * Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice. */ -struct LDKBolt11Invoice LSPS1Bolt11PaymentInfo_get_invoice(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr); +uint64_t SignedRawBolt11Invoice_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o); /** - * A BOLT11 invoice the client can pay to have to channel opened. + * Frees any resources used by the RawBolt11Invoice, if is_owned is set and inner is non-NULL. */ -void LSPS1Bolt11PaymentInfo_set_invoice(struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR this_ptr, struct LDKBolt11Invoice val); +void RawBolt11Invoice_free(struct LDKRawBolt11Invoice this_obj); /** - * Constructs a new LSPS1Bolt11PaymentInfo given each field + * data part */ -MUST_USE_RES struct LDKLSPS1Bolt11PaymentInfo LSPS1Bolt11PaymentInfo_new(enum LDKLSPS1PaymentState state_arg, struct LDKLSPSDateTime expires_at_arg, uint64_t fee_total_sat_arg, uint64_t order_total_sat_arg, struct LDKBolt11Invoice invoice_arg); +struct LDKRawDataPart RawBolt11Invoice_get_data(const struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr); /** - * Creates a copy of the LSPS1Bolt11PaymentInfo + * data part */ -struct LDKLSPS1Bolt11PaymentInfo LSPS1Bolt11PaymentInfo_clone(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR orig); +void RawBolt11Invoice_set_data(struct LDKRawBolt11Invoice *NONNULL_PTR this_ptr, struct LDKRawDataPart val); /** - * Checks if two LSPS1Bolt11PaymentInfos contain equal inner contents. + * Checks if two RawBolt11Invoices 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 LSPS1Bolt11PaymentInfo_eq(const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR a, const struct LDKLSPS1Bolt11PaymentInfo *NONNULL_PTR b); +bool RawBolt11Invoice_eq(const struct LDKRawBolt11Invoice *NONNULL_PTR a, const struct LDKRawBolt11Invoice *NONNULL_PTR b); /** - * Frees any resources used by the LSPS1OnchainPaymentInfo, if is_owned is set and inner is non-NULL. + * Creates a copy of the RawBolt11Invoice */ -void LSPS1OnchainPaymentInfo_free(struct LDKLSPS1OnchainPaymentInfo this_obj); +struct LDKRawBolt11Invoice RawBolt11Invoice_clone(const struct LDKRawBolt11Invoice *NONNULL_PTR orig); /** - * Indicates the current state of the payment. + * Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice. */ -enum LDKLSPS1PaymentState LSPS1OnchainPaymentInfo_get_state(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +uint64_t RawBolt11Invoice_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR o); /** - * Indicates the current state of the payment. + * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL. */ -void LSPS1OnchainPaymentInfo_set_state(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, enum LDKLSPS1PaymentState val); +void RawDataPart_free(struct LDKRawDataPart this_obj); /** - * The datetime when the payment option expires. + * generation time of the invoice */ -struct LDKLSPSDateTime LSPS1OnchainPaymentInfo_get_expires_at(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +struct LDKPositiveTimestamp RawDataPart_get_timestamp(const struct LDKRawDataPart *NONNULL_PTR this_ptr); /** - * The datetime when the payment option expires. + * generation time of the invoice */ -void LSPS1OnchainPaymentInfo_set_expires_at(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +void RawDataPart_set_timestamp(struct LDKRawDataPart *NONNULL_PTR this_ptr, struct LDKPositiveTimestamp val); /** - * The total fee the LSP will charge to open this channel in satoshi. + * Checks if two RawDataParts 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. */ -uint64_t LSPS1OnchainPaymentInfo_get_fee_total_sat(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDKRawDataPart *NONNULL_PTR b); /** - * The total fee the LSP will charge to open this channel in satoshi. + * Creates a copy of the RawDataPart */ -void LSPS1OnchainPaymentInfo_set_fee_total_sat(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, uint64_t val); +struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig); /** - * The amount the client needs to pay to have the requested channel openend. + * Generates a non-cryptographic 64-bit hash of the RawDataPart. */ -uint64_t LSPS1OnchainPaymentInfo_get_order_total_sat(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o); /** - * The amount the client needs to pay to have the requested channel openend. + * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL. */ -void LSPS1OnchainPaymentInfo_set_order_total_sat(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, uint64_t val); +void PositiveTimestamp_free(struct LDKPositiveTimestamp this_obj); /** - * An on-chain address the client can send [`Self::order_total_sat`] to to have the channel - * opened. + * Checks if two PositiveTimestamps 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. */ -struct LDKAddress LSPS1OnchainPaymentInfo_get_address(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, const struct LDKPositiveTimestamp *NONNULL_PTR b); /** - * An on-chain address the client can send [`Self::order_total_sat`] to to have the channel - * opened. + * Creates a copy of the PositiveTimestamp */ -void LSPS1OnchainPaymentInfo_set_address(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, struct LDKAddress val); +struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig); /** - * The minimum number of block confirmations that are required for the on-chain payment to be - * considered confirmed. + * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp. */ -struct LDKCOption_u16Z LSPS1OnchainPaymentInfo_get_min_onchain_payment_confirmations(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o); /** - * The minimum number of block confirmations that are required for the on-chain payment to be - * considered confirmed. + * Creates a copy of the SiPrefix */ -void LSPS1OnchainPaymentInfo_set_min_onchain_payment_confirmations(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); +enum LDKSiPrefix SiPrefix_clone(const enum LDKSiPrefix *NONNULL_PTR orig); /** - * The address where the LSP will send the funds if the order fails. + * Utility method to constructs a new Milli-variant SiPrefix */ -struct LDKCOption_AddressZ LSPS1OnchainPaymentInfo_get_refund_onchain_address(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr); +enum LDKSiPrefix SiPrefix_milli(void); /** - * The address where the LSP will send the funds if the order fails. + * Utility method to constructs a new Micro-variant SiPrefix */ -void LSPS1OnchainPaymentInfo_set_refund_onchain_address(struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR this_ptr, struct LDKCOption_AddressZ val); +enum LDKSiPrefix SiPrefix_micro(void); /** - * Creates a copy of the LSPS1OnchainPaymentInfo + * Utility method to constructs a new Nano-variant SiPrefix */ -struct LDKLSPS1OnchainPaymentInfo LSPS1OnchainPaymentInfo_clone(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR orig); +enum LDKSiPrefix SiPrefix_nano(void); /** - * Checks if two LSPS1OnchainPaymentInfos 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. + * Utility method to constructs a new Pico-variant SiPrefix */ -bool LSPS1OnchainPaymentInfo_eq(const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR a, const struct LDKLSPS1OnchainPaymentInfo *NONNULL_PTR b); +enum LDKSiPrefix SiPrefix_pico(void); /** - * Creates a copy of the LSPS1PaymentState + * Checks if two SiPrefixs contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -enum LDKLSPS1PaymentState LSPS1PaymentState_clone(const enum LDKLSPS1PaymentState *NONNULL_PTR orig); +bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b); /** - * Utility method to constructs a new ExpectPayment-variant LSPS1PaymentState + * Generates a non-cryptographic 64-bit hash of the SiPrefix. */ -enum LDKLSPS1PaymentState LSPS1PaymentState_expect_payment(void); +uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o); /** - * Utility method to constructs a new Paid-variant LSPS1PaymentState + * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix. + * This is effectively 10^12 * the prefix multiplier */ -enum LDKLSPS1PaymentState LSPS1PaymentState_paid(void); +MUST_USE_RES uint64_t SiPrefix_multiplier(const enum LDKSiPrefix *NONNULL_PTR this_arg); /** - * Utility method to constructs a new Refunded-variant LSPS1PaymentState + * Creates a copy of the Currency */ -enum LDKLSPS1PaymentState LSPS1PaymentState_refunded(void); +enum LDKCurrency Currency_clone(const enum LDKCurrency *NONNULL_PTR orig); /** - * Checks if two LSPS1PaymentStates contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Utility method to constructs a new Bitcoin-variant Currency */ -bool LSPS1PaymentState_eq(const enum LDKLSPS1PaymentState *NONNULL_PTR a, const enum LDKLSPS1PaymentState *NONNULL_PTR b); +enum LDKCurrency Currency_bitcoin(void); /** - * Frees any resources used by the LSPS1OnchainPayment, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new BitcoinTestnet-variant Currency */ -void LSPS1OnchainPayment_free(struct LDKLSPS1OnchainPayment this_obj); +enum LDKCurrency Currency_bitcoin_testnet(void); /** - * The outpoint of the payment. + * Utility method to constructs a new Regtest-variant Currency */ -struct LDKStr LSPS1OnchainPayment_get_outpoint(const struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr); +enum LDKCurrency Currency_regtest(void); /** - * The outpoint of the payment. + * Utility method to constructs a new Simnet-variant Currency */ -void LSPS1OnchainPayment_set_outpoint(struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr, struct LDKStr val); +enum LDKCurrency Currency_simnet(void); /** - * The amount of satoshi paid. + * Utility method to constructs a new Signet-variant Currency */ -uint64_t LSPS1OnchainPayment_get_sat(const struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr); +enum LDKCurrency Currency_signet(void); /** - * The amount of satoshi paid. + * Generates a non-cryptographic 64-bit hash of the Currency. */ -void LSPS1OnchainPayment_set_sat(struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr, uint64_t val); +uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o); /** - * Indicates if the LSP regards the transaction as sufficiently confirmed. + * Checks if two Currencys contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -bool LSPS1OnchainPayment_get_confirmed(const struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr); +bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b); /** - * Indicates if the LSP regards the transaction as sufficiently confirmed. + * Frees any resources used by the Sha256, if is_owned is set and inner is non-NULL. */ -void LSPS1OnchainPayment_set_confirmed(struct LDKLSPS1OnchainPayment *NONNULL_PTR this_ptr, bool val); +void Sha256_free(struct LDKSha256 this_obj); /** - * Constructs a new LSPS1OnchainPayment given each field + * Creates a copy of the Sha256 */ -MUST_USE_RES struct LDKLSPS1OnchainPayment LSPS1OnchainPayment_new(struct LDKStr outpoint_arg, uint64_t sat_arg, bool confirmed_arg); +struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig); /** - * Creates a copy of the LSPS1OnchainPayment + * Generates a non-cryptographic 64-bit hash of the Sha256. */ -struct LDKLSPS1OnchainPayment LSPS1OnchainPayment_clone(const struct LDKLSPS1OnchainPayment *NONNULL_PTR orig); +uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o); /** - * Checks if two LSPS1OnchainPayments contain equal inner contents. + * Checks if two Sha256s 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 LSPS1OnchainPayment_eq(const struct LDKLSPS1OnchainPayment *NONNULL_PTR a, const struct LDKLSPS1OnchainPayment *NONNULL_PTR b); +bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b); /** - * Frees any resources used by the LSPS1ChannelInfo, if is_owned is set and inner is non-NULL. + * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a + * single sha256 hash. */ -void LSPS1ChannelInfo_free(struct LDKLSPS1ChannelInfo this_obj); +MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]); /** - * The datetime when the funding transaction has been published. + * Frees any resources used by the Description, if is_owned is set and inner is non-NULL. */ -struct LDKLSPSDateTime LSPS1ChannelInfo_get_funded_at(const struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr); +void Description_free(struct LDKDescription this_obj); /** - * The datetime when the funding transaction has been published. + * Creates a copy of the Description */ -void LSPS1ChannelInfo_set_funded_at(struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig); /** - * The outpoint of the funding transaction. + * Generates a non-cryptographic 64-bit hash of the Description. */ -struct LDKOutPoint LSPS1ChannelInfo_get_funding_outpoint(const struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr); +uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o); /** - * The outpoint of the funding transaction. + * Checks if two Descriptions 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. */ -void LSPS1ChannelInfo_set_funding_outpoint(struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr, struct LDKOutPoint val); +bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b); /** - * The earliest datetime when the channel may be closed by the LSP. + * Frees any resources used by the PayeePubKey, if is_owned is set and inner is non-NULL. */ -struct LDKLSPSDateTime LSPS1ChannelInfo_get_expires_at(const struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr); +void PayeePubKey_free(struct LDKPayeePubKey this_obj); -/** - * The earliest datetime when the channel may be closed by the LSP. - */ -void LSPS1ChannelInfo_set_expires_at(struct LDKLSPS1ChannelInfo *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +struct LDKPublicKey PayeePubKey_get_a(const struct LDKPayeePubKey *NONNULL_PTR this_ptr); -/** - * Constructs a new LSPS1ChannelInfo given each field - */ -MUST_USE_RES struct LDKLSPS1ChannelInfo LSPS1ChannelInfo_new(struct LDKLSPSDateTime funded_at_arg, struct LDKOutPoint funding_outpoint_arg, struct LDKLSPSDateTime expires_at_arg); +void PayeePubKey_set_a(struct LDKPayeePubKey *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Creates a copy of the LSPS1ChannelInfo + * Constructs a new PayeePubKey given each field */ -struct LDKLSPS1ChannelInfo LSPS1ChannelInfo_clone(const struct LDKLSPS1ChannelInfo *NONNULL_PTR orig); +MUST_USE_RES struct LDKPayeePubKey PayeePubKey_new(struct LDKPublicKey a_arg); /** - * Checks if two LSPS1ChannelInfos 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. + * Creates a copy of the PayeePubKey */ -bool LSPS1ChannelInfo_eq(const struct LDKLSPS1ChannelInfo *NONNULL_PTR a, const struct LDKLSPS1ChannelInfo *NONNULL_PTR b); +struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig); /** - * Frees any resources used by the LSPS1GetOrderRequest, if is_owned is set and inner is non-NULL. + * Generates a non-cryptographic 64-bit hash of the PayeePubKey. */ -void LSPS1GetOrderRequest_free(struct LDKLSPS1GetOrderRequest this_obj); +uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o); /** - * The id of the order. + * Checks if two PayeePubKeys 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. */ -struct LDKLSPS1OrderId LSPS1GetOrderRequest_get_order_id(const struct LDKLSPS1GetOrderRequest *NONNULL_PTR this_ptr); +bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b); /** - * The id of the order. + * Frees any resources used by the ExpiryTime, if is_owned is set and inner is non-NULL. */ -void LSPS1GetOrderRequest_set_order_id(struct LDKLSPS1GetOrderRequest *NONNULL_PTR this_ptr, struct LDKLSPS1OrderId val); +void ExpiryTime_free(struct LDKExpiryTime this_obj); /** - * Constructs a new LSPS1GetOrderRequest given each field + * Creates a copy of the ExpiryTime */ -MUST_USE_RES struct LDKLSPS1GetOrderRequest LSPS1GetOrderRequest_new(struct LDKLSPS1OrderId order_id_arg); +struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig); /** - * Creates a copy of the LSPS1GetOrderRequest + * Generates a non-cryptographic 64-bit hash of the ExpiryTime. */ -struct LDKLSPS1GetOrderRequest LSPS1GetOrderRequest_clone(const struct LDKLSPS1GetOrderRequest *NONNULL_PTR orig); +uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o); /** - * Checks if two LSPS1GetOrderRequests contain equal inner contents. + * Checks if two ExpiryTimes 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 LSPS1GetOrderRequest_eq(const struct LDKLSPS1GetOrderRequest *NONNULL_PTR a, const struct LDKLSPS1GetOrderRequest *NONNULL_PTR b); +bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b); /** - * Frees any resources used by the LSPS1Request + * Frees any resources used by the MinFinalCltvExpiryDelta, if is_owned is set and inner is non-NULL. */ -void LSPS1Request_free(struct LDKLSPS1Request this_ptr); +void MinFinalCltvExpiryDelta_free(struct LDKMinFinalCltvExpiryDelta this_obj); -/** - * Creates a copy of the LSPS1Request - */ -struct LDKLSPS1Request LSPS1Request_clone(const struct LDKLSPS1Request *NONNULL_PTR orig); +uint64_t MinFinalCltvExpiryDelta_get_a(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr); + +void MinFinalCltvExpiryDelta_set_a(struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR this_ptr, uint64_t val); /** - * Utility method to constructs a new GetInfo-variant LSPS1Request + * Constructs a new MinFinalCltvExpiryDelta given each field */ -struct LDKLSPS1Request LSPS1Request_get_info(struct LDKLSPS1GetInfoRequest a); +MUST_USE_RES struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_new(uint64_t a_arg); /** - * Utility method to constructs a new CreateOrder-variant LSPS1Request + * Creates a copy of the MinFinalCltvExpiryDelta */ -struct LDKLSPS1Request LSPS1Request_create_order(struct LDKLSPS1CreateOrderRequest a); +struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig); /** - * Utility method to constructs a new GetOrder-variant LSPS1Request + * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta. */ -struct LDKLSPS1Request LSPS1Request_get_order(struct LDKLSPS1GetOrderRequest a); +uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o); /** - * Checks if two LSPS1Requests contain equal inner contents. + * Checks if two MinFinalCltvExpiryDeltas 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 LSPS1Request_eq(const struct LDKLSPS1Request *NONNULL_PTR a, const struct LDKLSPS1Request *NONNULL_PTR b); +bool MinFinalCltvExpiryDelta_eq(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR a, const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR b); /** - * Frees any resources used by the LSPS1Response + * Frees any resources used by the Fallback */ -void LSPS1Response_free(struct LDKLSPS1Response this_ptr); +void Fallback_free(struct LDKFallback this_ptr); /** - * Creates a copy of the LSPS1Response + * Creates a copy of the Fallback */ -struct LDKLSPS1Response LSPS1Response_clone(const struct LDKLSPS1Response *NONNULL_PTR orig); +struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig); /** - * Utility method to constructs a new GetInfo-variant LSPS1Response + * Utility method to constructs a new SegWitProgram-variant Fallback */ -struct LDKLSPS1Response LSPS1Response_get_info(struct LDKLSPS1GetInfoResponse a); +struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program); /** - * Utility method to constructs a new GetInfoError-variant LSPS1Response + * Utility method to constructs a new PubKeyHash-variant Fallback */ -struct LDKLSPS1Response LSPS1Response_get_info_error(struct LDKLSPSResponseError a); +struct LDKFallback Fallback_pub_key_hash(struct LDKTwentyBytes a); /** - * Utility method to constructs a new CreateOrder-variant LSPS1Response + * Utility method to constructs a new ScriptHash-variant Fallback */ -struct LDKLSPS1Response LSPS1Response_create_order(struct LDKLSPS1CreateOrderResponse a); +struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a); /** - * Utility method to constructs a new CreateOrderError-variant LSPS1Response + * Generates a non-cryptographic 64-bit hash of the Fallback. */ -struct LDKLSPS1Response LSPS1Response_create_order_error(struct LDKLSPSResponseError a); +uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o); /** - * Utility method to constructs a new GetOrder-variant LSPS1Response + * Checks if two Fallbacks contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKLSPS1Response LSPS1Response_get_order(struct LDKLSPS1CreateOrderResponse a); +bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b); /** - * Utility method to constructs a new GetOrderError-variant LSPS1Response + * Frees any resources used by the Bolt11InvoiceSignature, if is_owned is set and inner is non-NULL. */ -struct LDKLSPS1Response LSPS1Response_get_order_error(struct LDKLSPSResponseError a); +void Bolt11InvoiceSignature_free(struct LDKBolt11InvoiceSignature this_obj); -/** - * Checks if two LSPS1Responses contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool LSPS1Response_eq(const struct LDKLSPS1Response *NONNULL_PTR a, const struct LDKLSPS1Response *NONNULL_PTR b); +struct LDKRecoverableSignature Bolt11InvoiceSignature_get_a(const struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr); -/** - * Frees any resources used by the LSPS1Message - */ -void LSPS1Message_free(struct LDKLSPS1Message this_ptr); +void Bolt11InvoiceSignature_set_a(struct LDKBolt11InvoiceSignature *NONNULL_PTR this_ptr, struct LDKRecoverableSignature val); /** - * Creates a copy of the LSPS1Message + * Constructs a new Bolt11InvoiceSignature given each field */ -struct LDKLSPS1Message LSPS1Message_clone(const struct LDKLSPS1Message *NONNULL_PTR orig); +MUST_USE_RES struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_new(struct LDKRecoverableSignature a_arg); /** - * Utility method to constructs a new Request-variant LSPS1Message + * Creates a copy of the Bolt11InvoiceSignature */ -struct LDKLSPS1Message LSPS1Message_request(struct LDKLSPSRequestId a, struct LDKLSPS1Request b); +struct LDKBolt11InvoiceSignature Bolt11InvoiceSignature_clone(const struct LDKBolt11InvoiceSignature *NONNULL_PTR orig); /** - * Utility method to constructs a new Response-variant LSPS1Message + * Generates a non-cryptographic 64-bit hash of the Bolt11InvoiceSignature. */ -struct LDKLSPS1Message LSPS1Message_response(struct LDKLSPSRequestId a, struct LDKLSPS1Response b); +uint64_t Bolt11InvoiceSignature_hash(const struct LDKBolt11InvoiceSignature *NONNULL_PTR o); /** - * Checks if two LSPS1Messages contain equal inner contents. + * Checks if two Bolt11InvoiceSignatures 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 LSPS1Message_eq(const struct LDKLSPS1Message *NONNULL_PTR a, const struct LDKLSPS1Message *NONNULL_PTR b); +bool Bolt11InvoiceSignature_eq(const struct LDKBolt11InvoiceSignature *NONNULL_PTR a, const struct LDKBolt11InvoiceSignature *NONNULL_PTR b); /** - * Frees any resources used by the LSPS2ClientConfig, if is_owned is set and inner is non-NULL. + * Frees any resources used by the PrivateRoute, if is_owned is set and inner is non-NULL. */ -void LSPS2ClientConfig_free(struct LDKLSPS2ClientConfig this_obj); +void PrivateRoute_free(struct LDKPrivateRoute this_obj); /** - * Constructs a new LSPS2ClientConfig given each field + * Creates a copy of the PrivateRoute */ -MUST_USE_RES struct LDKLSPS2ClientConfig LSPS2ClientConfig_new(void); +struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig); /** - * Creates a copy of the LSPS2ClientConfig + * Generates a non-cryptographic 64-bit hash of the PrivateRoute. */ -struct LDKLSPS2ClientConfig LSPS2ClientConfig_clone(const struct LDKLSPS2ClientConfig *NONNULL_PTR orig); +uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o); /** - * Frees any resources used by the LSPS2ClientHandler, if is_owned is set and inner is non-NULL. + * Checks if two PrivateRoutes 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. */ -void LSPS2ClientHandler_free(struct LDKLSPS2ClientHandler this_obj); +bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b); /** - * Request the channel opening parameters from the LSP. - * - * This initiates the JIT-channel flow that, at the end of it, will have the LSP - * open a channel with sufficient inbound liquidity to be able to receive the payment. - * - * The user will receive the LSP's response via an [`OpeningParametersReady`] event. - * - * `counterparty_node_id` is the `node_id` of the LSP you would like to use. - * - * `token` is an optional `String` that will be provided to the LSP. - * It can be used by the LSP as an API key, coupon code, or some other way to identify a user. - * - * Returns the used [`LSPSRequestId`], which will be returned via [`OpeningParametersReady`]. - * - * [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady + * Disassembles the `SignedRawBolt11Invoice` into its three parts: + * 1. raw invoice + * 2. hash of the raw invoice + * 3. signature */ -MUST_USE_RES struct LDKLSPSRequestId LSPS2ClientHandler_request_opening_params(const struct LDKLSPS2ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCOption_StrZ token); +MUST_USE_RES struct LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ SignedRawBolt11Invoice_into_parts(struct LDKSignedRawBolt11Invoice this_arg); /** - * Confirms a set of chosen channel opening parameters to use for the JIT channel and - * requests the necessary invoice generation parameters from the LSP. - * - * Should be called in response to receiving a [`OpeningParametersReady`] event. - * - * The user will receive the LSP's response via an [`InvoiceParametersReady`] event. - * - * If `payment_size_msat` is [`Option::Some`] then the invoice will be for a fixed amount - * and MPP can be used to pay it. - * - * If `payment_size_msat` is [`Option::None`] then the invoice can be for an arbitrary amount - * but MPP can no longer be used to pay it. - * - * The client agrees to paying an opening fee equal to - * `max(min_fee_msat, proportional*(payment_size_msat/1_000_000))`. - * - * [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady - * [`InvoiceParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::InvoiceParametersReady + * The [`RawBolt11Invoice`] which was signed. */ -MUST_USE_RES struct LDKCResult_LSPSRequestIdAPIErrorZ LSPS2ClientHandler_select_opening_params(const struct LDKLSPS2ClientHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z payment_size_msat, struct LDKLSPS2OpeningFeeParams opening_fee_params); +MUST_USE_RES struct LDKRawBolt11Invoice SignedRawBolt11Invoice_raw_invoice(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS2ClientEvent + * The hash of the [`RawBolt11Invoice`] that was signed. */ -void LSPS2ClientEvent_free(struct LDKLSPS2ClientEvent this_ptr); +MUST_USE_RES const uint8_t (*SignedRawBolt11Invoice_signable_hash(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg))[32]; /** - * Creates a copy of the LSPS2ClientEvent + * Signature for the invoice. */ -struct LDKLSPS2ClientEvent LSPS2ClientEvent_clone(const struct LDKLSPS2ClientEvent *NONNULL_PTR orig); +MUST_USE_RES struct LDKBolt11InvoiceSignature SignedRawBolt11Invoice_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OpeningParametersReady-variant LSPS2ClientEvent + * Recovers the public key used for signing the invoice from the recoverable signature. */ -struct LDKLSPS2ClientEvent LSPS2ClientEvent_opening_parameters_ready(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKCVec_LSPS2OpeningFeeParamsZ opening_fee_params_menu); +MUST_USE_RES struct LDKCResult_PayeePubKeySecp256k1ErrorZ SignedRawBolt11Invoice_recover_payee_pub_key(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new InvoiceParametersReady-variant LSPS2ClientEvent + * Checks if the signature is valid for the included payee public key or if none exists if it's + * possible to recover the public key from the signature. */ -struct LDKLSPS2ClientEvent LSPS2ClientEvent_invoice_parameters_ready(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, uint64_t intercept_scid, uint32_t cltv_expiry_delta, struct LDKCOption_u64Z payment_size_msat); +MUST_USE_RES bool SignedRawBolt11Invoice_check_signature(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Checks if two LSPS2ClientEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Calculate the hash of the encoded `RawBolt11Invoice` which should be signed. */ -bool LSPS2ClientEvent_eq(const struct LDKLSPS2ClientEvent *NONNULL_PTR a, const struct LDKLSPS2ClientEvent *NONNULL_PTR b); +MUST_USE_RES struct LDKThirtyTwoBytes RawBolt11Invoice_signable_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS2ServiceEvent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void LSPS2ServiceEvent_free(struct LDKLSPS2ServiceEvent this_ptr); +MUST_USE_RES struct LDKSha256 RawBolt11Invoice_payment_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Creates a copy of the LSPS2ServiceEvent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKLSPS2ServiceEvent LSPS2ServiceEvent_clone(const struct LDKLSPS2ServiceEvent *NONNULL_PTR orig); +MUST_USE_RES struct LDKDescription RawBolt11Invoice_description(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new GetInfo-variant LSPS2ServiceEvent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKLSPS2ServiceEvent LSPS2ServiceEvent_get_info(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKCOption_StrZ token); +MUST_USE_RES struct LDKPayeePubKey RawBolt11Invoice_payee_pub_key(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new BuyRequest-variant LSPS2ServiceEvent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKLSPS2ServiceEvent LSPS2ServiceEvent_buy_request(struct LDKLSPSRequestId request_id, struct LDKPublicKey counterparty_node_id, struct LDKLSPS2OpeningFeeParams opening_fee_params, struct LDKCOption_u64Z payment_size_msat); +MUST_USE_RES struct LDKSha256 RawBolt11Invoice_description_hash(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Utility method to constructs a new OpenChannel-variant LSPS2ServiceEvent + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKLSPS2ServiceEvent LSPS2ServiceEvent_open_channel(struct LDKPublicKey their_network_key, uint64_t amt_to_forward_msat, uint64_t opening_fee_msat, struct LDKU128 user_channel_id, uint64_t intercept_scid); +MUST_USE_RES struct LDKExpiryTime RawBolt11Invoice_expiry_time(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Checks if two LSPS2ServiceEvents contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -bool LSPS2ServiceEvent_eq(const struct LDKLSPS2ServiceEvent *NONNULL_PTR a, const struct LDKLSPS2ServiceEvent *NONNULL_PTR b); +MUST_USE_RES struct LDKMinFinalCltvExpiryDelta RawBolt11Invoice_min_final_cltv_expiry_delta(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); -/** - * Frees any resources used by the LSPS2GetInfoRequest, if is_owned is set and inner is non-NULL. - */ -void LSPS2GetInfoRequest_free(struct LDKLSPS2GetInfoRequest this_obj); +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); /** - * An optional token to provide to the LSP. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCOption_StrZ LSPS2GetInfoRequest_get_token(const struct LDKLSPS2GetInfoRequest *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBolt11InvoiceFeatures RawBolt11Invoice_features(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); + +MUST_USE_RES struct LDKCVec_PrivateRouteZ RawBolt11Invoice_private_routes(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * An optional token to provide to the LSP. + * Returns `None` if no amount is set or on overflow. */ -void LSPS2GetInfoRequest_set_token(struct LDKLSPS2GetInfoRequest *NONNULL_PTR this_ptr, struct LDKCOption_StrZ val); +MUST_USE_RES struct LDKCOption_u64Z RawBolt11Invoice_amount_pico_btc(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); + +MUST_USE_RES enum LDKCurrency RawBolt11Invoice_currency(const struct LDKRawBolt11Invoice *NONNULL_PTR this_arg); /** - * Constructs a new LSPS2GetInfoRequest given each field + * Creates a `PositiveTimestamp` from a Unix timestamp in the range `0..=MAX_TIMESTAMP`. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. */ -MUST_USE_RES struct LDKLSPS2GetInfoRequest LSPS2GetInfoRequest_new(struct LDKCOption_StrZ token_arg); +MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_unix_timestamp(uint64_t unix_seconds); /** - * Creates a copy of the LSPS2GetInfoRequest + * Creates a `PositiveTimestamp` from a [`SystemTime`] with a corresponding Unix timestamp in + * the range `0..=MAX_TIMESTAMP`. + * + * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. */ -struct LDKLSPS2GetInfoRequest LSPS2GetInfoRequest_clone(const struct LDKLSPS2GetInfoRequest *NONNULL_PTR orig); +MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_system_time(uint64_t time); /** - * Checks if two LSPS2GetInfoRequests 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. + * Creates a `PositiveTimestamp` from a [`Duration`] since the Unix epoch in the range + * `0..=MAX_TIMESTAMP`. + * + * Note that the subsecond part is dropped as it is not representable in BOLT 11 invoices. + * + * Otherwise, returns a [`CreationError::TimestampOutOfBounds`]. */ -bool LSPS2GetInfoRequest_eq(const struct LDKLSPS2GetInfoRequest *NONNULL_PTR a, const struct LDKLSPS2GetInfoRequest *NONNULL_PTR b); +MUST_USE_RES struct LDKCResult_PositiveTimestampCreationErrorZ PositiveTimestamp_from_duration_since_epoch(uint64_t duration); /** - * Frees any resources used by the LSPS2RawOpeningFeeParams, if is_owned is set and inner is non-NULL. + * Returns the Unix timestamp representing the stored time */ -void LSPS2RawOpeningFeeParams_free(struct LDKLSPS2RawOpeningFeeParams this_obj); +MUST_USE_RES uint64_t PositiveTimestamp_as_unix_timestamp(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); /** - * The minimum fee required for the channel open. + * Returns the duration of the stored time since the Unix epoch */ -uint64_t LSPS2RawOpeningFeeParams_get_min_fee_msat(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t PositiveTimestamp_as_duration_since_epoch(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); /** - * The minimum fee required for the channel open. + * Returns the [`SystemTime`] representing the stored time */ -void LSPS2RawOpeningFeeParams_set_min_fee_msat(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg); /** - * A fee proportional to the size of the initial payment. + * The hash of the [`RawBolt11Invoice`] that was signed. */ -uint32_t LSPS2RawOpeningFeeParams_get_proportional(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKThirtyTwoBytes Bolt11Invoice_signable_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * A fee proportional to the size of the initial payment. + * Transform the `Bolt11Invoice` into its unchecked version. */ -void LSPS2RawOpeningFeeParams_set_proportional(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKSignedRawBolt11Invoice Bolt11Invoice_into_signed_raw(struct LDKBolt11Invoice this_arg); /** - * An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. + * Check that the invoice is signed correctly */ -struct LDKLSPSDateTime LSPS2RawOpeningFeeParams_get_valid_until(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_NoneBolt11SemanticErrorZ Bolt11Invoice_check_signature(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. + * Constructs a `Bolt11Invoice` from a [`SignedRawBolt11Invoice`] by checking all its invariants. + * ``` + * use lightning_invoice::*; + * + * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\ + * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\ + * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\ + * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\ + * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\ + * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\ + * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\ + * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\ + * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\ + * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\ + * j5r6drg6k6zcqj0fcwg\"; + * + * let signed = invoice.parse::().unwrap(); + * + * assert!(Bolt11Invoice::from_signed(signed).is_ok()); + * ``` */ -void LSPS2RawOpeningFeeParams_set_valid_until(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +MUST_USE_RES struct LDKCResult_Bolt11InvoiceBolt11SemanticErrorZ Bolt11Invoice_from_signed(struct LDKSignedRawBolt11Invoice signed_invoice); /** - * The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. + * Returns the `Bolt11Invoice`'s timestamp (should equal its creation time) */ -uint32_t LSPS2RawOpeningFeeParams_get_min_lifetime(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t Bolt11Invoice_timestamp(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. + * Returns the `Bolt11Invoice`'s timestamp as a duration since the Unix epoch */ -void LSPS2RawOpeningFeeParams_set_min_lifetime(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES uint64_t Bolt11Invoice_duration_since_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. + * Returns the hash to which we will receive the preimage on completion of the payment */ -uint32_t LSPS2RawOpeningFeeParams_get_max_client_to_self_delay(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_hash(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32]; /** - * The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. + * Get the payee's public key if one was included in the invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void LSPS2RawOpeningFeeParams_set_max_client_to_self_delay(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKPublicKey Bolt11Invoice_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The minimum payment size that the LSP will accept when opening a channel. + * Get the payment secret if one was included in the invoice */ -uint64_t LSPS2RawOpeningFeeParams_get_min_payment_size_msat(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES const uint8_t (*Bolt11Invoice_payment_secret(const struct LDKBolt11Invoice *NONNULL_PTR this_arg))[32]; /** - * The minimum payment size that the LSP will accept when opening a channel. + * Get the payment metadata blob if one was included in the invoice */ -void LSPS2RawOpeningFeeParams_set_min_payment_size_msat(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_CVec_u8ZZ Bolt11Invoice_payment_metadata(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum payment size that the LSP will accept when opening a channel. + * Get the invoice features if they were included in the invoice + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -uint64_t LSPS2RawOpeningFeeParams_get_max_payment_size_msat(const struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKBolt11InvoiceFeatures Bolt11Invoice_features(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum payment size that the LSP will accept when opening a channel. + * Recover the payee's public key (only to be used if none was included in the invoice) */ -void LSPS2RawOpeningFeeParams_set_max_payment_size_msat(struct LDKLSPS2RawOpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKPublicKey Bolt11Invoice_recover_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * Constructs a new LSPS2RawOpeningFeeParams given each field + * Recover the payee's public key if one was included in the invoice, otherwise return the + * recovered public key from the signature */ -MUST_USE_RES struct LDKLSPS2RawOpeningFeeParams LSPS2RawOpeningFeeParams_new(uint64_t min_fee_msat_arg, uint32_t proportional_arg, struct LDKLSPSDateTime valid_until_arg, uint32_t min_lifetime_arg, uint32_t max_client_to_self_delay_arg, uint64_t min_payment_size_msat_arg, uint64_t max_payment_size_msat_arg); +MUST_USE_RES struct LDKPublicKey Bolt11Invoice_get_payee_pub_key(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * Frees any resources used by the LSPS2OpeningFeeParams, if is_owned is set and inner is non-NULL. + * Returns the Duration since the Unix epoch at which the invoice expires. + * Returning None if overflow occurred. */ -void LSPS2OpeningFeeParams_free(struct LDKLSPS2OpeningFeeParams this_obj); +MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_expires_at(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The minimum fee required for the channel open. + * Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`]. */ -uint64_t LSPS2OpeningFeeParams_get_min_fee_msat(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t Bolt11Invoice_expiry_time(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The minimum fee required for the channel open. + * Returns whether the invoice has expired. */ -void LSPS2OpeningFeeParams_set_min_fee_msat(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES bool Bolt11Invoice_is_expired(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * A fee proportional to the size of the initial payment. + * Returns the Duration remaining until the invoice expires. */ -uint32_t LSPS2OpeningFeeParams_get_proportional(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t Bolt11Invoice_duration_until_expiry(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * A fee proportional to the size of the initial payment. + * Returns the Duration remaining until the invoice expires given the current time. + * `time` is the timestamp as a duration since the Unix epoch. */ -void LSPS2OpeningFeeParams_set_proportional(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES uint64_t Bolt11Invoice_expiration_remaining_from_epoch(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t time); /** - * An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. + * Returns whether the expiry time would pass at the given point in time. + * `at_time` is the timestamp as a duration since the Unix epoch. */ -struct LDKLSPSDateTime LSPS2OpeningFeeParams_get_valid_until(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES bool Bolt11Invoice_would_expire(const struct LDKBolt11Invoice *NONNULL_PTR this_arg, uint64_t at_time); /** - * An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. + * Returns the invoice's `min_final_cltv_expiry_delta` time, if present, otherwise + * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA`]. */ -void LSPS2OpeningFeeParams_set_valid_until(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, struct LDKLSPSDateTime val); +MUST_USE_RES uint64_t Bolt11Invoice_min_final_cltv_expiry_delta(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. + * Returns a list of all fallback addresses as [`Address`]es */ -uint32_t LSPS2OpeningFeeParams_get_min_lifetime(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_AddressZ Bolt11Invoice_fallback_addresses(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. + * Returns the first fallback address as an [`Address`]. + * + * See [`Self::fallback_addresses`] to fetch all addresses of known type. */ -void LSPS2OpeningFeeParams_set_min_lifetime(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCOption_AddressZ Bolt11Invoice_first_fallback_address(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. + * Returns a list of all routes included in the invoice */ -uint32_t LSPS2OpeningFeeParams_get_max_client_to_self_delay(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCVec_PrivateRouteZ Bolt11Invoice_private_routes(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. + * Returns a list of all routes included in the invoice as the underlying hints */ -void LSPS2OpeningFeeParams_set_max_client_to_self_delay(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint32_t val); +MUST_USE_RES struct LDKCVec_RouteHintZ Bolt11Invoice_route_hints(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The minimum payment size that the LSP will accept when opening a channel. + * Returns the currency for which the invoice was issued */ -uint64_t LSPS2OpeningFeeParams_get_min_payment_size_msat(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES enum LDKCurrency Bolt11Invoice_currency(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The minimum payment size that the LSP will accept when opening a channel. + * Returns the amount if specified in the invoice as millisatoshis. */ -void LSPS2OpeningFeeParams_set_min_payment_size_msat(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const struct LDKBolt11Invoice *NONNULL_PTR this_arg); /** - * The maximum payment size that the LSP will accept when opening a channel. + * Creates a new `Description` if `description` is at most 1023 * 5 bits (i.e., 639 bytes) + * long, and returns [`CreationError::DescriptionTooLong`] otherwise. + * + * Please note that single characters may use more than one byte due to UTF8 encoding. */ -uint64_t LSPS2OpeningFeeParams_get_max_payment_size_msat(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description); /** - * The maximum payment size that the LSP will accept when opening a channel. + * Creates an empty `Description`. */ -void LSPS2OpeningFeeParams_set_max_payment_size_msat(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, uint64_t val); +MUST_USE_RES struct LDKDescription Description_empty(void); /** - * The HMAC used to verify the authenticity of these parameters. + * Returns the underlying description [`UntrustedString`] */ -struct LDKStr LSPS2OpeningFeeParams_get_promise(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKUntrustedString Description_into_inner(struct LDKDescription this_arg); /** - * The HMAC used to verify the authenticity of these parameters. + * Get a reference to the underlying description [`UntrustedString`] */ -void LSPS2OpeningFeeParams_set_promise(struct LDKLSPS2OpeningFeeParams *NONNULL_PTR this_ptr, struct LDKStr val); +MUST_USE_RES struct LDKUntrustedString Description_as_inner(const struct LDKDescription *NONNULL_PTR this_arg); /** - * Constructs a new LSPS2OpeningFeeParams given each field + * Get the string representation of a Description object */ -MUST_USE_RES struct LDKLSPS2OpeningFeeParams LSPS2OpeningFeeParams_new(uint64_t min_fee_msat_arg, uint32_t proportional_arg, struct LDKLSPSDateTime valid_until_arg, uint32_t min_lifetime_arg, uint32_t max_client_to_self_delay_arg, uint64_t min_payment_size_msat_arg, uint64_t max_payment_size_msat_arg, struct LDKStr promise_arg); +struct LDKStr Description_to_str(const struct LDKDescription *NONNULL_PTR o); /** - * Creates a copy of the LSPS2OpeningFeeParams + * Build a PayeePubKey from a PublicKey */ -struct LDKLSPS2OpeningFeeParams LSPS2OpeningFeeParams_clone(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR orig); +struct LDKPayeePubKey PayeePubKey_from_PublicKey(struct LDKPublicKey f); /** - * Checks if two LSPS2OpeningFeeParamss 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. + * Construct an `ExpiryTime` from seconds. */ -bool LSPS2OpeningFeeParams_eq(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR a, const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR b); +MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds); /** - * Frees any resources used by the LSPS2GetInfoResponse, if is_owned is set and inner is non-NULL. + * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part. */ -void LSPS2GetInfoResponse_free(struct LDKLSPS2GetInfoResponse this_obj); +MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration); /** - * A set of opening fee parameters. + * Returns the expiry time in seconds */ -struct LDKCVec_LSPS2OpeningFeeParamsZ LSPS2GetInfoResponse_get_opening_fee_params_menu(const struct LDKLSPS2GetInfoResponse *NONNULL_PTR this_ptr); +MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg); /** - * A set of opening fee parameters. + * Returns a reference to the underlying [`Duration`] (=expiry time) */ -void LSPS2GetInfoResponse_set_opening_fee_params_menu(struct LDKLSPS2GetInfoResponse *NONNULL_PTR this_ptr, struct LDKCVec_LSPS2OpeningFeeParamsZ val); +MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg); /** - * Constructs a new LSPS2GetInfoResponse given each field + * Creates a new (partial) route from a list of hops */ -MUST_USE_RES struct LDKLSPS2GetInfoResponse LSPS2GetInfoResponse_new(struct LDKCVec_LSPS2OpeningFeeParamsZ opening_fee_params_menu_arg); +MUST_USE_RES struct LDKCResult_PrivateRouteCreationErrorZ PrivateRoute_new(struct LDKRouteHint hops); /** - * Creates a copy of the LSPS2GetInfoResponse + * Returns the underlying list of hops */ -struct LDKLSPS2GetInfoResponse LSPS2GetInfoResponse_clone(const struct LDKLSPS2GetInfoResponse *NONNULL_PTR orig); +MUST_USE_RES struct LDKRouteHint PrivateRoute_into_inner(struct LDKPrivateRoute this_arg); /** - * Checks if two LSPS2GetInfoResponses 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. + * Build a RouteHint from a PrivateRoute */ -bool LSPS2GetInfoResponse_eq(const struct LDKLSPS2GetInfoResponse *NONNULL_PTR a, const struct LDKLSPS2GetInfoResponse *NONNULL_PTR b); +struct LDKRouteHint RouteHint_from_PrivateRoute(struct LDKPrivateRoute f); /** - * Frees any resources used by the LSPS2BuyRequest, if is_owned is set and inner is non-NULL. + * Creates a copy of the CreationError */ -void LSPS2BuyRequest_free(struct LDKLSPS2BuyRequest this_obj); +enum LDKCreationError CreationError_clone(const enum LDKCreationError *NONNULL_PTR orig); /** - * The fee parameters you would like to use. + * Utility method to constructs a new DescriptionTooLong-variant CreationError */ -struct LDKLSPS2OpeningFeeParams LSPS2BuyRequest_get_opening_fee_params(const struct LDKLSPS2BuyRequest *NONNULL_PTR this_ptr); +enum LDKCreationError CreationError_description_too_long(void); /** - * The fee parameters you would like to use. + * Utility method to constructs a new RouteTooLong-variant CreationError */ -void LSPS2BuyRequest_set_opening_fee_params(struct LDKLSPS2BuyRequest *NONNULL_PTR this_ptr, struct LDKLSPS2OpeningFeeParams val); +enum LDKCreationError CreationError_route_too_long(void); /** - * The size of the initial payment you expect to receive. + * Utility method to constructs a new TimestampOutOfBounds-variant CreationError */ -struct LDKCOption_u64Z LSPS2BuyRequest_get_payment_size_msat(const struct LDKLSPS2BuyRequest *NONNULL_PTR this_ptr); +enum LDKCreationError CreationError_timestamp_out_of_bounds(void); /** - * The size of the initial payment you expect to receive. + * Utility method to constructs a new InvalidAmount-variant CreationError */ -void LSPS2BuyRequest_set_payment_size_msat(struct LDKLSPS2BuyRequest *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +enum LDKCreationError CreationError_invalid_amount(void); /** - * Constructs a new LSPS2BuyRequest given each field + * Utility method to constructs a new MissingRouteHints-variant CreationError */ -MUST_USE_RES struct LDKLSPS2BuyRequest LSPS2BuyRequest_new(struct LDKLSPS2OpeningFeeParams opening_fee_params_arg, struct LDKCOption_u64Z payment_size_msat_arg); +enum LDKCreationError CreationError_missing_route_hints(void); /** - * Creates a copy of the LSPS2BuyRequest + * Utility method to constructs a new MinFinalCltvExpiryDeltaTooShort-variant CreationError */ -struct LDKLSPS2BuyRequest LSPS2BuyRequest_clone(const struct LDKLSPS2BuyRequest *NONNULL_PTR orig); +enum LDKCreationError CreationError_min_final_cltv_expiry_delta_too_short(void); /** - * Checks if two LSPS2BuyRequests contain equal inner contents. + * Checks if two CreationErrors 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 LSPS2BuyRequest_eq(const struct LDKLSPS2BuyRequest *NONNULL_PTR a, const struct LDKLSPS2BuyRequest *NONNULL_PTR b); +bool CreationError_eq(const enum LDKCreationError *NONNULL_PTR a, const enum LDKCreationError *NONNULL_PTR b); /** - * Frees any resources used by the LSPS2InterceptScid, if is_owned is set and inner is non-NULL. + * Get the string representation of a CreationError object */ -void LSPS2InterceptScid_free(struct LDKLSPS2InterceptScid this_obj); +struct LDKStr CreationError_to_str(const enum LDKCreationError *NONNULL_PTR o); /** - * Creates a copy of the LSPS2InterceptScid + * Creates a copy of the Bolt11SemanticError */ -struct LDKLSPS2InterceptScid LSPS2InterceptScid_clone(const struct LDKLSPS2InterceptScid *NONNULL_PTR orig); +enum LDKBolt11SemanticError Bolt11SemanticError_clone(const enum LDKBolt11SemanticError *NONNULL_PTR orig); /** - * Checks if two LSPS2InterceptScids 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. + * Utility method to constructs a new NoPaymentHash-variant Bolt11SemanticError */ -bool LSPS2InterceptScid_eq(const struct LDKLSPS2InterceptScid *NONNULL_PTR a, const struct LDKLSPS2InterceptScid *NONNULL_PTR b); +enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_hash(void); /** - * Try to convert a [`LSPS2InterceptScid`] into a u64 used by LDK. + * Utility method to constructs a new MultiplePaymentHashes-variant Bolt11SemanticError */ -MUST_USE_RES struct LDKCResult_u64NoneZ LSPS2InterceptScid_to_scid(const struct LDKLSPS2InterceptScid *NONNULL_PTR this_arg); +enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_hashes(void); /** - * Frees any resources used by the LSPS2BuyResponse, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new NoDescription-variant Bolt11SemanticError */ -void LSPS2BuyResponse_free(struct LDKLSPS2BuyResponse this_obj); +enum LDKBolt11SemanticError Bolt11SemanticError_no_description(void); /** - * The intercept short channel id used by LSP to identify need to open channel. + * Utility method to constructs a new MultipleDescriptions-variant Bolt11SemanticError */ -struct LDKLSPS2InterceptScid LSPS2BuyResponse_get_jit_channel_scid(const struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr); +enum LDKBolt11SemanticError Bolt11SemanticError_multiple_descriptions(void); /** - * The intercept short channel id used by LSP to identify need to open channel. + * Utility method to constructs a new NoPaymentSecret-variant Bolt11SemanticError */ -void LSPS2BuyResponse_set_jit_channel_scid(struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr, struct LDKLSPS2InterceptScid val); +enum LDKBolt11SemanticError Bolt11SemanticError_no_payment_secret(void); /** - * The locktime expiry delta the lsp requires. + * Utility method to constructs a new MultiplePaymentSecrets-variant Bolt11SemanticError */ -uint32_t LSPS2BuyResponse_get_lsp_cltv_expiry_delta(const struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr); +enum LDKBolt11SemanticError Bolt11SemanticError_multiple_payment_secrets(void); /** - * The locktime expiry delta the lsp requires. + * Utility method to constructs a new InvalidFeatures-variant Bolt11SemanticError */ -void LSPS2BuyResponse_set_lsp_cltv_expiry_delta(struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr, uint32_t val); +enum LDKBolt11SemanticError Bolt11SemanticError_invalid_features(void); /** - * A flag that indicates who is trusting who. + * Utility method to constructs a new InvalidSignature-variant Bolt11SemanticError */ -bool LSPS2BuyResponse_get_client_trusts_lsp(const struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr); +enum LDKBolt11SemanticError Bolt11SemanticError_invalid_signature(void); /** - * A flag that indicates who is trusting who. + * Utility method to constructs a new ImpreciseAmount-variant Bolt11SemanticError */ -void LSPS2BuyResponse_set_client_trusts_lsp(struct LDKLSPS2BuyResponse *NONNULL_PTR this_ptr, bool val); +enum LDKBolt11SemanticError Bolt11SemanticError_imprecise_amount(void); /** - * Constructs a new LSPS2BuyResponse given each field + * Checks if two Bolt11SemanticErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -MUST_USE_RES struct LDKLSPS2BuyResponse LSPS2BuyResponse_new(struct LDKLSPS2InterceptScid jit_channel_scid_arg, uint32_t lsp_cltv_expiry_delta_arg, bool client_trusts_lsp_arg); +bool Bolt11SemanticError_eq(const enum LDKBolt11SemanticError *NONNULL_PTR a, const enum LDKBolt11SemanticError *NONNULL_PTR b); /** - * Creates a copy of the LSPS2BuyResponse + * Get the string representation of a Bolt11SemanticError object */ -struct LDKLSPS2BuyResponse LSPS2BuyResponse_clone(const struct LDKLSPS2BuyResponse *NONNULL_PTR orig); +struct LDKStr Bolt11SemanticError_to_str(const enum LDKBolt11SemanticError *NONNULL_PTR o); /** - * Checks if two LSPS2BuyResponses 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. + * Frees any resources used by the SignOrCreationError */ -bool LSPS2BuyResponse_eq(const struct LDKLSPS2BuyResponse *NONNULL_PTR a, const struct LDKLSPS2BuyResponse *NONNULL_PTR b); +void SignOrCreationError_free(struct LDKSignOrCreationError this_ptr); /** - * Frees any resources used by the LSPS2Request + * Creates a copy of the SignOrCreationError */ -void LSPS2Request_free(struct LDKLSPS2Request this_ptr); +struct LDKSignOrCreationError SignOrCreationError_clone(const struct LDKSignOrCreationError *NONNULL_PTR orig); /** - * Creates a copy of the LSPS2Request + * Utility method to constructs a new SignError-variant SignOrCreationError */ -struct LDKLSPS2Request LSPS2Request_clone(const struct LDKLSPS2Request *NONNULL_PTR orig); +struct LDKSignOrCreationError SignOrCreationError_sign_error(void); /** - * Utility method to constructs a new GetInfo-variant LSPS2Request + * Utility method to constructs a new CreationError-variant SignOrCreationError */ -struct LDKLSPS2Request LSPS2Request_get_info(struct LDKLSPS2GetInfoRequest a); +struct LDKSignOrCreationError SignOrCreationError_creation_error(enum LDKCreationError a); /** - * Utility method to constructs a new Buy-variant LSPS2Request + * Checks if two SignOrCreationErrors contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. */ -struct LDKLSPS2Request LSPS2Request_buy(struct LDKLSPS2BuyRequest a); +bool SignOrCreationError_eq(const struct LDKSignOrCreationError *NONNULL_PTR a, const struct LDKSignOrCreationError *NONNULL_PTR b); /** - * Checks if two LSPS2Requests contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Get the string representation of a SignOrCreationError object */ -bool LSPS2Request_eq(const struct LDKLSPS2Request *NONNULL_PTR a, const struct LDKLSPS2Request *NONNULL_PTR b); +struct LDKStr SignOrCreationError_to_str(const struct LDKSignOrCreationError *NONNULL_PTR o); /** - * Frees any resources used by the LSPS2Response + * Read a SiPrefix object from a string */ -void LSPS2Response_free(struct LDKLSPS2Response this_ptr); +struct LDKCResult_SiPrefixBolt11ParseErrorZ SiPrefix_from_str(struct LDKStr s); /** - * Creates a copy of the LSPS2Response + * Read a Bolt11Invoice object from a string */ -struct LDKLSPS2Response LSPS2Response_clone(const struct LDKLSPS2Response *NONNULL_PTR orig); +struct LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ Bolt11Invoice_from_str(struct LDKStr s); /** - * Utility method to constructs a new GetInfo-variant LSPS2Response + * Read a SignedRawBolt11Invoice object from a string */ -struct LDKLSPS2Response LSPS2Response_get_info(struct LDKLSPS2GetInfoResponse a); +struct LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ SignedRawBolt11Invoice_from_str(struct LDKStr s); /** - * Utility method to constructs a new GetInfoError-variant LSPS2Response + * Get the string representation of a Bolt11ParseError object */ -struct LDKLSPS2Response LSPS2Response_get_info_error(struct LDKLSPSResponseError a); +struct LDKStr Bolt11ParseError_to_str(const struct LDKBolt11ParseError *NONNULL_PTR o); /** - * Utility method to constructs a new Buy-variant LSPS2Response + * Get the string representation of a ParseOrSemanticError object */ -struct LDKLSPS2Response LSPS2Response_buy(struct LDKLSPS2BuyResponse a); +struct LDKStr ParseOrSemanticError_to_str(const struct LDKParseOrSemanticError *NONNULL_PTR o); /** - * Utility method to constructs a new BuyError-variant LSPS2Response + * Build a Bolt11ParseError from a Secp256k1Error */ -struct LDKLSPS2Response LSPS2Response_buy_error(struct LDKLSPSResponseError a); +struct LDKBolt11ParseError Bolt11ParseError_from_Secp256k1Error(enum LDKSecp256k1Error f); /** - * Checks if two LSPS2Responses contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Build a Bolt11ParseError from a Error */ -bool LSPS2Response_eq(const struct LDKLSPS2Response *NONNULL_PTR a, const struct LDKLSPS2Response *NONNULL_PTR b); +struct LDKBolt11ParseError Bolt11ParseError_from_Error(struct LDKError f); /** - * Frees any resources used by the LSPS2Message + * Build a ParseOrSemanticError from a Bolt11ParseError */ -void LSPS2Message_free(struct LDKLSPS2Message this_ptr); +struct LDKParseOrSemanticError ParseOrSemanticError_from_Bolt11ParseError(struct LDKBolt11ParseError f); /** - * Creates a copy of the LSPS2Message + * Build a ParseOrSemanticError from a Bolt11SemanticError */ -struct LDKLSPS2Message LSPS2Message_clone(const struct LDKLSPS2Message *NONNULL_PTR orig); +struct LDKParseOrSemanticError ParseOrSemanticError_from_Bolt11SemanticError(enum LDKBolt11SemanticError f); /** - * Utility method to constructs a new Request-variant LSPS2Message + * Get the string representation of a Bolt11Invoice object */ -struct LDKLSPS2Message LSPS2Message_request(struct LDKLSPSRequestId a, struct LDKLSPS2Request b); +struct LDKStr Bolt11Invoice_to_str(const struct LDKBolt11Invoice *NONNULL_PTR o); /** - * Utility method to constructs a new Response-variant LSPS2Message + * Get the string representation of a SignedRawBolt11Invoice object */ -struct LDKLSPS2Message LSPS2Message_response(struct LDKLSPSRequestId a, struct LDKLSPS2Response b); +struct LDKStr SignedRawBolt11Invoice_to_str(const struct LDKSignedRawBolt11Invoice *NONNULL_PTR o); /** - * Checks if two LSPS2Messages contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. + * Get the string representation of a Currency object */ -bool LSPS2Message_eq(const struct LDKLSPS2Message *NONNULL_PTR a, const struct LDKLSPS2Message *NONNULL_PTR b); +struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o); /** - * Frees any resources used by the LSPS2ServiceConfig, if is_owned is set and inner is non-NULL. + * Get the string representation of a SiPrefix object */ -void LSPS2ServiceConfig_free(struct LDKLSPS2ServiceConfig this_obj); +struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o); /** - * Used to calculate the promise for channel parameters supplied to clients. - * - * Note: If this changes then old promises given out will be considered invalid. + * Frees any resources used by the GraphSyncError */ -const uint8_t (*LSPS2ServiceConfig_get_promise_secret(const struct LDKLSPS2ServiceConfig *NONNULL_PTR this_ptr))[32]; +void GraphSyncError_free(struct LDKGraphSyncError this_ptr); /** - * Used to calculate the promise for channel parameters supplied to clients. - * - * Note: If this changes then old promises given out will be considered invalid. + * Creates a copy of the GraphSyncError */ -void LSPS2ServiceConfig_set_promise_secret(struct LDKLSPS2ServiceConfig *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); /** - * Constructs a new LSPS2ServiceConfig given each field + * Utility method to constructs a new DecodeError-variant GraphSyncError */ -MUST_USE_RES struct LDKLSPS2ServiceConfig LSPS2ServiceConfig_new(struct LDKThirtyTwoBytes promise_secret_arg); +struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); /** - * Creates a copy of the LSPS2ServiceConfig + * Utility method to constructs a new LightningError-variant GraphSyncError */ -struct LDKLSPS2ServiceConfig LSPS2ServiceConfig_clone(const struct LDKLSPS2ServiceConfig *NONNULL_PTR orig); +struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); /** - * Frees any resources used by the LSPS2ServiceHandler, if is_owned is set and inner is non-NULL. + * Build a GraphSyncError from a IOError */ -void LSPS2ServiceHandler_free(struct LDKLSPS2ServiceHandler this_obj); +struct LDKGraphSyncError GraphSyncError_from_IOError(enum LDKIOError f); /** - * Used by LSP to inform a client requesting a JIT Channel the token they used is invalid. - * - * Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event. - * - * [`LSPS2ServiceEvent::GetInfo`]: crate::lsps2::event::LSPS2ServiceEvent::GetInfo + * Build a GraphSyncError from a Secp256k1Error */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_invalid_token_provided(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKLSPSRequestId request_id); +struct LDKGraphSyncError GraphSyncError_from_Secp256k1Error(enum LDKSecp256k1Error f); /** - * Used by LSP to provide fee parameters to a client requesting a JIT Channel. - * - * Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event. - * - * [`LSPS2ServiceEvent::GetInfo`]: crate::lsps2::event::LSPS2ServiceEvent::GetInfo + * Build a GraphSyncError from a DecodeError */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_opening_fee_params_generated(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKLSPSRequestId request_id, struct LDKCVec_LSPS2RawOpeningFeeParamsZ opening_fee_params_menu); +struct LDKGraphSyncError GraphSyncError_from_DecodeError(struct LDKDecodeError f); /** - * Used by LSP to provide client with the intercept scid and cltv_expiry_delta to use in their invoice. - * - * Should be called in response to receiving a [`LSPS2ServiceEvent::BuyRequest`] event. - * - * [`LSPS2ServiceEvent::BuyRequest`]: crate::lsps2::event::LSPS2ServiceEvent::BuyRequest + * Build a GraphSyncError from a LightningError */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_invoice_parameters_generated(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKLSPSRequestId request_id, uint64_t intercept_scid, uint32_t cltv_expiry_delta, bool client_trusts_lsp, struct LDKU128 user_channel_id); +struct LDKGraphSyncError GraphSyncError_from_LightningError(struct LDKLightningError f); /** - * Forward [`Event::HTLCIntercepted`] event parameters into this function. - * - * Will fail the intercepted HTLC if the intercept scid matches a payment we are expecting - * but the payment amount is incorrect or the expiry has passed. - * - * Will generate a [`LSPS2ServiceEvent::OpenChannel`] event if the intercept scid matches a payment we are expected - * and the payment amount is correct and the offer has not expired. - * - * Will do nothing if the intercept scid does not match any of the ones we gave out. - * - * [`Event::HTLCIntercepted`]: lightning::events::Event::HTLCIntercepted - * [`LSPS2ServiceEvent::OpenChannel`]: crate::lsps2::event::LSPS2ServiceEvent::OpenChannel + * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_htlc_intercepted(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, uint64_t intercept_scid, struct LDKThirtyTwoBytes intercept_id, uint64_t expected_outbound_amount_msat, struct LDKThirtyTwoBytes payment_hash); +void RapidGossipSync_free(struct LDKRapidGossipSync this_obj); /** - * Forward [`Event::HTLCHandlingFailed`] event parameter into this function. - * - * Will attempt to forward the next payment in the queue if one is present. - * Will do nothing if the intercept scid does not match any of the ones we gave out - * or if the payment queue is empty - * - * [`Event::HTLCHandlingFailed`]: lightning::events::Event::HTLCHandlingFailed + * Instantiate a new [`RapidGossipSync`] instance. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_htlc_handling_failed(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKHTLCDestination failed_next_destination); +MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); /** - * Forward [`Event::PaymentForwarded`] event parameter into this function. + * Sync gossip data from a file. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * Will register the forwarded payment as having paid the JIT channel fee, and forward any held - * and future HTLCs for the SCID of the initial invoice. In the future, this will verify the - * `skimmed_fee_msat` in [`Event::PaymentForwarded`]. + * `network_graph`: The network graph to apply the updates to * - * Note that `next_channel_id` is required to be provided. Therefore, the corresponding - * [`Event::PaymentForwarded`] events need to be generated and serialized by LDK versions - * greater or equal to 0.0.107. + * `sync_path`: Path to the file where the gossip update data is located * - * [`Event::PaymentForwarded`]: lightning::events::Event::PaymentForwarded */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_payment_forwarded(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKChannelId next_channel_id); +MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path); /** - * Forward [`Event::ChannelReady`] event parameters into this function. - * - * Will forward the intercepted HTLC if it matches a channel - * we need to forward a payment over otherwise it will be ignored. + * Update network graph from binary data. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * [`Event::ChannelReady`]: lightning::events::Event::ChannelReady - */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ LSPS2ServiceHandler_channel_ready(const struct LDKLSPS2ServiceHandler *NONNULL_PTR this_arg, struct LDKU128 user_channel_id, const struct LDKChannelId *NONNULL_PTR channel_id, struct LDKPublicKey counterparty_node_id); - -/** - * Determines if the given parameters are valid given the secret used to generate the promise. - */ -bool is_valid_opening_fee_params(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR fee_params, const uint8_t (*promise_secret)[32]); - -/** - * Determines if the given parameters are expired, or still valid. + * `update_data`: `&[u8]` binary stream that comprises the update data */ -bool is_expired_opening_fee_params(const struct LDKLSPS2OpeningFeeParams *NONNULL_PTR fee_params); +MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data); /** - * Computes the opening fee given a payment size and the fee parameters. - * - * Returns [`Option::None`] when the computation overflows. + * Update network graph from binary data. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. * - * See the [`specification`](https://github.com/lightning/blips/blob/master/blip-0052.md#computing-the-opening_fee) for more details. - */ -struct LDKCOption_u64Z compute_opening_fee(uint64_t payment_size_msat, uint64_t opening_fee_min_fee_msat, uint64_t opening_fee_proportional); - -/** - * Frees any resources used by the MessageQueue, if is_owned is set and inner is non-NULL. + * `update_data`: `&[u8]` binary stream that comprises the update data + * `current_time_unix`: `Option` optional current timestamp to verify data age */ -void MessageQueue_free(struct LDKMessageQueue this_obj); +MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph_no_std(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data, struct LDKCOption_u64Z current_time_unix); /** - * Calls the free function if one is set + * Returns whether a rapid gossip sync has completed at least once. */ -void ProcessMessagesCallback_free(struct LDKProcessMessagesCallback this_ptr); +MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); #endif /* LDK_C_BINDINGS_H */ diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 270b007a..25f9e572 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -2,10 +2,12 @@ namespace LDK { // Forward declarations class Str; +class ECDSASignature; class RefundMaybeWithDerivedMetadataBuilder; class Refund; class Retry; class RetryableSendFailure; +class Bolt11PaymentError; class Bolt12PaymentError; class ProbeSendFailure; class RecipientOnionFields; @@ -15,7 +17,6 @@ class DNSSECQuery; class DNSSECProof; class HumanReadableName; class OMNameResolver; -class LSPS0ClientHandler; class InvoiceWithExplicitSigningPubkeyBuilder; class InvoiceWithDerivedSigningPubkeyBuilder; class UnsignedBolt12Invoice; @@ -27,12 +28,15 @@ class SpendableOutputDescriptor; class ChannelDerivationParameters; class HTLCDescriptor; class ChannelSigner; +class PeerStorageKey; +class ReceiveAuthKey; class Recipient; class EntropySource; class NodeSigner; class OutputSpender; class SignerProvider; -class ChangeDestinationSource; +class ChangeDestinationSourceSync; +class ChangeDestinationSourceSyncWrapper; class InMemorySigner; class KeysManager; class PhantomKeysManager; @@ -44,11 +48,13 @@ class Router; class ScorerAccountingForInFlightHtlcs; class InFlightHtlcs; class RouteHop; +class TrampolineHop; class BlindedTail; class Path; class Route; class RouteParameters; class PaymentParameters; +class RouteParametersConfig; class Payee; class FirstHopCandidate; class PublicHopCandidate; @@ -56,11 +62,6 @@ class PrivateHopCandidate; class BlindedPathCandidate; class OneHopBlindedPathCandidate; class CandidateRouteHop; -class LSPS0ListProtocolsRequest; -class LSPS0ListProtocolsResponse; -class LSPS0Request; -class LSPS0Response; -class LSPS0Message; class UntrustedString; class PrintableString; class ScoreLookUp; @@ -74,8 +75,10 @@ class MultiThreadedScoreLockWrite; class ChannelUsage; class FixedPenaltyScorer; class ProbabilisticScorer; +class ChannelLiquidities; class ProbabilisticScoringFeeParameters; class ProbabilisticScoringDecayParameters; +class CombinedScorer; class BestBlock; class Listen; class Confirm; @@ -83,18 +86,26 @@ class ChannelMonitorUpdateStatus; class Watch; class Filter; class WatchedOutput; -class LSPS1ClientConfig; -class LSPS1ClientHandler; -class LSPS2ClientConfig; -class LSPS2ClientHandler; -class LSPS2ClientEvent; -class LSPS2ServiceEvent; class OfferId; class OfferWithExplicitMetadataBuilder; class OfferWithDerivedMetadataBuilder; +class OfferFromHrn; class Offer; class Amount; +class CurrencyCode; class Quantity; +class CurrencyCodeError; +class AnchorDescriptor; +class BumpTransactionEvent; +class Input; +class Utxo; +class CoinSelection; +class ShortChannelIdError; +class InboundHTLCErr; +class WalletSourceSync; +class WalletSync; +class CoinSelectionSourceSync; +class BumpTransactionEventHandlerSync; class NodeId; class NetworkGraph; class ReadOnlyNetworkGraph; @@ -108,22 +119,12 @@ class NodeAnnouncementDetails; class NodeAnnouncementInfo; class NodeAlias; class NodeInfo; -class ShortChannelIdError; -class InboundHTLCErr; -class AnchorDescriptor; -class BumpTransactionEvent; -class Input; -class Utxo; -class CoinSelection; -class CoinSelectionSource; -class WalletSource; -class Wallet; -class BumpTransactionEventHandler; class PendingHTLCRouting; class BlindedForward; class PendingHTLCInfo; class BlindedFailure; class Verification; +class OptionalOfferPaymentParams; class FailureCode; class ChannelManager; class ChainParameters; @@ -131,22 +132,29 @@ class RecentPaymentDetails; class PhantomRouteHints; class Bolt11InvoiceParameters; class ChannelManagerReadArgs; +class TaggedHash; +class SignError; class ChannelHandshakeConfig; class ChannelHandshakeLimits; class MaxDustHTLCExposure; class ChannelConfig; class ChannelConfigUpdate; class UserConfig; +class ChannelConfigOverrides; +class ChannelHandshakeConfigUpdate; class APIError; -class TaggedHash; -class SignError; +class DecryptedOurPeerStorage; +class EncryptedOurPeerStorage; class EcdsaChannelSigner; -class LSPS2ServiceConfig; -class LSPS2ServiceHandler; +class BaseEcdsaChannelSigner; +class OffersMessageFlow; +class InvreqResponseInstructions; +class HeldHtlcReplyPath; class ChannelMonitorUpdate; class MonitorEvent; class HTLCUpdate; class BalanceSource; +class HolderCommitmentTransactionBalance; class Balance; class ChannelMonitor; class ExpandedKey; @@ -160,19 +168,19 @@ class PeerHandleError; class PeerManager; class GraphSyncError; class RapidGossipSync; -class LSPS1ClientEvent; -class KVStore; -class MigratableKVStore; -class Persister; -class MonitorUpdatingPersister; -class MonitorName; -class UpdateName; +class AsyncReceiveOfferCache; class InvoiceRequestWithDerivedPayerSigningPubkeyBuilder; class UnsignedInvoiceRequest; class SignInvoiceRequestFn; class InvoiceRequest; class VerifiedInvoiceRequest; class InvoiceRequestFields; +class KVStoreSync; +class KVStoreSyncWrapper; +class MigratableKVStore; +class MonitorUpdatingPersister; +class MonitorName; +class UpdateName; class DecodeError; class Init; class ErrorMessage; @@ -205,16 +213,24 @@ class TxAbort; class Shutdown; class ClosingSignedFeeRange; class ClosingSigned; +class ClosingComplete; +class ClosingSig; +class StartBatch; class UpdateAddHTLC; class OnionMessage; class UpdateFulfillHTLC; +class PeerStorage; +class PeerStorageRetrieval; class UpdateFailHTLC; class UpdateFailMalformedHTLC; -class CommitmentSignedBatch; class CommitmentSigned; class RevokeAndACK; class UpdateFee; class ChannelReestablish; +class NextFunding; +class NextFundingFlag; +class FundingLocked; +class FundingLockedFlags; class AnnouncementSignatures; class SocketAddress; class SocketAddressParseError; @@ -233,30 +249,15 @@ class GossipTimestampFilter; class ErrorAction; class LightningError; class CommitmentUpdate; +class MessageSendEvent; +class BaseMessageHandler; class ChannelMessageHandler; class RoutingMessageHandler; class OnionMessageHandler; +class SendOnlyMessageHandler; class FinalOnionHopData; class OnionPacket; class TrampolineOnionPacket; -class LSPS1OrderId; -class LSPS1GetInfoRequest; -class LSPS1Options; -class LSPS1GetInfoResponse; -class LSPS1CreateOrderRequest; -class LSPS1OrderParams; -class LSPS1CreateOrderResponse; -class LSPS1OrderState; -class LSPS1PaymentInfo; -class LSPS1Bolt11PaymentInfo; -class LSPS1OnchainPaymentInfo; -class LSPS1PaymentState; -class LSPS1OnchainPayment; -class LSPS1ChannelInfo; -class LSPS1GetOrderRequest; -class LSPS1Request; -class LSPS1Response; -class LSPS1Message; class Level; class Record; class Logger; @@ -268,18 +269,21 @@ class CounterpartyForwardingInfo; class ChannelCounterparty; class ChannelDetails; class ChannelShutdownState; +class Notifier; class FutureCallback; class Future; class Sleeper; -class RawLSPSMessage; -class LSPSRequestId; -class LSPSDateTime; -class LSPSResponseError; -class LSPSMessage; class AsyncPaymentsMessageHandler; class AsyncPaymentsMessage; +class OfferPathsRequest; +class OfferPaths; +class ServeStaticInvoice; +class StaticInvoicePersisted; class HeldHtlcAvailable; class ReleaseHeldHtlc; +class StaticInvoice; +class UnsignedStaticInvoice; +class SignStaticInvoiceFn; class OffersMessageHandler; class OffersMessage; class HTLCClaim; @@ -298,38 +302,29 @@ class CommitmentTransaction; class TrustedCommitmentTransaction; class ShutdownScript; class InvalidShutdownScript; +class AnchorChannelReserveContext; class Bolt12ParseError; class Bolt12SemanticError; class BroadcasterInterface; class ConfirmationTarget; class FeeEstimator; -class LSPS2GetInfoRequest; -class LSPS2RawOpeningFeeParams; -class LSPS2OpeningFeeParams; -class LSPS2GetInfoResponse; -class LSPS2BuyRequest; -class LSPS2InterceptScid; -class LSPS2BuyResponse; -class LSPS2Request; -class LSPS2Response; -class LSPS2Message; -class Packet; -class ParsedOnionMessageContents; -class OnionMessageContents; class FundingInfo; class PaymentPurpose; class ClaimedHTLC; class PathFailure; class ClosureReason; -class HTLCDestination; +class HTLCHandlingFailureType; +class HTLCHandlingFailureReason; class PaymentFailureReason; class InboundChannelFunds; class Event; -class MessageSendEvent; -class MessageSendEventsProvider; class EventsProvider; class ReplayEvent; class EventHandler; +class PaidBolt12Invoice; +class Packet; +class ParsedOnionMessageContents; +class OnionMessageContents; class Nonce; class RoutingFees; class RouteHint; @@ -357,39 +352,42 @@ class Bolt11SemanticError; class SignOrCreationError; class OutPoint; class BigSize; +class CollectionLength; class Hostname; -class TransactionU16LenLimited; -class ChannelId; -class CustomMessageReader; -class Type; class BlindedPayInfo; class BlindedPaymentPath; class PaymentForwardNode; class ForwardTlvs; +class TrampolineForwardTlvs; class ReceiveTlvs; class UnauthenticatedReceiveTlvs; class PaymentRelay; class PaymentConstraints; class PaymentContext; class Bolt12OfferContext; +class AsyncBolt12OfferContext; class Bolt12RefundContext; -class LSPS0ClientEvent; -class UtxoLookupError; -class UtxoResult; -class UtxoLookup; -class UtxoFuture; +class ChannelId; +class CustomMessageReader; +class Type; class OnionMessenger; class Responder; class ResponseInstruction; class MessageSendInstructions; class MessageRouter; class DefaultMessageRouter; +class NodeIdMessageRouter; +class NullMessageRouter; class OnionMessagePath; class Destination; class SendSuccess; class SendError; class CustomOnionMessageHandler; class PeeledOnion; +class UtxoLookupError; +class UtxoResult; +class UtxoLookup; +class UtxoFuture; class FilesystemStore; class InitFeatures; class NodeFeatures; @@ -405,15 +403,16 @@ class Direction; class NodeIdLookUp; class EmptyNodeIdLookUp; class BlindedHop; -class LiquidityEvent; -class MessageQueue; -class ProcessMessagesCallback; +class SpliceContribution; +class FundingTxInput; +class LocalHTLCFailureReason; +class AttributionData; class InvoiceError; class ErroneousField; class TrackedSpendableOutput; class OutputSpendStatus; -class OutputSweeper; class SpendingDelay; +class OutputSweeperSync; class DelayedPaymentBasepoint; class DelayedPaymentKey; class HtlcBasepoint; @@ -423,7 +422,6 @@ class RevocationKey; class Persist; class LockedChannelMonitor; class ChainMonitor; -class LSPS0ServiceHandler; class BlindedMessagePath; class NextMessageHop; class MessageForwardNode; @@ -431,439 +429,489 @@ class MessageContext; class OffersContext; class AsyncPaymentsContext; class DNSResolverContext; -class CResult_HtlcKeyDecodeErrorZ; -class CResult_HumanReadableNameDecodeErrorZ; -class CResult_TransactionU16LenLimitedNoneZ; -class CVec_TrackedSpendableOutputZ; -class CResult_PhantomRouteHintsDecodeErrorZ; class CResult_LockedChannelMonitorNoneZ; -class CResult_FundingCreatedDecodeErrorZ; -class COption_C2Tuple_DNSResolverMessageResponseInstructionZZ; +class CResult_PhantomRouteHintsDecodeErrorZ; +class CVec_C2Tuple_u32TxOutZZ; class CResult_RetryDecodeErrorZ; class CResult_BlindedForwardDecodeErrorZ; -class CResult_ChannelInfoDecodeErrorZ; -class COption_PaymentContextZ; class COption_MaxDustHTLCExposureZ; -class CVec_C2Tuple_u32TxOutZZ; -class CResult_NoneSendErrorZ; -class CResult_CVec_u8ZPeerHandleErrorZ; -class CResult_OnionPacketDecodeErrorZ; -class COption_NetworkUpdateZ; class COption_u64Z; -class CResult_GossipTimestampFilterDecodeErrorZ; -class C2Tuple_OnionMessageContentsResponseInstructionZ; class CResult_RouteHintDecodeErrorZ; class COption_FilterZ; -class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; -class CResult_COption_APIErrorZDecodeErrorZ; -class CVec_C3Tuple_StrStrStrZZ; +class CResult_TxAbortDecodeErrorZ; class CVec_UpdateAddHTLCZ; -class CResult_StaticPaymentOutputDescriptorDecodeErrorZ; -class COption_u32Z; class CResult_RecipientOnionFieldsNoneZ; class C2Tuple__u1632_u1632Z; -class CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ; -class C2Tuple_HumanReadableNameThirtyTwoBytesZ; -class CResult_TransactionNoneZ; -class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ; -class CResult_CVec_StrZIOErrorZ; -class CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; class COption_ECDSASignatureZ; -class CResult_TxAbortDecodeErrorZ; +class C2Tuple_HumanReadableNameThirtyTwoBytesZ; class CResult_ClosingSignedFeeRangeDecodeErrorZ; -class CResult_CommitmentSignedDecodeErrorZ; -class CResult_StfuDecodeErrorZ; -class CResult_OpenChannelDecodeErrorZ; +class COption_TransactionZ; class CResult_ErrorMessageDecodeErrorZ; -class CResult_CommitmentTransactionDecodeErrorZ; -class CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ; +class CResult_LocalHTLCFailureReasonDecodeErrorZ; class COption_APIErrorZ; class CVec_PeerDetailsZ; class CResult_u64ShortChannelIdErrorZ; class CResult_QueryChannelRangeDecodeErrorZ; -class CVec_InputZ; class CVec_TransactionZ; -class C2Tuple_DNSResolverMessageResponseInstructionZ; +class CResult_NoneBolt11PaymentErrorZ; class CResult_ChannelReadyDecodeErrorZ; -class CResult_UpdateFeeDecodeErrorZ; -class CResult_NoneBolt11SemanticErrorZ; -class CResult_ChannelFeaturesDecodeErrorZ; class CResult_RevocationBasepointDecodeErrorZ; -class COption_OnionMessageContentsZ; -class CResult_NoneRetryableSendFailureZ; +class CResult_UpdateFeeDecodeErrorZ; class CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ; -class CResult_NodeIdDecodeErrorZ; class CResult_boolLightningErrorZ; -class CResult_ChannelShutdownStateDecodeErrorZ; -class CResult_NodeAnnouncementInfoDecodeErrorZ; class CResult_InvoiceRequestBolt12SemanticErrorZ; -class CResult_COption_NetworkUpdateZDecodeErrorZ; class CVec_UpdateFailMalformedHTLCZ; -class CResult_ShutdownScriptNoneZ; -class CResult_PendingHTLCInfoInboundHTLCErrZ; -class CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ; -class CResult_PendingHTLCInfoDecodeErrorZ; class CResult_SpliceInitDecodeErrorZ; -class CResult_HTLCOutputInCommitmentDecodeErrorZ; +class COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ; class CVec_RouteHopZ; -class CResult_ShutdownScriptInvalidShutdownScriptZ; -class CResult_CVec_UtxoZNoneZ; +class CVec_C2Tuple_u64BlindedMessagePathZZ; class CResult_CVec_u8ZIOErrorZ; -class COption_HTLCDestinationZ; +class CVec_TrampolineHopZ; class CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ; +class C2Tuple_CVec_u8Zu16Z; class CVec_ThirtyTwoBytesZ; class CResult_ChannelMonitorUpdateStatusNoneZ; -class CResult_ClosingSignedDecodeErrorZ; -class CResult_SchnorrSignatureNoneZ; -class C2Tuple_ReleaseHeldHtlcResponseInstructionZ; +class CResult_ServeStaticInvoiceDecodeErrorZ; +class CResult_CollectionLengthDecodeErrorZ; class CResult_CounterpartyCommitmentSecretsDecodeErrorZ; -class CResult_HTLCDescriptorDecodeErrorZ; -class CVec_RecentPaymentDetailsZ; class CVec_RouteHintHopZ; class CResult_UntrustedStringDecodeErrorZ; class CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ; class CResult_PaymentParametersDecodeErrorZ; class CResult_DelayedPaymentBasepointDecodeErrorZ; class C2Tuple_ThirtyTwoBytesChannelMonitorZ; -class COption_U128Z; class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ; class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; class CResult_UpdateNameIOErrorZ; -class CVec_MessageForwardNodeZ; -class CResult_TxAckRbfDecodeErrorZ; -class CResult_Bolt11InvoiceBolt11SemanticErrorZ; -class COption_UtxoLookupZ; +class CVec_C2Tuple_ChannelIdCOption_U128ZZZ; class CResult__u832NoneZ; class CResult_PongDecodeErrorZ; -class CResult_UnsignedChannelAnnouncementDecodeErrorZ; class CResult_ChannelIdAPIErrorZ; class CResult_CVec_u8ZNoneZ; class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ; class CVec_C2Tuple_ChannelIdPublicKeyZZ; class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ; -class CResult_ChannelTransactionParametersDecodeErrorZ; +class CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ; class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ; -class CResult_LSPSRequestIdAPIErrorZ; class CResult_InFlightHtlcsDecodeErrorZ; -class CResult_CommitmentSignedBatchDecodeErrorZ; -class CResult_COption_HTLCDestinationZDecodeErrorZ; -class CResult_Bolt12OfferContextDecodeErrorZ; +class CResult_RouteParametersConfigDecodeErrorZ; class CResult_ThirtyTwoBytesNoneZ; class C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ; -class CResult_SendSuccessSendErrorZ; class CResult_NoneReplayEventZ; -class C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ; class CResult_BlindedHopDecodeErrorZ; -class CResult_NoneLightningErrorZ; -class CResult_FixedPenaltyScorerDecodeErrorZ; class CResult_NonePeerHandleErrorZ; -class CResult_RawLSPSMessageDecodeErrorZ; class CResult_FinalOnionHopDataDecodeErrorZ; -class CResult_TrustedCommitmentTransactionNoneZ; +class CResult_COption_EventZDecodeErrorZ; class CResult_DNSResolverMessageDecodeErrorZ; class C2Tuple_PublicKeyChannelIdZ; -class CResult_COption_EventZDecodeErrorZ; -class COption_SocketAddressZ; -class CResult_COption_MonitorEventZDecodeErrorZ; class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; -class CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ; -class CResult_RoutingFeesDecodeErrorZ; -class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; -class CResult_DescriptionCreationErrorZ; -class CResult_PaymentRelayDecodeErrorZ; -class CResult_QueryShortChannelIdsDecodeErrorZ; -class CResult_VerifiedInvoiceRequestNoneZ; class CResult_UpdateAddHTLCDecodeErrorZ; class CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ; -class COption_OutboundHTLCStateDetailsZ; -class COption_MonitorEventZ; -class CResult_COption_TypeZDecodeErrorZ; class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ; -class CResult_OfferDecodeErrorZ; class COption_TypeZ; -class CResult_Bolt11InvoiceSignOrCreationErrorZ; class CResult_COption_PathFailureZDecodeErrorZ; -class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ; +class CResult_UtxoDecodeErrorZ; +class CResult_PeerStorageDecodeErrorZ; class COption_C2Tuple_PublicKeyChannelIdZZ; -class CResult_UpdateFailHTLCDecodeErrorZ; -class CResult_BlindedPaymentPathNoneZ; -class CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ; class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ; -class CResult_SpendableOutputDescriptorDecodeErrorZ; -class CResult_RevokeAndACKDecodeErrorZ; +class C2Tuple__u832u16Z; +class CResult_ChannelLiquiditiesDecodeErrorZ; class CResult_UnsignedChannelUpdateDecodeErrorZ; -class CResult_MonitorNameIOErrorZ; class CResult_PayeePubKeySecp256k1ErrorZ; -class C2Tuple__u832u16Z; -class CResult_BlindedMessagePathDecodeErrorZ; -class CResult_BlindedMessagePathNoneZ; -class CResult_CVec_BlindedMessagePathZNoneZ; -class COption_BigEndianScalarZ; +class CResult_DecryptedOurPeerStorageNoneZ; class CVec_ChannelIdZ; -class CResult_PublicKeySecp256k1ErrorZ; -class C2Tuple_OnionMessageContentsMessageSendInstructionsZ; -class CVec_BlindedHopZ; -class CResult_ReleaseHeldHtlcDecodeErrorZ; -class CResult_CVec_ECDSASignatureZNoneZ; -class CResult_COption_ClosureReasonZDecodeErrorZ; -class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; class CResult_NonceDecodeErrorZ; +class CResult_OfferNoneZ; +class CResult_StartBatchDecodeErrorZ; +class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; class CResult_RouteParametersDecodeErrorZ; -class CResult_LSPSDateTimeNoneZ; -class CResult_u64NoneZ; -class CResult_NodeAliasDecodeErrorZ; -class CResult_PrivateRouteCreationErrorZ; -class CResult_InvoiceErrorDecodeErrorZ; -class C2Tuple_BestBlockOutputSweeperZ; -class CVec_UpdateFulfillHTLCZ; class CVec_C2Tuple_u32CVec_u8ZZZ; class C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ; -class CResult_AnnouncementSignaturesDecodeErrorZ; -class CResult_TxCompleteDecodeErrorZ; -class CResult_UpdateFulfillHTLCDecodeErrorZ; +class COption_MessageContextZ; class CResult_NodeFeaturesDecodeErrorZ; -class CResult_InMemorySignerDecodeErrorZ; -class CResult_TxSignaturesDecodeErrorZ; class CVec_HTLCDescriptorZ; -class CResult_ReplyShortChannelIdsEndDecodeErrorZ; -class COption_PathFailureZ; -class COption_MessageContextZ; -class CVec_ECDSASignatureZ; -class C2Tuple_DNSResolverMessageMessageSendInstructionsZ; class CResult_ChannelUpdateInfoDecodeErrorZ; -class CVec_TxOutZ; +class C2Tuple_DNSResolverMessageMessageSendInstructionsZ; class CVec_DestinationZ; -class CVec_UpdateFailHTLCZ; -class CVec_InboundHTLCDetailsZ; -class CVec_OutboundHTLCDetailsZ; class CResult_BuiltCommitmentTransactionDecodeErrorZ; -class C2Tuple_boolboolZ; -class CVec_PaymentForwardNodeZ; class CResult_TrackedSpendableOutputDecodeErrorZ; class CVec_SpendableOutputDescriptorZ; -class C2Tuple_OutPointCVec_u64ZZ; +class CResult_ClosingSigDecodeErrorZ; class CResult_ResponderDecodeErrorZ; -class C2Tuple_OutPointCVec_u8ZZ; class CResult_WitnessNoneZ; class COption_C2Tuple_u64u64ZZ; class CResult_ChannelAnnouncementDecodeErrorZ; class CResult_HTLCUpdateDecodeErrorZ; class CResult_TxAddInputDecodeErrorZ; -class CResult_HeldHtlcAvailableDecodeErrorZ; -class CResult_TxInitRbfDecodeErrorZ; -class COption_WriteableScoreZ; -class CVec_StrZ; class CResult_AsyncPaymentsMessageDecodeErrorZ; -class CVec_LSPS2OpeningFeeParamsZ; -class CResult_SpliceAckDecodeErrorZ; -class CResult_PositiveTimestampCreationErrorZ; class CResult_PeeledOnionNoneZ; -class CVec_C2Tuple_OutPointChannelIdZZ; -class CResult_ChannelMonitorUpdateDecodeErrorZ; -class CResult_ReplyChannelRangeDecodeErrorZ; -class CResult_UnsignedNodeAnnouncementDecodeErrorZ; -class CResult_TrustedClosingTransactionNoneZ; -class C2Tuple_PublicKeyTypeZ; +class CVec_StrZ; +class CResult_PositiveTimestampCreationErrorZ; +class CResult_InvreqResponseInstructionsNoneZ; class CResult_TxRemoveOutputDecodeErrorZ; -class CResult_ChannelReestablishDecodeErrorZ; -class CResult_OnionMessageDecodeErrorZ; -class CResult_Bolt11InvoiceParseOrSemanticErrorZ; class CResult_MessageContextDecodeErrorZ; class CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ; -class CResult_InitFeaturesDecodeErrorZ; +class CResult_RouteStrZ; class CResult_PublicKeyNoneZ; -class C3Tuple_StrStrStrZ; -class CResult_PingDecodeErrorZ; -class CResult_RevocationKeyDecodeErrorZ; +class CResult_CurrencyCodeCurrencyCodeErrorZ; +class CResult_InitFeaturesDecodeErrorZ; +class CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ; class C2Tuple_OffersMessageMessageSendInstructionsZ; -class CResult_ChannelIdDecodeErrorZ; class CResult_BlindedHopFeaturesDecodeErrorZ; -class CVec_TransactionOutputsZ; -class COption_HTLCClaimZ; -class CVec_BlindedPaymentPathZ; +class CVec_CVec_u8ZZ; class CResult_HumanReadableNameNoneZ; -class COption_boolZ; class CResult_ProbabilisticScorerDecodeErrorZ; -class CResult_CVec_BlindedPaymentPathZNoneZ; class COption_StrZ; +class CResult_CVec_BlindedPaymentPathZNoneZ; +class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; class C2Tuple_usizeTransactionZ; -class COption_OffersContextZ; -class COption_C2Tuple_OffersMessageResponseInstructionZZ; -class CVec_ChannelMonitorZ; +class CVec_FutureZ; +class CResult_TxCreationKeysDecodeErrorZ; class CResult_AcceptChannelV2DecodeErrorZ; -class CResult_NodeAnnouncementDecodeErrorZ; +class CResult_SiPrefixBolt11ParseErrorZ; +class CResult_ShutdownScriptDecodeErrorZ; class CResult_RouteHopDecodeErrorZ; class CResult_OfferIdDecodeErrorZ; -class CVec_HTLCOutputInCommitmentZ; class CResult_CoinSelectionNoneZ; -class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; -class CVec_FutureZ; -class CResult_RefundBolt12SemanticErrorZ; +class CResult_StrNoneZ; +class CVec_BalanceZ; class CResult_NoneIOErrorZ; class CResult_MaxDustHTLCExposureDecodeErrorZ; -class CVec_BalanceZ; -class CVec_CommitmentTransactionZ; -class CResult_FundingSignedDecodeErrorZ; -class CResult_RecoverableSignatureNoneZ; +class CResult_AsyncBolt12OfferContextDecodeErrorZ; class CResult_SocketAddressDecodeErrorZ; -class C2Tuple_Z; -class COption_AddressZ; class CResult_InboundHTLCDetailsDecodeErrorZ; -class CResult_TxCreationKeysDecodeErrorZ; class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; -class CResult_ShutdownScriptDecodeErrorZ; class CVec_PathZ; -class CResult_NetworkGraphDecodeErrorZ; -class CResult_SiPrefixBolt11ParseErrorZ; class CResult_NodeInfoDecodeErrorZ; class CVec_NodeIdZ; class CVec_u8Z; -class CResult_RouteLightningErrorZ; -class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; -class CResult_ChannelPublicKeysDecodeErrorZ; +class CResult_PeerStorageRetrievalDecodeErrorZ; class CVec_ClaimedHTLCZ; class CResult_DelayedPaymentKeyDecodeErrorZ; +class COption_HTLCHandlingFailureReasonZ; class COption_CVec_ThirtyTwoBytesZZ; -class CVec_SocketAddressZ; -class CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; class CResult_InvoiceRequestDecodeErrorZ; class CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ; -class CResult_WarningMessageDecodeErrorZ; -class CResult_ChannelCounterpartyDecodeErrorZ; -class CResult_HolderCommitmentTransactionDecodeErrorZ; -class CResult_AsyncPaymentsContextDecodeErrorZ; -class C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ; +class COption_u8Z; +class CResult_ClaimedHTLCDecodeErrorZ; class CResult_OfferBolt12SemanticErrorZ; class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; -class CVec_LSPS2RawOpeningFeeParamsZ; -class CResult_InitDecodeErrorZ; -class CResult_PaymentPurposeDecodeErrorZ; -class CResult_ClaimedHTLCDecodeErrorZ; -class CVec_ChannelDetailsZ; class CResult_OutPointDecodeErrorZ; -class CVec_MessageSendEventZ; +class CVec_ChannelDetailsZ; class CResult_Bolt11InvoiceFeaturesDecodeErrorZ; -class CResult_DNSResolverContextDecodeErrorZ; +class C2Tuple_ChannelIdCVec_u64ZZ; class CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ; class CResult_RouteHintHopDecodeErrorZ; -class CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ; -class CResult_UpdateFailMalformedHTLCDecodeErrorZ; -class CResult_BlindedPayInfoDecodeErrorZ; -class CResult_ThirtyTwoBytesAPIErrorZ; class COption_ChannelShutdownStateZ; -class CResult_Bolt12InvoiceBolt12SemanticErrorZ; -class CResult_InvoiceRequestFieldsDecodeErrorZ; class CResult_NoneBolt12PaymentErrorZ; class CResult_AcceptChannelDecodeErrorZ; -class CResult_RefundDecodeErrorZ; -class CResult_HostnameDecodeErrorZ; +class CResult_C2Tuple_OfferboolZNoneZ; class C2Tuple_u64u16Z; class COption_ThirtyTwoBytesZ; class CVec_u64Z; class CResult_NoneBolt12SemanticErrorZ; class COption_InboundHTLCStateDetailsZ; -class CResult_OutputSweeperDecodeErrorZ; -class CResult_C2Tuple_CVec_u8Zu64ZNoneZ; class COption_EventZ; class COption_CVec_SocketAddressZZ; class CResult_ChannelTypeFeaturesDecodeErrorZ; -class CVec_RouteHintZ; -class COption_u16Z; -class COption_PaymentFailureReasonZ; class CResult_Bolt12RefundContextDecodeErrorZ; +class CResult_AsyncReceiveOfferCacheDecodeErrorZ; +class CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ; class CResult_ECDSASignatureNoneZ; -class C2Tuple_ChannelIdPublicKeyZ; +class CVec_WitnessZ; class C2Tuple_OffersMessageResponseInstructionZ; -class CResult_EcdsaChannelSignerDecodeErrorZ; class CResult_BlindedTailDecodeErrorZ; -class CVec_WitnessZ; -class COption_C2Tuple_u64u16ZZ; -class CResult_SocketAddressSocketAddressParseErrorZ; -class CResult_COption_PaymentFailureReasonZDecodeErrorZ; -class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; -class CResult_ChannelDerivationParametersDecodeErrorZ; class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ; +class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; class CResult_PaymentConstraintsDecodeErrorZ; class C2Tuple_u32CVec_u8ZZ; -class CVec_C2Tuple_PublicKeyTypeZZ; -class CVec_u16Z; -class CResult_OutboundHTLCDetailsDecodeErrorZ; class CResult_RefundBolt12ParseErrorZ; class CResult_u32GraphSyncErrorZ; -class CVec_C2Tuple_u64CVec_u8ZZZ; class CResult_OffersMessageDecodeErrorZ; -class CResult_OnionMessagePathNoneZ; +class CVec_PhantomRouteHintsZ; class CResult_NoneAPIErrorZ; class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; -class COption_f64Z; -class CResult_TxRemoveInputDecodeErrorZ; +class CResult_PaymentContextDecodeErrorZ; +class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; class CVec_PublicKeyZ; class C2Tuple_CVec_u8Zu64Z; +class C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ; +class COption_C2Tuple_OnionMessageContentsResponseInstructionZZ; +class CResult_RecipientOnionFieldsDecodeErrorZ; +class C2Tuple_u32TxOutZ; +class CVec_C2Tuple_OutPointCVec_u8ZZZ; +class C3Tuple_OnionPacketu64u32Z; +class COption_C2Tuple_OfferPathsResponseInstructionZZ; +class CResult_ChannelConfigDecodeErrorZ; +class COption_i64Z; +class CResult_C2Tuple_CVec_u8Zu16ZNoneZ; +class CVec_PrivateRouteZ; +class C2Tuple_ThirtyTwoBytesChannelManagerZ; +class CVec_CommitmentSignedZ; +class CVec_MonitorEventZ; +class CResult_TxOutUtxoLookupErrorZ; +class C2Tuple_u64BlindedMessagePathZ; +class COption_usizeZ; +class CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ; +class CVec_AddressZ; +class CResult_NoneNoneZ; +class CResult_AttributionDataDecodeErrorZ; +class CResult_FundingInfoDecodeErrorZ; +class COption_AmountZ; +class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; +class CResult_OpenChannelV2DecodeErrorZ; +class CResult_BestBlockDecodeErrorZ; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; +class CResult_OutputSpendStatusDecodeErrorZ; +class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; +class CResult_BlindedFailureDecodeErrorZ; +class COption_QuantityZ; +class CResult_HtlcKeyDecodeErrorZ; +class CResult_HumanReadableNameDecodeErrorZ; +class CVec_TrackedSpendableOutputZ; +class CResult_FundingCreatedDecodeErrorZ; +class COption_C2Tuple_DNSResolverMessageResponseInstructionZZ; +class CResult_ChannelInfoDecodeErrorZ; +class COption_PaymentContextZ; +class CResult_NoneSendErrorZ; +class CResult_CVec_u8ZPeerHandleErrorZ; +class CResult_OnionPacketDecodeErrorZ; +class COption_NetworkUpdateZ; +class CResult_GossipTimestampFilterDecodeErrorZ; +class C2Tuple_OnionMessageContentsResponseInstructionZ; +class CResult_StaticInvoicePersistedDecodeErrorZ; +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; +class CVec_C3Tuple_StrStrStrZZ; +class CResult_COption_APIErrorZDecodeErrorZ; +class CResult_CommitmentSignedDecodeErrorZ; +class COption_OutPointZ; +class CResult_StaticPaymentOutputDescriptorDecodeErrorZ; +class COption_u32Z; +class CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ; +class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ; +class CResult_CVec_StrZIOErrorZ; +class CResult_CommitmentTransactionDecodeErrorZ; +class CResult_TransactionNoneZ; +class CResult_OfferPathsDecodeErrorZ; +class CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; +class CResult_StfuDecodeErrorZ; +class CResult_OpenChannelDecodeErrorZ; +class CResult_OfferPathsRequestDecodeErrorZ; +class CVec_InputZ; +class CResult_ChannelFeaturesDecodeErrorZ; +class C2Tuple_DNSResolverMessageResponseInstructionZ; +class CResult_NoneBolt11SemanticErrorZ; +class COption_OnionMessageContentsZ; +class CResult_NoneRetryableSendFailureZ; +class CResult_HTLCOutputInCommitmentDecodeErrorZ; +class CResult_NodeIdDecodeErrorZ; +class CResult_ChannelShutdownStateDecodeErrorZ; +class CResult_NodeAnnouncementInfoDecodeErrorZ; +class CResult_ShutdownScriptInvalidShutdownScriptZ; +class CResult_COption_NetworkUpdateZDecodeErrorZ; +class CResult_ShutdownScriptNoneZ; +class CResult_PendingHTLCInfoInboundHTLCErrZ; +class CResult_PendingHTLCInfoDecodeErrorZ; +class CResult_CVec_UtxoZNoneZ; +class CResult_HTLCHandlingFailureReasonDecodeErrorZ; +class CVec_FundingTxInputZ; +class CResult_ClosingSignedDecodeErrorZ; +class CResult_SchnorrSignatureNoneZ; +class C2Tuple_ReleaseHeldHtlcResponseInstructionZ; +class COption_C2Tuple_ServeStaticInvoiceMessageContextZZ; +class CResult_HTLCDescriptorDecodeErrorZ; +class CVec_RecentPaymentDetailsZ; +class C2Tuple_ServeStaticInvoiceMessageContextZ; +class COption_U128Z; +class COption_PaidBolt12InvoiceZ; +class CResult_FundingTxInputDecodeErrorZ; +class CVec_MessageForwardNodeZ; +class C2Tuple_ChannelIdCOption_U128ZZ; +class CResult_TxAckRbfDecodeErrorZ; +class CResult_Bolt11InvoiceBolt11SemanticErrorZ; +class COption_UtxoLookupZ; +class C2Tuple_OfferPathsMessageContextZ; +class CResult_UnsignedChannelAnnouncementDecodeErrorZ; +class CResult_ChannelTransactionParametersDecodeErrorZ; +class CVec_HolderCommitmentTransactionBalanceZ; +class CResult_Bolt12OfferContextDecodeErrorZ; +class CResult_PaidBolt12InvoiceDecodeErrorZ; +class CResult_SendSuccessSendErrorZ; +class CResult_NoneLightningErrorZ; +class CResult_FixedPenaltyScorerDecodeErrorZ; +class CResult_TrustedCommitmentTransactionNoneZ; +class COption_SocketAddressZ; +class CResult_COption_MonitorEventZDecodeErrorZ; +class CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ; +class CResult_DescriptionCreationErrorZ; +class CResult_RoutingFeesDecodeErrorZ; +class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ; +class CResult_PacketDecodeErrorZ; +class CResult_PaymentRelayDecodeErrorZ; +class CResult_QueryShortChannelIdsDecodeErrorZ; +class CResult_VerifiedInvoiceRequestNoneZ; +class COption_HTLCHandlingFailureTypeZ; +class CVec_u32Z; +class COption_OutboundHTLCStateDetailsZ; +class COption_MonitorEventZ; +class CResult_COption_TypeZDecodeErrorZ; +class CResult_OfferDecodeErrorZ; +class C2Tuple_OfferboolZ; +class CResult_Bolt11InvoiceSignOrCreationErrorZ; +class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ; +class CResult_UpdateFailHTLCDecodeErrorZ; +class CResult_BlindedPaymentPathNoneZ; +class CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ; +class CResult_RevokeAndACKDecodeErrorZ; +class CResult_SpendableOutputDescriptorDecodeErrorZ; +class CResult_EncryptedOurPeerStorageNoneZ; +class CResult_BlindedMessagePathDecodeErrorZ; +class CResult_CVec_BlindedMessagePathZNoneZ; +class COption_BigEndianScalarZ; +class C2Tuple_OnionMessageContentsMessageSendInstructionsZ; +class CResult_PublicKeySecp256k1ErrorZ; +class CResult_TrampolineOnionPacketDecodeErrorZ; +class CVec_BlindedHopZ; +class CResult_ReleaseHeldHtlcDecodeErrorZ; +class CResult_CVec_ECDSASignatureZNoneZ; +class CResult_COption_ClosureReasonZDecodeErrorZ; +class CResult_InvoiceErrorDecodeErrorZ; +class CResult_PrivateRouteCreationErrorZ; +class CResult_NodeAliasDecodeErrorZ; +class CVec_UpdateFulfillHTLCZ; +class CResult_AnnouncementSignaturesDecodeErrorZ; +class CResult_UpdateFulfillHTLCDecodeErrorZ; +class CResult_TxCompleteDecodeErrorZ; +class CResult_ReplyShortChannelIdsEndDecodeErrorZ; +class CResult_TxSignaturesDecodeErrorZ; +class COption_PathFailureZ; +class CVec_ECDSASignatureZ; +class CVec_UpdateFailHTLCZ; +class CVec_C2Tuple_ChannelIdu64ZZ; +class CVec_TxOutZ; +class CVec_InboundHTLCDetailsZ; +class CVec_OutboundHTLCDetailsZ; +class CVec_PaymentForwardNodeZ; +class C2Tuple_boolboolZ; +class C2Tuple_BestBlockOutputSweeperSyncZ; +class COption_C2Tuple_OfferPathsMessageContextZZ; +class C2Tuple_OutPointCVec_u8ZZ; +class CResult_HeldHtlcAvailableDecodeErrorZ; +class CVec_OutPointZ; +class CResult_TxInitRbfDecodeErrorZ; +class COption_WriteableScoreZ; +class CResult_SpliceAckDecodeErrorZ; +class CResult_ChannelMonitorUpdateDecodeErrorZ; +class CResult_ReplyChannelRangeDecodeErrorZ; +class CResult_UnsignedNodeAnnouncementDecodeErrorZ; +class CResult_TrustedClosingTransactionNoneZ; +class C2Tuple_PublicKeyTypeZ; +class CResult_ChannelReestablishDecodeErrorZ; +class CResult_OnionMessageDecodeErrorZ; +class C2Tuple_OfferPathsResponseInstructionZ; +class CResult_Bolt11InvoiceParseOrSemanticErrorZ; +class C3Tuple_StrStrStrZ; +class CResult_PingDecodeErrorZ; +class CResult_RevocationKeyDecodeErrorZ; +class C2Tuple_OffersMessageCOption_MessageContextZZ; +class CResult_ChannelIdDecodeErrorZ; +class CVec_TransactionOutputsZ; +class COption_HTLCClaimZ; +class CVec_BlindedPaymentPathZ; +class CResult_NoneSecp256k1ErrorZ; +class COption_C2Tuple_OffersMessageResponseInstructionZZ; +class COption_boolZ; +class CResult_NodeAnnouncementDecodeErrorZ; +class COption_OffersContextZ; +class CVec_ChannelMonitorZ; +class CVec_HTLCOutputInCommitmentZ; +class CResult_RefundBolt12SemanticErrorZ; +class CVec_CommitmentTransactionZ; +class CResult_FundingSignedDecodeErrorZ; +class CResult_RecoverableSignatureNoneZ; +class CResult_FundingTxInputNoneZ; +class C2Tuple_Z; +class COption_AddressZ; +class CResult_NetworkGraphDecodeErrorZ; +class CResult_AsyncPaymentsContextDecodeErrorZ; +class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; +class CResult_ChannelPublicKeysDecodeErrorZ; +class CVec_SocketAddressZ; +class CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; +class CResult_HolderCommitmentTransactionDecodeErrorZ; +class CResult_WarningMessageDecodeErrorZ; +class CResult_ChannelCounterpartyDecodeErrorZ; +class CResult_DNSResolverContextDecodeErrorZ; +class CResult_InitDecodeErrorZ; +class CResult_PaymentPurposeDecodeErrorZ; +class CVec_MessageSendEventZ; +class CResult_UpdateFailMalformedHTLCDecodeErrorZ; +class CResult_BlindedPayInfoDecodeErrorZ; +class CResult_ThirtyTwoBytesAPIErrorZ; +class CResult_Bolt12InvoiceBolt12SemanticErrorZ; +class C2Tuple_ChannelIdu64Z; +class CResult_InvoiceRequestFieldsDecodeErrorZ; +class CResult_RefundDecodeErrorZ; +class CResult_HostnameDecodeErrorZ; +class CResult_C2Tuple_CVec_u8Zu64ZNoneZ; +class CVec_RouteHintZ; +class COption_u16Z; +class COption_PaymentFailureReasonZ; +class C2Tuple_ChannelIdPublicKeyZ; +class CResult_COption_PaymentFailureReasonZDecodeErrorZ; +class CResult_SocketAddressSocketAddressParseErrorZ; +class COption_C2Tuple_u64u16ZZ; +class CResult_StaticInvoiceSignErrorZ; +class CResult_ClosingCompleteDecodeErrorZ; +class CResult_ChannelDerivationParametersDecodeErrorZ; +class CVec_C2Tuple_PublicKeyTypeZZ; +class CResult_OutboundHTLCDetailsDecodeErrorZ; +class CResult_OnionMessagePathNoneZ; +class CVec_C2Tuple_u64CVec_u8ZZZ; +class COption_f64Z; +class CResult_TxRemoveInputDecodeErrorZ; class CVec_C2Tuple_usizeTransactionZZ; +class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; +class CResult_ChannelDetailsDecodeErrorZ; class CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; class CResult_Bolt12InvoiceDecodeErrorZ; class C2Tuple_u64u64Z; class COption_NodeAnnouncementInfoZ; class CResult_PendingHTLCRoutingDecodeErrorZ; -class COption_C2Tuple_OnionMessageContentsResponseInstructionZZ; -class CResult_RecipientOnionFieldsDecodeErrorZ; -class C2Tuple_u32TxOutZ; -class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; -class CResult_ChannelDetailsDecodeErrorZ; -class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; class CVec_UtxoZ; -class CResult_PaymentContextDecodeErrorZ; class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ; -class CResult_ChannelConfigDecodeErrorZ; -class COption_i64Z; -class CVec_PrivateRouteZ; -class CVec_PhantomRouteHintsZ; -class CVec_C2Tuple_OutPointCVec_u64ZZZ; -class C2Tuple_ThirtyTwoBytesChannelManagerZ; +class CResult_TrampolineHopDecodeErrorZ; class CResult_COption_OnionMessageContentsZDecodeErrorZ; +class CResult_ShutdownDecodeErrorZ; class C2Tuple_u64CVec_u8ZZ; class CResult_OfferBolt12ParseErrorZ; class CResult_ThirtyTwoBytesRetryableSendFailureZ; -class CVec_MonitorEventZ; class CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ; -class CResult_ShutdownDecodeErrorZ; class CResult_BigSizeDecodeErrorZ; -class CResult_TxOutUtxoLookupErrorZ; -class COption_usizeZ; +class C2Tuple_ServeStaticInvoiceResponseInstructionZ; class CVec_BlindedMessagePathZ; class CResult_OffersContextDecodeErrorZ; -class CVec_AddressZ; -class CResult_NoneNoneZ; -class CResult_boolPeerHandleErrorZ; -class COption_TxOutZ; -class CResult_ChannelUpdateDecodeErrorZ; class COption_ClosureReasonZ; +class CResult_ChannelUpdateDecodeErrorZ; +class COption_TxOutZ; +class CVec_C2Tuple_ChannelIdCVec_u64ZZZ; class CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ; class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; -class CResult_TransactionU16LenLimitedDecodeErrorZ; -class CResult_FundingInfoDecodeErrorZ; -class COption_AmountZ; class C2Tuple_DNSSECQueryDNSResolverContextZ; class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; -class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; -class CResult_BestBlockDecodeErrorZ; -class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; -class CResult_OpenChannelV2DecodeErrorZ; +class CResult_NextFundingDecodeErrorZ; class CResult_CounterpartyForwardingInfoDecodeErrorZ; -class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; +class CResult_HtlcBasepointDecodeErrorZ; +class CResult_StaticInvoiceDecodeErrorZ; +class CResult_SpliceLockedDecodeErrorZ; class CResult_RouteDecodeErrorZ; -class CResult_BlindedFailureDecodeErrorZ; -class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ; class COption_NoneZ; -class CResult_SpliceLockedDecodeErrorZ; +class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ; +class CResult_TxAddOutputDecodeErrorZ; class COption_CVec_u8ZZ; -class COption_QuantityZ; +class CResult_FundingLockedDecodeErrorZ; class CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ; -class CResult_TxAddOutputDecodeErrorZ; -class CResult_OutputSpendStatusDecodeErrorZ; -class CResult_HtlcBasepointDecodeErrorZ; -class C2Tuple_OutPointChannelIdZ; class Str { private: @@ -880,9 +928,23 @@ class Str { const LDKStr* operator &() const { return &self; } const LDKStr* operator ->() const { return &self; } }; -class RefundMaybeWithDerivedMetadataBuilder { +class ECDSASignature { private: - LDKRefundMaybeWithDerivedMetadataBuilder self; + LDKECDSASignature self; +public: + ECDSASignature(const ECDSASignature&) = delete; + ECDSASignature(ECDSASignature&& o) : self(o.self) { memset(&o, 0, sizeof(ECDSASignature)); } + ECDSASignature(LDKECDSASignature&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKECDSASignature)); } + operator LDKECDSASignature() && { LDKECDSASignature res = self; memset(&self, 0, sizeof(LDKECDSASignature)); return res; } + ECDSASignature& operator=(ECDSASignature&& o) { self = o.self; memset(&o, 0, sizeof(ECDSASignature)); return *this; } + LDKECDSASignature* operator &() { return &self; } + LDKECDSASignature* operator ->() { return &self; } + const LDKECDSASignature* operator &() const { return &self; } + const LDKECDSASignature* operator ->() const { return &self; } +}; +class RefundMaybeWithDerivedMetadataBuilder { +private: + LDKRefundMaybeWithDerivedMetadataBuilder self; public: RefundMaybeWithDerivedMetadataBuilder(const RefundMaybeWithDerivedMetadataBuilder&) = delete; RefundMaybeWithDerivedMetadataBuilder(RefundMaybeWithDerivedMetadataBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(RefundMaybeWithDerivedMetadataBuilder)); } @@ -939,6 +1001,21 @@ class RetryableSendFailure { const LDKRetryableSendFailure* operator &() const { return &self; } const LDKRetryableSendFailure* operator ->() const { return &self; } }; +class Bolt11PaymentError { +private: + LDKBolt11PaymentError self; +public: + Bolt11PaymentError(const Bolt11PaymentError&) = delete; + Bolt11PaymentError(Bolt11PaymentError&& o) : self(o.self) { memset(&o, 0, sizeof(Bolt11PaymentError)); } + Bolt11PaymentError(LDKBolt11PaymentError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBolt11PaymentError)); } + operator LDKBolt11PaymentError() && { LDKBolt11PaymentError res = self; memset(&self, 0, sizeof(LDKBolt11PaymentError)); return res; } + ~Bolt11PaymentError() { Bolt11PaymentError_free(self); } + Bolt11PaymentError& operator=(Bolt11PaymentError&& o) { Bolt11PaymentError_free(self); self = o.self; memset(&o, 0, sizeof(Bolt11PaymentError)); return *this; } + LDKBolt11PaymentError* operator &() { return &self; } + LDKBolt11PaymentError* operator ->() { return &self; } + const LDKBolt11PaymentError* operator &() const { return &self; } + const LDKBolt11PaymentError* operator ->() const { return &self; } +}; class Bolt12PaymentError { private: LDKBolt12PaymentError self; @@ -1010,7 +1087,12 @@ class DNSResolverMessageHandler { /** * Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). * + * The provided [`DNSResolverContext`] was authenticated by the [`OnionMessenger`] as coming from + * a blinded path that we created. + * * With this, we should be able to validate the DNS record we requested. + * + * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger */ inline void handle_dnssec_proof(struct LDKDNSSECProof message, struct LDKDNSResolverContext context); /** @@ -1099,21 +1181,6 @@ class OMNameResolver { const LDKOMNameResolver* operator &() const { return &self; } const LDKOMNameResolver* operator ->() const { return &self; } }; -class LSPS0ClientHandler { -private: - LDKLSPS0ClientHandler self; -public: - LSPS0ClientHandler(const LSPS0ClientHandler&) = delete; - LSPS0ClientHandler(LSPS0ClientHandler&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0ClientHandler)); } - LSPS0ClientHandler(LDKLSPS0ClientHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0ClientHandler)); } - operator LDKLSPS0ClientHandler() && { LDKLSPS0ClientHandler res = self; memset(&self, 0, sizeof(LDKLSPS0ClientHandler)); return res; } - ~LSPS0ClientHandler() { LSPS0ClientHandler_free(self); } - LSPS0ClientHandler& operator=(LSPS0ClientHandler&& o) { LSPS0ClientHandler_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0ClientHandler)); return *this; } - LDKLSPS0ClientHandler* operator &() { return &self; } - LDKLSPS0ClientHandler* operator ->() { return &self; } - const LDKLSPS0ClientHandler* operator &() const { return &self; } - const LDKLSPS0ClientHandler* operator ->() const { return &self; } -}; class InvoiceWithExplicitSigningPubkeyBuilder { private: LDKInvoiceWithExplicitSigningPubkeyBuilder self; @@ -1340,6 +1407,26 @@ class ChannelSigner { * and pause future signing operations until this validation completes. */ inline LDK::CResult_NoneNoneZ validate_counterparty_revocation(uint64_t idx, const uint8_t (*secret)[32]); + /** + * Returns the holder channel public keys and basepoints. This should only be called once + * during channel creation and as such implementations are allowed undefined behavior if + * called more than once. + * + * This method is *not* asynchronous. Instead, the value must be computed locally or in + * advance and cached. + */ + inline LDK::ChannelPublicKeys pubkeys(); + /** + * Returns a new funding pubkey (i.e. our public which is used in a 2-of-2 with the + * counterparty's key to to lock the funds on-chain) for a spliced channel. + * + * `splice_parent_funding_txid` can be used to compute a tweak with which to rotate the base + * key (which will then be available later in signing operations via + * [`ChannelTransactionParameters::splice_parent_funding_txid`]). + * + * This method is *not* asynchronous. Instead, the value must be cached locally. + */ + inline LDKPublicKey new_funding_pubkey(struct LDKThirtyTwoBytes splice_parent_funding_txid); /** * 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 @@ -1348,18 +1435,36 @@ class ChannelSigner { * This method is *not* asynchronous. Instead, the value must be cached locally. */ inline LDKThirtyTwoBytes channel_keys_id(); - /** - * Set the counterparty static channel data, including basepoints, - * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. - * - * This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] - * instance, LDK will call this method exactly once - either immediately after construction - * (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding - * information has been generated. - * - * channel_parameters.is_populated() MUST be true. - */ - inline void provide_channel_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); +}; +class PeerStorageKey { +private: + LDKPeerStorageKey self; +public: + PeerStorageKey(const PeerStorageKey&) = delete; + PeerStorageKey(PeerStorageKey&& o) : self(o.self) { memset(&o, 0, sizeof(PeerStorageKey)); } + PeerStorageKey(LDKPeerStorageKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerStorageKey)); } + operator LDKPeerStorageKey() && { LDKPeerStorageKey res = self; memset(&self, 0, sizeof(LDKPeerStorageKey)); return res; } + ~PeerStorageKey() { PeerStorageKey_free(self); } + PeerStorageKey& operator=(PeerStorageKey&& o) { PeerStorageKey_free(self); self = o.self; memset(&o, 0, sizeof(PeerStorageKey)); return *this; } + LDKPeerStorageKey* operator &() { return &self; } + LDKPeerStorageKey* operator ->() { return &self; } + const LDKPeerStorageKey* operator &() const { return &self; } + const LDKPeerStorageKey* operator ->() const { return &self; } +}; +class ReceiveAuthKey { +private: + LDKReceiveAuthKey self; +public: + ReceiveAuthKey(const ReceiveAuthKey&) = delete; + ReceiveAuthKey(ReceiveAuthKey&& o) : self(o.self) { memset(&o, 0, sizeof(ReceiveAuthKey)); } + ReceiveAuthKey(LDKReceiveAuthKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKReceiveAuthKey)); } + operator LDKReceiveAuthKey() && { LDKReceiveAuthKey res = self; memset(&self, 0, sizeof(LDKReceiveAuthKey)); return res; } + ~ReceiveAuthKey() { ReceiveAuthKey_free(self); } + ReceiveAuthKey& operator=(ReceiveAuthKey&& o) { ReceiveAuthKey_free(self); self = o.self; memset(&o, 0, sizeof(ReceiveAuthKey)); return *this; } + LDKReceiveAuthKey* operator &() { return &self; } + LDKReceiveAuthKey* operator ->() { return &self; } + const LDKReceiveAuthKey* operator &() const { return &self; } + const LDKReceiveAuthKey* operator ->() const { return &self; } }; class Recipient { private: @@ -1410,17 +1515,50 @@ class NodeSigner { const LDKNodeSigner* operator &() const { return &self; } const LDKNodeSigner* operator ->() const { return &self; } /** - * Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. + * Get the [`ExpandedKey`] which provides cryptographic material for various Lightning Network operations. * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. + * This key set is used for: + * - Encrypting and decrypting inbound payment metadata + * - Authenticating payment hashes (both LDK-provided and user-provided) + * - Supporting BOLT 12 Offers functionality (key derivation and authentication) + * - Authenticating spontaneous payments' metadata * * This method must return the same value each time it is called. * + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. This is because LDK avoids storing inbound payment data. Instead, this key + * is used to construct a payment secret which is received in the payment onion and used to + * reconstruct the payment preimage. Therefore, for a payment to be receivable by multiple + * nodes, they must share the same key. + * * [phantom node payments]: PhantomKeysManager */ - inline LDK::ExpandedKey get_inbound_payment_key(); + inline LDK::ExpandedKey get_expanded_key(); + /** + * Defines a method to derive a 32-byte encryption key for peer storage. + * + * Implementations of this method must derive a secure encryption key. + * The key is used to encrypt or decrypt backups of our state stored with our peers. + * + * Thus, if you wish to rely on recovery using this method, you should use a key which + * can be re-derived from data which would be available after state loss (eg the wallet seed). + */ + inline LDK::PeerStorageKey get_peer_storage_key(); + /** + * Returns the [`ReceiveAuthKey`] used to authenticate incoming [`BlindedMessagePath`] contexts. + * + * This key is used as additional associated data (AAD) during MAC verification of the + * [`MessageContext`] at the final hop of a blinded path. It ensures that only paths + * constructed by this node will be accepted, preventing unauthorized parties from forging + * valid-looking messages. + * + * Implementers must ensure that this key remains secret and consistent across invocations. + * + * [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + * [`MessageContext`]: crate::blinded_path::message::MessageContext + */ + inline LDK::ReceiveAuthKey get_receive_auth_key(); /** * Get node id based on the provided [`Recipient`]. * @@ -1475,6 +1613,18 @@ class NodeSigner { * corresponding channel. */ inline LDK::CResult_ECDSASignatureNoneZ sign_gossip_message(struct LDKUnsignedGossipMessage msg); + /** + * Sign an arbitrary message with the node's secret key. + * + * Creates a digital signature of a message given the node's secret. The message is prefixed + * with "Lightning Signed Message:" before signing. See [this description of the format](https://web.archive.org/web/20191010011846/https://twitter.com/rusty_twit/status/1182102005914800128) + * for more details. + * + * A receiver knowing the node's id and the message can be sure that the signature was generated by the caller. + * An `Err` can be returned to signal that the signer is unavailable / cannot produce a valid + * signature. + */ + inline LDK::CResult_StrNoneZ sign_message(struct LDKu8slice msg); }; class OutputSpender { private: @@ -1528,7 +1678,7 @@ class SignerProvider { * * This method must return a different value each time it is called. */ - inline LDKThirtyTwoBytes generate_channel_keys_id(bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id); + inline LDKThirtyTwoBytes generate_channel_keys_id(bool inbound, struct LDKU128 user_channel_id); /** * Derives the private key material backing a `Signer`. * @@ -1537,23 +1687,7 @@ class SignerProvider { * re-derived from its `channel_keys_id`, which can be obtained through its trait method * [`ChannelSigner::channel_keys_id`]. */ - inline LDK::EcdsaChannelSigner derive_channel_signer(uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); - /** - * Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. - * This is only called during deserialization of other objects which contain - * [`EcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. - * - * This method is slowly being phased out -- it will only be called when reading objects - * written by LDK versions prior to 0.0.113. - * - * [`Signer`]: Self::EcdsaSigner - * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - inline LDK::CResult_EcdsaChannelSignerDecodeErrorZ read_chan_signer(struct LDKu8slice reader); + inline LDK::EcdsaChannelSigner derive_channel_signer(struct LDKThirtyTwoBytes channel_keys_id); /** * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. * @@ -1576,20 +1710,20 @@ class SignerProvider { */ inline LDK::CResult_ShutdownScriptNoneZ get_shutdown_scriptpubkey(); }; -class ChangeDestinationSource { +class ChangeDestinationSourceSync { private: - LDKChangeDestinationSource self; + LDKChangeDestinationSourceSync self; public: - ChangeDestinationSource(const ChangeDestinationSource&) = delete; - ChangeDestinationSource(ChangeDestinationSource&& o) : self(o.self) { memset(&o, 0, sizeof(ChangeDestinationSource)); } - ChangeDestinationSource(LDKChangeDestinationSource&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChangeDestinationSource)); } - operator LDKChangeDestinationSource() && { LDKChangeDestinationSource res = self; memset(&self, 0, sizeof(LDKChangeDestinationSource)); return res; } - ~ChangeDestinationSource() { ChangeDestinationSource_free(self); } - ChangeDestinationSource& operator=(ChangeDestinationSource&& o) { ChangeDestinationSource_free(self); self = o.self; memset(&o, 0, sizeof(ChangeDestinationSource)); return *this; } - LDKChangeDestinationSource* operator &() { return &self; } - LDKChangeDestinationSource* operator ->() { return &self; } - const LDKChangeDestinationSource* operator &() const { return &self; } - const LDKChangeDestinationSource* operator ->() const { return &self; } + ChangeDestinationSourceSync(const ChangeDestinationSourceSync&) = delete; + ChangeDestinationSourceSync(ChangeDestinationSourceSync&& o) : self(o.self) { memset(&o, 0, sizeof(ChangeDestinationSourceSync)); } + ChangeDestinationSourceSync(LDKChangeDestinationSourceSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChangeDestinationSourceSync)); } + operator LDKChangeDestinationSourceSync() && { LDKChangeDestinationSourceSync res = self; memset(&self, 0, sizeof(LDKChangeDestinationSourceSync)); return res; } + ~ChangeDestinationSourceSync() { ChangeDestinationSourceSync_free(self); } + ChangeDestinationSourceSync& operator=(ChangeDestinationSourceSync&& o) { ChangeDestinationSourceSync_free(self); self = o.self; memset(&o, 0, sizeof(ChangeDestinationSourceSync)); return *this; } + LDKChangeDestinationSourceSync* operator &() { return &self; } + LDKChangeDestinationSourceSync* operator ->() { return &self; } + const LDKChangeDestinationSourceSync* operator &() const { return &self; } + const LDKChangeDestinationSourceSync* operator ->() const { return &self; } /** * Returns a script pubkey which can be used as a change destination for * [`OutputSpender::spend_spendable_outputs`]. @@ -1599,6 +1733,21 @@ class ChangeDestinationSource { */ inline LDK::CResult_CVec_u8ZNoneZ get_change_destination_script(); }; +class ChangeDestinationSourceSyncWrapper { +private: + LDKChangeDestinationSourceSyncWrapper self; +public: + ChangeDestinationSourceSyncWrapper(const ChangeDestinationSourceSyncWrapper&) = delete; + ChangeDestinationSourceSyncWrapper(ChangeDestinationSourceSyncWrapper&& o) : self(o.self) { memset(&o, 0, sizeof(ChangeDestinationSourceSyncWrapper)); } + ChangeDestinationSourceSyncWrapper(LDKChangeDestinationSourceSyncWrapper&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChangeDestinationSourceSyncWrapper)); } + operator LDKChangeDestinationSourceSyncWrapper() && { LDKChangeDestinationSourceSyncWrapper res = self; memset(&self, 0, sizeof(LDKChangeDestinationSourceSyncWrapper)); return res; } + ~ChangeDestinationSourceSyncWrapper() { ChangeDestinationSourceSyncWrapper_free(self); } + ChangeDestinationSourceSyncWrapper& operator=(ChangeDestinationSourceSyncWrapper&& o) { ChangeDestinationSourceSyncWrapper_free(self); self = o.self; memset(&o, 0, sizeof(ChangeDestinationSourceSyncWrapper)); return *this; } + LDKChangeDestinationSourceSyncWrapper* operator &() { return &self; } + LDKChangeDestinationSourceSyncWrapper* operator ->() { return &self; } + const LDKChangeDestinationSourceSyncWrapper* operator &() const { return &self; } + const LDKChangeDestinationSourceSyncWrapper* operator ->() const { return &self; } +}; class InMemorySigner { private: LDKInMemorySigner self; @@ -1726,7 +1875,7 @@ class Router { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); + inline LDK::CResult_RouteStrZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); /** * Finds a [`Route`] for a payment between the given `payer` and a payee. * @@ -1738,13 +1887,13 @@ class Router { * * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_RouteLightningErrorZ find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + inline LDK::CResult_RouteStrZ find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); /** * Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` * are assumed to be with the `recipient`'s peers. The payment secret and any constraints are * given in `tlvs`. */ - inline LDK::CResult_CVec_BlindedPaymentPathZNoneZ create_blinded_payment_paths(struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats); + inline LDK::CResult_CVec_BlindedPaymentPathZNoneZ create_blinded_payment_paths(struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, struct LDKCOption_u64Z amount_msats); }; class ScorerAccountingForInFlightHtlcs { private: @@ -1791,6 +1940,21 @@ class RouteHop { const LDKRouteHop* operator &() const { return &self; } const LDKRouteHop* operator ->() const { return &self; } }; +class TrampolineHop { +private: + LDKTrampolineHop self; +public: + TrampolineHop(const TrampolineHop&) = delete; + TrampolineHop(TrampolineHop&& o) : self(o.self) { memset(&o, 0, sizeof(TrampolineHop)); } + TrampolineHop(LDKTrampolineHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTrampolineHop)); } + operator LDKTrampolineHop() && { LDKTrampolineHop res = self; memset(&self, 0, sizeof(LDKTrampolineHop)); return res; } + ~TrampolineHop() { TrampolineHop_free(self); } + TrampolineHop& operator=(TrampolineHop&& o) { TrampolineHop_free(self); self = o.self; memset(&o, 0, sizeof(TrampolineHop)); return *this; } + LDKTrampolineHop* operator &() { return &self; } + LDKTrampolineHop* operator ->() { return &self; } + const LDKTrampolineHop* operator &() const { return &self; } + const LDKTrampolineHop* operator ->() const { return &self; } +}; class BlindedTail { private: LDKBlindedTail self; @@ -1866,6 +2030,21 @@ class PaymentParameters { const LDKPaymentParameters* operator &() const { return &self; } const LDKPaymentParameters* operator ->() const { return &self; } }; +class RouteParametersConfig { +private: + LDKRouteParametersConfig self; +public: + RouteParametersConfig(const RouteParametersConfig&) = delete; + RouteParametersConfig(RouteParametersConfig&& o) : self(o.self) { memset(&o, 0, sizeof(RouteParametersConfig)); } + RouteParametersConfig(LDKRouteParametersConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouteParametersConfig)); } + operator LDKRouteParametersConfig() && { LDKRouteParametersConfig res = self; memset(&self, 0, sizeof(LDKRouteParametersConfig)); return res; } + ~RouteParametersConfig() { RouteParametersConfig_free(self); } + RouteParametersConfig& operator=(RouteParametersConfig&& o) { RouteParametersConfig_free(self); self = o.self; memset(&o, 0, sizeof(RouteParametersConfig)); return *this; } + LDKRouteParametersConfig* operator &() { return &self; } + LDKRouteParametersConfig* operator ->() { return &self; } + const LDKRouteParametersConfig* operator &() const { return &self; } + const LDKRouteParametersConfig* operator ->() const { return &self; } +}; class Payee { private: LDKPayee self; @@ -1971,81 +2150,6 @@ class CandidateRouteHop { const LDKCandidateRouteHop* operator &() const { return &self; } const LDKCandidateRouteHop* operator ->() const { return &self; } }; -class LSPS0ListProtocolsRequest { -private: - LDKLSPS0ListProtocolsRequest self; -public: - LSPS0ListProtocolsRequest(const LSPS0ListProtocolsRequest&) = delete; - LSPS0ListProtocolsRequest(LSPS0ListProtocolsRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0ListProtocolsRequest)); } - LSPS0ListProtocolsRequest(LDKLSPS0ListProtocolsRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0ListProtocolsRequest)); } - operator LDKLSPS0ListProtocolsRequest() && { LDKLSPS0ListProtocolsRequest res = self; memset(&self, 0, sizeof(LDKLSPS0ListProtocolsRequest)); return res; } - ~LSPS0ListProtocolsRequest() { LSPS0ListProtocolsRequest_free(self); } - LSPS0ListProtocolsRequest& operator=(LSPS0ListProtocolsRequest&& o) { LSPS0ListProtocolsRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0ListProtocolsRequest)); return *this; } - LDKLSPS0ListProtocolsRequest* operator &() { return &self; } - LDKLSPS0ListProtocolsRequest* operator ->() { return &self; } - const LDKLSPS0ListProtocolsRequest* operator &() const { return &self; } - const LDKLSPS0ListProtocolsRequest* operator ->() const { return &self; } -}; -class LSPS0ListProtocolsResponse { -private: - LDKLSPS0ListProtocolsResponse self; -public: - LSPS0ListProtocolsResponse(const LSPS0ListProtocolsResponse&) = delete; - LSPS0ListProtocolsResponse(LSPS0ListProtocolsResponse&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0ListProtocolsResponse)); } - LSPS0ListProtocolsResponse(LDKLSPS0ListProtocolsResponse&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0ListProtocolsResponse)); } - operator LDKLSPS0ListProtocolsResponse() && { LDKLSPS0ListProtocolsResponse res = self; memset(&self, 0, sizeof(LDKLSPS0ListProtocolsResponse)); return res; } - ~LSPS0ListProtocolsResponse() { LSPS0ListProtocolsResponse_free(self); } - LSPS0ListProtocolsResponse& operator=(LSPS0ListProtocolsResponse&& o) { LSPS0ListProtocolsResponse_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0ListProtocolsResponse)); return *this; } - LDKLSPS0ListProtocolsResponse* operator &() { return &self; } - LDKLSPS0ListProtocolsResponse* operator ->() { return &self; } - const LDKLSPS0ListProtocolsResponse* operator &() const { return &self; } - const LDKLSPS0ListProtocolsResponse* operator ->() const { return &self; } -}; -class LSPS0Request { -private: - LDKLSPS0Request self; -public: - LSPS0Request(const LSPS0Request&) = delete; - LSPS0Request(LSPS0Request&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0Request)); } - LSPS0Request(LDKLSPS0Request&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0Request)); } - operator LDKLSPS0Request() && { LDKLSPS0Request res = self; memset(&self, 0, sizeof(LDKLSPS0Request)); return res; } - ~LSPS0Request() { LSPS0Request_free(self); } - LSPS0Request& operator=(LSPS0Request&& o) { LSPS0Request_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0Request)); return *this; } - LDKLSPS0Request* operator &() { return &self; } - LDKLSPS0Request* operator ->() { return &self; } - const LDKLSPS0Request* operator &() const { return &self; } - const LDKLSPS0Request* operator ->() const { return &self; } -}; -class LSPS0Response { -private: - LDKLSPS0Response self; -public: - LSPS0Response(const LSPS0Response&) = delete; - LSPS0Response(LSPS0Response&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0Response)); } - LSPS0Response(LDKLSPS0Response&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0Response)); } - operator LDKLSPS0Response() && { LDKLSPS0Response res = self; memset(&self, 0, sizeof(LDKLSPS0Response)); return res; } - ~LSPS0Response() { LSPS0Response_free(self); } - LSPS0Response& operator=(LSPS0Response&& o) { LSPS0Response_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0Response)); return *this; } - LDKLSPS0Response* operator &() { return &self; } - LDKLSPS0Response* operator ->() { return &self; } - const LDKLSPS0Response* operator &() const { return &self; } - const LDKLSPS0Response* operator ->() const { return &self; } -}; -class LSPS0Message { -private: - LDKLSPS0Message self; -public: - LSPS0Message(const LSPS0Message&) = delete; - LSPS0Message(LSPS0Message&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0Message)); } - LSPS0Message(LDKLSPS0Message&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0Message)); } - operator LDKLSPS0Message() && { LDKLSPS0Message res = self; memset(&self, 0, sizeof(LDKLSPS0Message)); return res; } - ~LSPS0Message() { LSPS0Message_free(self); } - LSPS0Message& operator=(LSPS0Message&& o) { LSPS0Message_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0Message)); return *this; } - LDKLSPS0Message* operator &() { return &self; } - LDKLSPS0Message* operator ->() { return &self; } - const LDKLSPS0Message* operator &() const { return &self; } - const LDKLSPS0Message* operator ->() const { return &self; } -}; class UntrustedString { private: LDKUntrustedString self; @@ -2283,6 +2387,21 @@ class ProbabilisticScorer { const LDKProbabilisticScorer* operator &() const { return &self; } const LDKProbabilisticScorer* operator ->() const { return &self; } }; +class ChannelLiquidities { +private: + LDKChannelLiquidities self; +public: + ChannelLiquidities(const ChannelLiquidities&) = delete; + ChannelLiquidities(ChannelLiquidities&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelLiquidities)); } + ChannelLiquidities(LDKChannelLiquidities&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelLiquidities)); } + operator LDKChannelLiquidities() && { LDKChannelLiquidities res = self; memset(&self, 0, sizeof(LDKChannelLiquidities)); return res; } + ~ChannelLiquidities() { ChannelLiquidities_free(self); } + ChannelLiquidities& operator=(ChannelLiquidities&& o) { ChannelLiquidities_free(self); self = o.self; memset(&o, 0, sizeof(ChannelLiquidities)); return *this; } + LDKChannelLiquidities* operator &() { return &self; } + LDKChannelLiquidities* operator ->() { return &self; } + const LDKChannelLiquidities* operator &() const { return &self; } + const LDKChannelLiquidities* operator ->() const { return &self; } +}; class ProbabilisticScoringFeeParameters { private: LDKProbabilisticScoringFeeParameters self; @@ -2313,6 +2432,21 @@ class ProbabilisticScoringDecayParameters { const LDKProbabilisticScoringDecayParameters* operator &() const { return &self; } const LDKProbabilisticScoringDecayParameters* operator ->() const { return &self; } }; +class CombinedScorer { +private: + LDKCombinedScorer self; +public: + CombinedScorer(const CombinedScorer&) = delete; + CombinedScorer(CombinedScorer&& o) : self(o.self) { memset(&o, 0, sizeof(CombinedScorer)); } + CombinedScorer(LDKCombinedScorer&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCombinedScorer)); } + operator LDKCombinedScorer() && { LDKCombinedScorer res = self; memset(&self, 0, sizeof(LDKCombinedScorer)); return res; } + ~CombinedScorer() { CombinedScorer_free(self); } + CombinedScorer& operator=(CombinedScorer&& o) { CombinedScorer_free(self); self = o.self; memset(&o, 0, sizeof(CombinedScorer)); return *this; } + LDKCombinedScorer* operator &() { return &self; } + LDKCombinedScorer* operator ->() { return &self; } + const LDKCombinedScorer* operator &() const { return &self; } + const LDKCombinedScorer* operator ->() const { return &self; } +}; class BestBlock { private: LDKBestBlock self; @@ -2352,9 +2486,14 @@ class Listen { */ inline void block_connected(struct LDKu8slice block, uint32_t height); /** - * Notifies the listener that a block was removed at the given height. + * Notifies the listener that one or more blocks were removed in anticipation of a reorg. + * + * The provided [`BestBlock`] is the new best block after disconnecting blocks in the reorg + * but before connecting new ones (i.e. the "fork point" block). For backwards compatibility, + * you may instead walk the chain backwards, calling `blocks_disconnected` for each block + * that is disconnected in a reorg. */ - inline void block_disconnected(const uint8_t (*header)[80], uint32_t height); + inline void blocks_disconnected(struct LDKBestBlock fork_point_block); }; class Confirm { private: @@ -2459,25 +2598,25 @@ class Watch { const LDKWatch* operator &() const { return &self; } const LDKWatch* operator ->() const { return &self; } /** - * Watches a channel identified by `funding_txo` using `monitor`. + * Watches a channel identified by `channel_id` using `monitor`. * * Implementations are responsible for watching the chain for the funding transaction along * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. + * calling [`block_connected`] and [`blocks_disconnected`] on the monitor. * * 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(())` + * If the given `channel_id` 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 + * [`blocks_disconnected`]: channelmonitor::ChannelMonitor::blocks_disconnected */ - inline LDK::CResult_ChannelMonitorUpdateStatusNoneZ watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + inline LDK::CResult_ChannelMonitorUpdateStatusNoneZ watch_channel(struct LDKChannelId channel_id, struct LDKChannelMonitor monitor); /** - * Updates a channel identified by `funding_txo` by applying `update` to its monitor. + * Updates a channel identified by `channel_id` by applying `update` to its monitor. * * Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This * may fail (returning an `Err(())`), in which case this should return @@ -2493,7 +2632,7 @@ class Watch { * * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ - inline LDK::ChannelMonitorUpdateStatus update_channel(struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); + inline LDK::ChannelMonitorUpdateStatus update_channel(struct LDKChannelId channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update); /** * Returns any monitor events since the last call. Subsequent calls must only return new * events. @@ -2559,96 +2698,6 @@ class WatchedOutput { const LDKWatchedOutput* operator &() const { return &self; } const LDKWatchedOutput* operator ->() const { return &self; } }; -class LSPS1ClientConfig { -private: - LDKLSPS1ClientConfig self; -public: - LSPS1ClientConfig(const LSPS1ClientConfig&) = delete; - LSPS1ClientConfig(LSPS1ClientConfig&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1ClientConfig)); } - LSPS1ClientConfig(LDKLSPS1ClientConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1ClientConfig)); } - operator LDKLSPS1ClientConfig() && { LDKLSPS1ClientConfig res = self; memset(&self, 0, sizeof(LDKLSPS1ClientConfig)); return res; } - ~LSPS1ClientConfig() { LSPS1ClientConfig_free(self); } - LSPS1ClientConfig& operator=(LSPS1ClientConfig&& o) { LSPS1ClientConfig_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1ClientConfig)); return *this; } - LDKLSPS1ClientConfig* operator &() { return &self; } - LDKLSPS1ClientConfig* operator ->() { return &self; } - const LDKLSPS1ClientConfig* operator &() const { return &self; } - const LDKLSPS1ClientConfig* operator ->() const { return &self; } -}; -class LSPS1ClientHandler { -private: - LDKLSPS1ClientHandler self; -public: - LSPS1ClientHandler(const LSPS1ClientHandler&) = delete; - LSPS1ClientHandler(LSPS1ClientHandler&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1ClientHandler)); } - LSPS1ClientHandler(LDKLSPS1ClientHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1ClientHandler)); } - operator LDKLSPS1ClientHandler() && { LDKLSPS1ClientHandler res = self; memset(&self, 0, sizeof(LDKLSPS1ClientHandler)); return res; } - ~LSPS1ClientHandler() { LSPS1ClientHandler_free(self); } - LSPS1ClientHandler& operator=(LSPS1ClientHandler&& o) { LSPS1ClientHandler_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1ClientHandler)); return *this; } - LDKLSPS1ClientHandler* operator &() { return &self; } - LDKLSPS1ClientHandler* operator ->() { return &self; } - const LDKLSPS1ClientHandler* operator &() const { return &self; } - const LDKLSPS1ClientHandler* operator ->() const { return &self; } -}; -class LSPS2ClientConfig { -private: - LDKLSPS2ClientConfig self; -public: - LSPS2ClientConfig(const LSPS2ClientConfig&) = delete; - LSPS2ClientConfig(LSPS2ClientConfig&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ClientConfig)); } - LSPS2ClientConfig(LDKLSPS2ClientConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ClientConfig)); } - operator LDKLSPS2ClientConfig() && { LDKLSPS2ClientConfig res = self; memset(&self, 0, sizeof(LDKLSPS2ClientConfig)); return res; } - ~LSPS2ClientConfig() { LSPS2ClientConfig_free(self); } - LSPS2ClientConfig& operator=(LSPS2ClientConfig&& o) { LSPS2ClientConfig_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ClientConfig)); return *this; } - LDKLSPS2ClientConfig* operator &() { return &self; } - LDKLSPS2ClientConfig* operator ->() { return &self; } - const LDKLSPS2ClientConfig* operator &() const { return &self; } - const LDKLSPS2ClientConfig* operator ->() const { return &self; } -}; -class LSPS2ClientHandler { -private: - LDKLSPS2ClientHandler self; -public: - LSPS2ClientHandler(const LSPS2ClientHandler&) = delete; - LSPS2ClientHandler(LSPS2ClientHandler&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ClientHandler)); } - LSPS2ClientHandler(LDKLSPS2ClientHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ClientHandler)); } - operator LDKLSPS2ClientHandler() && { LDKLSPS2ClientHandler res = self; memset(&self, 0, sizeof(LDKLSPS2ClientHandler)); return res; } - ~LSPS2ClientHandler() { LSPS2ClientHandler_free(self); } - LSPS2ClientHandler& operator=(LSPS2ClientHandler&& o) { LSPS2ClientHandler_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ClientHandler)); return *this; } - LDKLSPS2ClientHandler* operator &() { return &self; } - LDKLSPS2ClientHandler* operator ->() { return &self; } - const LDKLSPS2ClientHandler* operator &() const { return &self; } - const LDKLSPS2ClientHandler* operator ->() const { return &self; } -}; -class LSPS2ClientEvent { -private: - LDKLSPS2ClientEvent self; -public: - LSPS2ClientEvent(const LSPS2ClientEvent&) = delete; - LSPS2ClientEvent(LSPS2ClientEvent&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ClientEvent)); } - LSPS2ClientEvent(LDKLSPS2ClientEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ClientEvent)); } - operator LDKLSPS2ClientEvent() && { LDKLSPS2ClientEvent res = self; memset(&self, 0, sizeof(LDKLSPS2ClientEvent)); return res; } - ~LSPS2ClientEvent() { LSPS2ClientEvent_free(self); } - LSPS2ClientEvent& operator=(LSPS2ClientEvent&& o) { LSPS2ClientEvent_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ClientEvent)); return *this; } - LDKLSPS2ClientEvent* operator &() { return &self; } - LDKLSPS2ClientEvent* operator ->() { return &self; } - const LDKLSPS2ClientEvent* operator &() const { return &self; } - const LDKLSPS2ClientEvent* operator ->() const { return &self; } -}; -class LSPS2ServiceEvent { -private: - LDKLSPS2ServiceEvent self; -public: - LSPS2ServiceEvent(const LSPS2ServiceEvent&) = delete; - LSPS2ServiceEvent(LSPS2ServiceEvent&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ServiceEvent)); } - LSPS2ServiceEvent(LDKLSPS2ServiceEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ServiceEvent)); } - operator LDKLSPS2ServiceEvent() && { LDKLSPS2ServiceEvent res = self; memset(&self, 0, sizeof(LDKLSPS2ServiceEvent)); return res; } - ~LSPS2ServiceEvent() { LSPS2ServiceEvent_free(self); } - LSPS2ServiceEvent& operator=(LSPS2ServiceEvent&& o) { LSPS2ServiceEvent_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ServiceEvent)); return *this; } - LDKLSPS2ServiceEvent* operator &() { return &self; } - LDKLSPS2ServiceEvent* operator ->() { return &self; } - const LDKLSPS2ServiceEvent* operator &() const { return &self; } - const LDKLSPS2ServiceEvent* operator ->() const { return &self; } -}; class OfferId { private: LDKOfferId self; @@ -2694,6 +2743,21 @@ class OfferWithDerivedMetadataBuilder { const LDKOfferWithDerivedMetadataBuilder* operator &() const { return &self; } const LDKOfferWithDerivedMetadataBuilder* operator ->() const { return &self; } }; +class OfferFromHrn { +private: + LDKOfferFromHrn self; +public: + OfferFromHrn(const OfferFromHrn&) = delete; + OfferFromHrn(OfferFromHrn&& o) : self(o.self) { memset(&o, 0, sizeof(OfferFromHrn)); } + OfferFromHrn(LDKOfferFromHrn&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOfferFromHrn)); } + operator LDKOfferFromHrn() && { LDKOfferFromHrn res = self; memset(&self, 0, sizeof(LDKOfferFromHrn)); return res; } + ~OfferFromHrn() { OfferFromHrn_free(self); } + OfferFromHrn& operator=(OfferFromHrn&& o) { OfferFromHrn_free(self); self = o.self; memset(&o, 0, sizeof(OfferFromHrn)); return *this; } + LDKOfferFromHrn* operator &() { return &self; } + LDKOfferFromHrn* operator ->() { return &self; } + const LDKOfferFromHrn* operator &() const { return &self; } + const LDKOfferFromHrn* operator ->() const { return &self; } +}; class Offer { private: LDKOffer self; @@ -2724,6 +2788,21 @@ class Amount { const LDKAmount* operator &() const { return &self; } const LDKAmount* operator ->() const { return &self; } }; +class CurrencyCode { +private: + LDKCurrencyCode self; +public: + CurrencyCode(const CurrencyCode&) = delete; + CurrencyCode(CurrencyCode&& o) : self(o.self) { memset(&o, 0, sizeof(CurrencyCode)); } + CurrencyCode(LDKCurrencyCode&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCurrencyCode)); } + operator LDKCurrencyCode() && { LDKCurrencyCode res = self; memset(&self, 0, sizeof(LDKCurrencyCode)); return res; } + ~CurrencyCode() { CurrencyCode_free(self); } + CurrencyCode& operator=(CurrencyCode&& o) { CurrencyCode_free(self); self = o.self; memset(&o, 0, sizeof(CurrencyCode)); return *this; } + LDKCurrencyCode* operator &() { return &self; } + LDKCurrencyCode* operator ->() { return &self; } + const LDKCurrencyCode* operator &() const { return &self; } + const LDKCurrencyCode* operator ->() const { return &self; } +}; class Quantity { private: LDKQuantity self; @@ -2739,6 +2818,251 @@ class Quantity { const LDKQuantity* operator &() const { return &self; } const LDKQuantity* operator ->() const { return &self; } }; +class CurrencyCodeError { +private: + LDKCurrencyCodeError self; +public: + CurrencyCodeError(const CurrencyCodeError&) = delete; + CurrencyCodeError(CurrencyCodeError&& o) : self(o.self) { memset(&o, 0, sizeof(CurrencyCodeError)); } + CurrencyCodeError(LDKCurrencyCodeError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCurrencyCodeError)); } + operator LDKCurrencyCodeError() && { LDKCurrencyCodeError res = self; memset(&self, 0, sizeof(LDKCurrencyCodeError)); return res; } + ~CurrencyCodeError() { CurrencyCodeError_free(self); } + CurrencyCodeError& operator=(CurrencyCodeError&& o) { CurrencyCodeError_free(self); self = o.self; memset(&o, 0, sizeof(CurrencyCodeError)); return *this; } + LDKCurrencyCodeError* operator &() { return &self; } + LDKCurrencyCodeError* operator ->() { return &self; } + const LDKCurrencyCodeError* operator &() const { return &self; } + const LDKCurrencyCodeError* operator ->() const { return &self; } +}; +class AnchorDescriptor { +private: + LDKAnchorDescriptor self; +public: + AnchorDescriptor(const AnchorDescriptor&) = delete; + AnchorDescriptor(AnchorDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(AnchorDescriptor)); } + AnchorDescriptor(LDKAnchorDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAnchorDescriptor)); } + operator LDKAnchorDescriptor() && { LDKAnchorDescriptor res = self; memset(&self, 0, sizeof(LDKAnchorDescriptor)); return res; } + ~AnchorDescriptor() { AnchorDescriptor_free(self); } + AnchorDescriptor& operator=(AnchorDescriptor&& o) { AnchorDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(AnchorDescriptor)); return *this; } + LDKAnchorDescriptor* operator &() { return &self; } + LDKAnchorDescriptor* operator ->() { return &self; } + const LDKAnchorDescriptor* operator &() const { return &self; } + const LDKAnchorDescriptor* operator ->() const { return &self; } +}; +class BumpTransactionEvent { +private: + LDKBumpTransactionEvent self; +public: + BumpTransactionEvent(const BumpTransactionEvent&) = delete; + BumpTransactionEvent(BumpTransactionEvent&& o) : self(o.self) { memset(&o, 0, sizeof(BumpTransactionEvent)); } + BumpTransactionEvent(LDKBumpTransactionEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBumpTransactionEvent)); } + operator LDKBumpTransactionEvent() && { LDKBumpTransactionEvent res = self; memset(&self, 0, sizeof(LDKBumpTransactionEvent)); return res; } + ~BumpTransactionEvent() { BumpTransactionEvent_free(self); } + BumpTransactionEvent& operator=(BumpTransactionEvent&& o) { BumpTransactionEvent_free(self); self = o.self; memset(&o, 0, sizeof(BumpTransactionEvent)); return *this; } + LDKBumpTransactionEvent* operator &() { return &self; } + LDKBumpTransactionEvent* operator ->() { return &self; } + const LDKBumpTransactionEvent* operator &() const { return &self; } + const LDKBumpTransactionEvent* operator ->() const { return &self; } +}; +class Input { +private: + LDKInput self; +public: + Input(const Input&) = delete; + Input(Input&& o) : self(o.self) { memset(&o, 0, sizeof(Input)); } + Input(LDKInput&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInput)); } + operator LDKInput() && { LDKInput res = self; memset(&self, 0, sizeof(LDKInput)); return res; } + ~Input() { Input_free(self); } + Input& operator=(Input&& o) { Input_free(self); self = o.self; memset(&o, 0, sizeof(Input)); return *this; } + LDKInput* operator &() { return &self; } + LDKInput* operator ->() { return &self; } + const LDKInput* operator &() const { return &self; } + const LDKInput* operator ->() const { return &self; } +}; +class Utxo { +private: + LDKUtxo self; +public: + Utxo(const Utxo&) = delete; + Utxo(Utxo&& o) : self(o.self) { memset(&o, 0, sizeof(Utxo)); } + Utxo(LDKUtxo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxo)); } + operator LDKUtxo() && { LDKUtxo res = self; memset(&self, 0, sizeof(LDKUtxo)); return res; } + ~Utxo() { Utxo_free(self); } + Utxo& operator=(Utxo&& o) { Utxo_free(self); self = o.self; memset(&o, 0, sizeof(Utxo)); return *this; } + LDKUtxo* operator &() { return &self; } + LDKUtxo* operator ->() { return &self; } + const LDKUtxo* operator &() const { return &self; } + const LDKUtxo* operator ->() const { return &self; } +}; +class CoinSelection { +private: + LDKCoinSelection self; +public: + CoinSelection(const CoinSelection&) = delete; + CoinSelection(CoinSelection&& o) : self(o.self) { memset(&o, 0, sizeof(CoinSelection)); } + CoinSelection(LDKCoinSelection&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCoinSelection)); } + operator LDKCoinSelection() && { LDKCoinSelection res = self; memset(&self, 0, sizeof(LDKCoinSelection)); return res; } + ~CoinSelection() { CoinSelection_free(self); } + CoinSelection& operator=(CoinSelection&& o) { CoinSelection_free(self); self = o.self; memset(&o, 0, sizeof(CoinSelection)); return *this; } + LDKCoinSelection* operator &() { return &self; } + LDKCoinSelection* operator ->() { return &self; } + const LDKCoinSelection* operator &() const { return &self; } + const LDKCoinSelection* operator ->() const { return &self; } +}; +class ShortChannelIdError { +private: + LDKShortChannelIdError self; +public: + ShortChannelIdError(const ShortChannelIdError&) = delete; + ShortChannelIdError(ShortChannelIdError&& o) : self(o.self) { memset(&o, 0, sizeof(ShortChannelIdError)); } + ShortChannelIdError(LDKShortChannelIdError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKShortChannelIdError)); } + operator LDKShortChannelIdError() && { LDKShortChannelIdError res = self; memset(&self, 0, sizeof(LDKShortChannelIdError)); return res; } + ShortChannelIdError& operator=(ShortChannelIdError&& o) { self = o.self; memset(&o, 0, sizeof(ShortChannelIdError)); return *this; } + LDKShortChannelIdError* operator &() { return &self; } + LDKShortChannelIdError* operator ->() { return &self; } + const LDKShortChannelIdError* operator &() const { return &self; } + const LDKShortChannelIdError* operator ->() const { return &self; } +}; +class InboundHTLCErr { +private: + LDKInboundHTLCErr self; +public: + InboundHTLCErr(const InboundHTLCErr&) = delete; + InboundHTLCErr(InboundHTLCErr&& o) : self(o.self) { memset(&o, 0, sizeof(InboundHTLCErr)); } + InboundHTLCErr(LDKInboundHTLCErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInboundHTLCErr)); } + operator LDKInboundHTLCErr() && { LDKInboundHTLCErr res = self; memset(&self, 0, sizeof(LDKInboundHTLCErr)); return res; } + ~InboundHTLCErr() { InboundHTLCErr_free(self); } + InboundHTLCErr& operator=(InboundHTLCErr&& o) { InboundHTLCErr_free(self); self = o.self; memset(&o, 0, sizeof(InboundHTLCErr)); return *this; } + LDKInboundHTLCErr* operator &() { return &self; } + LDKInboundHTLCErr* operator ->() { return &self; } + const LDKInboundHTLCErr* operator &() const { return &self; } + const LDKInboundHTLCErr* operator ->() const { return &self; } +}; +class WalletSourceSync { +private: + LDKWalletSourceSync self; +public: + WalletSourceSync(const WalletSourceSync&) = delete; + WalletSourceSync(WalletSourceSync&& o) : self(o.self) { memset(&o, 0, sizeof(WalletSourceSync)); } + WalletSourceSync(LDKWalletSourceSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWalletSourceSync)); } + operator LDKWalletSourceSync() && { LDKWalletSourceSync res = self; memset(&self, 0, sizeof(LDKWalletSourceSync)); return res; } + ~WalletSourceSync() { WalletSourceSync_free(self); } + WalletSourceSync& operator=(WalletSourceSync&& o) { WalletSourceSync_free(self); self = o.self; memset(&o, 0, sizeof(WalletSourceSync)); return *this; } + LDKWalletSourceSync* operator &() { return &self; } + LDKWalletSourceSync* operator ->() { return &self; } + const LDKWalletSourceSync* operator &() const { return &self; } + const LDKWalletSourceSync* operator ->() const { return &self; } + /** + * Returns all UTXOs, with at least 1 confirmation each, that are available to spend. + */ + inline LDK::CResult_CVec_UtxoZNoneZ list_confirmed_utxos(); + /** + * Returns a script to use for change above dust resulting from a successful coin selection + * attempt. + */ + 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 + * [`WalletSource::list_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. + * + * [`TxIn::script_sig`]: bitcoin::TxIn::script_sig + * [`TxIn::witness`]: bitcoin::TxIn::witness + */ + inline LDK::CResult_TransactionNoneZ sign_psbt(struct LDKCVec_u8Z psbt); +}; +class WalletSync { +private: + LDKWalletSync self; +public: + WalletSync(const WalletSync&) = delete; + WalletSync(WalletSync&& o) : self(o.self) { memset(&o, 0, sizeof(WalletSync)); } + WalletSync(LDKWalletSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWalletSync)); } + operator LDKWalletSync() && { LDKWalletSync res = self; memset(&self, 0, sizeof(LDKWalletSync)); return res; } + ~WalletSync() { WalletSync_free(self); } + WalletSync& operator=(WalletSync&& o) { WalletSync_free(self); self = o.self; memset(&o, 0, sizeof(WalletSync)); return *this; } + LDKWalletSync* operator &() { return &self; } + LDKWalletSync* operator ->() { return &self; } + const LDKWalletSync* operator &() const { return &self; } + const LDKWalletSync* operator ->() const { return &self; } +}; +class CoinSelectionSourceSync { +private: + LDKCoinSelectionSourceSync self; +public: + CoinSelectionSourceSync(const CoinSelectionSourceSync&) = delete; + CoinSelectionSourceSync(CoinSelectionSourceSync&& o) : self(o.self) { memset(&o, 0, sizeof(CoinSelectionSourceSync)); } + CoinSelectionSourceSync(LDKCoinSelectionSourceSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCoinSelectionSourceSync)); } + operator LDKCoinSelectionSourceSync() && { LDKCoinSelectionSourceSync res = self; memset(&self, 0, sizeof(LDKCoinSelectionSourceSync)); return res; } + ~CoinSelectionSourceSync() { CoinSelectionSourceSync_free(self); } + CoinSelectionSourceSync& operator=(CoinSelectionSourceSync&& o) { CoinSelectionSourceSync_free(self); self = o.self; memset(&o, 0, sizeof(CoinSelectionSourceSync)); return *this; } + LDKCoinSelectionSourceSync* operator &() { return &self; } + LDKCoinSelectionSourceSync* operator ->() { return &self; } + const LDKCoinSelectionSourceSync* operator &() const { return &self; } + const LDKCoinSelectionSourceSync* operator ->() const { return &self; } + /** + * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are + * available to spend. Implementations are free to pick their coin selection algorithm of + * choice, as long as the following requirements are met: + * + * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction + * throughout coin selection, but must not be returned as part of the result. + * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction + * throughout coin selection. In some cases, like when funding an anchor transaction, this + * set is empty. Implementations should ensure they handle this correctly on their end, + * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be + * provided, in which case a zero-value empty OP_RETURN output can be used instead. + * 3. Enough inputs must be selected/contributed for the resulting transaction (including the + * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. + * 4. The final transaction must have a weight smaller than `max_tx_weight`; if this + * constraint can't be met, return an `Err`. In the case of counterparty-signed HTLC + * transactions, we will remove a chunk of HTLCs and try your algorithm again. As for + * anchor transactions, we will try your coin selection again with the same input-output + * set when you call [`ChannelMonitor::rebroadcast_pending_claims`], as anchor transactions + * cannot be downsized. + * + * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of + * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require + * providing the full input weight. Failing to do so may lead to underestimating fee bumps and + * delaying block inclusion. + * + * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they + * can be re-used within new fee-bumped iterations of the original claiming transaction, + * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a + * transaction associated with it, and all of the available UTXOs have already been assigned to + * other claims, implementations must be willing to double spend their UTXOs. The choice of + * which UTXOs to double spend is left to the implementation, but it must strive to keep the + * set of other claims being double spent to a minimum. + * + * [`ChannelMonitor::rebroadcast_pending_claims`]: crate::chain::channelmonitor::ChannelMonitor::rebroadcast_pending_claims + */ + inline LDK::CResult_CoinSelectionNoneZ select_confirmed_utxos(struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight, uint64_t max_tx_weight); + /** + * Signs and provides the full witness for all inputs within the transaction known to the + * trait (i.e., any provided via [`CoinSelectionSourceSync::select_confirmed_utxos`]). + * + * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + * unsigned transaction and then sign it with your wallet. + */ + inline LDK::CResult_TransactionNoneZ sign_psbt(struct LDKCVec_u8Z psbt); +}; +class BumpTransactionEventHandlerSync { +private: + LDKBumpTransactionEventHandlerSync self; +public: + BumpTransactionEventHandlerSync(const BumpTransactionEventHandlerSync&) = delete; + BumpTransactionEventHandlerSync(BumpTransactionEventHandlerSync&& o) : self(o.self) { memset(&o, 0, sizeof(BumpTransactionEventHandlerSync)); } + BumpTransactionEventHandlerSync(LDKBumpTransactionEventHandlerSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBumpTransactionEventHandlerSync)); } + operator LDKBumpTransactionEventHandlerSync() && { LDKBumpTransactionEventHandlerSync res = self; memset(&self, 0, sizeof(LDKBumpTransactionEventHandlerSync)); return res; } + ~BumpTransactionEventHandlerSync() { BumpTransactionEventHandlerSync_free(self); } + BumpTransactionEventHandlerSync& operator=(BumpTransactionEventHandlerSync&& o) { BumpTransactionEventHandlerSync_free(self); self = o.self; memset(&o, 0, sizeof(BumpTransactionEventHandlerSync)); return *this; } + LDKBumpTransactionEventHandlerSync* operator &() { return &self; } + LDKBumpTransactionEventHandlerSync* operator ->() { return &self; } + const LDKBumpTransactionEventHandlerSync* operator &() const { return &self; } + const LDKBumpTransactionEventHandlerSync* operator ->() const { return &self; } +}; class NodeId { private: LDKNodeId self; @@ -2934,228 +3258,9 @@ class NodeInfo { const LDKNodeInfo* operator &() const { return &self; } const LDKNodeInfo* operator ->() const { return &self; } }; -class ShortChannelIdError { +class PendingHTLCRouting { private: - LDKShortChannelIdError self; -public: - ShortChannelIdError(const ShortChannelIdError&) = delete; - ShortChannelIdError(ShortChannelIdError&& o) : self(o.self) { memset(&o, 0, sizeof(ShortChannelIdError)); } - ShortChannelIdError(LDKShortChannelIdError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKShortChannelIdError)); } - operator LDKShortChannelIdError() && { LDKShortChannelIdError res = self; memset(&self, 0, sizeof(LDKShortChannelIdError)); return res; } - ShortChannelIdError& operator=(ShortChannelIdError&& o) { self = o.self; memset(&o, 0, sizeof(ShortChannelIdError)); return *this; } - LDKShortChannelIdError* operator &() { return &self; } - LDKShortChannelIdError* operator ->() { return &self; } - const LDKShortChannelIdError* operator &() const { return &self; } - const LDKShortChannelIdError* operator ->() const { return &self; } -}; -class InboundHTLCErr { -private: - LDKInboundHTLCErr self; -public: - InboundHTLCErr(const InboundHTLCErr&) = delete; - InboundHTLCErr(InboundHTLCErr&& o) : self(o.self) { memset(&o, 0, sizeof(InboundHTLCErr)); } - InboundHTLCErr(LDKInboundHTLCErr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInboundHTLCErr)); } - operator LDKInboundHTLCErr() && { LDKInboundHTLCErr res = self; memset(&self, 0, sizeof(LDKInboundHTLCErr)); return res; } - ~InboundHTLCErr() { InboundHTLCErr_free(self); } - InboundHTLCErr& operator=(InboundHTLCErr&& o) { InboundHTLCErr_free(self); self = o.self; memset(&o, 0, sizeof(InboundHTLCErr)); return *this; } - LDKInboundHTLCErr* operator &() { return &self; } - LDKInboundHTLCErr* operator ->() { return &self; } - const LDKInboundHTLCErr* operator &() const { return &self; } - const LDKInboundHTLCErr* operator ->() const { return &self; } -}; -class AnchorDescriptor { -private: - LDKAnchorDescriptor self; -public: - AnchorDescriptor(const AnchorDescriptor&) = delete; - AnchorDescriptor(AnchorDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(AnchorDescriptor)); } - AnchorDescriptor(LDKAnchorDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAnchorDescriptor)); } - operator LDKAnchorDescriptor() && { LDKAnchorDescriptor res = self; memset(&self, 0, sizeof(LDKAnchorDescriptor)); return res; } - ~AnchorDescriptor() { AnchorDescriptor_free(self); } - AnchorDescriptor& operator=(AnchorDescriptor&& o) { AnchorDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(AnchorDescriptor)); return *this; } - LDKAnchorDescriptor* operator &() { return &self; } - LDKAnchorDescriptor* operator ->() { return &self; } - const LDKAnchorDescriptor* operator &() const { return &self; } - const LDKAnchorDescriptor* operator ->() const { return &self; } -}; -class BumpTransactionEvent { -private: - LDKBumpTransactionEvent self; -public: - BumpTransactionEvent(const BumpTransactionEvent&) = delete; - BumpTransactionEvent(BumpTransactionEvent&& o) : self(o.self) { memset(&o, 0, sizeof(BumpTransactionEvent)); } - BumpTransactionEvent(LDKBumpTransactionEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBumpTransactionEvent)); } - operator LDKBumpTransactionEvent() && { LDKBumpTransactionEvent res = self; memset(&self, 0, sizeof(LDKBumpTransactionEvent)); return res; } - ~BumpTransactionEvent() { BumpTransactionEvent_free(self); } - BumpTransactionEvent& operator=(BumpTransactionEvent&& o) { BumpTransactionEvent_free(self); self = o.self; memset(&o, 0, sizeof(BumpTransactionEvent)); return *this; } - LDKBumpTransactionEvent* operator &() { return &self; } - LDKBumpTransactionEvent* operator ->() { return &self; } - const LDKBumpTransactionEvent* operator &() const { return &self; } - const LDKBumpTransactionEvent* operator ->() const { return &self; } -}; -class Input { -private: - LDKInput self; -public: - Input(const Input&) = delete; - Input(Input&& o) : self(o.self) { memset(&o, 0, sizeof(Input)); } - Input(LDKInput&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInput)); } - operator LDKInput() && { LDKInput res = self; memset(&self, 0, sizeof(LDKInput)); return res; } - ~Input() { Input_free(self); } - Input& operator=(Input&& o) { Input_free(self); self = o.self; memset(&o, 0, sizeof(Input)); return *this; } - LDKInput* operator &() { return &self; } - LDKInput* operator ->() { return &self; } - const LDKInput* operator &() const { return &self; } - const LDKInput* operator ->() const { return &self; } -}; -class Utxo { -private: - LDKUtxo self; -public: - Utxo(const Utxo&) = delete; - Utxo(Utxo&& o) : self(o.self) { memset(&o, 0, sizeof(Utxo)); } - Utxo(LDKUtxo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxo)); } - operator LDKUtxo() && { LDKUtxo res = self; memset(&self, 0, sizeof(LDKUtxo)); return res; } - ~Utxo() { Utxo_free(self); } - Utxo& operator=(Utxo&& o) { Utxo_free(self); self = o.self; memset(&o, 0, sizeof(Utxo)); return *this; } - LDKUtxo* operator &() { return &self; } - LDKUtxo* operator ->() { return &self; } - const LDKUtxo* operator &() const { return &self; } - const LDKUtxo* operator ->() const { return &self; } -}; -class CoinSelection { -private: - LDKCoinSelection self; -public: - CoinSelection(const CoinSelection&) = delete; - CoinSelection(CoinSelection&& o) : self(o.self) { memset(&o, 0, sizeof(CoinSelection)); } - CoinSelection(LDKCoinSelection&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCoinSelection)); } - operator LDKCoinSelection() && { LDKCoinSelection res = self; memset(&self, 0, sizeof(LDKCoinSelection)); return res; } - ~CoinSelection() { CoinSelection_free(self); } - CoinSelection& operator=(CoinSelection&& o) { CoinSelection_free(self); self = o.self; memset(&o, 0, sizeof(CoinSelection)); return *this; } - LDKCoinSelection* operator &() { return &self; } - LDKCoinSelection* operator ->() { return &self; } - const LDKCoinSelection* operator &() const { return &self; } - const LDKCoinSelection* operator ->() const { return &self; } -}; -class CoinSelectionSource { -private: - LDKCoinSelectionSource self; -public: - CoinSelectionSource(const CoinSelectionSource&) = delete; - CoinSelectionSource(CoinSelectionSource&& o) : self(o.self) { memset(&o, 0, sizeof(CoinSelectionSource)); } - CoinSelectionSource(LDKCoinSelectionSource&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCoinSelectionSource)); } - operator LDKCoinSelectionSource() && { LDKCoinSelectionSource res = self; memset(&self, 0, sizeof(LDKCoinSelectionSource)); return res; } - ~CoinSelectionSource() { CoinSelectionSource_free(self); } - CoinSelectionSource& operator=(CoinSelectionSource&& o) { CoinSelectionSource_free(self); self = o.self; memset(&o, 0, sizeof(CoinSelectionSource)); return *this; } - LDKCoinSelectionSource* operator &() { return &self; } - LDKCoinSelectionSource* operator ->() { return &self; } - const LDKCoinSelectionSource* operator &() const { return &self; } - const LDKCoinSelectionSource* operator ->() const { return &self; } - /** - * Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are - * available to spend. Implementations are free to pick their coin selection algorithm of - * choice, as long as the following requirements are met: - * - * 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction - * throughout coin selection, but must not be returned as part of the result. - * 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction - * throughout coin selection. In some cases, like when funding an anchor transaction, this - * set is empty. Implementations should ensure they handle this correctly on their end, - * e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be - * provided, in which case a zero-value empty OP_RETURN output can be used instead. - * 3. Enough inputs must be selected/contributed for the resulting transaction (including the - * inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. - * - * Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of - * the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require - * providing the full input weight. Failing to do so may lead to underestimating fee bumps and - * delaying block inclusion. - * - * The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they - * can be re-used within new fee-bumped iterations of the original claiming transaction, - * ensuring that claims don't double spend each other. If a specific `claim_id` has never had a - * transaction associated with it, and all of the available UTXOs have already been assigned to - * other claims, implementations must be willing to double spend their UTXOs. The choice of - * which UTXOs to double spend is left to the implementation, but it must strive to keep the - * set of other claims being double spent to a minimum. - */ - inline LDK::CResult_CoinSelectionNoneZ select_confirmed_utxos(struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight); - /** - * Signs and provides the full witness for all inputs within the transaction known to the - * trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). - * - * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - * unsigned transaction and then sign it with your wallet. - */ - inline LDK::CResult_TransactionNoneZ sign_psbt(struct LDKCVec_u8Z psbt); -}; -class WalletSource { -private: - LDKWalletSource self; -public: - WalletSource(const WalletSource&) = delete; - WalletSource(WalletSource&& o) : self(o.self) { memset(&o, 0, sizeof(WalletSource)); } - WalletSource(LDKWalletSource&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWalletSource)); } - operator LDKWalletSource() && { LDKWalletSource res = self; memset(&self, 0, sizeof(LDKWalletSource)); return res; } - ~WalletSource() { WalletSource_free(self); } - WalletSource& operator=(WalletSource&& o) { WalletSource_free(self); self = o.self; memset(&o, 0, sizeof(WalletSource)); return *this; } - LDKWalletSource* operator &() { return &self; } - LDKWalletSource* operator ->() { return &self; } - const LDKWalletSource* operator &() const { return &self; } - const LDKWalletSource* operator ->() const { return &self; } - /** - * Returns all UTXOs, with at least 1 confirmation each, that are available to spend. - */ - inline LDK::CResult_CVec_UtxoZNoneZ list_confirmed_utxos(); - /** - * Returns a script to use for change above dust resulting from a successful coin selection - * attempt. - */ - 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 - * [`WalletSource::list_confirmed_utxos`]). - * - * If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - * unsigned transaction and then sign it with your wallet. - */ - inline LDK::CResult_TransactionNoneZ sign_psbt(struct LDKCVec_u8Z psbt); -}; -class Wallet { -private: - LDKWallet self; -public: - Wallet(const Wallet&) = delete; - Wallet(Wallet&& o) : self(o.self) { memset(&o, 0, sizeof(Wallet)); } - Wallet(LDKWallet&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKWallet)); } - operator LDKWallet() && { LDKWallet res = self; memset(&self, 0, sizeof(LDKWallet)); return res; } - ~Wallet() { Wallet_free(self); } - Wallet& operator=(Wallet&& o) { Wallet_free(self); self = o.self; memset(&o, 0, sizeof(Wallet)); return *this; } - LDKWallet* operator &() { return &self; } - LDKWallet* operator ->() { return &self; } - const LDKWallet* operator &() const { return &self; } - const LDKWallet* operator ->() const { return &self; } -}; -class BumpTransactionEventHandler { -private: - LDKBumpTransactionEventHandler self; -public: - BumpTransactionEventHandler(const BumpTransactionEventHandler&) = delete; - BumpTransactionEventHandler(BumpTransactionEventHandler&& o) : self(o.self) { memset(&o, 0, sizeof(BumpTransactionEventHandler)); } - BumpTransactionEventHandler(LDKBumpTransactionEventHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBumpTransactionEventHandler)); } - operator LDKBumpTransactionEventHandler() && { LDKBumpTransactionEventHandler res = self; memset(&self, 0, sizeof(LDKBumpTransactionEventHandler)); return res; } - ~BumpTransactionEventHandler() { BumpTransactionEventHandler_free(self); } - BumpTransactionEventHandler& operator=(BumpTransactionEventHandler&& o) { BumpTransactionEventHandler_free(self); self = o.self; memset(&o, 0, sizeof(BumpTransactionEventHandler)); return *this; } - LDKBumpTransactionEventHandler* operator &() { return &self; } - LDKBumpTransactionEventHandler* operator ->() { return &self; } - const LDKBumpTransactionEventHandler* operator &() const { return &self; } - const LDKBumpTransactionEventHandler* operator ->() const { return &self; } -}; -class PendingHTLCRouting { -private: - LDKPendingHTLCRouting self; + LDKPendingHTLCRouting self; public: PendingHTLCRouting(const PendingHTLCRouting&) = delete; PendingHTLCRouting(PendingHTLCRouting&& o) : self(o.self) { memset(&o, 0, sizeof(PendingHTLCRouting)); } @@ -3236,6 +3341,21 @@ class Verification { */ inline LDK::CResult_NoneNoneZ verify_for_offer_payment(struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); }; +class OptionalOfferPaymentParams { +private: + LDKOptionalOfferPaymentParams self; +public: + OptionalOfferPaymentParams(const OptionalOfferPaymentParams&) = delete; + OptionalOfferPaymentParams(OptionalOfferPaymentParams&& o) : self(o.self) { memset(&o, 0, sizeof(OptionalOfferPaymentParams)); } + OptionalOfferPaymentParams(LDKOptionalOfferPaymentParams&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOptionalOfferPaymentParams)); } + operator LDKOptionalOfferPaymentParams() && { LDKOptionalOfferPaymentParams res = self; memset(&self, 0, sizeof(LDKOptionalOfferPaymentParams)); return res; } + ~OptionalOfferPaymentParams() { OptionalOfferPaymentParams_free(self); } + OptionalOfferPaymentParams& operator=(OptionalOfferPaymentParams&& o) { OptionalOfferPaymentParams_free(self); self = o.self; memset(&o, 0, sizeof(OptionalOfferPaymentParams)); return *this; } + LDKOptionalOfferPaymentParams* operator &() { return &self; } + LDKOptionalOfferPaymentParams* operator ->() { return &self; } + const LDKOptionalOfferPaymentParams* operator &() const { return &self; } + const LDKOptionalOfferPaymentParams* operator ->() const { return &self; } +}; class FailureCode { private: LDKFailureCode self; @@ -3341,6 +3461,36 @@ class ChannelManagerReadArgs { const LDKChannelManagerReadArgs* operator &() const { return &self; } const LDKChannelManagerReadArgs* 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 SignError { +private: + LDKSignError self; +public: + SignError(const SignError&) = delete; + SignError(SignError&& o) : self(o.self) { memset(&o, 0, sizeof(SignError)); } + SignError(LDKSignError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignError)); } + operator LDKSignError() && { LDKSignError res = self; memset(&self, 0, sizeof(LDKSignError)); return res; } + ~SignError() { SignError_free(self); } + SignError& operator=(SignError&& o) { SignError_free(self); self = o.self; memset(&o, 0, sizeof(SignError)); return *this; } + LDKSignError* operator &() { return &self; } + LDKSignError* operator ->() { return &self; } + const LDKSignError* operator &() const { return &self; } + const LDKSignError* operator ->() const { return &self; } +}; class ChannelHandshakeConfig { private: LDKChannelHandshakeConfig self; @@ -3431,6 +3581,36 @@ class UserConfig { const LDKUserConfig* operator &() const { return &self; } const LDKUserConfig* operator ->() const { return &self; } }; +class ChannelConfigOverrides { +private: + LDKChannelConfigOverrides self; +public: + ChannelConfigOverrides(const ChannelConfigOverrides&) = delete; + ChannelConfigOverrides(ChannelConfigOverrides&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelConfigOverrides)); } + ChannelConfigOverrides(LDKChannelConfigOverrides&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelConfigOverrides)); } + operator LDKChannelConfigOverrides() && { LDKChannelConfigOverrides res = self; memset(&self, 0, sizeof(LDKChannelConfigOverrides)); return res; } + ~ChannelConfigOverrides() { ChannelConfigOverrides_free(self); } + ChannelConfigOverrides& operator=(ChannelConfigOverrides&& o) { ChannelConfigOverrides_free(self); self = o.self; memset(&o, 0, sizeof(ChannelConfigOverrides)); return *this; } + LDKChannelConfigOverrides* operator &() { return &self; } + LDKChannelConfigOverrides* operator ->() { return &self; } + const LDKChannelConfigOverrides* operator &() const { return &self; } + const LDKChannelConfigOverrides* operator ->() const { return &self; } +}; +class ChannelHandshakeConfigUpdate { +private: + LDKChannelHandshakeConfigUpdate self; +public: + ChannelHandshakeConfigUpdate(const ChannelHandshakeConfigUpdate&) = delete; + ChannelHandshakeConfigUpdate(ChannelHandshakeConfigUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelHandshakeConfigUpdate)); } + ChannelHandshakeConfigUpdate(LDKChannelHandshakeConfigUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelHandshakeConfigUpdate)); } + operator LDKChannelHandshakeConfigUpdate() && { LDKChannelHandshakeConfigUpdate res = self; memset(&self, 0, sizeof(LDKChannelHandshakeConfigUpdate)); return res; } + ~ChannelHandshakeConfigUpdate() { ChannelHandshakeConfigUpdate_free(self); } + ChannelHandshakeConfigUpdate& operator=(ChannelHandshakeConfigUpdate&& o) { ChannelHandshakeConfigUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ChannelHandshakeConfigUpdate)); return *this; } + LDKChannelHandshakeConfigUpdate* operator &() { return &self; } + LDKChannelHandshakeConfigUpdate* operator ->() { return &self; } + const LDKChannelHandshakeConfigUpdate* operator &() const { return &self; } + const LDKChannelHandshakeConfigUpdate* operator ->() const { return &self; } +}; class APIError { private: LDKAPIError self; @@ -3446,35 +3626,35 @@ class APIError { const LDKAPIError* operator &() const { return &self; } const LDKAPIError* operator ->() const { return &self; } }; -class TaggedHash { +class DecryptedOurPeerStorage { private: - LDKTaggedHash self; + LDKDecryptedOurPeerStorage 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; } + DecryptedOurPeerStorage(const DecryptedOurPeerStorage&) = delete; + DecryptedOurPeerStorage(DecryptedOurPeerStorage&& o) : self(o.self) { memset(&o, 0, sizeof(DecryptedOurPeerStorage)); } + DecryptedOurPeerStorage(LDKDecryptedOurPeerStorage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDecryptedOurPeerStorage)); } + operator LDKDecryptedOurPeerStorage() && { LDKDecryptedOurPeerStorage res = self; memset(&self, 0, sizeof(LDKDecryptedOurPeerStorage)); return res; } + ~DecryptedOurPeerStorage() { DecryptedOurPeerStorage_free(self); } + DecryptedOurPeerStorage& operator=(DecryptedOurPeerStorage&& o) { DecryptedOurPeerStorage_free(self); self = o.self; memset(&o, 0, sizeof(DecryptedOurPeerStorage)); return *this; } + LDKDecryptedOurPeerStorage* operator &() { return &self; } + LDKDecryptedOurPeerStorage* operator ->() { return &self; } + const LDKDecryptedOurPeerStorage* operator &() const { return &self; } + const LDKDecryptedOurPeerStorage* operator ->() const { return &self; } }; -class SignError { +class EncryptedOurPeerStorage { private: - LDKSignError self; + LDKEncryptedOurPeerStorage self; public: - SignError(const SignError&) = delete; - SignError(SignError&& o) : self(o.self) { memset(&o, 0, sizeof(SignError)); } - SignError(LDKSignError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignError)); } - operator LDKSignError() && { LDKSignError res = self; memset(&self, 0, sizeof(LDKSignError)); return res; } - ~SignError() { SignError_free(self); } - SignError& operator=(SignError&& o) { SignError_free(self); self = o.self; memset(&o, 0, sizeof(SignError)); return *this; } - LDKSignError* operator &() { return &self; } - LDKSignError* operator ->() { return &self; } - const LDKSignError* operator &() const { return &self; } - const LDKSignError* operator ->() const { return &self; } + EncryptedOurPeerStorage(const EncryptedOurPeerStorage&) = delete; + EncryptedOurPeerStorage(EncryptedOurPeerStorage&& o) : self(o.self) { memset(&o, 0, sizeof(EncryptedOurPeerStorage)); } + EncryptedOurPeerStorage(LDKEncryptedOurPeerStorage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKEncryptedOurPeerStorage)); } + operator LDKEncryptedOurPeerStorage() && { LDKEncryptedOurPeerStorage res = self; memset(&self, 0, sizeof(LDKEncryptedOurPeerStorage)); return res; } + ~EncryptedOurPeerStorage() { EncryptedOurPeerStorage_free(self); } + EncryptedOurPeerStorage& operator=(EncryptedOurPeerStorage&& o) { EncryptedOurPeerStorage_free(self); self = o.self; memset(&o, 0, sizeof(EncryptedOurPeerStorage)); return *this; } + LDKEncryptedOurPeerStorage* operator &() { return &self; } + LDKEncryptedOurPeerStorage* operator ->() { return &self; } + const LDKEncryptedOurPeerStorage* operator &() const { return &self; } + const LDKEncryptedOurPeerStorage* operator ->() const { return &self; } }; class EcdsaChannelSigner { private: @@ -3490,6 +3670,21 @@ class EcdsaChannelSigner { LDKEcdsaChannelSigner* operator ->() { return &self; } const LDKEcdsaChannelSigner* operator &() const { return &self; } const LDKEcdsaChannelSigner* operator ->() const { return &self; } +}; +class BaseEcdsaChannelSigner { +private: + LDKBaseEcdsaChannelSigner self; +public: + BaseEcdsaChannelSigner(const BaseEcdsaChannelSigner&) = delete; + BaseEcdsaChannelSigner(BaseEcdsaChannelSigner&& o) : self(o.self) { memset(&o, 0, sizeof(BaseEcdsaChannelSigner)); } + BaseEcdsaChannelSigner(LDKBaseEcdsaChannelSigner&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBaseEcdsaChannelSigner)); } + operator LDKBaseEcdsaChannelSigner() && { LDKBaseEcdsaChannelSigner res = self; memset(&self, 0, sizeof(LDKBaseEcdsaChannelSigner)); return res; } + ~BaseEcdsaChannelSigner() { BaseEcdsaChannelSigner_free(self); } + BaseEcdsaChannelSigner& operator=(BaseEcdsaChannelSigner&& o) { BaseEcdsaChannelSigner_free(self); self = o.self; memset(&o, 0, sizeof(BaseEcdsaChannelSigner)); return *this; } + LDKBaseEcdsaChannelSigner* operator &() { return &self; } + LDKBaseEcdsaChannelSigner* operator ->() { return &self; } + const LDKBaseEcdsaChannelSigner* operator &() const { return &self; } + const LDKBaseEcdsaChannelSigner* operator ->() const { return &self; } /** * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * @@ -3510,7 +3705,7 @@ class EcdsaChannelSigner { * * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ - inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); + inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** * Creates a signature for a holder's commitment transaction. * @@ -3530,7 +3725,7 @@ class EcdsaChannelSigner { * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - inline LDK::CResult_ECDSASignatureNoneZ sign_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + inline LDK::CResult_ECDSASignatureNoneZ sign_holder_commitment(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. @@ -3555,7 +3750,7 @@ class EcdsaChannelSigner { * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - 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]); + inline LDK::CResult_ECDSASignatureNoneZ sign_justice_revoked_output(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. @@ -3584,7 +3779,7 @@ class EcdsaChannelSigner { * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - 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); + inline LDK::CResult_ECDSASignatureNoneZ sign_justice_revoked_htlc(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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 @@ -3632,7 +3827,7 @@ class EcdsaChannelSigner { * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - 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); + inline LDK::CResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. * @@ -3645,9 +3840,9 @@ class EcdsaChannelSigner { * * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ - inline LDK::CResult_ECDSASignatureNoneZ sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + inline LDK::CResult_ECDSASignatureNoneZ sign_closing_transaction(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** - * Computes the signature for a commitment transaction's anchor output used as an + * Computes the signature for a commitment transaction's keyed anchor output used as an * input within `anchor_tx`, which spends the commitment transaction, at index `input`. * * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid @@ -3658,7 +3853,7 @@ class EcdsaChannelSigner { * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ - inline LDK::CResult_ECDSASignatureNoneZ sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input); + inline LDK::CResult_ECDSASignatureNoneZ sign_holder_keyed_anchor_input(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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. @@ -3672,52 +3867,66 @@ class EcdsaChannelSigner { * * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message */ - inline LDK::CResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + inline LDK::CResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** - * Signs the input of a splicing funding transaction with our funding key. + * Signs the shared input of a splice transaction with our funding key. * * In splicing, the previous funding transaction output is spent as the input of * the new funding transaction, and is a 2-of-2 multisig. * + * `channel_parameters`: The [`ChannelTransactionParameters`] for the channel's current funding + * transaction that is being spent in the splice transaction to sign. A new set of + * [`ChannelTransactionParameters`] will become available for the new funding transaction. + * * `input_index`: The index of the input within the new funding transaction `tx`, * spending the previous funding transaction's output - * - * `input_value`: The value of the previous funding transaction output. - * - * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately - * closed. */ - inline LDK::CResult_ECDSASignatureNoneZ sign_splicing_funding_input(struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value); -}; -class LSPS2ServiceConfig { -private: - LDKLSPS2ServiceConfig self; -public: - LSPS2ServiceConfig(const LSPS2ServiceConfig&) = delete; - LSPS2ServiceConfig(LSPS2ServiceConfig&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ServiceConfig)); } - LSPS2ServiceConfig(LDKLSPS2ServiceConfig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ServiceConfig)); } - operator LDKLSPS2ServiceConfig() && { LDKLSPS2ServiceConfig res = self; memset(&self, 0, sizeof(LDKLSPS2ServiceConfig)); return res; } - ~LSPS2ServiceConfig() { LSPS2ServiceConfig_free(self); } - LSPS2ServiceConfig& operator=(LSPS2ServiceConfig&& o) { LSPS2ServiceConfig_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ServiceConfig)); return *this; } - LDKLSPS2ServiceConfig* operator &() { return &self; } - LDKLSPS2ServiceConfig* operator ->() { return &self; } - const LDKLSPS2ServiceConfig* operator &() const { return &self; } - const LDKLSPS2ServiceConfig* operator ->() const { return &self; } -}; -class LSPS2ServiceHandler { -private: - LDKLSPS2ServiceHandler self; -public: - LSPS2ServiceHandler(const LSPS2ServiceHandler&) = delete; - LSPS2ServiceHandler(LSPS2ServiceHandler&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2ServiceHandler)); } - LSPS2ServiceHandler(LDKLSPS2ServiceHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2ServiceHandler)); } - operator LDKLSPS2ServiceHandler() && { LDKLSPS2ServiceHandler res = self; memset(&self, 0, sizeof(LDKLSPS2ServiceHandler)); return res; } - ~LSPS2ServiceHandler() { LSPS2ServiceHandler_free(self); } - LSPS2ServiceHandler& operator=(LSPS2ServiceHandler&& o) { LSPS2ServiceHandler_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2ServiceHandler)); return *this; } - LDKLSPS2ServiceHandler* operator &() { return &self; } - LDKLSPS2ServiceHandler* operator ->() { return &self; } - const LDKLSPS2ServiceHandler* operator &() const { return &self; } - const LDKLSPS2ServiceHandler* operator ->() const { return &self; } + inline LDK::ECDSASignature sign_splice_shared_input(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction tx, uintptr_t input_index); +}; +class OffersMessageFlow { +private: + LDKOffersMessageFlow self; +public: + OffersMessageFlow(const OffersMessageFlow&) = delete; + OffersMessageFlow(OffersMessageFlow&& o) : self(o.self) { memset(&o, 0, sizeof(OffersMessageFlow)); } + OffersMessageFlow(LDKOffersMessageFlow&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOffersMessageFlow)); } + operator LDKOffersMessageFlow() && { LDKOffersMessageFlow res = self; memset(&self, 0, sizeof(LDKOffersMessageFlow)); return res; } + ~OffersMessageFlow() { OffersMessageFlow_free(self); } + OffersMessageFlow& operator=(OffersMessageFlow&& o) { OffersMessageFlow_free(self); self = o.self; memset(&o, 0, sizeof(OffersMessageFlow)); return *this; } + LDKOffersMessageFlow* operator &() { return &self; } + LDKOffersMessageFlow* operator ->() { return &self; } + const LDKOffersMessageFlow* operator &() const { return &self; } + const LDKOffersMessageFlow* operator ->() const { return &self; } +}; +class InvreqResponseInstructions { +private: + LDKInvreqResponseInstructions self; +public: + InvreqResponseInstructions(const InvreqResponseInstructions&) = delete; + InvreqResponseInstructions(InvreqResponseInstructions&& o) : self(o.self) { memset(&o, 0, sizeof(InvreqResponseInstructions)); } + InvreqResponseInstructions(LDKInvreqResponseInstructions&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvreqResponseInstructions)); } + operator LDKInvreqResponseInstructions() && { LDKInvreqResponseInstructions res = self; memset(&self, 0, sizeof(LDKInvreqResponseInstructions)); return res; } + ~InvreqResponseInstructions() { InvreqResponseInstructions_free(self); } + InvreqResponseInstructions& operator=(InvreqResponseInstructions&& o) { InvreqResponseInstructions_free(self); self = o.self; memset(&o, 0, sizeof(InvreqResponseInstructions)); return *this; } + LDKInvreqResponseInstructions* operator &() { return &self; } + LDKInvreqResponseInstructions* operator ->() { return &self; } + const LDKInvreqResponseInstructions* operator &() const { return &self; } + const LDKInvreqResponseInstructions* operator ->() const { return &self; } +}; +class HeldHtlcReplyPath { +private: + LDKHeldHtlcReplyPath self; +public: + HeldHtlcReplyPath(const HeldHtlcReplyPath&) = delete; + HeldHtlcReplyPath(HeldHtlcReplyPath&& o) : self(o.self) { memset(&o, 0, sizeof(HeldHtlcReplyPath)); } + HeldHtlcReplyPath(LDKHeldHtlcReplyPath&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHeldHtlcReplyPath)); } + operator LDKHeldHtlcReplyPath() && { LDKHeldHtlcReplyPath res = self; memset(&self, 0, sizeof(LDKHeldHtlcReplyPath)); return res; } + ~HeldHtlcReplyPath() { HeldHtlcReplyPath_free(self); } + HeldHtlcReplyPath& operator=(HeldHtlcReplyPath&& o) { HeldHtlcReplyPath_free(self); self = o.self; memset(&o, 0, sizeof(HeldHtlcReplyPath)); return *this; } + LDKHeldHtlcReplyPath* operator &() { return &self; } + LDKHeldHtlcReplyPath* operator ->() { return &self; } + const LDKHeldHtlcReplyPath* operator &() const { return &self; } + const LDKHeldHtlcReplyPath* operator ->() const { return &self; } }; class ChannelMonitorUpdate { private: @@ -3778,6 +3987,21 @@ class BalanceSource { const LDKBalanceSource* operator &() const { return &self; } const LDKBalanceSource* operator ->() const { return &self; } }; +class HolderCommitmentTransactionBalance { +private: + LDKHolderCommitmentTransactionBalance self; +public: + HolderCommitmentTransactionBalance(const HolderCommitmentTransactionBalance&) = delete; + HolderCommitmentTransactionBalance(HolderCommitmentTransactionBalance&& o) : self(o.self) { memset(&o, 0, sizeof(HolderCommitmentTransactionBalance)); } + HolderCommitmentTransactionBalance(LDKHolderCommitmentTransactionBalance&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHolderCommitmentTransactionBalance)); } + operator LDKHolderCommitmentTransactionBalance() && { LDKHolderCommitmentTransactionBalance res = self; memset(&self, 0, sizeof(LDKHolderCommitmentTransactionBalance)); return res; } + ~HolderCommitmentTransactionBalance() { HolderCommitmentTransactionBalance_free(self); } + HolderCommitmentTransactionBalance& operator=(HolderCommitmentTransactionBalance&& o) { HolderCommitmentTransactionBalance_free(self); self = o.self; memset(&o, 0, sizeof(HolderCommitmentTransactionBalance)); return *this; } + LDKHolderCommitmentTransactionBalance* operator &() { return &self; } + LDKHolderCommitmentTransactionBalance* operator ->() { return &self; } + const LDKHolderCommitmentTransactionBalance* operator &() const { return &self; } + const LDKHolderCommitmentTransactionBalance* operator ->() const { return &self; } +}; class Balance { private: LDKBalance self; @@ -3856,9 +4080,11 @@ class CustomMessageHandler { /** * Handle a peer connecting. * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. + * May return an `Err(())` to indicate that we should immediately disconnect from the peer + * (e.g. because the features they support are not sufficient to communicate with us). + * + * Note, of course, that other message handlers may wish to communicate with the peer, which + * disconnecting them will prevent. * * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. */ @@ -3948,17 +4174,16 @@ class SocketDescriptor { * * If the returned size is smaller than `data.len()`, a * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be - * written. Additionally, until a `send_data` event completes fully, no further - * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to - * prevent denial-of-service issues, you should not read or buffer any data from the socket - * until then. + * written. + * + * If `continue_read` is *not* set, further [`PeerManager::read_event`] calls should be + * avoided until another call is made with it set. This allows us to pause read if there are + * too many outgoing messages queued for a peer to avoid DoS issues where a peer fills our + * buffer by sending us messages that need response without reading the responses. * - * If a [`PeerManager::read_event`] call on this descriptor had previously returned true - * (indicating that read events should be paused to prevent DoS in the send buffer), - * `resume_read` may be set indicating that read events on this descriptor should resume. A - * `resume_read` of false carries no meaning, and should not cause any action. + * Note that calls may be made with an empty `data` to update the `continue_read` flag. */ - inline uintptr_t send_data(struct LDKu8slice data, bool resume_read); + inline uintptr_t send_data(struct LDKu8slice data, bool continue_read); /** * Disconnect the socket pointed to by this SocketDescriptor. * @@ -4049,41 +4274,135 @@ class RapidGossipSync { const LDKRapidGossipSync* operator &() const { return &self; } const LDKRapidGossipSync* operator ->() const { return &self; } }; -class LSPS1ClientEvent { +class AsyncReceiveOfferCache { private: - LDKLSPS1ClientEvent self; + LDKAsyncReceiveOfferCache self; public: - LSPS1ClientEvent(const LSPS1ClientEvent&) = delete; - LSPS1ClientEvent(LSPS1ClientEvent&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1ClientEvent)); } - LSPS1ClientEvent(LDKLSPS1ClientEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1ClientEvent)); } - operator LDKLSPS1ClientEvent() && { LDKLSPS1ClientEvent res = self; memset(&self, 0, sizeof(LDKLSPS1ClientEvent)); return res; } - ~LSPS1ClientEvent() { LSPS1ClientEvent_free(self); } - LSPS1ClientEvent& operator=(LSPS1ClientEvent&& o) { LSPS1ClientEvent_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1ClientEvent)); return *this; } - LDKLSPS1ClientEvent* operator &() { return &self; } - LDKLSPS1ClientEvent* operator ->() { return &self; } - const LDKLSPS1ClientEvent* operator &() const { return &self; } - const LDKLSPS1ClientEvent* operator ->() const { return &self; } + AsyncReceiveOfferCache(const AsyncReceiveOfferCache&) = delete; + AsyncReceiveOfferCache(AsyncReceiveOfferCache&& o) : self(o.self) { memset(&o, 0, sizeof(AsyncReceiveOfferCache)); } + AsyncReceiveOfferCache(LDKAsyncReceiveOfferCache&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAsyncReceiveOfferCache)); } + operator LDKAsyncReceiveOfferCache() && { LDKAsyncReceiveOfferCache res = self; memset(&self, 0, sizeof(LDKAsyncReceiveOfferCache)); return res; } + ~AsyncReceiveOfferCache() { AsyncReceiveOfferCache_free(self); } + AsyncReceiveOfferCache& operator=(AsyncReceiveOfferCache&& o) { AsyncReceiveOfferCache_free(self); self = o.self; memset(&o, 0, sizeof(AsyncReceiveOfferCache)); return *this; } + LDKAsyncReceiveOfferCache* operator &() { return &self; } + LDKAsyncReceiveOfferCache* operator ->() { return &self; } + const LDKAsyncReceiveOfferCache* operator &() const { return &self; } + const LDKAsyncReceiveOfferCache* operator ->() const { return &self; } }; -class KVStore { +class InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { private: - LDKKVStore self; + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder 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`. + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(const InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&) = delete; + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } + operator LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder() && { LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder res = self; memset(&self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return res; } + ~InvoiceRequestWithDerivedPayerSigningPubkeyBuilder() { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); } + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder& operator=(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return *this; } + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() { return &self; } + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() { return &self; } + const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() const { return &self; } + const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() const { return &self; } +}; +class UnsignedInvoiceRequest { +private: + LDKUnsignedInvoiceRequest self; +public: + UnsignedInvoiceRequest(const UnsignedInvoiceRequest&) = delete; + UnsignedInvoiceRequest(UnsignedInvoiceRequest&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedInvoiceRequest)); } + UnsignedInvoiceRequest(LDKUnsignedInvoiceRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedInvoiceRequest)); } + operator LDKUnsignedInvoiceRequest() && { LDKUnsignedInvoiceRequest res = self; memset(&self, 0, sizeof(LDKUnsignedInvoiceRequest)); return res; } + ~UnsignedInvoiceRequest() { UnsignedInvoiceRequest_free(self); } + UnsignedInvoiceRequest& operator=(UnsignedInvoiceRequest&& o) { UnsignedInvoiceRequest_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedInvoiceRequest)); return *this; } + LDKUnsignedInvoiceRequest* operator &() { return &self; } + LDKUnsignedInvoiceRequest* operator ->() { return &self; } + const LDKUnsignedInvoiceRequest* operator &() const { return &self; } + const LDKUnsignedInvoiceRequest* operator ->() const { return &self; } +}; +class SignInvoiceRequestFn { +private: + LDKSignInvoiceRequestFn self; +public: + SignInvoiceRequestFn(const SignInvoiceRequestFn&) = delete; + SignInvoiceRequestFn(SignInvoiceRequestFn&& o) : self(o.self) { memset(&o, 0, sizeof(SignInvoiceRequestFn)); } + SignInvoiceRequestFn(LDKSignInvoiceRequestFn&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignInvoiceRequestFn)); } + operator LDKSignInvoiceRequestFn() && { LDKSignInvoiceRequestFn res = self; memset(&self, 0, sizeof(LDKSignInvoiceRequestFn)); return res; } + ~SignInvoiceRequestFn() { SignInvoiceRequestFn_free(self); } + SignInvoiceRequestFn& operator=(SignInvoiceRequestFn&& o) { SignInvoiceRequestFn_free(self); self = o.self; memset(&o, 0, sizeof(SignInvoiceRequestFn)); return *this; } + LDKSignInvoiceRequestFn* operator &() { return &self; } + LDKSignInvoiceRequestFn* operator ->() { return &self; } + const LDKSignInvoiceRequestFn* operator &() const { return &self; } + const LDKSignInvoiceRequestFn* operator ->() const { return &self; } + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + inline LDK::CResult_SchnorrSignatureNoneZ sign_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message); +}; +class InvoiceRequest { +private: + LDKInvoiceRequest self; +public: + InvoiceRequest(const InvoiceRequest&) = delete; + InvoiceRequest(InvoiceRequest&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequest)); } + InvoiceRequest(LDKInvoiceRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequest)); } + operator LDKInvoiceRequest() && { LDKInvoiceRequest res = self; memset(&self, 0, sizeof(LDKInvoiceRequest)); return res; } + ~InvoiceRequest() { InvoiceRequest_free(self); } + InvoiceRequest& operator=(InvoiceRequest&& o) { InvoiceRequest_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequest)); return *this; } + LDKInvoiceRequest* operator &() { return &self; } + LDKInvoiceRequest* operator ->() { return &self; } + 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 InvoiceRequestFields { +private: + LDKInvoiceRequestFields self; +public: + InvoiceRequestFields(const InvoiceRequestFields&) = delete; + InvoiceRequestFields(InvoiceRequestFields&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestFields)); } + InvoiceRequestFields(LDKInvoiceRequestFields&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestFields)); } + operator LDKInvoiceRequestFields() && { LDKInvoiceRequestFields res = self; memset(&self, 0, sizeof(LDKInvoiceRequestFields)); return res; } + ~InvoiceRequestFields() { InvoiceRequestFields_free(self); } + InvoiceRequestFields& operator=(InvoiceRequestFields&& o) { InvoiceRequestFields_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestFields)); return *this; } + LDKInvoiceRequestFields* operator &() { return &self; } + LDKInvoiceRequestFields* operator ->() { return &self; } + const LDKInvoiceRequestFields* operator &() const { return &self; } + const LDKInvoiceRequestFields* operator ->() const { return &self; } +}; +class KVStoreSync { +private: + LDKKVStoreSync self; +public: + KVStoreSync(const KVStoreSync&) = delete; + KVStoreSync(KVStoreSync&& o) : self(o.self) { memset(&o, 0, sizeof(KVStoreSync)); } + KVStoreSync(LDKKVStoreSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKKVStoreSync)); } + operator LDKKVStoreSync() && { LDKKVStoreSync res = self; memset(&self, 0, sizeof(LDKKVStoreSync)); return res; } + ~KVStoreSync() { KVStoreSync_free(self); } + KVStoreSync& operator=(KVStoreSync&& o) { KVStoreSync_free(self); self = o.self; memset(&o, 0, sizeof(KVStoreSync)); return *this; } + LDKKVStoreSync* operator &() { return &self; } + LDKKVStoreSync* operator ->() { return &self; } + const LDKKVStoreSync* operator &() const { return &self; } + const LDKKVStoreSync* 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 */ @@ -4091,23 +4410,27 @@ class KVStore { /** * Persists the given data under the given `key`. * - * Will create the given `primary_namespace` and `secondary_namespace` if not already present - * in the store. + * 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); + inline LDK::CResult_NoneIOErrorZ write(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKCVec_u8Z 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. + * [`KVStoreSync::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. * + * All removal operations must complete in a consistent total order with [`Self::write`]s + * to the same key. Whether a removal operation is `lazy` or not, [`Self::write`] operations + * to the same key which occur before a removal completes must cancel/overwrite the pending + * removal. + * * 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. @@ -4122,6 +4445,21 @@ class KVStore { */ inline LDK::CResult_CVec_StrZIOErrorZ list(struct LDKStr primary_namespace, struct LDKStr secondary_namespace); }; +class KVStoreSyncWrapper { +private: + LDKKVStoreSyncWrapper self; +public: + KVStoreSyncWrapper(const KVStoreSyncWrapper&) = delete; + KVStoreSyncWrapper(KVStoreSyncWrapper&& o) : self(o.self) { memset(&o, 0, sizeof(KVStoreSyncWrapper)); } + KVStoreSyncWrapper(LDKKVStoreSyncWrapper&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKKVStoreSyncWrapper)); } + operator LDKKVStoreSyncWrapper() && { LDKKVStoreSyncWrapper res = self; memset(&self, 0, sizeof(LDKKVStoreSyncWrapper)); return res; } + ~KVStoreSyncWrapper() { KVStoreSyncWrapper_free(self); } + KVStoreSyncWrapper& operator=(KVStoreSyncWrapper&& o) { KVStoreSyncWrapper_free(self); self = o.self; memset(&o, 0, sizeof(KVStoreSyncWrapper)); return *this; } + LDKKVStoreSyncWrapper* operator &() { return &self; } + LDKKVStoreSyncWrapper* operator ->() { return &self; } + const LDKKVStoreSyncWrapper* operator &() const { return &self; } + const LDKKVStoreSyncWrapper* operator ->() const { return &self; } +}; class MigratableKVStore { private: LDKMigratableKVStore self; @@ -4139,7 +4477,7 @@ class MigratableKVStore { /** * Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. * - * This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] + * This is useful for migrating data from [`KVStoreSync`] implementation to [`KVStoreSync`] * implementation. * * Must exhaustively return all entries known to the store to ensure no data is missed, but @@ -4147,35 +4485,6 @@ class MigratableKVStore { */ inline LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ list_all_keys(); }; -class Persister { -private: - LDKPersister self; -public: - Persister(const Persister&) = delete; - Persister(Persister&& o) : self(o.self) { memset(&o, 0, sizeof(Persister)); } - Persister(LDKPersister&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPersister)); } - operator LDKPersister() && { LDKPersister res = self; memset(&self, 0, sizeof(LDKPersister)); return res; } - ~Persister() { Persister_free(self); } - Persister& operator=(Persister&& o) { Persister_free(self); self = o.self; memset(&o, 0, sizeof(Persister)); return *this; } - LDKPersister* operator &() { return &self; } - LDKPersister* operator ->() { return &self; } - const LDKPersister* operator &() const { return &self; } - const LDKPersister* operator ->() const { return &self; } - /** - * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ - 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_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_NoneIOErrorZ persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer); -}; class MonitorUpdatingPersister { private: LDKMonitorUpdatingPersister self; @@ -4221,100 +4530,6 @@ class UpdateName { const LDKUpdateName* operator &() const { return &self; } const LDKUpdateName* operator ->() const { return &self; } }; -class InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { -private: - LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder self; -public: - InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(const InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&) = delete; - InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } - InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } - operator LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder() && { LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder res = self; memset(&self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return res; } - ~InvoiceRequestWithDerivedPayerSigningPubkeyBuilder() { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); } - InvoiceRequestWithDerivedPayerSigningPubkeyBuilder& operator=(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return *this; } - LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() { return &self; } - LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() { return &self; } - const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() const { return &self; } - const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() const { return &self; } -}; -class UnsignedInvoiceRequest { -private: - LDKUnsignedInvoiceRequest self; -public: - UnsignedInvoiceRequest(const UnsignedInvoiceRequest&) = delete; - UnsignedInvoiceRequest(UnsignedInvoiceRequest&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedInvoiceRequest)); } - UnsignedInvoiceRequest(LDKUnsignedInvoiceRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedInvoiceRequest)); } - operator LDKUnsignedInvoiceRequest() && { LDKUnsignedInvoiceRequest res = self; memset(&self, 0, sizeof(LDKUnsignedInvoiceRequest)); return res; } - ~UnsignedInvoiceRequest() { UnsignedInvoiceRequest_free(self); } - UnsignedInvoiceRequest& operator=(UnsignedInvoiceRequest&& o) { UnsignedInvoiceRequest_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedInvoiceRequest)); return *this; } - LDKUnsignedInvoiceRequest* operator &() { return &self; } - LDKUnsignedInvoiceRequest* operator ->() { return &self; } - const LDKUnsignedInvoiceRequest* operator &() const { return &self; } - const LDKUnsignedInvoiceRequest* operator ->() const { return &self; } -}; -class SignInvoiceRequestFn { -private: - LDKSignInvoiceRequestFn self; -public: - SignInvoiceRequestFn(const SignInvoiceRequestFn&) = delete; - SignInvoiceRequestFn(SignInvoiceRequestFn&& o) : self(o.self) { memset(&o, 0, sizeof(SignInvoiceRequestFn)); } - SignInvoiceRequestFn(LDKSignInvoiceRequestFn&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignInvoiceRequestFn)); } - operator LDKSignInvoiceRequestFn() && { LDKSignInvoiceRequestFn res = self; memset(&self, 0, sizeof(LDKSignInvoiceRequestFn)); return res; } - ~SignInvoiceRequestFn() { SignInvoiceRequestFn_free(self); } - SignInvoiceRequestFn& operator=(SignInvoiceRequestFn&& o) { SignInvoiceRequestFn_free(self); self = o.self; memset(&o, 0, sizeof(SignInvoiceRequestFn)); return *this; } - LDKSignInvoiceRequestFn* operator &() { return &self; } - LDKSignInvoiceRequestFn* operator ->() { return &self; } - const LDKSignInvoiceRequestFn* operator &() const { return &self; } - const LDKSignInvoiceRequestFn* operator ->() const { return &self; } - /** - * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. - */ - inline LDK::CResult_SchnorrSignatureNoneZ sign_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message); -}; -class InvoiceRequest { -private: - LDKInvoiceRequest self; -public: - InvoiceRequest(const InvoiceRequest&) = delete; - InvoiceRequest(InvoiceRequest&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequest)); } - InvoiceRequest(LDKInvoiceRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequest)); } - operator LDKInvoiceRequest() && { LDKInvoiceRequest res = self; memset(&self, 0, sizeof(LDKInvoiceRequest)); return res; } - ~InvoiceRequest() { InvoiceRequest_free(self); } - InvoiceRequest& operator=(InvoiceRequest&& o) { InvoiceRequest_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequest)); return *this; } - LDKInvoiceRequest* operator &() { return &self; } - LDKInvoiceRequest* operator ->() { return &self; } - 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 InvoiceRequestFields { -private: - LDKInvoiceRequestFields self; -public: - InvoiceRequestFields(const InvoiceRequestFields&) = delete; - InvoiceRequestFields(InvoiceRequestFields&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestFields)); } - InvoiceRequestFields(LDKInvoiceRequestFields&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestFields)); } - operator LDKInvoiceRequestFields() && { LDKInvoiceRequestFields res = self; memset(&self, 0, sizeof(LDKInvoiceRequestFields)); return res; } - ~InvoiceRequestFields() { InvoiceRequestFields_free(self); } - InvoiceRequestFields& operator=(InvoiceRequestFields&& o) { InvoiceRequestFields_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestFields)); return *this; } - LDKInvoiceRequestFields* operator &() { return &self; } - LDKInvoiceRequestFields* operator ->() { return &self; } - const LDKInvoiceRequestFields* operator &() const { return &self; } - const LDKInvoiceRequestFields* operator ->() const { return &self; } -}; class DecodeError { private: LDKDecodeError self; @@ -4795,6 +5010,51 @@ class ClosingSigned { const LDKClosingSigned* operator &() const { return &self; } const LDKClosingSigned* operator ->() const { return &self; } }; +class ClosingComplete { +private: + LDKClosingComplete self; +public: + ClosingComplete(const ClosingComplete&) = delete; + ClosingComplete(ClosingComplete&& o) : self(o.self) { memset(&o, 0, sizeof(ClosingComplete)); } + ClosingComplete(LDKClosingComplete&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClosingComplete)); } + operator LDKClosingComplete() && { LDKClosingComplete res = self; memset(&self, 0, sizeof(LDKClosingComplete)); return res; } + ~ClosingComplete() { ClosingComplete_free(self); } + ClosingComplete& operator=(ClosingComplete&& o) { ClosingComplete_free(self); self = o.self; memset(&o, 0, sizeof(ClosingComplete)); return *this; } + LDKClosingComplete* operator &() { return &self; } + LDKClosingComplete* operator ->() { return &self; } + const LDKClosingComplete* operator &() const { return &self; } + const LDKClosingComplete* operator ->() const { return &self; } +}; +class ClosingSig { +private: + LDKClosingSig self; +public: + ClosingSig(const ClosingSig&) = delete; + ClosingSig(ClosingSig&& o) : self(o.self) { memset(&o, 0, sizeof(ClosingSig)); } + ClosingSig(LDKClosingSig&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKClosingSig)); } + operator LDKClosingSig() && { LDKClosingSig res = self; memset(&self, 0, sizeof(LDKClosingSig)); return res; } + ~ClosingSig() { ClosingSig_free(self); } + ClosingSig& operator=(ClosingSig&& o) { ClosingSig_free(self); self = o.self; memset(&o, 0, sizeof(ClosingSig)); return *this; } + LDKClosingSig* operator &() { return &self; } + LDKClosingSig* operator ->() { return &self; } + const LDKClosingSig* operator &() const { return &self; } + const LDKClosingSig* operator ->() const { return &self; } +}; +class StartBatch { +private: + LDKStartBatch self; +public: + StartBatch(const StartBatch&) = delete; + StartBatch(StartBatch&& o) : self(o.self) { memset(&o, 0, sizeof(StartBatch)); } + StartBatch(LDKStartBatch&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKStartBatch)); } + operator LDKStartBatch() && { LDKStartBatch res = self; memset(&self, 0, sizeof(LDKStartBatch)); return res; } + ~StartBatch() { StartBatch_free(self); } + StartBatch& operator=(StartBatch&& o) { StartBatch_free(self); self = o.self; memset(&o, 0, sizeof(StartBatch)); return *this; } + LDKStartBatch* operator &() { return &self; } + LDKStartBatch* operator ->() { return &self; } + const LDKStartBatch* operator &() const { return &self; } + const LDKStartBatch* operator ->() const { return &self; } +}; class UpdateAddHTLC { private: LDKUpdateAddHTLC self; @@ -4840,6 +5100,36 @@ class UpdateFulfillHTLC { const LDKUpdateFulfillHTLC* operator &() const { return &self; } const LDKUpdateFulfillHTLC* operator ->() const { return &self; } }; +class PeerStorage { +private: + LDKPeerStorage self; +public: + PeerStorage(const PeerStorage&) = delete; + PeerStorage(PeerStorage&& o) : self(o.self) { memset(&o, 0, sizeof(PeerStorage)); } + PeerStorage(LDKPeerStorage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerStorage)); } + operator LDKPeerStorage() && { LDKPeerStorage res = self; memset(&self, 0, sizeof(LDKPeerStorage)); return res; } + ~PeerStorage() { PeerStorage_free(self); } + PeerStorage& operator=(PeerStorage&& o) { PeerStorage_free(self); self = o.self; memset(&o, 0, sizeof(PeerStorage)); return *this; } + LDKPeerStorage* operator &() { return &self; } + LDKPeerStorage* operator ->() { return &self; } + const LDKPeerStorage* operator &() const { return &self; } + const LDKPeerStorage* operator ->() const { return &self; } +}; +class PeerStorageRetrieval { +private: + LDKPeerStorageRetrieval self; +public: + PeerStorageRetrieval(const PeerStorageRetrieval&) = delete; + PeerStorageRetrieval(PeerStorageRetrieval&& o) : self(o.self) { memset(&o, 0, sizeof(PeerStorageRetrieval)); } + PeerStorageRetrieval(LDKPeerStorageRetrieval&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerStorageRetrieval)); } + operator LDKPeerStorageRetrieval() && { LDKPeerStorageRetrieval res = self; memset(&self, 0, sizeof(LDKPeerStorageRetrieval)); return res; } + ~PeerStorageRetrieval() { PeerStorageRetrieval_free(self); } + PeerStorageRetrieval& operator=(PeerStorageRetrieval&& o) { PeerStorageRetrieval_free(self); self = o.self; memset(&o, 0, sizeof(PeerStorageRetrieval)); return *this; } + LDKPeerStorageRetrieval* operator &() { return &self; } + LDKPeerStorageRetrieval* operator ->() { return &self; } + const LDKPeerStorageRetrieval* operator &() const { return &self; } + const LDKPeerStorageRetrieval* operator ->() const { return &self; } +}; class UpdateFailHTLC { private: LDKUpdateFailHTLC self; @@ -4870,21 +5160,6 @@ class UpdateFailMalformedHTLC { const LDKUpdateFailMalformedHTLC* operator &() const { return &self; } const LDKUpdateFailMalformedHTLC* operator ->() const { return &self; } }; -class CommitmentSignedBatch { -private: - LDKCommitmentSignedBatch self; -public: - CommitmentSignedBatch(const CommitmentSignedBatch&) = delete; - CommitmentSignedBatch(CommitmentSignedBatch&& o) : self(o.self) { memset(&o, 0, sizeof(CommitmentSignedBatch)); } - CommitmentSignedBatch(LDKCommitmentSignedBatch&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCommitmentSignedBatch)); } - operator LDKCommitmentSignedBatch() && { LDKCommitmentSignedBatch res = self; memset(&self, 0, sizeof(LDKCommitmentSignedBatch)); return res; } - ~CommitmentSignedBatch() { CommitmentSignedBatch_free(self); } - CommitmentSignedBatch& operator=(CommitmentSignedBatch&& o) { CommitmentSignedBatch_free(self); self = o.self; memset(&o, 0, sizeof(CommitmentSignedBatch)); return *this; } - LDKCommitmentSignedBatch* operator &() { return &self; } - LDKCommitmentSignedBatch* operator ->() { return &self; } - const LDKCommitmentSignedBatch* operator &() const { return &self; } - const LDKCommitmentSignedBatch* operator ->() const { return &self; } -}; class CommitmentSigned { private: LDKCommitmentSigned self; @@ -4945,6 +5220,64 @@ class ChannelReestablish { const LDKChannelReestablish* operator &() const { return &self; } const LDKChannelReestablish* operator ->() const { return &self; } }; +class NextFunding { +private: + LDKNextFunding self; +public: + NextFunding(const NextFunding&) = delete; + NextFunding(NextFunding&& o) : self(o.self) { memset(&o, 0, sizeof(NextFunding)); } + NextFunding(LDKNextFunding&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNextFunding)); } + operator LDKNextFunding() && { LDKNextFunding res = self; memset(&self, 0, sizeof(LDKNextFunding)); return res; } + ~NextFunding() { NextFunding_free(self); } + NextFunding& operator=(NextFunding&& o) { NextFunding_free(self); self = o.self; memset(&o, 0, sizeof(NextFunding)); return *this; } + LDKNextFunding* operator &() { return &self; } + LDKNextFunding* operator ->() { return &self; } + const LDKNextFunding* operator &() const { return &self; } + const LDKNextFunding* operator ->() const { return &self; } +}; +class NextFundingFlag { +private: + LDKNextFundingFlag self; +public: + NextFundingFlag(const NextFundingFlag&) = delete; + NextFundingFlag(NextFundingFlag&& o) : self(o.self) { memset(&o, 0, sizeof(NextFundingFlag)); } + NextFundingFlag(LDKNextFundingFlag&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNextFundingFlag)); } + operator LDKNextFundingFlag() && { LDKNextFundingFlag res = self; memset(&self, 0, sizeof(LDKNextFundingFlag)); return res; } + NextFundingFlag& operator=(NextFundingFlag&& o) { self = o.self; memset(&o, 0, sizeof(NextFundingFlag)); return *this; } + LDKNextFundingFlag* operator &() { return &self; } + LDKNextFundingFlag* operator ->() { return &self; } + const LDKNextFundingFlag* operator &() const { return &self; } + const LDKNextFundingFlag* operator ->() const { return &self; } +}; +class FundingLocked { +private: + LDKFundingLocked self; +public: + FundingLocked(const FundingLocked&) = delete; + FundingLocked(FundingLocked&& o) : self(o.self) { memset(&o, 0, sizeof(FundingLocked)); } + FundingLocked(LDKFundingLocked&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingLocked)); } + operator LDKFundingLocked() && { LDKFundingLocked res = self; memset(&self, 0, sizeof(LDKFundingLocked)); return res; } + ~FundingLocked() { FundingLocked_free(self); } + FundingLocked& operator=(FundingLocked&& o) { FundingLocked_free(self); self = o.self; memset(&o, 0, sizeof(FundingLocked)); return *this; } + LDKFundingLocked* operator &() { return &self; } + LDKFundingLocked* operator ->() { return &self; } + const LDKFundingLocked* operator &() const { return &self; } + const LDKFundingLocked* operator ->() const { return &self; } +}; +class FundingLockedFlags { +private: + LDKFundingLockedFlags self; +public: + FundingLockedFlags(const FundingLockedFlags&) = delete; + FundingLockedFlags(FundingLockedFlags&& o) : self(o.self) { memset(&o, 0, sizeof(FundingLockedFlags)); } + FundingLockedFlags(LDKFundingLockedFlags&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingLockedFlags)); } + operator LDKFundingLockedFlags() && { LDKFundingLockedFlags res = self; memset(&self, 0, sizeof(LDKFundingLockedFlags)); return res; } + FundingLockedFlags& operator=(FundingLockedFlags&& o) { self = o.self; memset(&o, 0, sizeof(FundingLockedFlags)); return *this; } + LDKFundingLockedFlags* operator &() { return &self; } + LDKFundingLockedFlags* operator ->() { return &self; } + const LDKFundingLockedFlags* operator &() const { return &self; } + const LDKFundingLockedFlags* operator ->() const { return &self; } +}; class AnnouncementSignatures { private: LDKAnnouncementSignatures self; @@ -5214,31 +5547,96 @@ class CommitmentUpdate { const LDKCommitmentUpdate* operator &() const { return &self; } const LDKCommitmentUpdate* operator ->() const { return &self; } }; -class ChannelMessageHandler { +class MessageSendEvent { private: - LDKChannelMessageHandler self; + LDKMessageSendEvent self; public: - ChannelMessageHandler(const ChannelMessageHandler&) = delete; - ChannelMessageHandler(ChannelMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMessageHandler)); } - ChannelMessageHandler(LDKChannelMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMessageHandler)); } - operator LDKChannelMessageHandler() && { LDKChannelMessageHandler res = self; memset(&self, 0, sizeof(LDKChannelMessageHandler)); return res; } - ~ChannelMessageHandler() { ChannelMessageHandler_free(self); } - ChannelMessageHandler& operator=(ChannelMessageHandler&& o) { ChannelMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMessageHandler)); return *this; } - LDKChannelMessageHandler* operator &() { return &self; } - LDKChannelMessageHandler* operator ->() { return &self; } - const LDKChannelMessageHandler* operator &() const { return &self; } - const LDKChannelMessageHandler* operator ->() const { return &self; } + MessageSendEvent(const MessageSendEvent&) = delete; + MessageSendEvent(MessageSendEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEvent)); } + MessageSendEvent(LDKMessageSendEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEvent)); } + operator LDKMessageSendEvent() && { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; } + ~MessageSendEvent() { MessageSendEvent_free(self); } + MessageSendEvent& operator=(MessageSendEvent&& o) { MessageSendEvent_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEvent)); return *this; } + LDKMessageSendEvent* operator &() { return &self; } + LDKMessageSendEvent* operator ->() { return &self; } + const LDKMessageSendEvent* operator &() const { return &self; } + const LDKMessageSendEvent* operator ->() const { return &self; } +}; +class BaseMessageHandler { +private: + LDKBaseMessageHandler self; +public: + BaseMessageHandler(const BaseMessageHandler&) = delete; + BaseMessageHandler(BaseMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(BaseMessageHandler)); } + BaseMessageHandler(LDKBaseMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBaseMessageHandler)); } + operator LDKBaseMessageHandler() && { LDKBaseMessageHandler res = self; memset(&self, 0, sizeof(LDKBaseMessageHandler)); return res; } + ~BaseMessageHandler() { BaseMessageHandler_free(self); } + BaseMessageHandler& operator=(BaseMessageHandler&& o) { BaseMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(BaseMessageHandler)); return *this; } + LDKBaseMessageHandler* operator &() { return &self; } + LDKBaseMessageHandler* operator ->() { return &self; } + const LDKBaseMessageHandler* operator &() const { return &self; } + const LDKBaseMessageHandler* operator ->() const { return &self; } /** - * Handle an incoming `open_channel` message from the given peer. + * Gets the list of pending events which were generated by previous actions, clearing the list + * in the process. */ - inline void handle_open_channel(struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); + inline LDK::CVec_MessageSendEventZ get_and_clear_pending_msg_events(); /** - * Handle an incoming `open_channel2` message from the given peer. + * Indicates a connection to the peer failed/an existing connection was lost. */ - inline void handle_open_channel_v2(struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); + inline void peer_disconnected(struct LDKPublicKey their_node_id); /** - * Handle an incoming `accept_channel` message from the given peer. - */ + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + inline LDK::NodeFeatures provided_node_features(); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + inline LDK::InitFeatures provided_init_features(struct LDKPublicKey their_node_id); + /** + * Handle a peer (re)connecting. + * + * May return an `Err(())` to indicate that we should immediately disconnect from the peer + * (e.g. because the features they support are not sufficient to communicate with us). + * + * Note, of course, that other message handlers may wish to communicate with the peer, which + * disconnecting them will prevent. + * + * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. + */ + inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); +}; +class ChannelMessageHandler { +private: + LDKChannelMessageHandler self; +public: + ChannelMessageHandler(const ChannelMessageHandler&) = delete; + ChannelMessageHandler(ChannelMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMessageHandler)); } + ChannelMessageHandler(LDKChannelMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMessageHandler)); } + operator LDKChannelMessageHandler() && { LDKChannelMessageHandler res = self; memset(&self, 0, sizeof(LDKChannelMessageHandler)); return res; } + ~ChannelMessageHandler() { ChannelMessageHandler_free(self); } + ChannelMessageHandler& operator=(ChannelMessageHandler&& o) { ChannelMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMessageHandler)); return *this; } + LDKChannelMessageHandler* operator &() { return &self; } + LDKChannelMessageHandler* operator ->() { return &self; } + const LDKChannelMessageHandler* operator &() const { return &self; } + const LDKChannelMessageHandler* operator ->() const { return &self; } + /** + * Handle an incoming `open_channel` message from the given peer. + */ + inline void handle_open_channel(struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg); + /** + * Handle an incoming `open_channel2` message from the given peer. + */ + inline void handle_open_channel_v2(struct LDKPublicKey their_node_id, const struct LDKOpenChannelV2 *NONNULL_PTR msg); + /** + * Handle an incoming `accept_channel` message from the given peer. + */ inline void handle_accept_channel(struct LDKPublicKey their_node_id, const struct LDKAcceptChannel *NONNULL_PTR msg); /** * Handle an incoming `accept_channel2` message from the given peer. @@ -5256,6 +5654,14 @@ class ChannelMessageHandler { * Handle an incoming `channel_ready` message from the given peer. */ inline void handle_channel_ready(struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); + /** + * Handle an incoming `peer_storage` message from the given peer. + */ + inline void handle_peer_storage(struct LDKPublicKey their_node_id, struct LDKPeerStorage msg); + /** + * Handle an incoming `peer_storage_retrieval` message from the given peer. + */ + inline void handle_peer_storage_retrieval(struct LDKPublicKey their_node_id, struct LDKPeerStorageRetrieval msg); /** * Handle an incoming `shutdown` message from the given peer. */ @@ -5268,6 +5674,18 @@ class ChannelMessageHandler { * Handle an incoming `stfu` message from the given peer. */ inline void handle_stfu(struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg); + /** + * Handle an incoming `splice_init` message from the given peer. + */ + inline void handle_splice_init(struct LDKPublicKey their_node_id, const struct LDKSpliceInit *NONNULL_PTR msg); + /** + * Handle an incoming `splice_ack` message from the given peer. + */ + inline void handle_splice_ack(struct LDKPublicKey their_node_id, const struct LDKSpliceAck *NONNULL_PTR msg); + /** + * Handle an incoming `splice_locked` message from the given peer. + */ + inline void handle_splice_locked(struct LDKPublicKey their_node_id, const struct LDKSpliceLocked *NONNULL_PTR msg); /** * Handle an incoming `tx_add_input message` from the given peer. */ @@ -5311,7 +5729,7 @@ class ChannelMessageHandler { /** * Handle an incoming `update_fulfill_htlc` message from the given peer. */ - inline void handle_update_fulfill_htlc(struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg); + inline void handle_update_fulfill_htlc(struct LDKPublicKey their_node_id, struct LDKUpdateFulfillHTLC msg); /** * Handle an incoming `update_fail_htlc` message from the given peer. */ @@ -5324,6 +5742,10 @@ class ChannelMessageHandler { * Handle an incoming `commitment_signed` message from the given peer. */ inline void handle_commitment_signed(struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg); + /** + * Handle a batch of incoming `commitment_signed` message from the given peer. + */ + inline void handle_commitment_signed_batch(struct LDKPublicKey their_node_id, struct LDKChannelId channel_id, struct LDKCVec_CommitmentSignedZ batch); /** * Handle an incoming `revoke_and_ack` message from the given peer. */ @@ -5336,20 +5758,6 @@ class ChannelMessageHandler { * Handle an incoming `announcement_signatures` message from the given peer. */ inline void handle_announcement_signatures(struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg); - /** - * Indicates a connection to the peer failed/an existing connection was lost. - */ - inline void peer_disconnected(struct LDKPublicKey their_node_id); - /** - * Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - * - * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - */ - inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound); /** * Handle an incoming `channel_reestablish` message from the given peer. */ @@ -5362,20 +5770,6 @@ class ChannelMessageHandler { * Handle an incoming `error` message from the given peer. */ inline void handle_error(struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); - /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. - */ - inline LDK::NodeFeatures provided_node_features(); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. - */ - inline LDK::InitFeatures provided_init_features(struct LDKPublicKey their_node_id); /** * Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. * @@ -5450,16 +5844,6 @@ class RoutingMessageHandler { * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ inline LDK::NodeAnnouncement get_next_node_announcement(struct LDKNodeId starting_point); - /** - * Called when a connection is established with a peer. This can be used to - * perform routing table synchronization using a strategy defined by the - * implementor. - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - */ - inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); /** * Handles the reply of a query we initiated to learn about channels * for a given range of blocks. We can expect to receive one or more @@ -5490,20 +5874,6 @@ class RoutingMessageHandler { * [`ChannelAnnouncement`]s. */ inline bool processing_queue_high(); - /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. - */ - inline LDK::NodeFeatures provided_node_features(); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. - */ - inline LDK::InitFeatures provided_init_features(struct LDKPublicKey their_node_id); }; class OnionMessageHandler { private: @@ -5526,44 +5896,32 @@ class OnionMessageHandler { /** * Returns the next pending onion message for the peer with the given node id. * + * Note that onion messages can only be provided upstream via this method and *not* via + * [`BaseMessageHandler::get_and_clear_pending_msg_events`]. + * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ inline LDK::OnionMessage next_onion_message_for_peer(struct LDKPublicKey peer_node_id); - /** - * Called when a connection is established with a peer. Can be used to track which peers - * advertise onion message support and are online. - * - * May return an `Err(())` if the features the peer supports are not sufficient to communicate - * with us. Implementors should be somewhat conservative about doing so, however, as other - * message handlers may still wish to communicate with this peer. - * - * [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - */ - inline LDK::CResult_NoneNoneZ peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound); - /** - * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to - * drop and refuse to forward onion messages to this peer. - */ - inline void peer_disconnected(struct LDKPublicKey their_node_id); /** * Performs actions that should happen roughly every ten seconds after startup. Allows handlers - * to drop any buffered onion messages intended for prospective peers. + * to drop any buffered onion messages intended for prospective peerst. */ inline void timer_tick_occurred(); - /** - * Gets the node feature flags which this handler itself supports. All available handlers are - * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - * which are broadcasted in our [`NodeAnnouncement`] message. - */ - inline LDK::NodeFeatures provided_node_features(); - /** - * Gets the init feature flags which should be sent to the given peer. All available handlers - * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - * which are sent in our [`Init`] message. - * - * Note that this method is called before [`Self::peer_connected`]. - */ - inline LDK::InitFeatures provided_init_features(struct LDKPublicKey their_node_id); +}; +class SendOnlyMessageHandler { +private: + LDKSendOnlyMessageHandler self; +public: + SendOnlyMessageHandler(const SendOnlyMessageHandler&) = delete; + SendOnlyMessageHandler(SendOnlyMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(SendOnlyMessageHandler)); } + SendOnlyMessageHandler(LDKSendOnlyMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSendOnlyMessageHandler)); } + operator LDKSendOnlyMessageHandler() && { LDKSendOnlyMessageHandler res = self; memset(&self, 0, sizeof(LDKSendOnlyMessageHandler)); return res; } + ~SendOnlyMessageHandler() { SendOnlyMessageHandler_free(self); } + SendOnlyMessageHandler& operator=(SendOnlyMessageHandler&& o) { SendOnlyMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(SendOnlyMessageHandler)); return *this; } + LDKSendOnlyMessageHandler* operator &() { return &self; } + LDKSendOnlyMessageHandler* operator ->() { return &self; } + const LDKSendOnlyMessageHandler* operator &() const { return &self; } + const LDKSendOnlyMessageHandler* operator ->() const { return &self; } }; class FinalOnionHopData { private: @@ -5610,274 +5968,6 @@ class TrampolineOnionPacket { const LDKTrampolineOnionPacket* operator &() const { return &self; } const LDKTrampolineOnionPacket* operator ->() const { return &self; } }; -class LSPS1OrderId { -private: - LDKLSPS1OrderId self; -public: - LSPS1OrderId(const LSPS1OrderId&) = delete; - LSPS1OrderId(LSPS1OrderId&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1OrderId)); } - LSPS1OrderId(LDKLSPS1OrderId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1OrderId)); } - operator LDKLSPS1OrderId() && { LDKLSPS1OrderId res = self; memset(&self, 0, sizeof(LDKLSPS1OrderId)); return res; } - ~LSPS1OrderId() { LSPS1OrderId_free(self); } - LSPS1OrderId& operator=(LSPS1OrderId&& o) { LSPS1OrderId_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1OrderId)); return *this; } - LDKLSPS1OrderId* operator &() { return &self; } - LDKLSPS1OrderId* operator ->() { return &self; } - const LDKLSPS1OrderId* operator &() const { return &self; } - const LDKLSPS1OrderId* operator ->() const { return &self; } -}; -class LSPS1GetInfoRequest { -private: - LDKLSPS1GetInfoRequest self; -public: - LSPS1GetInfoRequest(const LSPS1GetInfoRequest&) = delete; - LSPS1GetInfoRequest(LSPS1GetInfoRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1GetInfoRequest)); } - LSPS1GetInfoRequest(LDKLSPS1GetInfoRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1GetInfoRequest)); } - operator LDKLSPS1GetInfoRequest() && { LDKLSPS1GetInfoRequest res = self; memset(&self, 0, sizeof(LDKLSPS1GetInfoRequest)); return res; } - ~LSPS1GetInfoRequest() { LSPS1GetInfoRequest_free(self); } - LSPS1GetInfoRequest& operator=(LSPS1GetInfoRequest&& o) { LSPS1GetInfoRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1GetInfoRequest)); return *this; } - LDKLSPS1GetInfoRequest* operator &() { return &self; } - LDKLSPS1GetInfoRequest* operator ->() { return &self; } - const LDKLSPS1GetInfoRequest* operator &() const { return &self; } - const LDKLSPS1GetInfoRequest* operator ->() const { return &self; } -}; -class LSPS1Options { -private: - LDKLSPS1Options self; -public: - LSPS1Options(const LSPS1Options&) = delete; - LSPS1Options(LSPS1Options&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1Options)); } - LSPS1Options(LDKLSPS1Options&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1Options)); } - operator LDKLSPS1Options() && { LDKLSPS1Options res = self; memset(&self, 0, sizeof(LDKLSPS1Options)); return res; } - ~LSPS1Options() { LSPS1Options_free(self); } - LSPS1Options& operator=(LSPS1Options&& o) { LSPS1Options_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1Options)); return *this; } - LDKLSPS1Options* operator &() { return &self; } - LDKLSPS1Options* operator ->() { return &self; } - const LDKLSPS1Options* operator &() const { return &self; } - const LDKLSPS1Options* operator ->() const { return &self; } -}; -class LSPS1GetInfoResponse { -private: - LDKLSPS1GetInfoResponse self; -public: - LSPS1GetInfoResponse(const LSPS1GetInfoResponse&) = delete; - LSPS1GetInfoResponse(LSPS1GetInfoResponse&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1GetInfoResponse)); } - LSPS1GetInfoResponse(LDKLSPS1GetInfoResponse&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1GetInfoResponse)); } - operator LDKLSPS1GetInfoResponse() && { LDKLSPS1GetInfoResponse res = self; memset(&self, 0, sizeof(LDKLSPS1GetInfoResponse)); return res; } - ~LSPS1GetInfoResponse() { LSPS1GetInfoResponse_free(self); } - LSPS1GetInfoResponse& operator=(LSPS1GetInfoResponse&& o) { LSPS1GetInfoResponse_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1GetInfoResponse)); return *this; } - LDKLSPS1GetInfoResponse* operator &() { return &self; } - LDKLSPS1GetInfoResponse* operator ->() { return &self; } - const LDKLSPS1GetInfoResponse* operator &() const { return &self; } - const LDKLSPS1GetInfoResponse* operator ->() const { return &self; } -}; -class LSPS1CreateOrderRequest { -private: - LDKLSPS1CreateOrderRequest self; -public: - LSPS1CreateOrderRequest(const LSPS1CreateOrderRequest&) = delete; - LSPS1CreateOrderRequest(LSPS1CreateOrderRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1CreateOrderRequest)); } - LSPS1CreateOrderRequest(LDKLSPS1CreateOrderRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1CreateOrderRequest)); } - operator LDKLSPS1CreateOrderRequest() && { LDKLSPS1CreateOrderRequest res = self; memset(&self, 0, sizeof(LDKLSPS1CreateOrderRequest)); return res; } - ~LSPS1CreateOrderRequest() { LSPS1CreateOrderRequest_free(self); } - LSPS1CreateOrderRequest& operator=(LSPS1CreateOrderRequest&& o) { LSPS1CreateOrderRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1CreateOrderRequest)); return *this; } - LDKLSPS1CreateOrderRequest* operator &() { return &self; } - LDKLSPS1CreateOrderRequest* operator ->() { return &self; } - const LDKLSPS1CreateOrderRequest* operator &() const { return &self; } - const LDKLSPS1CreateOrderRequest* operator ->() const { return &self; } -}; -class LSPS1OrderParams { -private: - LDKLSPS1OrderParams self; -public: - LSPS1OrderParams(const LSPS1OrderParams&) = delete; - LSPS1OrderParams(LSPS1OrderParams&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1OrderParams)); } - LSPS1OrderParams(LDKLSPS1OrderParams&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1OrderParams)); } - operator LDKLSPS1OrderParams() && { LDKLSPS1OrderParams res = self; memset(&self, 0, sizeof(LDKLSPS1OrderParams)); return res; } - ~LSPS1OrderParams() { LSPS1OrderParams_free(self); } - LSPS1OrderParams& operator=(LSPS1OrderParams&& o) { LSPS1OrderParams_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1OrderParams)); return *this; } - LDKLSPS1OrderParams* operator &() { return &self; } - LDKLSPS1OrderParams* operator ->() { return &self; } - const LDKLSPS1OrderParams* operator &() const { return &self; } - const LDKLSPS1OrderParams* operator ->() const { return &self; } -}; -class LSPS1CreateOrderResponse { -private: - LDKLSPS1CreateOrderResponse self; -public: - LSPS1CreateOrderResponse(const LSPS1CreateOrderResponse&) = delete; - LSPS1CreateOrderResponse(LSPS1CreateOrderResponse&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1CreateOrderResponse)); } - LSPS1CreateOrderResponse(LDKLSPS1CreateOrderResponse&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1CreateOrderResponse)); } - operator LDKLSPS1CreateOrderResponse() && { LDKLSPS1CreateOrderResponse res = self; memset(&self, 0, sizeof(LDKLSPS1CreateOrderResponse)); return res; } - ~LSPS1CreateOrderResponse() { LSPS1CreateOrderResponse_free(self); } - LSPS1CreateOrderResponse& operator=(LSPS1CreateOrderResponse&& o) { LSPS1CreateOrderResponse_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1CreateOrderResponse)); return *this; } - LDKLSPS1CreateOrderResponse* operator &() { return &self; } - LDKLSPS1CreateOrderResponse* operator ->() { return &self; } - const LDKLSPS1CreateOrderResponse* operator &() const { return &self; } - const LDKLSPS1CreateOrderResponse* operator ->() const { return &self; } -}; -class LSPS1OrderState { -private: - LDKLSPS1OrderState self; -public: - LSPS1OrderState(const LSPS1OrderState&) = delete; - LSPS1OrderState(LSPS1OrderState&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1OrderState)); } - LSPS1OrderState(LDKLSPS1OrderState&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1OrderState)); } - operator LDKLSPS1OrderState() && { LDKLSPS1OrderState res = self; memset(&self, 0, sizeof(LDKLSPS1OrderState)); return res; } - LSPS1OrderState& operator=(LSPS1OrderState&& o) { self = o.self; memset(&o, 0, sizeof(LSPS1OrderState)); return *this; } - LDKLSPS1OrderState* operator &() { return &self; } - LDKLSPS1OrderState* operator ->() { return &self; } - const LDKLSPS1OrderState* operator &() const { return &self; } - const LDKLSPS1OrderState* operator ->() const { return &self; } -}; -class LSPS1PaymentInfo { -private: - LDKLSPS1PaymentInfo self; -public: - LSPS1PaymentInfo(const LSPS1PaymentInfo&) = delete; - LSPS1PaymentInfo(LSPS1PaymentInfo&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1PaymentInfo)); } - LSPS1PaymentInfo(LDKLSPS1PaymentInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1PaymentInfo)); } - operator LDKLSPS1PaymentInfo() && { LDKLSPS1PaymentInfo res = self; memset(&self, 0, sizeof(LDKLSPS1PaymentInfo)); return res; } - ~LSPS1PaymentInfo() { LSPS1PaymentInfo_free(self); } - LSPS1PaymentInfo& operator=(LSPS1PaymentInfo&& o) { LSPS1PaymentInfo_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1PaymentInfo)); return *this; } - LDKLSPS1PaymentInfo* operator &() { return &self; } - LDKLSPS1PaymentInfo* operator ->() { return &self; } - const LDKLSPS1PaymentInfo* operator &() const { return &self; } - const LDKLSPS1PaymentInfo* operator ->() const { return &self; } -}; -class LSPS1Bolt11PaymentInfo { -private: - LDKLSPS1Bolt11PaymentInfo self; -public: - LSPS1Bolt11PaymentInfo(const LSPS1Bolt11PaymentInfo&) = delete; - LSPS1Bolt11PaymentInfo(LSPS1Bolt11PaymentInfo&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1Bolt11PaymentInfo)); } - LSPS1Bolt11PaymentInfo(LDKLSPS1Bolt11PaymentInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1Bolt11PaymentInfo)); } - operator LDKLSPS1Bolt11PaymentInfo() && { LDKLSPS1Bolt11PaymentInfo res = self; memset(&self, 0, sizeof(LDKLSPS1Bolt11PaymentInfo)); return res; } - ~LSPS1Bolt11PaymentInfo() { LSPS1Bolt11PaymentInfo_free(self); } - LSPS1Bolt11PaymentInfo& operator=(LSPS1Bolt11PaymentInfo&& o) { LSPS1Bolt11PaymentInfo_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1Bolt11PaymentInfo)); return *this; } - LDKLSPS1Bolt11PaymentInfo* operator &() { return &self; } - LDKLSPS1Bolt11PaymentInfo* operator ->() { return &self; } - const LDKLSPS1Bolt11PaymentInfo* operator &() const { return &self; } - const LDKLSPS1Bolt11PaymentInfo* operator ->() const { return &self; } -}; -class LSPS1OnchainPaymentInfo { -private: - LDKLSPS1OnchainPaymentInfo self; -public: - LSPS1OnchainPaymentInfo(const LSPS1OnchainPaymentInfo&) = delete; - LSPS1OnchainPaymentInfo(LSPS1OnchainPaymentInfo&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1OnchainPaymentInfo)); } - LSPS1OnchainPaymentInfo(LDKLSPS1OnchainPaymentInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1OnchainPaymentInfo)); } - operator LDKLSPS1OnchainPaymentInfo() && { LDKLSPS1OnchainPaymentInfo res = self; memset(&self, 0, sizeof(LDKLSPS1OnchainPaymentInfo)); return res; } - ~LSPS1OnchainPaymentInfo() { LSPS1OnchainPaymentInfo_free(self); } - LSPS1OnchainPaymentInfo& operator=(LSPS1OnchainPaymentInfo&& o) { LSPS1OnchainPaymentInfo_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1OnchainPaymentInfo)); return *this; } - LDKLSPS1OnchainPaymentInfo* operator &() { return &self; } - LDKLSPS1OnchainPaymentInfo* operator ->() { return &self; } - const LDKLSPS1OnchainPaymentInfo* operator &() const { return &self; } - const LDKLSPS1OnchainPaymentInfo* operator ->() const { return &self; } -}; -class LSPS1PaymentState { -private: - LDKLSPS1PaymentState self; -public: - LSPS1PaymentState(const LSPS1PaymentState&) = delete; - LSPS1PaymentState(LSPS1PaymentState&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1PaymentState)); } - LSPS1PaymentState(LDKLSPS1PaymentState&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1PaymentState)); } - operator LDKLSPS1PaymentState() && { LDKLSPS1PaymentState res = self; memset(&self, 0, sizeof(LDKLSPS1PaymentState)); return res; } - LSPS1PaymentState& operator=(LSPS1PaymentState&& o) { self = o.self; memset(&o, 0, sizeof(LSPS1PaymentState)); return *this; } - LDKLSPS1PaymentState* operator &() { return &self; } - LDKLSPS1PaymentState* operator ->() { return &self; } - const LDKLSPS1PaymentState* operator &() const { return &self; } - const LDKLSPS1PaymentState* operator ->() const { return &self; } -}; -class LSPS1OnchainPayment { -private: - LDKLSPS1OnchainPayment self; -public: - LSPS1OnchainPayment(const LSPS1OnchainPayment&) = delete; - LSPS1OnchainPayment(LSPS1OnchainPayment&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1OnchainPayment)); } - LSPS1OnchainPayment(LDKLSPS1OnchainPayment&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1OnchainPayment)); } - operator LDKLSPS1OnchainPayment() && { LDKLSPS1OnchainPayment res = self; memset(&self, 0, sizeof(LDKLSPS1OnchainPayment)); return res; } - ~LSPS1OnchainPayment() { LSPS1OnchainPayment_free(self); } - LSPS1OnchainPayment& operator=(LSPS1OnchainPayment&& o) { LSPS1OnchainPayment_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1OnchainPayment)); return *this; } - LDKLSPS1OnchainPayment* operator &() { return &self; } - LDKLSPS1OnchainPayment* operator ->() { return &self; } - const LDKLSPS1OnchainPayment* operator &() const { return &self; } - const LDKLSPS1OnchainPayment* operator ->() const { return &self; } -}; -class LSPS1ChannelInfo { -private: - LDKLSPS1ChannelInfo self; -public: - LSPS1ChannelInfo(const LSPS1ChannelInfo&) = delete; - LSPS1ChannelInfo(LSPS1ChannelInfo&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1ChannelInfo)); } - LSPS1ChannelInfo(LDKLSPS1ChannelInfo&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1ChannelInfo)); } - operator LDKLSPS1ChannelInfo() && { LDKLSPS1ChannelInfo res = self; memset(&self, 0, sizeof(LDKLSPS1ChannelInfo)); return res; } - ~LSPS1ChannelInfo() { LSPS1ChannelInfo_free(self); } - LSPS1ChannelInfo& operator=(LSPS1ChannelInfo&& o) { LSPS1ChannelInfo_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1ChannelInfo)); return *this; } - LDKLSPS1ChannelInfo* operator &() { return &self; } - LDKLSPS1ChannelInfo* operator ->() { return &self; } - const LDKLSPS1ChannelInfo* operator &() const { return &self; } - const LDKLSPS1ChannelInfo* operator ->() const { return &self; } -}; -class LSPS1GetOrderRequest { -private: - LDKLSPS1GetOrderRequest self; -public: - LSPS1GetOrderRequest(const LSPS1GetOrderRequest&) = delete; - LSPS1GetOrderRequest(LSPS1GetOrderRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1GetOrderRequest)); } - LSPS1GetOrderRequest(LDKLSPS1GetOrderRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1GetOrderRequest)); } - operator LDKLSPS1GetOrderRequest() && { LDKLSPS1GetOrderRequest res = self; memset(&self, 0, sizeof(LDKLSPS1GetOrderRequest)); return res; } - ~LSPS1GetOrderRequest() { LSPS1GetOrderRequest_free(self); } - LSPS1GetOrderRequest& operator=(LSPS1GetOrderRequest&& o) { LSPS1GetOrderRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1GetOrderRequest)); return *this; } - LDKLSPS1GetOrderRequest* operator &() { return &self; } - LDKLSPS1GetOrderRequest* operator ->() { return &self; } - const LDKLSPS1GetOrderRequest* operator &() const { return &self; } - const LDKLSPS1GetOrderRequest* operator ->() const { return &self; } -}; -class LSPS1Request { -private: - LDKLSPS1Request self; -public: - LSPS1Request(const LSPS1Request&) = delete; - LSPS1Request(LSPS1Request&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1Request)); } - LSPS1Request(LDKLSPS1Request&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1Request)); } - operator LDKLSPS1Request() && { LDKLSPS1Request res = self; memset(&self, 0, sizeof(LDKLSPS1Request)); return res; } - ~LSPS1Request() { LSPS1Request_free(self); } - LSPS1Request& operator=(LSPS1Request&& o) { LSPS1Request_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1Request)); return *this; } - LDKLSPS1Request* operator &() { return &self; } - LDKLSPS1Request* operator ->() { return &self; } - const LDKLSPS1Request* operator &() const { return &self; } - const LDKLSPS1Request* operator ->() const { return &self; } -}; -class LSPS1Response { -private: - LDKLSPS1Response self; -public: - LSPS1Response(const LSPS1Response&) = delete; - LSPS1Response(LSPS1Response&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1Response)); } - LSPS1Response(LDKLSPS1Response&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1Response)); } - operator LDKLSPS1Response() && { LDKLSPS1Response res = self; memset(&self, 0, sizeof(LDKLSPS1Response)); return res; } - ~LSPS1Response() { LSPS1Response_free(self); } - LSPS1Response& operator=(LSPS1Response&& o) { LSPS1Response_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1Response)); return *this; } - LDKLSPS1Response* operator &() { return &self; } - LDKLSPS1Response* operator ->() { return &self; } - const LDKLSPS1Response* operator &() const { return &self; } - const LDKLSPS1Response* operator ->() const { return &self; } -}; -class LSPS1Message { -private: - LDKLSPS1Message self; -public: - LSPS1Message(const LSPS1Message&) = delete; - LSPS1Message(LSPS1Message&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS1Message)); } - LSPS1Message(LDKLSPS1Message&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS1Message)); } - operator LDKLSPS1Message() && { LDKLSPS1Message res = self; memset(&self, 0, sizeof(LDKLSPS1Message)); return res; } - ~LSPS1Message() { LSPS1Message_free(self); } - LSPS1Message& operator=(LSPS1Message&& o) { LSPS1Message_free(self); self = o.self; memset(&o, 0, sizeof(LSPS1Message)); return *this; } - LDKLSPS1Message* operator &() { return &self; } - LDKLSPS1Message* operator ->() { return &self; } - const LDKLSPS1Message* operator &() const { return &self; } - const LDKLSPS1Message* operator ->() const { return &self; } -}; class Level { private: LDKLevel self; @@ -6043,6 +6133,21 @@ class ChannelShutdownState { const LDKChannelShutdownState* operator &() const { return &self; } const LDKChannelShutdownState* operator ->() const { return &self; } }; +class Notifier { +private: + LDKNotifier self; +public: + Notifier(const Notifier&) = delete; + Notifier(Notifier&& o) : self(o.self) { memset(&o, 0, sizeof(Notifier)); } + Notifier(LDKNotifier&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNotifier)); } + operator LDKNotifier() && { LDKNotifier res = self; memset(&self, 0, sizeof(LDKNotifier)); return res; } + ~Notifier() { Notifier_free(self); } + Notifier& operator=(Notifier&& o) { Notifier_free(self); self = o.self; memset(&o, 0, sizeof(Notifier)); return *this; } + LDKNotifier* operator &() { return &self; } + LDKNotifier* operator ->() { return &self; } + const LDKNotifier* operator &() const { return &self; } + const LDKNotifier* operator ->() const { return &self; } +}; class FutureCallback { private: LDKFutureCallback self; @@ -6092,81 +6197,6 @@ class Sleeper { const LDKSleeper* operator &() const { return &self; } const LDKSleeper* operator ->() const { return &self; } }; -class RawLSPSMessage { -private: - LDKRawLSPSMessage self; -public: - RawLSPSMessage(const RawLSPSMessage&) = delete; - RawLSPSMessage(RawLSPSMessage&& o) : self(o.self) { memset(&o, 0, sizeof(RawLSPSMessage)); } - RawLSPSMessage(LDKRawLSPSMessage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRawLSPSMessage)); } - operator LDKRawLSPSMessage() && { LDKRawLSPSMessage res = self; memset(&self, 0, sizeof(LDKRawLSPSMessage)); return res; } - ~RawLSPSMessage() { RawLSPSMessage_free(self); } - RawLSPSMessage& operator=(RawLSPSMessage&& o) { RawLSPSMessage_free(self); self = o.self; memset(&o, 0, sizeof(RawLSPSMessage)); return *this; } - LDKRawLSPSMessage* operator &() { return &self; } - LDKRawLSPSMessage* operator ->() { return &self; } - const LDKRawLSPSMessage* operator &() const { return &self; } - const LDKRawLSPSMessage* operator ->() const { return &self; } -}; -class LSPSRequestId { -private: - LDKLSPSRequestId self; -public: - LSPSRequestId(const LSPSRequestId&) = delete; - LSPSRequestId(LSPSRequestId&& o) : self(o.self) { memset(&o, 0, sizeof(LSPSRequestId)); } - LSPSRequestId(LDKLSPSRequestId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPSRequestId)); } - operator LDKLSPSRequestId() && { LDKLSPSRequestId res = self; memset(&self, 0, sizeof(LDKLSPSRequestId)); return res; } - ~LSPSRequestId() { LSPSRequestId_free(self); } - LSPSRequestId& operator=(LSPSRequestId&& o) { LSPSRequestId_free(self); self = o.self; memset(&o, 0, sizeof(LSPSRequestId)); return *this; } - LDKLSPSRequestId* operator &() { return &self; } - LDKLSPSRequestId* operator ->() { return &self; } - const LDKLSPSRequestId* operator &() const { return &self; } - const LDKLSPSRequestId* operator ->() const { return &self; } -}; -class LSPSDateTime { -private: - LDKLSPSDateTime self; -public: - LSPSDateTime(const LSPSDateTime&) = delete; - LSPSDateTime(LSPSDateTime&& o) : self(o.self) { memset(&o, 0, sizeof(LSPSDateTime)); } - LSPSDateTime(LDKLSPSDateTime&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPSDateTime)); } - operator LDKLSPSDateTime() && { LDKLSPSDateTime res = self; memset(&self, 0, sizeof(LDKLSPSDateTime)); return res; } - ~LSPSDateTime() { LSPSDateTime_free(self); } - LSPSDateTime& operator=(LSPSDateTime&& o) { LSPSDateTime_free(self); self = o.self; memset(&o, 0, sizeof(LSPSDateTime)); return *this; } - LDKLSPSDateTime* operator &() { return &self; } - LDKLSPSDateTime* operator ->() { return &self; } - const LDKLSPSDateTime* operator &() const { return &self; } - const LDKLSPSDateTime* operator ->() const { return &self; } -}; -class LSPSResponseError { -private: - LDKLSPSResponseError self; -public: - LSPSResponseError(const LSPSResponseError&) = delete; - LSPSResponseError(LSPSResponseError&& o) : self(o.self) { memset(&o, 0, sizeof(LSPSResponseError)); } - LSPSResponseError(LDKLSPSResponseError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPSResponseError)); } - operator LDKLSPSResponseError() && { LDKLSPSResponseError res = self; memset(&self, 0, sizeof(LDKLSPSResponseError)); return res; } - ~LSPSResponseError() { LSPSResponseError_free(self); } - LSPSResponseError& operator=(LSPSResponseError&& o) { LSPSResponseError_free(self); self = o.self; memset(&o, 0, sizeof(LSPSResponseError)); return *this; } - LDKLSPSResponseError* operator &() { return &self; } - LDKLSPSResponseError* operator ->() { return &self; } - const LDKLSPSResponseError* operator &() const { return &self; } - const LDKLSPSResponseError* operator ->() const { return &self; } -}; -class LSPSMessage { -private: - LDKLSPSMessage self; -public: - LSPSMessage(const LSPSMessage&) = delete; - LSPSMessage(LSPSMessage&& o) : self(o.self) { memset(&o, 0, sizeof(LSPSMessage)); } - LSPSMessage(LDKLSPSMessage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPSMessage)); } - operator LDKLSPSMessage() && { LDKLSPSMessage res = self; memset(&self, 0, sizeof(LDKLSPSMessage)); return res; } - ~LSPSMessage() { LSPSMessage_free(self); } - LSPSMessage& operator=(LSPSMessage&& o) { LSPSMessage_free(self); self = o.self; memset(&o, 0, sizeof(LSPSMessage)); return *this; } - LDKLSPSMessage* operator &() { return &self; } - LDKLSPSMessage* operator ->() { return &self; } - const LDKLSPSMessage* operator &() const { return &self; } - const LDKLSPSMessage* operator ->() const { return &self; } -}; class AsyncPaymentsMessageHandler { private: LDKAsyncPaymentsMessageHandler self; @@ -6181,13 +6211,48 @@ class AsyncPaymentsMessageHandler { LDKAsyncPaymentsMessageHandler* operator ->() { return &self; } const LDKAsyncPaymentsMessageHandler* operator &() const { return &self; } const LDKAsyncPaymentsMessageHandler* operator ->() const { return &self; } + /** + * Handle an [`OfferPathsRequest`] message. If we are a static invoice server and the message was + * sent over paths that we previously provided to an async recipient, an [`OfferPaths`] message + * should be returned. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + inline LDK::COption_C2Tuple_OfferPathsResponseInstructionZZ handle_offer_paths_request(struct LDKOfferPathsRequest message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); + /** + * Handle an [`OfferPaths`] message. If this is in response to an [`OfferPathsRequest`] that + * we previously sent as an async recipient, we should build an [`Offer`] containing the + * included [`OfferPaths::paths`] and a corresponding [`StaticInvoice`], and reply with + * [`ServeStaticInvoice`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + inline LDK::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ handle_offer_paths(struct LDKOfferPaths message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); + /** + * Handle a [`ServeStaticInvoice`] message. If this is in response to an [`OfferPaths`] message + * we previously sent as a static invoice server, a [`StaticInvoicePersisted`] message should be + * sent once the message is handled. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + inline void handle_serve_static_invoice(struct LDKServeStaticInvoice message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); + /** + * Handle a [`StaticInvoicePersisted`] message. If this is in response to a + * [`ServeStaticInvoice`] message we previously sent as an async recipient, then the offer we + * generated on receipt of a previous [`OfferPaths`] message is now ready to be used for async + * payments. + */ + inline void handle_static_invoice_persisted(struct LDKStaticInvoicePersisted message, struct LDKAsyncPaymentsContext context); /** * Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release * the held funds. * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder); + inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder); /** * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC * should be released to the corresponding payee. @@ -6216,6 +6281,66 @@ class AsyncPaymentsMessage { const LDKAsyncPaymentsMessage* operator &() const { return &self; } const LDKAsyncPaymentsMessage* operator ->() const { return &self; } }; +class OfferPathsRequest { +private: + LDKOfferPathsRequest self; +public: + OfferPathsRequest(const OfferPathsRequest&) = delete; + OfferPathsRequest(OfferPathsRequest&& o) : self(o.self) { memset(&o, 0, sizeof(OfferPathsRequest)); } + OfferPathsRequest(LDKOfferPathsRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOfferPathsRequest)); } + operator LDKOfferPathsRequest() && { LDKOfferPathsRequest res = self; memset(&self, 0, sizeof(LDKOfferPathsRequest)); return res; } + ~OfferPathsRequest() { OfferPathsRequest_free(self); } + OfferPathsRequest& operator=(OfferPathsRequest&& o) { OfferPathsRequest_free(self); self = o.self; memset(&o, 0, sizeof(OfferPathsRequest)); return *this; } + LDKOfferPathsRequest* operator &() { return &self; } + LDKOfferPathsRequest* operator ->() { return &self; } + const LDKOfferPathsRequest* operator &() const { return &self; } + const LDKOfferPathsRequest* operator ->() const { return &self; } +}; +class OfferPaths { +private: + LDKOfferPaths self; +public: + OfferPaths(const OfferPaths&) = delete; + OfferPaths(OfferPaths&& o) : self(o.self) { memset(&o, 0, sizeof(OfferPaths)); } + OfferPaths(LDKOfferPaths&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOfferPaths)); } + operator LDKOfferPaths() && { LDKOfferPaths res = self; memset(&self, 0, sizeof(LDKOfferPaths)); return res; } + ~OfferPaths() { OfferPaths_free(self); } + OfferPaths& operator=(OfferPaths&& o) { OfferPaths_free(self); self = o.self; memset(&o, 0, sizeof(OfferPaths)); return *this; } + LDKOfferPaths* operator &() { return &self; } + LDKOfferPaths* operator ->() { return &self; } + const LDKOfferPaths* operator &() const { return &self; } + const LDKOfferPaths* operator ->() const { return &self; } +}; +class ServeStaticInvoice { +private: + LDKServeStaticInvoice self; +public: + ServeStaticInvoice(const ServeStaticInvoice&) = delete; + ServeStaticInvoice(ServeStaticInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(ServeStaticInvoice)); } + ServeStaticInvoice(LDKServeStaticInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKServeStaticInvoice)); } + operator LDKServeStaticInvoice() && { LDKServeStaticInvoice res = self; memset(&self, 0, sizeof(LDKServeStaticInvoice)); return res; } + ~ServeStaticInvoice() { ServeStaticInvoice_free(self); } + ServeStaticInvoice& operator=(ServeStaticInvoice&& o) { ServeStaticInvoice_free(self); self = o.self; memset(&o, 0, sizeof(ServeStaticInvoice)); return *this; } + LDKServeStaticInvoice* operator &() { return &self; } + LDKServeStaticInvoice* operator ->() { return &self; } + const LDKServeStaticInvoice* operator &() const { return &self; } + const LDKServeStaticInvoice* operator ->() const { return &self; } +}; +class StaticInvoicePersisted { +private: + LDKStaticInvoicePersisted self; +public: + StaticInvoicePersisted(const StaticInvoicePersisted&) = delete; + StaticInvoicePersisted(StaticInvoicePersisted&& o) : self(o.self) { memset(&o, 0, sizeof(StaticInvoicePersisted)); } + StaticInvoicePersisted(LDKStaticInvoicePersisted&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKStaticInvoicePersisted)); } + operator LDKStaticInvoicePersisted() && { LDKStaticInvoicePersisted res = self; memset(&self, 0, sizeof(LDKStaticInvoicePersisted)); return res; } + ~StaticInvoicePersisted() { StaticInvoicePersisted_free(self); } + StaticInvoicePersisted& operator=(StaticInvoicePersisted&& o) { StaticInvoicePersisted_free(self); self = o.self; memset(&o, 0, sizeof(StaticInvoicePersisted)); return *this; } + LDKStaticInvoicePersisted* operator &() { return &self; } + LDKStaticInvoicePersisted* operator ->() { return &self; } + const LDKStaticInvoicePersisted* operator &() const { return &self; } + const LDKStaticInvoicePersisted* operator ->() const { return &self; } +}; class HeldHtlcAvailable { private: LDKHeldHtlcAvailable self; @@ -6246,6 +6371,55 @@ class ReleaseHeldHtlc { const LDKReleaseHeldHtlc* operator &() const { return &self; } const LDKReleaseHeldHtlc* operator ->() const { return &self; } }; +class StaticInvoice { +private: + LDKStaticInvoice self; +public: + StaticInvoice(const StaticInvoice&) = delete; + StaticInvoice(StaticInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(StaticInvoice)); } + StaticInvoice(LDKStaticInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKStaticInvoice)); } + operator LDKStaticInvoice() && { LDKStaticInvoice res = self; memset(&self, 0, sizeof(LDKStaticInvoice)); return res; } + ~StaticInvoice() { StaticInvoice_free(self); } + StaticInvoice& operator=(StaticInvoice&& o) { StaticInvoice_free(self); self = o.self; memset(&o, 0, sizeof(StaticInvoice)); return *this; } + LDKStaticInvoice* operator &() { return &self; } + LDKStaticInvoice* operator ->() { return &self; } + const LDKStaticInvoice* operator &() const { return &self; } + const LDKStaticInvoice* operator ->() const { return &self; } +}; +class UnsignedStaticInvoice { +private: + LDKUnsignedStaticInvoice self; +public: + UnsignedStaticInvoice(const UnsignedStaticInvoice&) = delete; + UnsignedStaticInvoice(UnsignedStaticInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(UnsignedStaticInvoice)); } + UnsignedStaticInvoice(LDKUnsignedStaticInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnsignedStaticInvoice)); } + operator LDKUnsignedStaticInvoice() && { LDKUnsignedStaticInvoice res = self; memset(&self, 0, sizeof(LDKUnsignedStaticInvoice)); return res; } + ~UnsignedStaticInvoice() { UnsignedStaticInvoice_free(self); } + UnsignedStaticInvoice& operator=(UnsignedStaticInvoice&& o) { UnsignedStaticInvoice_free(self); self = o.self; memset(&o, 0, sizeof(UnsignedStaticInvoice)); return *this; } + LDKUnsignedStaticInvoice* operator &() { return &self; } + LDKUnsignedStaticInvoice* operator ->() { return &self; } + const LDKUnsignedStaticInvoice* operator &() const { return &self; } + const LDKUnsignedStaticInvoice* operator ->() const { return &self; } +}; +class SignStaticInvoiceFn { +private: + LDKSignStaticInvoiceFn self; +public: + SignStaticInvoiceFn(const SignStaticInvoiceFn&) = delete; + SignStaticInvoiceFn(SignStaticInvoiceFn&& o) : self(o.self) { memset(&o, 0, sizeof(SignStaticInvoiceFn)); } + SignStaticInvoiceFn(LDKSignStaticInvoiceFn&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignStaticInvoiceFn)); } + operator LDKSignStaticInvoiceFn() && { LDKSignStaticInvoiceFn res = self; memset(&self, 0, sizeof(LDKSignStaticInvoiceFn)); return res; } + ~SignStaticInvoiceFn() { SignStaticInvoiceFn_free(self); } + SignStaticInvoiceFn& operator=(SignStaticInvoiceFn&& o) { SignStaticInvoiceFn_free(self); self = o.self; memset(&o, 0, sizeof(SignStaticInvoiceFn)); return *this; } + LDKSignStaticInvoiceFn* operator &() { return &self; } + LDKSignStaticInvoiceFn* operator ->() { return &self; } + const LDKSignStaticInvoiceFn* operator &() const { return &self; } + const LDKSignStaticInvoiceFn* operator ->() const { return &self; } + /** + * Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + */ + inline LDK::CResult_SchnorrSignatureNoneZ sign_invoice(const struct LDKUnsignedStaticInvoice *NONNULL_PTR message); +}; class OffersMessageHandler { private: LDKOffersMessageHandler self; @@ -6264,6 +6438,14 @@ class OffersMessageHandler { * Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, * or replying with an error. * + * If the provided [`OffersContext`] is `Some`, then the message was sent to a blinded path that we + * created and was authenticated as such by the [`OnionMessenger`]. There is one exception to + * this: [`OffersContext::InvoiceRequest`]. + * + * In order to support offers created prior to LDK 0.2, [`OffersContext::InvoiceRequest`]s are + * not authenticated by the [`OnionMessenger`]. It is the responsibility of message handling code + * to authenticate the provided [`OffersContext`] in this case. + * * The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. * * [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger @@ -6533,6 +6715,21 @@ class InvalidShutdownScript { const LDKInvalidShutdownScript* operator &() const { return &self; } const LDKInvalidShutdownScript* operator ->() const { return &self; } }; +class AnchorChannelReserveContext { +private: + LDKAnchorChannelReserveContext self; +public: + AnchorChannelReserveContext(const AnchorChannelReserveContext&) = delete; + AnchorChannelReserveContext(AnchorChannelReserveContext&& o) : self(o.self) { memset(&o, 0, sizeof(AnchorChannelReserveContext)); } + AnchorChannelReserveContext(LDKAnchorChannelReserveContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAnchorChannelReserveContext)); } + operator LDKAnchorChannelReserveContext() && { LDKAnchorChannelReserveContext res = self; memset(&self, 0, sizeof(LDKAnchorChannelReserveContext)); return res; } + ~AnchorChannelReserveContext() { AnchorChannelReserveContext_free(self); } + AnchorChannelReserveContext& operator=(AnchorChannelReserveContext&& o) { AnchorChannelReserveContext_free(self); self = o.self; memset(&o, 0, sizeof(AnchorChannelReserveContext)); return *this; } + LDKAnchorChannelReserveContext* operator &() { return &self; } + LDKAnchorChannelReserveContext* operator ->() { return &self; } + const LDKAnchorChannelReserveContext* operator &() const { return &self; } + const LDKAnchorChannelReserveContext* operator ->() const { return &self; } +}; class Bolt12ParseError { private: LDKBolt12ParseError self; @@ -6584,9 +6781,12 @@ class BroadcasterInterface { * In some cases LDK may attempt to broadcast a transaction which double-spends another * and this isn't a bug and can be safely ignored. * - * If more than one transaction is given, these transactions should be considered to be a - * package and broadcast together. Some of the transactions may or may not depend on each other, - * be sure to manage both cases correctly. + * If more than one transaction is given, these transactions MUST be a + * single child and its parents and be broadcast together as a package + * (see the [`submitpackage`](https://bitcoincore.org/en/doc/30.0.0/rpc/rawtransactions/submitpackage) + * Bitcoin Core RPC). + * + * Implementations MUST NOT assume any topological order on the transactions. * * Bitcoin transaction packages are defined in BIP 331 and here: * @@ -6633,213 +6833,6 @@ class FeeEstimator { */ inline uint32_t get_est_sat_per_1000_weight(enum LDKConfirmationTarget confirmation_target); }; -class LSPS2GetInfoRequest { -private: - LDKLSPS2GetInfoRequest self; -public: - LSPS2GetInfoRequest(const LSPS2GetInfoRequest&) = delete; - LSPS2GetInfoRequest(LSPS2GetInfoRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2GetInfoRequest)); } - LSPS2GetInfoRequest(LDKLSPS2GetInfoRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2GetInfoRequest)); } - operator LDKLSPS2GetInfoRequest() && { LDKLSPS2GetInfoRequest res = self; memset(&self, 0, sizeof(LDKLSPS2GetInfoRequest)); return res; } - ~LSPS2GetInfoRequest() { LSPS2GetInfoRequest_free(self); } - LSPS2GetInfoRequest& operator=(LSPS2GetInfoRequest&& o) { LSPS2GetInfoRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2GetInfoRequest)); return *this; } - LDKLSPS2GetInfoRequest* operator &() { return &self; } - LDKLSPS2GetInfoRequest* operator ->() { return &self; } - const LDKLSPS2GetInfoRequest* operator &() const { return &self; } - const LDKLSPS2GetInfoRequest* operator ->() const { return &self; } -}; -class LSPS2RawOpeningFeeParams { -private: - LDKLSPS2RawOpeningFeeParams self; -public: - LSPS2RawOpeningFeeParams(const LSPS2RawOpeningFeeParams&) = delete; - LSPS2RawOpeningFeeParams(LSPS2RawOpeningFeeParams&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2RawOpeningFeeParams)); } - LSPS2RawOpeningFeeParams(LDKLSPS2RawOpeningFeeParams&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2RawOpeningFeeParams)); } - operator LDKLSPS2RawOpeningFeeParams() && { LDKLSPS2RawOpeningFeeParams res = self; memset(&self, 0, sizeof(LDKLSPS2RawOpeningFeeParams)); return res; } - ~LSPS2RawOpeningFeeParams() { LSPS2RawOpeningFeeParams_free(self); } - LSPS2RawOpeningFeeParams& operator=(LSPS2RawOpeningFeeParams&& o) { LSPS2RawOpeningFeeParams_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2RawOpeningFeeParams)); return *this; } - LDKLSPS2RawOpeningFeeParams* operator &() { return &self; } - LDKLSPS2RawOpeningFeeParams* operator ->() { return &self; } - const LDKLSPS2RawOpeningFeeParams* operator &() const { return &self; } - const LDKLSPS2RawOpeningFeeParams* operator ->() const { return &self; } -}; -class LSPS2OpeningFeeParams { -private: - LDKLSPS2OpeningFeeParams self; -public: - LSPS2OpeningFeeParams(const LSPS2OpeningFeeParams&) = delete; - LSPS2OpeningFeeParams(LSPS2OpeningFeeParams&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2OpeningFeeParams)); } - LSPS2OpeningFeeParams(LDKLSPS2OpeningFeeParams&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2OpeningFeeParams)); } - operator LDKLSPS2OpeningFeeParams() && { LDKLSPS2OpeningFeeParams res = self; memset(&self, 0, sizeof(LDKLSPS2OpeningFeeParams)); return res; } - ~LSPS2OpeningFeeParams() { LSPS2OpeningFeeParams_free(self); } - LSPS2OpeningFeeParams& operator=(LSPS2OpeningFeeParams&& o) { LSPS2OpeningFeeParams_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2OpeningFeeParams)); return *this; } - LDKLSPS2OpeningFeeParams* operator &() { return &self; } - LDKLSPS2OpeningFeeParams* operator ->() { return &self; } - const LDKLSPS2OpeningFeeParams* operator &() const { return &self; } - const LDKLSPS2OpeningFeeParams* operator ->() const { return &self; } -}; -class LSPS2GetInfoResponse { -private: - LDKLSPS2GetInfoResponse self; -public: - LSPS2GetInfoResponse(const LSPS2GetInfoResponse&) = delete; - LSPS2GetInfoResponse(LSPS2GetInfoResponse&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2GetInfoResponse)); } - LSPS2GetInfoResponse(LDKLSPS2GetInfoResponse&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2GetInfoResponse)); } - operator LDKLSPS2GetInfoResponse() && { LDKLSPS2GetInfoResponse res = self; memset(&self, 0, sizeof(LDKLSPS2GetInfoResponse)); return res; } - ~LSPS2GetInfoResponse() { LSPS2GetInfoResponse_free(self); } - LSPS2GetInfoResponse& operator=(LSPS2GetInfoResponse&& o) { LSPS2GetInfoResponse_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2GetInfoResponse)); return *this; } - LDKLSPS2GetInfoResponse* operator &() { return &self; } - LDKLSPS2GetInfoResponse* operator ->() { return &self; } - const LDKLSPS2GetInfoResponse* operator &() const { return &self; } - const LDKLSPS2GetInfoResponse* operator ->() const { return &self; } -}; -class LSPS2BuyRequest { -private: - LDKLSPS2BuyRequest self; -public: - LSPS2BuyRequest(const LSPS2BuyRequest&) = delete; - LSPS2BuyRequest(LSPS2BuyRequest&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2BuyRequest)); } - LSPS2BuyRequest(LDKLSPS2BuyRequest&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2BuyRequest)); } - operator LDKLSPS2BuyRequest() && { LDKLSPS2BuyRequest res = self; memset(&self, 0, sizeof(LDKLSPS2BuyRequest)); return res; } - ~LSPS2BuyRequest() { LSPS2BuyRequest_free(self); } - LSPS2BuyRequest& operator=(LSPS2BuyRequest&& o) { LSPS2BuyRequest_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2BuyRequest)); return *this; } - LDKLSPS2BuyRequest* operator &() { return &self; } - LDKLSPS2BuyRequest* operator ->() { return &self; } - const LDKLSPS2BuyRequest* operator &() const { return &self; } - const LDKLSPS2BuyRequest* operator ->() const { return &self; } -}; -class LSPS2InterceptScid { -private: - LDKLSPS2InterceptScid self; -public: - LSPS2InterceptScid(const LSPS2InterceptScid&) = delete; - LSPS2InterceptScid(LSPS2InterceptScid&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2InterceptScid)); } - LSPS2InterceptScid(LDKLSPS2InterceptScid&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2InterceptScid)); } - operator LDKLSPS2InterceptScid() && { LDKLSPS2InterceptScid res = self; memset(&self, 0, sizeof(LDKLSPS2InterceptScid)); return res; } - ~LSPS2InterceptScid() { LSPS2InterceptScid_free(self); } - LSPS2InterceptScid& operator=(LSPS2InterceptScid&& o) { LSPS2InterceptScid_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2InterceptScid)); return *this; } - LDKLSPS2InterceptScid* operator &() { return &self; } - LDKLSPS2InterceptScid* operator ->() { return &self; } - const LDKLSPS2InterceptScid* operator &() const { return &self; } - const LDKLSPS2InterceptScid* operator ->() const { return &self; } -}; -class LSPS2BuyResponse { -private: - LDKLSPS2BuyResponse self; -public: - LSPS2BuyResponse(const LSPS2BuyResponse&) = delete; - LSPS2BuyResponse(LSPS2BuyResponse&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2BuyResponse)); } - LSPS2BuyResponse(LDKLSPS2BuyResponse&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2BuyResponse)); } - operator LDKLSPS2BuyResponse() && { LDKLSPS2BuyResponse res = self; memset(&self, 0, sizeof(LDKLSPS2BuyResponse)); return res; } - ~LSPS2BuyResponse() { LSPS2BuyResponse_free(self); } - LSPS2BuyResponse& operator=(LSPS2BuyResponse&& o) { LSPS2BuyResponse_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2BuyResponse)); return *this; } - LDKLSPS2BuyResponse* operator &() { return &self; } - LDKLSPS2BuyResponse* operator ->() { return &self; } - const LDKLSPS2BuyResponse* operator &() const { return &self; } - const LDKLSPS2BuyResponse* operator ->() const { return &self; } -}; -class LSPS2Request { -private: - LDKLSPS2Request self; -public: - LSPS2Request(const LSPS2Request&) = delete; - LSPS2Request(LSPS2Request&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2Request)); } - LSPS2Request(LDKLSPS2Request&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2Request)); } - operator LDKLSPS2Request() && { LDKLSPS2Request res = self; memset(&self, 0, sizeof(LDKLSPS2Request)); return res; } - ~LSPS2Request() { LSPS2Request_free(self); } - LSPS2Request& operator=(LSPS2Request&& o) { LSPS2Request_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2Request)); return *this; } - LDKLSPS2Request* operator &() { return &self; } - LDKLSPS2Request* operator ->() { return &self; } - const LDKLSPS2Request* operator &() const { return &self; } - const LDKLSPS2Request* operator ->() const { return &self; } -}; -class LSPS2Response { -private: - LDKLSPS2Response self; -public: - LSPS2Response(const LSPS2Response&) = delete; - LSPS2Response(LSPS2Response&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2Response)); } - LSPS2Response(LDKLSPS2Response&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2Response)); } - operator LDKLSPS2Response() && { LDKLSPS2Response res = self; memset(&self, 0, sizeof(LDKLSPS2Response)); return res; } - ~LSPS2Response() { LSPS2Response_free(self); } - LSPS2Response& operator=(LSPS2Response&& o) { LSPS2Response_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2Response)); return *this; } - LDKLSPS2Response* operator &() { return &self; } - LDKLSPS2Response* operator ->() { return &self; } - const LDKLSPS2Response* operator &() const { return &self; } - const LDKLSPS2Response* operator ->() const { return &self; } -}; -class LSPS2Message { -private: - LDKLSPS2Message self; -public: - LSPS2Message(const LSPS2Message&) = delete; - LSPS2Message(LSPS2Message&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS2Message)); } - LSPS2Message(LDKLSPS2Message&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS2Message)); } - operator LDKLSPS2Message() && { LDKLSPS2Message res = self; memset(&self, 0, sizeof(LDKLSPS2Message)); return res; } - ~LSPS2Message() { LSPS2Message_free(self); } - LSPS2Message& operator=(LSPS2Message&& o) { LSPS2Message_free(self); self = o.self; memset(&o, 0, sizeof(LSPS2Message)); return *this; } - LDKLSPS2Message* operator &() { return &self; } - LDKLSPS2Message* operator ->() { return &self; } - const LDKLSPS2Message* operator &() const { return &self; } - const LDKLSPS2Message* operator ->() const { return &self; } -}; -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 ParsedOnionMessageContents { -private: - LDKParsedOnionMessageContents self; -public: - ParsedOnionMessageContents(const ParsedOnionMessageContents&) = delete; - ParsedOnionMessageContents(ParsedOnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(ParsedOnionMessageContents)); } - ParsedOnionMessageContents(LDKParsedOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParsedOnionMessageContents)); } - operator LDKParsedOnionMessageContents() && { LDKParsedOnionMessageContents res = self; memset(&self, 0, sizeof(LDKParsedOnionMessageContents)); return res; } - ~ParsedOnionMessageContents() { ParsedOnionMessageContents_free(self); } - ParsedOnionMessageContents& operator=(ParsedOnionMessageContents&& o) { ParsedOnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(ParsedOnionMessageContents)); return *this; } - LDKParsedOnionMessageContents* operator &() { return &self; } - LDKParsedOnionMessageContents* operator ->() { return &self; } - const LDKParsedOnionMessageContents* operator &() const { return &self; } - const LDKParsedOnionMessageContents* operator ->() const { return &self; } -}; -class OnionMessageContents { -private: - LDKOnionMessageContents self; -public: - OnionMessageContents(const OnionMessageContents&) = delete; - OnionMessageContents(OnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessageContents)); } - OnionMessageContents(LDKOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessageContents)); } - operator LDKOnionMessageContents() && { LDKOnionMessageContents res = self; memset(&self, 0, sizeof(LDKOnionMessageContents)); return res; } - ~OnionMessageContents() { OnionMessageContents_free(self); } - OnionMessageContents& operator=(OnionMessageContents&& o) { OnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessageContents)); return *this; } - LDKOnionMessageContents* operator &() { return &self; } - LDKOnionMessageContents* operator ->() { return &self; } - const LDKOnionMessageContents* operator &() const { return &self; } - const LDKOnionMessageContents* operator ->() const { return &self; } - /** - * Returns the TLV type identifying the message contents. MUST be >= 64. - */ - inline uint64_t tlv_type(); - /** - * Returns the message type - */ - inline LDK::Str msg_type(); - /** - * Return a human-readable "debug" string describing this object - */ - inline LDK::Str debug_str(); -}; class FundingInfo { private: LDKFundingInfo self; @@ -6915,20 +6908,35 @@ class ClosureReason { const LDKClosureReason* operator &() const { return &self; } const LDKClosureReason* operator ->() const { return &self; } }; -class HTLCDestination { +class HTLCHandlingFailureType { +private: + LDKHTLCHandlingFailureType self; +public: + HTLCHandlingFailureType(const HTLCHandlingFailureType&) = delete; + HTLCHandlingFailureType(HTLCHandlingFailureType&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCHandlingFailureType)); } + HTLCHandlingFailureType(LDKHTLCHandlingFailureType&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCHandlingFailureType)); } + operator LDKHTLCHandlingFailureType() && { LDKHTLCHandlingFailureType res = self; memset(&self, 0, sizeof(LDKHTLCHandlingFailureType)); return res; } + ~HTLCHandlingFailureType() { HTLCHandlingFailureType_free(self); } + HTLCHandlingFailureType& operator=(HTLCHandlingFailureType&& o) { HTLCHandlingFailureType_free(self); self = o.self; memset(&o, 0, sizeof(HTLCHandlingFailureType)); return *this; } + LDKHTLCHandlingFailureType* operator &() { return &self; } + LDKHTLCHandlingFailureType* operator ->() { return &self; } + const LDKHTLCHandlingFailureType* operator &() const { return &self; } + const LDKHTLCHandlingFailureType* operator ->() const { return &self; } +}; +class HTLCHandlingFailureReason { private: - LDKHTLCDestination self; + LDKHTLCHandlingFailureReason self; public: - HTLCDestination(const HTLCDestination&) = delete; - HTLCDestination(HTLCDestination&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCDestination)); } - HTLCDestination(LDKHTLCDestination&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCDestination)); } - operator LDKHTLCDestination() && { LDKHTLCDestination res = self; memset(&self, 0, sizeof(LDKHTLCDestination)); return res; } - ~HTLCDestination() { HTLCDestination_free(self); } - HTLCDestination& operator=(HTLCDestination&& o) { HTLCDestination_free(self); self = o.self; memset(&o, 0, sizeof(HTLCDestination)); return *this; } - LDKHTLCDestination* operator &() { return &self; } - LDKHTLCDestination* operator ->() { return &self; } - const LDKHTLCDestination* operator &() const { return &self; } - const LDKHTLCDestination* operator ->() const { return &self; } + HTLCHandlingFailureReason(const HTLCHandlingFailureReason&) = delete; + HTLCHandlingFailureReason(HTLCHandlingFailureReason&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCHandlingFailureReason)); } + HTLCHandlingFailureReason(LDKHTLCHandlingFailureReason&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCHandlingFailureReason)); } + operator LDKHTLCHandlingFailureReason() && { LDKHTLCHandlingFailureReason res = self; memset(&self, 0, sizeof(LDKHTLCHandlingFailureReason)); return res; } + ~HTLCHandlingFailureReason() { HTLCHandlingFailureReason_free(self); } + HTLCHandlingFailureReason& operator=(HTLCHandlingFailureReason&& o) { HTLCHandlingFailureReason_free(self); self = o.self; memset(&o, 0, sizeof(HTLCHandlingFailureReason)); return *this; } + LDKHTLCHandlingFailureReason* operator &() { return &self; } + LDKHTLCHandlingFailureReason* operator ->() { return &self; } + const LDKHTLCHandlingFailureReason* operator &() const { return &self; } + const LDKHTLCHandlingFailureReason* operator ->() const { return &self; } }; class PaymentFailureReason { private: @@ -6974,41 +6982,6 @@ class Event { const LDKEvent* operator &() const { return &self; } const LDKEvent* operator ->() const { return &self; } }; -class MessageSendEvent { -private: - LDKMessageSendEvent self; -public: - MessageSendEvent(const MessageSendEvent&) = delete; - MessageSendEvent(MessageSendEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEvent)); } - MessageSendEvent(LDKMessageSendEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEvent)); } - operator LDKMessageSendEvent() && { LDKMessageSendEvent res = self; memset(&self, 0, sizeof(LDKMessageSendEvent)); return res; } - ~MessageSendEvent() { MessageSendEvent_free(self); } - MessageSendEvent& operator=(MessageSendEvent&& o) { MessageSendEvent_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEvent)); return *this; } - LDKMessageSendEvent* operator &() { return &self; } - LDKMessageSendEvent* operator ->() { return &self; } - const LDKMessageSendEvent* operator &() const { return &self; } - const LDKMessageSendEvent* operator ->() const { return &self; } -}; -class MessageSendEventsProvider { -private: - LDKMessageSendEventsProvider self; -public: - MessageSendEventsProvider(const MessageSendEventsProvider&) = delete; - MessageSendEventsProvider(MessageSendEventsProvider&& o) : self(o.self) { memset(&o, 0, sizeof(MessageSendEventsProvider)); } - MessageSendEventsProvider(LDKMessageSendEventsProvider&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageSendEventsProvider)); } - operator LDKMessageSendEventsProvider() && { LDKMessageSendEventsProvider res = self; memset(&self, 0, sizeof(LDKMessageSendEventsProvider)); return res; } - ~MessageSendEventsProvider() { MessageSendEventsProvider_free(self); } - MessageSendEventsProvider& operator=(MessageSendEventsProvider&& o) { MessageSendEventsProvider_free(self); self = o.self; memset(&o, 0, sizeof(MessageSendEventsProvider)); return *this; } - LDKMessageSendEventsProvider* operator &() { return &self; } - LDKMessageSendEventsProvider* operator ->() { return &self; } - const LDKMessageSendEventsProvider* operator &() const { return &self; } - const LDKMessageSendEventsProvider* operator ->() const { return &self; } - /** - * Gets the list of pending events which were generated by previous actions, clearing the list - * in the process. - */ - inline LDK::CVec_MessageSendEventZ get_and_clear_pending_msg_events(); -}; class EventsProvider { private: LDKEventsProvider self; @@ -7066,24 +7039,96 @@ class EventHandler { */ inline LDK::CResult_NoneReplayEventZ handle_event(struct LDKEvent event); }; -class Nonce { +class PaidBolt12Invoice { private: - LDKNonce self; + LDKPaidBolt12Invoice self; public: - Nonce(const Nonce&) = delete; - Nonce(Nonce&& o) : self(o.self) { memset(&o, 0, sizeof(Nonce)); } - Nonce(LDKNonce&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNonce)); } - operator LDKNonce() && { LDKNonce res = self; memset(&self, 0, sizeof(LDKNonce)); return res; } - ~Nonce() { Nonce_free(self); } - Nonce& operator=(Nonce&& o) { Nonce_free(self); self = o.self; memset(&o, 0, sizeof(Nonce)); return *this; } - LDKNonce* operator &() { return &self; } - LDKNonce* operator ->() { return &self; } - const LDKNonce* operator &() const { return &self; } - const LDKNonce* operator ->() const { return &self; } + PaidBolt12Invoice(const PaidBolt12Invoice&) = delete; + PaidBolt12Invoice(PaidBolt12Invoice&& o) : self(o.self) { memset(&o, 0, sizeof(PaidBolt12Invoice)); } + PaidBolt12Invoice(LDKPaidBolt12Invoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaidBolt12Invoice)); } + operator LDKPaidBolt12Invoice() && { LDKPaidBolt12Invoice res = self; memset(&self, 0, sizeof(LDKPaidBolt12Invoice)); return res; } + ~PaidBolt12Invoice() { PaidBolt12Invoice_free(self); } + PaidBolt12Invoice& operator=(PaidBolt12Invoice&& o) { PaidBolt12Invoice_free(self); self = o.self; memset(&o, 0, sizeof(PaidBolt12Invoice)); return *this; } + LDKPaidBolt12Invoice* operator &() { return &self; } + LDKPaidBolt12Invoice* operator ->() { return &self; } + const LDKPaidBolt12Invoice* operator &() const { return &self; } + const LDKPaidBolt12Invoice* operator ->() const { return &self; } }; -class RoutingFees { +class Packet { private: - LDKRoutingFees self; + 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 ParsedOnionMessageContents { +private: + LDKParsedOnionMessageContents self; +public: + ParsedOnionMessageContents(const ParsedOnionMessageContents&) = delete; + ParsedOnionMessageContents(ParsedOnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(ParsedOnionMessageContents)); } + ParsedOnionMessageContents(LDKParsedOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParsedOnionMessageContents)); } + operator LDKParsedOnionMessageContents() && { LDKParsedOnionMessageContents res = self; memset(&self, 0, sizeof(LDKParsedOnionMessageContents)); return res; } + ~ParsedOnionMessageContents() { ParsedOnionMessageContents_free(self); } + ParsedOnionMessageContents& operator=(ParsedOnionMessageContents&& o) { ParsedOnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(ParsedOnionMessageContents)); return *this; } + LDKParsedOnionMessageContents* operator &() { return &self; } + LDKParsedOnionMessageContents* operator ->() { return &self; } + const LDKParsedOnionMessageContents* operator &() const { return &self; } + const LDKParsedOnionMessageContents* operator ->() const { return &self; } +}; +class OnionMessageContents { +private: + LDKOnionMessageContents self; +public: + OnionMessageContents(const OnionMessageContents&) = delete; + OnionMessageContents(OnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessageContents)); } + OnionMessageContents(LDKOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessageContents)); } + operator LDKOnionMessageContents() && { LDKOnionMessageContents res = self; memset(&self, 0, sizeof(LDKOnionMessageContents)); return res; } + ~OnionMessageContents() { OnionMessageContents_free(self); } + OnionMessageContents& operator=(OnionMessageContents&& o) { OnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessageContents)); return *this; } + LDKOnionMessageContents* operator &() { return &self; } + LDKOnionMessageContents* operator ->() { return &self; } + const LDKOnionMessageContents* operator &() const { return &self; } + const LDKOnionMessageContents* operator ->() const { return &self; } + /** + * Returns the TLV type identifying the message contents. MUST be >= 64. + */ + inline uint64_t tlv_type(); + /** + * Returns the message type + */ + inline LDK::Str msg_type(); + /** + * Return a human-readable "debug" string describing this object + */ + inline LDK::Str debug_str(); +}; +class Nonce { +private: + LDKNonce self; +public: + Nonce(const Nonce&) = delete; + Nonce(Nonce&& o) : self(o.self) { memset(&o, 0, sizeof(Nonce)); } + Nonce(LDKNonce&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNonce)); } + operator LDKNonce() && { LDKNonce res = self; memset(&self, 0, sizeof(LDKNonce)); return res; } + ~Nonce() { Nonce_free(self); } + Nonce& operator=(Nonce&& o) { Nonce_free(self); self = o.self; memset(&o, 0, sizeof(Nonce)); return *this; } + LDKNonce* operator &() { return &self; } + LDKNonce* operator ->() { return &self; } + const LDKNonce* operator &() const { return &self; } + const LDKNonce* operator ->() const { return &self; } +}; +class RoutingFees { +private: + LDKRoutingFees self; public: RoutingFees(const RoutingFees&) = delete; RoutingFees(RoutingFees&& o) : self(o.self) { memset(&o, 0, sizeof(RoutingFees)); } @@ -7467,6 +7512,21 @@ class BigSize { const LDKBigSize* operator &() const { return &self; } const LDKBigSize* operator ->() const { return &self; } }; +class CollectionLength { +private: + LDKCollectionLength self; +public: + CollectionLength(const CollectionLength&) = delete; + CollectionLength(CollectionLength&& o) : self(o.self) { memset(&o, 0, sizeof(CollectionLength)); } + CollectionLength(LDKCollectionLength&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCollectionLength)); } + operator LDKCollectionLength() && { LDKCollectionLength res = self; memset(&self, 0, sizeof(LDKCollectionLength)); return res; } + ~CollectionLength() { CollectionLength_free(self); } + CollectionLength& operator=(CollectionLength&& o) { CollectionLength_free(self); self = o.self; memset(&o, 0, sizeof(CollectionLength)); return *this; } + LDKCollectionLength* operator &() { return &self; } + LDKCollectionLength* operator ->() { return &self; } + const LDKCollectionLength* operator &() const { return &self; } + const LDKCollectionLength* operator ->() const { return &self; } +}; class Hostname { private: LDKHostname self; @@ -7482,81 +7542,6 @@ class Hostname { const LDKHostname* operator &() const { return &self; } const LDKHostname* operator ->() const { return &self; } }; -class TransactionU16LenLimited { -private: - LDKTransactionU16LenLimited self; -public: - TransactionU16LenLimited(const TransactionU16LenLimited&) = delete; - TransactionU16LenLimited(TransactionU16LenLimited&& o) : self(o.self) { memset(&o, 0, sizeof(TransactionU16LenLimited)); } - TransactionU16LenLimited(LDKTransactionU16LenLimited&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTransactionU16LenLimited)); } - operator LDKTransactionU16LenLimited() && { LDKTransactionU16LenLimited res = self; memset(&self, 0, sizeof(LDKTransactionU16LenLimited)); return res; } - ~TransactionU16LenLimited() { TransactionU16LenLimited_free(self); } - TransactionU16LenLimited& operator=(TransactionU16LenLimited&& o) { TransactionU16LenLimited_free(self); self = o.self; memset(&o, 0, sizeof(TransactionU16LenLimited)); return *this; } - LDKTransactionU16LenLimited* operator &() { return &self; } - LDKTransactionU16LenLimited* operator ->() { return &self; } - const LDKTransactionU16LenLimited* operator &() const { return &self; } - const LDKTransactionU16LenLimited* operator ->() const { return &self; } -}; -class ChannelId { -private: - LDKChannelId self; -public: - ChannelId(const ChannelId&) = delete; - ChannelId(ChannelId&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelId)); } - ChannelId(LDKChannelId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelId)); } - operator LDKChannelId() && { LDKChannelId res = self; memset(&self, 0, sizeof(LDKChannelId)); return res; } - ~ChannelId() { ChannelId_free(self); } - ChannelId& operator=(ChannelId&& o) { ChannelId_free(self); self = o.self; memset(&o, 0, sizeof(ChannelId)); return *this; } - LDKChannelId* operator &() { return &self; } - LDKChannelId* operator ->() { return &self; } - const LDKChannelId* operator &() const { return &self; } - const LDKChannelId* operator ->() const { return &self; } -}; -class CustomMessageReader { -private: - LDKCustomMessageReader self; -public: - CustomMessageReader(const CustomMessageReader&) = delete; - CustomMessageReader(CustomMessageReader&& o) : self(o.self) { memset(&o, 0, sizeof(CustomMessageReader)); } - CustomMessageReader(LDKCustomMessageReader&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomMessageReader)); } - operator LDKCustomMessageReader() && { LDKCustomMessageReader res = self; memset(&self, 0, sizeof(LDKCustomMessageReader)); return res; } - ~CustomMessageReader() { CustomMessageReader_free(self); } - CustomMessageReader& operator=(CustomMessageReader&& o) { CustomMessageReader_free(self); self = o.self; memset(&o, 0, sizeof(CustomMessageReader)); return *this; } - LDKCustomMessageReader* operator &() { return &self; } - LDKCustomMessageReader* operator ->() { return &self; } - const LDKCustomMessageReader* operator &() const { return &self; } - const LDKCustomMessageReader* operator ->() const { return &self; } - /** - * Decodes a custom message to `CustomMessageType`. If the given message type is known to the - * implementation and the message could be decoded, must return `Ok(Some(message))`. If the - * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error - * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. - */ - inline LDK::CResult_COption_TypeZDecodeErrorZ read(uint16_t message_type, struct LDKu8slice buffer); -}; -class Type { -private: - LDKType self; -public: - Type(const Type&) = delete; - Type(Type&& o) : self(o.self) { memset(&o, 0, sizeof(Type)); } - Type(LDKType&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKType)); } - operator LDKType() && { LDKType res = self; memset(&self, 0, sizeof(LDKType)); return res; } - ~Type() { Type_free(self); } - Type& operator=(Type&& o) { Type_free(self); self = o.self; memset(&o, 0, sizeof(Type)); return *this; } - LDKType* operator &() { return &self; } - LDKType* operator ->() { return &self; } - const LDKType* operator &() const { return &self; } - const LDKType* operator ->() const { return &self; } - /** - * Returns the type identifying the message payload. - */ - inline uint16_t type_id(); - /** - * Return a human-readable "debug" string describing this object - */ - inline LDK::Str debug_str(); -}; class BlindedPayInfo { private: LDKBlindedPayInfo self; @@ -7617,6 +7602,21 @@ class ForwardTlvs { const LDKForwardTlvs* operator &() const { return &self; } const LDKForwardTlvs* operator ->() const { return &self; } }; +class TrampolineForwardTlvs { +private: + LDKTrampolineForwardTlvs self; +public: + TrampolineForwardTlvs(const TrampolineForwardTlvs&) = delete; + TrampolineForwardTlvs(TrampolineForwardTlvs&& o) : self(o.self) { memset(&o, 0, sizeof(TrampolineForwardTlvs)); } + TrampolineForwardTlvs(LDKTrampolineForwardTlvs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTrampolineForwardTlvs)); } + operator LDKTrampolineForwardTlvs() && { LDKTrampolineForwardTlvs res = self; memset(&self, 0, sizeof(LDKTrampolineForwardTlvs)); return res; } + ~TrampolineForwardTlvs() { TrampolineForwardTlvs_free(self); } + TrampolineForwardTlvs& operator=(TrampolineForwardTlvs&& o) { TrampolineForwardTlvs_free(self); self = o.self; memset(&o, 0, sizeof(TrampolineForwardTlvs)); return *this; } + LDKTrampolineForwardTlvs* operator &() { return &self; } + LDKTrampolineForwardTlvs* operator ->() { return &self; } + const LDKTrampolineForwardTlvs* operator &() const { return &self; } + const LDKTrampolineForwardTlvs* operator ->() const { return &self; } +}; class ReceiveTlvs { private: LDKReceiveTlvs self; @@ -7707,6 +7707,21 @@ class Bolt12OfferContext { const LDKBolt12OfferContext* operator &() const { return &self; } const LDKBolt12OfferContext* operator ->() const { return &self; } }; +class AsyncBolt12OfferContext { +private: + LDKAsyncBolt12OfferContext self; +public: + AsyncBolt12OfferContext(const AsyncBolt12OfferContext&) = delete; + AsyncBolt12OfferContext(AsyncBolt12OfferContext&& o) : self(o.self) { memset(&o, 0, sizeof(AsyncBolt12OfferContext)); } + AsyncBolt12OfferContext(LDKAsyncBolt12OfferContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAsyncBolt12OfferContext)); } + operator LDKAsyncBolt12OfferContext() && { LDKAsyncBolt12OfferContext res = self; memset(&self, 0, sizeof(LDKAsyncBolt12OfferContext)); return res; } + ~AsyncBolt12OfferContext() { AsyncBolt12OfferContext_free(self); } + AsyncBolt12OfferContext& operator=(AsyncBolt12OfferContext&& o) { AsyncBolt12OfferContext_free(self); self = o.self; memset(&o, 0, sizeof(AsyncBolt12OfferContext)); return *this; } + LDKAsyncBolt12OfferContext* operator &() { return &self; } + LDKAsyncBolt12OfferContext* operator ->() { return &self; } + const LDKAsyncBolt12OfferContext* operator &() const { return &self; } + const LDKAsyncBolt12OfferContext* operator ->() const { return &self; } +}; class Bolt12RefundContext { private: LDKBolt12RefundContext self; @@ -7722,87 +7737,65 @@ class Bolt12RefundContext { const LDKBolt12RefundContext* operator &() const { return &self; } const LDKBolt12RefundContext* operator ->() const { return &self; } }; -class LSPS0ClientEvent { -private: - LDKLSPS0ClientEvent self; -public: - LSPS0ClientEvent(const LSPS0ClientEvent&) = delete; - LSPS0ClientEvent(LSPS0ClientEvent&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0ClientEvent)); } - LSPS0ClientEvent(LDKLSPS0ClientEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0ClientEvent)); } - operator LDKLSPS0ClientEvent() && { LDKLSPS0ClientEvent res = self; memset(&self, 0, sizeof(LDKLSPS0ClientEvent)); return res; } - ~LSPS0ClientEvent() { LSPS0ClientEvent_free(self); } - LSPS0ClientEvent& operator=(LSPS0ClientEvent&& o) { LSPS0ClientEvent_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0ClientEvent)); return *this; } - LDKLSPS0ClientEvent* operator &() { return &self; } - LDKLSPS0ClientEvent* operator ->() { return &self; } - const LDKLSPS0ClientEvent* operator &() const { return &self; } - const LDKLSPS0ClientEvent* operator ->() const { return &self; } -}; -class UtxoLookupError { -private: - LDKUtxoLookupError self; -public: - UtxoLookupError(const UtxoLookupError&) = delete; - UtxoLookupError(UtxoLookupError&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoLookupError)); } - UtxoLookupError(LDKUtxoLookupError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoLookupError)); } - operator LDKUtxoLookupError() && { LDKUtxoLookupError res = self; memset(&self, 0, sizeof(LDKUtxoLookupError)); return res; } - UtxoLookupError& operator=(UtxoLookupError&& o) { self = o.self; memset(&o, 0, sizeof(UtxoLookupError)); return *this; } - LDKUtxoLookupError* operator &() { return &self; } - LDKUtxoLookupError* operator ->() { return &self; } - const LDKUtxoLookupError* operator &() const { return &self; } - const LDKUtxoLookupError* operator ->() const { return &self; } -}; -class UtxoResult { +class ChannelId { private: - LDKUtxoResult self; + LDKChannelId self; public: - UtxoResult(const UtxoResult&) = delete; - UtxoResult(UtxoResult&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoResult)); } - UtxoResult(LDKUtxoResult&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoResult)); } - operator LDKUtxoResult() && { LDKUtxoResult res = self; memset(&self, 0, sizeof(LDKUtxoResult)); return res; } - ~UtxoResult() { UtxoResult_free(self); } - UtxoResult& operator=(UtxoResult&& o) { UtxoResult_free(self); self = o.self; memset(&o, 0, sizeof(UtxoResult)); return *this; } - LDKUtxoResult* operator &() { return &self; } - LDKUtxoResult* operator ->() { return &self; } - const LDKUtxoResult* operator &() const { return &self; } - const LDKUtxoResult* operator ->() const { return &self; } + ChannelId(const ChannelId&) = delete; + ChannelId(ChannelId&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelId)); } + ChannelId(LDKChannelId&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelId)); } + operator LDKChannelId() && { LDKChannelId res = self; memset(&self, 0, sizeof(LDKChannelId)); return res; } + ~ChannelId() { ChannelId_free(self); } + ChannelId& operator=(ChannelId&& o) { ChannelId_free(self); self = o.self; memset(&o, 0, sizeof(ChannelId)); return *this; } + LDKChannelId* operator &() { return &self; } + LDKChannelId* operator ->() { return &self; } + const LDKChannelId* operator &() const { return &self; } + const LDKChannelId* operator ->() const { return &self; } }; -class UtxoLookup { +class CustomMessageReader { private: - LDKUtxoLookup self; + LDKCustomMessageReader self; public: - UtxoLookup(const UtxoLookup&) = delete; - UtxoLookup(UtxoLookup&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoLookup)); } - UtxoLookup(LDKUtxoLookup&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoLookup)); } - operator LDKUtxoLookup() && { LDKUtxoLookup res = self; memset(&self, 0, sizeof(LDKUtxoLookup)); return res; } - ~UtxoLookup() { UtxoLookup_free(self); } - UtxoLookup& operator=(UtxoLookup&& o) { UtxoLookup_free(self); self = o.self; memset(&o, 0, sizeof(UtxoLookup)); return *this; } - LDKUtxoLookup* operator &() { return &self; } - LDKUtxoLookup* operator ->() { return &self; } - const LDKUtxoLookup* operator &() const { return &self; } - const LDKUtxoLookup* operator ->() const { return &self; } + CustomMessageReader(const CustomMessageReader&) = delete; + CustomMessageReader(CustomMessageReader&& o) : self(o.self) { memset(&o, 0, sizeof(CustomMessageReader)); } + CustomMessageReader(LDKCustomMessageReader&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomMessageReader)); } + operator LDKCustomMessageReader() && { LDKCustomMessageReader res = self; memset(&self, 0, sizeof(LDKCustomMessageReader)); return res; } + ~CustomMessageReader() { CustomMessageReader_free(self); } + CustomMessageReader& operator=(CustomMessageReader&& o) { CustomMessageReader_free(self); self = o.self; memset(&o, 0, sizeof(CustomMessageReader)); return *this; } + LDKCustomMessageReader* operator &() { return &self; } + LDKCustomMessageReader* operator ->() { return &self; } + const LDKCustomMessageReader* operator &() const { return &self; } + const LDKCustomMessageReader* operator ->() const { return &self; } /** - * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `chain_hash` is for a different chain or if such a transaction output is - * unknown. - * - * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id + * Decodes a custom message to `CustomMessageType`. If the given message type is known to the + * implementation and the message could be decoded, must return `Ok(Some(message))`. If the + * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error + * occur, must return `Err(DecodeError::X)` where `X` details the encountered error. */ - inline LDK::UtxoResult get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id); + inline LDK::CResult_COption_TypeZDecodeErrorZ read(uint16_t message_type, struct LDKu8slice buffer); }; -class UtxoFuture { +class Type { private: - LDKUtxoFuture self; + LDKType self; public: - UtxoFuture(const UtxoFuture&) = delete; - UtxoFuture(UtxoFuture&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoFuture)); } - UtxoFuture(LDKUtxoFuture&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoFuture)); } - operator LDKUtxoFuture() && { LDKUtxoFuture res = self; memset(&self, 0, sizeof(LDKUtxoFuture)); return res; } - ~UtxoFuture() { UtxoFuture_free(self); } - UtxoFuture& operator=(UtxoFuture&& o) { UtxoFuture_free(self); self = o.self; memset(&o, 0, sizeof(UtxoFuture)); return *this; } - LDKUtxoFuture* operator &() { return &self; } - LDKUtxoFuture* operator ->() { return &self; } - const LDKUtxoFuture* operator &() const { return &self; } - const LDKUtxoFuture* operator ->() const { return &self; } + Type(const Type&) = delete; + Type(Type&& o) : self(o.self) { memset(&o, 0, sizeof(Type)); } + Type(LDKType&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKType)); } + operator LDKType() && { LDKType res = self; memset(&self, 0, sizeof(LDKType)); return res; } + ~Type() { Type_free(self); } + Type& operator=(Type&& o) { Type_free(self); self = o.self; memset(&o, 0, sizeof(Type)); return *this; } + LDKType* operator &() { return &self; } + LDKType* operator ->() { return &self; } + const LDKType* operator &() const { return &self; } + const LDKType* operator ->() const { return &self; } + /** + * Returns the type identifying the message payload. + */ + inline uint16_t type_id(); + /** + * Return a human-readable "debug" string describing this object + */ + inline LDK::Str debug_str(); }; class OnionMessenger { private: @@ -7886,23 +7879,7 @@ class MessageRouter { * Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to * be direct peers with the `recipient`. */ - inline LDK::CResult_CVec_BlindedMessagePathZNoneZ create_blinded_paths(struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers); - /** - * Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are - * assumed to be direct peers with the `recipient`. - * - * Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, - * which is beneficial when a QR code is used to transport the data. The SCID is passed using - * a [`MessageForwardNode`] but may be `None` for graceful degradation. - * - * Implementations using additional intermediate nodes are responsible for using a - * [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations - * should call [`BlindedMessagePath::use_compact_introduction_node`]. - * - * The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], - * ignoring the short channel ids. - */ - inline LDK::CResult_CVec_BlindedMessagePathZNoneZ create_compact_blinded_paths(struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); + inline LDK::CResult_CVec_BlindedMessagePathZNoneZ create_blinded_paths(struct LDKPublicKey recipient, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); }; class DefaultMessageRouter { private: @@ -7919,6 +7896,36 @@ class DefaultMessageRouter { const LDKDefaultMessageRouter* operator &() const { return &self; } const LDKDefaultMessageRouter* operator ->() const { return &self; } }; +class NodeIdMessageRouter { +private: + LDKNodeIdMessageRouter self; +public: + NodeIdMessageRouter(const NodeIdMessageRouter&) = delete; + NodeIdMessageRouter(NodeIdMessageRouter&& o) : self(o.self) { memset(&o, 0, sizeof(NodeIdMessageRouter)); } + NodeIdMessageRouter(LDKNodeIdMessageRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNodeIdMessageRouter)); } + operator LDKNodeIdMessageRouter() && { LDKNodeIdMessageRouter res = self; memset(&self, 0, sizeof(LDKNodeIdMessageRouter)); return res; } + ~NodeIdMessageRouter() { NodeIdMessageRouter_free(self); } + NodeIdMessageRouter& operator=(NodeIdMessageRouter&& o) { NodeIdMessageRouter_free(self); self = o.self; memset(&o, 0, sizeof(NodeIdMessageRouter)); return *this; } + LDKNodeIdMessageRouter* operator &() { return &self; } + LDKNodeIdMessageRouter* operator ->() { return &self; } + const LDKNodeIdMessageRouter* operator &() const { return &self; } + const LDKNodeIdMessageRouter* operator ->() const { return &self; } +}; +class NullMessageRouter { +private: + LDKNullMessageRouter self; +public: + NullMessageRouter(const NullMessageRouter&) = delete; + NullMessageRouter(NullMessageRouter&& o) : self(o.self) { memset(&o, 0, sizeof(NullMessageRouter)); } + NullMessageRouter(LDKNullMessageRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNullMessageRouter)); } + operator LDKNullMessageRouter() && { LDKNullMessageRouter res = self; memset(&self, 0, sizeof(LDKNullMessageRouter)); return res; } + ~NullMessageRouter() { NullMessageRouter_free(self); } + NullMessageRouter& operator=(NullMessageRouter&& o) { NullMessageRouter_free(self); self = o.self; memset(&o, 0, sizeof(NullMessageRouter)); return *this; } + LDKNullMessageRouter* operator &() { return &self; } + LDKNullMessageRouter* operator ->() { return &self; } + const LDKNullMessageRouter* operator &() const { return &self; } + const LDKNullMessageRouter* operator ->() const { return &self; } +}; class OnionMessagePath { private: LDKOnionMessagePath self; @@ -7996,6 +8003,9 @@ class CustomOnionMessageHandler { /** * Called with the custom message that was received, returning a response to send, if any. * + * If the provided `context` is `Some`, then the message was sent to a blinded path that we + * created and was authenticated as such by the [`OnionMessenger`]. + * * The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -8029,6 +8039,73 @@ class PeeledOnion { const LDKPeeledOnion* operator &() const { return &self; } const LDKPeeledOnion* operator ->() const { return &self; } }; +class UtxoLookupError { +private: + LDKUtxoLookupError self; +public: + UtxoLookupError(const UtxoLookupError&) = delete; + UtxoLookupError(UtxoLookupError&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoLookupError)); } + UtxoLookupError(LDKUtxoLookupError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoLookupError)); } + operator LDKUtxoLookupError() && { LDKUtxoLookupError res = self; memset(&self, 0, sizeof(LDKUtxoLookupError)); return res; } + UtxoLookupError& operator=(UtxoLookupError&& o) { self = o.self; memset(&o, 0, sizeof(UtxoLookupError)); return *this; } + LDKUtxoLookupError* operator &() { return &self; } + LDKUtxoLookupError* operator ->() { return &self; } + const LDKUtxoLookupError* operator &() const { return &self; } + const LDKUtxoLookupError* operator ->() const { return &self; } +}; +class UtxoResult { +private: + LDKUtxoResult self; +public: + UtxoResult(const UtxoResult&) = delete; + UtxoResult(UtxoResult&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoResult)); } + UtxoResult(LDKUtxoResult&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoResult)); } + operator LDKUtxoResult() && { LDKUtxoResult res = self; memset(&self, 0, sizeof(LDKUtxoResult)); return res; } + ~UtxoResult() { UtxoResult_free(self); } + UtxoResult& operator=(UtxoResult&& o) { UtxoResult_free(self); self = o.self; memset(&o, 0, sizeof(UtxoResult)); return *this; } + LDKUtxoResult* operator &() { return &self; } + LDKUtxoResult* operator ->() { return &self; } + const LDKUtxoResult* operator &() const { return &self; } + const LDKUtxoResult* operator ->() const { return &self; } +}; +class UtxoLookup { +private: + LDKUtxoLookup self; +public: + UtxoLookup(const UtxoLookup&) = delete; + UtxoLookup(UtxoLookup&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoLookup)); } + UtxoLookup(LDKUtxoLookup&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoLookup)); } + operator LDKUtxoLookup() && { LDKUtxoLookup res = self; memset(&self, 0, sizeof(LDKUtxoLookup)); return res; } + ~UtxoLookup() { UtxoLookup_free(self); } + UtxoLookup& operator=(UtxoLookup&& o) { UtxoLookup_free(self); self = o.self; memset(&o, 0, sizeof(UtxoLookup)); return *this; } + LDKUtxoLookup* operator &() { return &self; } + LDKUtxoLookup* operator ->() { return &self; } + const LDKUtxoLookup* operator &() const { return &self; } + const LDKUtxoLookup* operator ->() const { return &self; } + /** + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `chain_hash` is for a different chain or if such a transaction output is + * unknown. + * + * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id + */ + inline LDK::UtxoResult get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id); +}; +class UtxoFuture { +private: + LDKUtxoFuture self; +public: + UtxoFuture(const UtxoFuture&) = delete; + UtxoFuture(UtxoFuture&& o) : self(o.self) { memset(&o, 0, sizeof(UtxoFuture)); } + UtxoFuture(LDKUtxoFuture&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUtxoFuture)); } + operator LDKUtxoFuture() && { LDKUtxoFuture res = self; memset(&self, 0, sizeof(LDKUtxoFuture)); return res; } + ~UtxoFuture() { UtxoFuture_free(self); } + UtxoFuture& operator=(UtxoFuture&& o) { UtxoFuture_free(self); self = o.self; memset(&o, 0, sizeof(UtxoFuture)); return *this; } + LDKUtxoFuture* operator &() { return &self; } + LDKUtxoFuture* operator ->() { return &self; } + const LDKUtxoFuture* operator &() const { return &self; } + const LDKUtxoFuture* operator ->() const { return &self; } +}; class FilesystemStore { private: LDKFilesystemStore self; @@ -8264,54 +8341,65 @@ class BlindedHop { const LDKBlindedHop* operator &() const { return &self; } const LDKBlindedHop* operator ->() const { return &self; } }; -class LiquidityEvent { -private: - LDKLiquidityEvent self; -public: - LiquidityEvent(const LiquidityEvent&) = delete; - LiquidityEvent(LiquidityEvent&& o) : self(o.self) { memset(&o, 0, sizeof(LiquidityEvent)); } - LiquidityEvent(LDKLiquidityEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLiquidityEvent)); } - operator LDKLiquidityEvent() && { LDKLiquidityEvent res = self; memset(&self, 0, sizeof(LDKLiquidityEvent)); return res; } - ~LiquidityEvent() { LiquidityEvent_free(self); } - LiquidityEvent& operator=(LiquidityEvent&& o) { LiquidityEvent_free(self); self = o.self; memset(&o, 0, sizeof(LiquidityEvent)); return *this; } - LDKLiquidityEvent* operator &() { return &self; } - LDKLiquidityEvent* operator ->() { return &self; } - const LDKLiquidityEvent* operator &() const { return &self; } - const LDKLiquidityEvent* operator ->() const { return &self; } -}; -class MessageQueue { -private: - LDKMessageQueue self; -public: - MessageQueue(const MessageQueue&) = delete; - MessageQueue(MessageQueue&& o) : self(o.self) { memset(&o, 0, sizeof(MessageQueue)); } - MessageQueue(LDKMessageQueue&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageQueue)); } - operator LDKMessageQueue() && { LDKMessageQueue res = self; memset(&self, 0, sizeof(LDKMessageQueue)); return res; } - ~MessageQueue() { MessageQueue_free(self); } - MessageQueue& operator=(MessageQueue&& o) { MessageQueue_free(self); self = o.self; memset(&o, 0, sizeof(MessageQueue)); return *this; } - LDKMessageQueue* operator &() { return &self; } - LDKMessageQueue* operator ->() { return &self; } - const LDKMessageQueue* operator &() const { return &self; } - const LDKMessageQueue* operator ->() const { return &self; } -}; -class ProcessMessagesCallback { -private: - LDKProcessMessagesCallback self; -public: - ProcessMessagesCallback(const ProcessMessagesCallback&) = delete; - ProcessMessagesCallback(ProcessMessagesCallback&& o) : self(o.self) { memset(&o, 0, sizeof(ProcessMessagesCallback)); } - ProcessMessagesCallback(LDKProcessMessagesCallback&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKProcessMessagesCallback)); } - operator LDKProcessMessagesCallback() && { LDKProcessMessagesCallback res = self; memset(&self, 0, sizeof(LDKProcessMessagesCallback)); return res; } - ~ProcessMessagesCallback() { ProcessMessagesCallback_free(self); } - ProcessMessagesCallback& operator=(ProcessMessagesCallback&& o) { ProcessMessagesCallback_free(self); self = o.self; memset(&o, 0, sizeof(ProcessMessagesCallback)); return *this; } - LDKProcessMessagesCallback* operator &() { return &self; } - LDKProcessMessagesCallback* operator ->() { return &self; } - const LDKProcessMessagesCallback* operator &() const { return &self; } - const LDKProcessMessagesCallback* operator ->() const { return &self; } - /** - * The method which is called. - */ - inline void call(); +class SpliceContribution { +private: + LDKSpliceContribution self; +public: + SpliceContribution(const SpliceContribution&) = delete; + SpliceContribution(SpliceContribution&& o) : self(o.self) { memset(&o, 0, sizeof(SpliceContribution)); } + SpliceContribution(LDKSpliceContribution&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSpliceContribution)); } + operator LDKSpliceContribution() && { LDKSpliceContribution res = self; memset(&self, 0, sizeof(LDKSpliceContribution)); return res; } + ~SpliceContribution() { SpliceContribution_free(self); } + SpliceContribution& operator=(SpliceContribution&& o) { SpliceContribution_free(self); self = o.self; memset(&o, 0, sizeof(SpliceContribution)); return *this; } + LDKSpliceContribution* operator &() { return &self; } + LDKSpliceContribution* operator ->() { return &self; } + const LDKSpliceContribution* operator &() const { return &self; } + const LDKSpliceContribution* operator ->() const { return &self; } +}; +class FundingTxInput { +private: + LDKFundingTxInput self; +public: + FundingTxInput(const FundingTxInput&) = delete; + FundingTxInput(FundingTxInput&& o) : self(o.self) { memset(&o, 0, sizeof(FundingTxInput)); } + FundingTxInput(LDKFundingTxInput&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFundingTxInput)); } + operator LDKFundingTxInput() && { LDKFundingTxInput res = self; memset(&self, 0, sizeof(LDKFundingTxInput)); return res; } + ~FundingTxInput() { FundingTxInput_free(self); } + FundingTxInput& operator=(FundingTxInput&& o) { FundingTxInput_free(self); self = o.self; memset(&o, 0, sizeof(FundingTxInput)); return *this; } + LDKFundingTxInput* operator &() { return &self; } + LDKFundingTxInput* operator ->() { return &self; } + const LDKFundingTxInput* operator &() const { return &self; } + const LDKFundingTxInput* operator ->() const { return &self; } +}; +class LocalHTLCFailureReason { +private: + LDKLocalHTLCFailureReason self; +public: + LocalHTLCFailureReason(const LocalHTLCFailureReason&) = delete; + LocalHTLCFailureReason(LocalHTLCFailureReason&& o) : self(o.self) { memset(&o, 0, sizeof(LocalHTLCFailureReason)); } + LocalHTLCFailureReason(LDKLocalHTLCFailureReason&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLocalHTLCFailureReason)); } + operator LDKLocalHTLCFailureReason() && { LDKLocalHTLCFailureReason res = self; memset(&self, 0, sizeof(LDKLocalHTLCFailureReason)); return res; } + ~LocalHTLCFailureReason() { LocalHTLCFailureReason_free(self); } + LocalHTLCFailureReason& operator=(LocalHTLCFailureReason&& o) { LocalHTLCFailureReason_free(self); self = o.self; memset(&o, 0, sizeof(LocalHTLCFailureReason)); return *this; } + LDKLocalHTLCFailureReason* operator &() { return &self; } + LDKLocalHTLCFailureReason* operator ->() { return &self; } + const LDKLocalHTLCFailureReason* operator &() const { return &self; } + const LDKLocalHTLCFailureReason* operator ->() const { return &self; } +}; +class AttributionData { +private: + LDKAttributionData self; +public: + AttributionData(const AttributionData&) = delete; + AttributionData(AttributionData&& o) : self(o.self) { memset(&o, 0, sizeof(AttributionData)); } + AttributionData(LDKAttributionData&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAttributionData)); } + operator LDKAttributionData() && { LDKAttributionData res = self; memset(&self, 0, sizeof(LDKAttributionData)); return res; } + ~AttributionData() { AttributionData_free(self); } + AttributionData& operator=(AttributionData&& o) { AttributionData_free(self); self = o.self; memset(&o, 0, sizeof(AttributionData)); return *this; } + LDKAttributionData* operator &() { return &self; } + LDKAttributionData* operator ->() { return &self; } + const LDKAttributionData* operator &() const { return &self; } + const LDKAttributionData* operator ->() const { return &self; } }; class InvoiceError { private: @@ -8373,21 +8461,6 @@ class OutputSpendStatus { const LDKOutputSpendStatus* operator &() const { return &self; } const LDKOutputSpendStatus* operator ->() const { return &self; } }; -class OutputSweeper { -private: - LDKOutputSweeper self; -public: - OutputSweeper(const OutputSweeper&) = delete; - OutputSweeper(OutputSweeper&& o) : self(o.self) { memset(&o, 0, sizeof(OutputSweeper)); } - OutputSweeper(LDKOutputSweeper&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOutputSweeper)); } - operator LDKOutputSweeper() && { LDKOutputSweeper res = self; memset(&self, 0, sizeof(LDKOutputSweeper)); return res; } - ~OutputSweeper() { OutputSweeper_free(self); } - OutputSweeper& operator=(OutputSweeper&& o) { OutputSweeper_free(self); self = o.self; memset(&o, 0, sizeof(OutputSweeper)); return *this; } - LDKOutputSweeper* operator &() { return &self; } - LDKOutputSweeper* operator ->() { return &self; } - const LDKOutputSweeper* operator &() const { return &self; } - const LDKOutputSweeper* operator ->() const { return &self; } -}; class SpendingDelay { private: LDKSpendingDelay self; @@ -8403,6 +8476,21 @@ class SpendingDelay { const LDKSpendingDelay* operator &() const { return &self; } const LDKSpendingDelay* operator ->() const { return &self; } }; +class OutputSweeperSync { +private: + LDKOutputSweeperSync self; +public: + OutputSweeperSync(const OutputSweeperSync&) = delete; + OutputSweeperSync(OutputSweeperSync&& o) : self(o.self) { memset(&o, 0, sizeof(OutputSweeperSync)); } + OutputSweeperSync(LDKOutputSweeperSync&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOutputSweeperSync)); } + operator LDKOutputSweeperSync() && { LDKOutputSweeperSync res = self; memset(&self, 0, sizeof(LDKOutputSweeperSync)); return res; } + ~OutputSweeperSync() { OutputSweeperSync_free(self); } + OutputSweeperSync& operator=(OutputSweeperSync&& o) { OutputSweeperSync_free(self); self = o.self; memset(&o, 0, sizeof(OutputSweeperSync)); return *this; } + LDKOutputSweeperSync* operator &() { return &self; } + LDKOutputSweeperSync* operator ->() { return &self; } + const LDKOutputSweeperSync* operator &() const { return &self; } + const LDKOutputSweeperSync* operator ->() const { return &self; } +}; class DelayedPaymentBasepoint { private: LDKDelayedPaymentBasepoint self; @@ -8509,11 +8597,13 @@ class Persist { const LDKPersist* operator ->() const { return &self; } /** * 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. + * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup, + * with the `monitor_name` returned by [`ChannelMonitor::persistence_key`]. * - * 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 data can be stored any way you want, so long as `monitor_name` is used to maintain a + * correct mapping with the stored channel data (i.e., calls to `update_persisted_channel` with + * the same `monitor_name` must be applied to or overwrite this data). Note that you **must** + * persist every new monitor to disk. * * The [`ChannelMonitor::get_latest_update_id`] uniquely links this call to [`ChainMonitor::channel_monitor_updated`]. * For [`Persist::persist_new_channel`], it is only necessary to call [`ChainMonitor::channel_monitor_updated`] @@ -8525,7 +8615,7 @@ class Persist { * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [`Writeable::write`]: crate::util::ser::Writeable::write */ - inline LDK::ChannelMonitorUpdateStatus persist_new_channel(struct LDKOutPoint channel_funding_outpoint, const struct LDKChannelMonitor *NONNULL_PTR monitor); + inline LDK::ChannelMonitorUpdateStatus persist_new_channel(struct LDKMonitorName monitor_name, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given * update. @@ -8567,7 +8657,7 @@ class Persist { * * Note that monitor_update (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::ChannelMonitorUpdateStatus update_persisted_channel(struct LDKOutPoint channel_funding_outpoint, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor); + inline LDK::ChannelMonitorUpdateStatus update_persisted_channel(struct LDKMonitorName monitor_name, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor); /** * Prevents the channel monitor from being loaded on startup. * @@ -8581,7 +8671,16 @@ class Persist { * restart, this method must in that case be idempotent, ensuring it can handle scenarios where * the monitor already exists in the archive. */ - inline void archive_persisted_channel(struct LDKOutPoint channel_funding_outpoint); + inline void archive_persisted_channel(struct LDKMonitorName monitor_name); + /** + * Fetches the set of [`ChannelMonitorUpdate`]s, previously persisted with + * [`Self::update_persisted_channel`], which have completed. + * + * Returning an update here is equivalent to calling + * [`ChainMonitor::channel_monitor_updated`]. Because of this, this method is defaulted and + * hidden in the docs. + */ + inline LDK::CVec_C2Tuple_ChannelIdu64ZZ get_and_clear_completed_updates(); }; class LockedChannelMonitor { private: @@ -8613,21 +8712,6 @@ class ChainMonitor { const LDKChainMonitor* operator &() const { return &self; } const LDKChainMonitor* operator ->() const { return &self; } }; -class LSPS0ServiceHandler { -private: - LDKLSPS0ServiceHandler self; -public: - LSPS0ServiceHandler(const LSPS0ServiceHandler&) = delete; - LSPS0ServiceHandler(LSPS0ServiceHandler&& o) : self(o.self) { memset(&o, 0, sizeof(LSPS0ServiceHandler)); } - LSPS0ServiceHandler(LDKLSPS0ServiceHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLSPS0ServiceHandler)); } - operator LDKLSPS0ServiceHandler() && { LDKLSPS0ServiceHandler res = self; memset(&self, 0, sizeof(LDKLSPS0ServiceHandler)); return res; } - ~LSPS0ServiceHandler() { LSPS0ServiceHandler_free(self); } - LSPS0ServiceHandler& operator=(LSPS0ServiceHandler&& o) { LSPS0ServiceHandler_free(self); self = o.self; memset(&o, 0, sizeof(LSPS0ServiceHandler)); return *this; } - LDKLSPS0ServiceHandler* operator &() { return &self; } - LDKLSPS0ServiceHandler* operator ->() { return &self; } - const LDKLSPS0ServiceHandler* operator &() const { return &self; } - const LDKLSPS0ServiceHandler* operator ->() const { return &self; } -}; class BlindedMessagePath { private: LDKBlindedMessagePath self; @@ -8643,95 +8727,3665 @@ class BlindedMessagePath { const LDKBlindedMessagePath* operator &() const { return &self; } const LDKBlindedMessagePath* operator ->() const { return &self; } }; -class NextMessageHop { +class NextMessageHop { +private: + LDKNextMessageHop self; +public: + NextMessageHop(const NextMessageHop&) = delete; + NextMessageHop(NextMessageHop&& o) : self(o.self) { memset(&o, 0, sizeof(NextMessageHop)); } + NextMessageHop(LDKNextMessageHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNextMessageHop)); } + operator LDKNextMessageHop() && { LDKNextMessageHop res = self; memset(&self, 0, sizeof(LDKNextMessageHop)); return res; } + ~NextMessageHop() { NextMessageHop_free(self); } + NextMessageHop& operator=(NextMessageHop&& o) { NextMessageHop_free(self); self = o.self; memset(&o, 0, sizeof(NextMessageHop)); return *this; } + LDKNextMessageHop* operator &() { return &self; } + LDKNextMessageHop* operator ->() { return &self; } + const LDKNextMessageHop* operator &() const { return &self; } + const LDKNextMessageHop* operator ->() const { return &self; } +}; +class MessageForwardNode { +private: + LDKMessageForwardNode self; +public: + MessageForwardNode(const MessageForwardNode&) = delete; + MessageForwardNode(MessageForwardNode&& o) : self(o.self) { memset(&o, 0, sizeof(MessageForwardNode)); } + MessageForwardNode(LDKMessageForwardNode&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageForwardNode)); } + operator LDKMessageForwardNode() && { LDKMessageForwardNode res = self; memset(&self, 0, sizeof(LDKMessageForwardNode)); return res; } + ~MessageForwardNode() { MessageForwardNode_free(self); } + MessageForwardNode& operator=(MessageForwardNode&& o) { MessageForwardNode_free(self); self = o.self; memset(&o, 0, sizeof(MessageForwardNode)); return *this; } + LDKMessageForwardNode* operator &() { return &self; } + LDKMessageForwardNode* operator ->() { return &self; } + const LDKMessageForwardNode* operator &() const { return &self; } + const LDKMessageForwardNode* operator ->() const { return &self; } +}; +class MessageContext { +private: + LDKMessageContext self; +public: + MessageContext(const MessageContext&) = delete; + MessageContext(MessageContext&& o) : self(o.self) { memset(&o, 0, sizeof(MessageContext)); } + MessageContext(LDKMessageContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageContext)); } + operator LDKMessageContext() && { LDKMessageContext res = self; memset(&self, 0, sizeof(LDKMessageContext)); return res; } + ~MessageContext() { MessageContext_free(self); } + MessageContext& operator=(MessageContext&& o) { MessageContext_free(self); self = o.self; memset(&o, 0, sizeof(MessageContext)); return *this; } + LDKMessageContext* operator &() { return &self; } + LDKMessageContext* operator ->() { return &self; } + const LDKMessageContext* operator &() const { return &self; } + const LDKMessageContext* operator ->() const { return &self; } +}; +class OffersContext { +private: + LDKOffersContext self; +public: + OffersContext(const OffersContext&) = delete; + OffersContext(OffersContext&& o) : self(o.self) { memset(&o, 0, sizeof(OffersContext)); } + OffersContext(LDKOffersContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOffersContext)); } + operator LDKOffersContext() && { LDKOffersContext res = self; memset(&self, 0, sizeof(LDKOffersContext)); return res; } + ~OffersContext() { OffersContext_free(self); } + OffersContext& operator=(OffersContext&& o) { OffersContext_free(self); self = o.self; memset(&o, 0, sizeof(OffersContext)); return *this; } + LDKOffersContext* operator &() { return &self; } + LDKOffersContext* operator ->() { return &self; } + const LDKOffersContext* operator &() const { return &self; } + const LDKOffersContext* operator ->() const { return &self; } +}; +class AsyncPaymentsContext { +private: + LDKAsyncPaymentsContext self; +public: + AsyncPaymentsContext(const AsyncPaymentsContext&) = delete; + AsyncPaymentsContext(AsyncPaymentsContext&& o) : self(o.self) { memset(&o, 0, sizeof(AsyncPaymentsContext)); } + AsyncPaymentsContext(LDKAsyncPaymentsContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAsyncPaymentsContext)); } + operator LDKAsyncPaymentsContext() && { LDKAsyncPaymentsContext res = self; memset(&self, 0, sizeof(LDKAsyncPaymentsContext)); return res; } + ~AsyncPaymentsContext() { AsyncPaymentsContext_free(self); } + AsyncPaymentsContext& operator=(AsyncPaymentsContext&& o) { AsyncPaymentsContext_free(self); self = o.self; memset(&o, 0, sizeof(AsyncPaymentsContext)); return *this; } + LDKAsyncPaymentsContext* operator &() { return &self; } + LDKAsyncPaymentsContext* operator ->() { return &self; } + const LDKAsyncPaymentsContext* operator &() const { return &self; } + const LDKAsyncPaymentsContext* operator ->() const { return &self; } +}; +class DNSResolverContext { +private: + LDKDNSResolverContext self; +public: + DNSResolverContext(const DNSResolverContext&) = delete; + DNSResolverContext(DNSResolverContext&& o) : self(o.self) { memset(&o, 0, sizeof(DNSResolverContext)); } + DNSResolverContext(LDKDNSResolverContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSResolverContext)); } + operator LDKDNSResolverContext() && { LDKDNSResolverContext res = self; memset(&self, 0, sizeof(LDKDNSResolverContext)); return res; } + ~DNSResolverContext() { DNSResolverContext_free(self); } + DNSResolverContext& operator=(DNSResolverContext&& o) { DNSResolverContext_free(self); self = o.self; memset(&o, 0, sizeof(DNSResolverContext)); return *this; } + LDKDNSResolverContext* operator &() { return &self; } + LDKDNSResolverContext* operator ->() { return &self; } + const LDKDNSResolverContext* operator &() const { return &self; } + const LDKDNSResolverContext* operator ->() const { return &self; } +}; +class CResult_LockedChannelMonitorNoneZ { +private: + LDKCResult_LockedChannelMonitorNoneZ self; +public: + CResult_LockedChannelMonitorNoneZ(const CResult_LockedChannelMonitorNoneZ&) = delete; + CResult_LockedChannelMonitorNoneZ(CResult_LockedChannelMonitorNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); } + CResult_LockedChannelMonitorNoneZ(LDKCResult_LockedChannelMonitorNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); } + operator LDKCResult_LockedChannelMonitorNoneZ() && { LDKCResult_LockedChannelMonitorNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); return res; } + ~CResult_LockedChannelMonitorNoneZ() { CResult_LockedChannelMonitorNoneZ_free(self); } + CResult_LockedChannelMonitorNoneZ& operator=(CResult_LockedChannelMonitorNoneZ&& o) { CResult_LockedChannelMonitorNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); return *this; } + LDKCResult_LockedChannelMonitorNoneZ* operator &() { return &self; } + LDKCResult_LockedChannelMonitorNoneZ* operator ->() { return &self; } + const LDKCResult_LockedChannelMonitorNoneZ* operator &() const { return &self; } + const LDKCResult_LockedChannelMonitorNoneZ* operator ->() const { return &self; } +}; +class CResult_PhantomRouteHintsDecodeErrorZ { +private: + LDKCResult_PhantomRouteHintsDecodeErrorZ self; +public: + CResult_PhantomRouteHintsDecodeErrorZ(const CResult_PhantomRouteHintsDecodeErrorZ&) = delete; + CResult_PhantomRouteHintsDecodeErrorZ(CResult_PhantomRouteHintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); } + CResult_PhantomRouteHintsDecodeErrorZ(LDKCResult_PhantomRouteHintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); } + operator LDKCResult_PhantomRouteHintsDecodeErrorZ() && { LDKCResult_PhantomRouteHintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); return res; } + ~CResult_PhantomRouteHintsDecodeErrorZ() { CResult_PhantomRouteHintsDecodeErrorZ_free(self); } + CResult_PhantomRouteHintsDecodeErrorZ& operator=(CResult_PhantomRouteHintsDecodeErrorZ&& o) { CResult_PhantomRouteHintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); return *this; } + LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() { return &self; } + LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_u32TxOutZZ { +private: + LDKCVec_C2Tuple_u32TxOutZZ self; +public: + CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete; + CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); } + CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); } + operator LDKCVec_C2Tuple_u32TxOutZZ() && { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } + ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } + CVec_C2Tuple_u32TxOutZZ& operator=(CVec_C2Tuple_u32TxOutZZ&& o) { CVec_C2Tuple_u32TxOutZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); return *this; } + LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; } +}; +class CResult_RetryDecodeErrorZ { +private: + LDKCResult_RetryDecodeErrorZ self; +public: + 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 CResult_BlindedForwardDecodeErrorZ { +private: + LDKCResult_BlindedForwardDecodeErrorZ self; +public: + CResult_BlindedForwardDecodeErrorZ(const CResult_BlindedForwardDecodeErrorZ&) = delete; + CResult_BlindedForwardDecodeErrorZ(CResult_BlindedForwardDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedForwardDecodeErrorZ)); } + CResult_BlindedForwardDecodeErrorZ(LDKCResult_BlindedForwardDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedForwardDecodeErrorZ)); } + operator LDKCResult_BlindedForwardDecodeErrorZ() && { LDKCResult_BlindedForwardDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedForwardDecodeErrorZ)); return res; } + ~CResult_BlindedForwardDecodeErrorZ() { CResult_BlindedForwardDecodeErrorZ_free(self); } + CResult_BlindedForwardDecodeErrorZ& operator=(CResult_BlindedForwardDecodeErrorZ&& o) { CResult_BlindedForwardDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedForwardDecodeErrorZ)); return *this; } + LDKCResult_BlindedForwardDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedForwardDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedForwardDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedForwardDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_MaxDustHTLCExposureZ { +private: + LDKCOption_MaxDustHTLCExposureZ self; +public: + COption_MaxDustHTLCExposureZ(const COption_MaxDustHTLCExposureZ&) = delete; + COption_MaxDustHTLCExposureZ(COption_MaxDustHTLCExposureZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MaxDustHTLCExposureZ)); } + COption_MaxDustHTLCExposureZ(LDKCOption_MaxDustHTLCExposureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MaxDustHTLCExposureZ)); } + operator LDKCOption_MaxDustHTLCExposureZ() && { LDKCOption_MaxDustHTLCExposureZ res = self; memset(&self, 0, sizeof(LDKCOption_MaxDustHTLCExposureZ)); return res; } + ~COption_MaxDustHTLCExposureZ() { COption_MaxDustHTLCExposureZ_free(self); } + COption_MaxDustHTLCExposureZ& operator=(COption_MaxDustHTLCExposureZ&& o) { COption_MaxDustHTLCExposureZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MaxDustHTLCExposureZ)); return *this; } + LDKCOption_MaxDustHTLCExposureZ* operator &() { return &self; } + LDKCOption_MaxDustHTLCExposureZ* operator ->() { return &self; } + const LDKCOption_MaxDustHTLCExposureZ* operator &() const { return &self; } + const LDKCOption_MaxDustHTLCExposureZ* operator ->() const { return &self; } +}; +class COption_u64Z { +private: + LDKCOption_u64Z self; +public: + COption_u64Z(const COption_u64Z&) = delete; + COption_u64Z(COption_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u64Z)); } + COption_u64Z(LDKCOption_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u64Z)); } + operator LDKCOption_u64Z() && { LDKCOption_u64Z res = self; memset(&self, 0, sizeof(LDKCOption_u64Z)); return res; } + ~COption_u64Z() { COption_u64Z_free(self); } + COption_u64Z& operator=(COption_u64Z&& o) { COption_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u64Z)); return *this; } + LDKCOption_u64Z* operator &() { return &self; } + LDKCOption_u64Z* operator ->() { return &self; } + const LDKCOption_u64Z* operator &() const { return &self; } + const LDKCOption_u64Z* operator ->() const { return &self; } +}; +class CResult_RouteHintDecodeErrorZ { +private: + LDKCResult_RouteHintDecodeErrorZ self; +public: + CResult_RouteHintDecodeErrorZ(const CResult_RouteHintDecodeErrorZ&) = delete; + CResult_RouteHintDecodeErrorZ(CResult_RouteHintDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); } + CResult_RouteHintDecodeErrorZ(LDKCResult_RouteHintDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); } + operator LDKCResult_RouteHintDecodeErrorZ() && { LDKCResult_RouteHintDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); return res; } + ~CResult_RouteHintDecodeErrorZ() { CResult_RouteHintDecodeErrorZ_free(self); } + CResult_RouteHintDecodeErrorZ& operator=(CResult_RouteHintDecodeErrorZ&& o) { CResult_RouteHintDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); return *this; } + LDKCResult_RouteHintDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHintDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_FilterZ { +private: + LDKCOption_FilterZ self; +public: + COption_FilterZ(const COption_FilterZ&) = delete; + COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); } + COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); } + operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; } + ~COption_FilterZ() { COption_FilterZ_free(self); } + COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; } + LDKCOption_FilterZ* operator &() { return &self; } + LDKCOption_FilterZ* operator ->() { return &self; } + const LDKCOption_FilterZ* operator &() const { return &self; } + const LDKCOption_FilterZ* operator ->() const { return &self; } +}; +class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +private: + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; +public: + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete; + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } + operator LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() && { LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } + ~COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ& operator=(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return *this; } + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; } + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; } + const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; } + const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; } +}; +class CResult_TxAbortDecodeErrorZ { +private: + LDKCResult_TxAbortDecodeErrorZ self; +public: + CResult_TxAbortDecodeErrorZ(const CResult_TxAbortDecodeErrorZ&) = delete; + CResult_TxAbortDecodeErrorZ(CResult_TxAbortDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); } + CResult_TxAbortDecodeErrorZ(LDKCResult_TxAbortDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); } + operator LDKCResult_TxAbortDecodeErrorZ() && { LDKCResult_TxAbortDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); return res; } + ~CResult_TxAbortDecodeErrorZ() { CResult_TxAbortDecodeErrorZ_free(self); } + CResult_TxAbortDecodeErrorZ& operator=(CResult_TxAbortDecodeErrorZ&& o) { CResult_TxAbortDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); return *this; } + LDKCResult_TxAbortDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxAbortDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxAbortDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxAbortDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_UpdateAddHTLCZ { +private: + LDKCVec_UpdateAddHTLCZ self; +public: + CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; + CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } + CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } + operator LDKCVec_UpdateAddHTLCZ() && { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } + ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } + CVec_UpdateAddHTLCZ& operator=(CVec_UpdateAddHTLCZ&& o) { CVec_UpdateAddHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); return *this; } + LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } + LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } +}; +class CResult_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 COption_ECDSASignatureZ { +private: + LDKCOption_ECDSASignatureZ self; +public: + COption_ECDSASignatureZ(const COption_ECDSASignatureZ&) = delete; + COption_ECDSASignatureZ(COption_ECDSASignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ECDSASignatureZ)); } + COption_ECDSASignatureZ(LDKCOption_ECDSASignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ECDSASignatureZ)); } + operator LDKCOption_ECDSASignatureZ() && { LDKCOption_ECDSASignatureZ res = self; memset(&self, 0, sizeof(LDKCOption_ECDSASignatureZ)); return res; } + ~COption_ECDSASignatureZ() { COption_ECDSASignatureZ_free(self); } + COption_ECDSASignatureZ& operator=(COption_ECDSASignatureZ&& o) { COption_ECDSASignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ECDSASignatureZ)); return *this; } + LDKCOption_ECDSASignatureZ* operator &() { return &self; } + LDKCOption_ECDSASignatureZ* operator ->() { return &self; } + const LDKCOption_ECDSASignatureZ* operator &() const { return &self; } + const LDKCOption_ECDSASignatureZ* operator ->() const { return &self; } +}; +class C2Tuple_HumanReadableNameThirtyTwoBytesZ { +private: + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ self; +public: + C2Tuple_HumanReadableNameThirtyTwoBytesZ(const C2Tuple_HumanReadableNameThirtyTwoBytesZ&) = delete; + C2Tuple_HumanReadableNameThirtyTwoBytesZ(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); } + C2Tuple_HumanReadableNameThirtyTwoBytesZ(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); } + operator LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ() && { LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); return res; } + ~C2Tuple_HumanReadableNameThirtyTwoBytesZ() { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); } + C2Tuple_HumanReadableNameThirtyTwoBytesZ& operator=(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); return *this; } + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() { return &self; } + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() { return &self; } + const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() const { return &self; } + const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() const { return &self; } +}; +class CResult_ClosingSignedFeeRangeDecodeErrorZ { +private: + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self; +public: + CResult_ClosingSignedFeeRangeDecodeErrorZ(const CResult_ClosingSignedFeeRangeDecodeErrorZ&) = delete; + CResult_ClosingSignedFeeRangeDecodeErrorZ(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); } + CResult_ClosingSignedFeeRangeDecodeErrorZ(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); } + operator LDKCResult_ClosingSignedFeeRangeDecodeErrorZ() && { LDKCResult_ClosingSignedFeeRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); return res; } + ~CResult_ClosingSignedFeeRangeDecodeErrorZ() { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); } + CResult_ClosingSignedFeeRangeDecodeErrorZ& operator=(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); return *this; } + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_TransactionZ { +private: + LDKCOption_TransactionZ self; +public: + COption_TransactionZ(const COption_TransactionZ&) = delete; + COption_TransactionZ(COption_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TransactionZ)); } + COption_TransactionZ(LDKCOption_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TransactionZ)); } + operator LDKCOption_TransactionZ() && { LDKCOption_TransactionZ res = self; memset(&self, 0, sizeof(LDKCOption_TransactionZ)); return res; } + ~COption_TransactionZ() { COption_TransactionZ_free(self); } + COption_TransactionZ& operator=(COption_TransactionZ&& o) { COption_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TransactionZ)); return *this; } + LDKCOption_TransactionZ* operator &() { return &self; } + LDKCOption_TransactionZ* operator ->() { return &self; } + const LDKCOption_TransactionZ* operator &() const { return &self; } + const LDKCOption_TransactionZ* 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_LocalHTLCFailureReasonDecodeErrorZ { +private: + LDKCResult_LocalHTLCFailureReasonDecodeErrorZ self; +public: + CResult_LocalHTLCFailureReasonDecodeErrorZ(const CResult_LocalHTLCFailureReasonDecodeErrorZ&) = delete; + CResult_LocalHTLCFailureReasonDecodeErrorZ(CResult_LocalHTLCFailureReasonDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LocalHTLCFailureReasonDecodeErrorZ)); } + CResult_LocalHTLCFailureReasonDecodeErrorZ(LDKCResult_LocalHTLCFailureReasonDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LocalHTLCFailureReasonDecodeErrorZ)); } + operator LDKCResult_LocalHTLCFailureReasonDecodeErrorZ() && { LDKCResult_LocalHTLCFailureReasonDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_LocalHTLCFailureReasonDecodeErrorZ)); return res; } + ~CResult_LocalHTLCFailureReasonDecodeErrorZ() { CResult_LocalHTLCFailureReasonDecodeErrorZ_free(self); } + CResult_LocalHTLCFailureReasonDecodeErrorZ& operator=(CResult_LocalHTLCFailureReasonDecodeErrorZ&& o) { CResult_LocalHTLCFailureReasonDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LocalHTLCFailureReasonDecodeErrorZ)); return *this; } + LDKCResult_LocalHTLCFailureReasonDecodeErrorZ* operator &() { return &self; } + LDKCResult_LocalHTLCFailureReasonDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_LocalHTLCFailureReasonDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_LocalHTLCFailureReasonDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_APIErrorZ { +private: + LDKCOption_APIErrorZ self; +public: + COption_APIErrorZ(const COption_APIErrorZ&) = delete; + COption_APIErrorZ(COption_APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_APIErrorZ)); } + COption_APIErrorZ(LDKCOption_APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_APIErrorZ)); } + operator LDKCOption_APIErrorZ() && { LDKCOption_APIErrorZ res = self; memset(&self, 0, sizeof(LDKCOption_APIErrorZ)); return res; } + ~COption_APIErrorZ() { COption_APIErrorZ_free(self); } + COption_APIErrorZ& operator=(COption_APIErrorZ&& o) { COption_APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_APIErrorZ)); return *this; } + LDKCOption_APIErrorZ* operator &() { return &self; } + LDKCOption_APIErrorZ* operator ->() { return &self; } + const LDKCOption_APIErrorZ* operator &() const { return &self; } + const LDKCOption_APIErrorZ* operator ->() const { return &self; } +}; +class CVec_PeerDetailsZ { +private: + LDKCVec_PeerDetailsZ self; +public: + CVec_PeerDetailsZ(const CVec_PeerDetailsZ&) = delete; + CVec_PeerDetailsZ(CVec_PeerDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PeerDetailsZ)); } + CVec_PeerDetailsZ(LDKCVec_PeerDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PeerDetailsZ)); } + operator LDKCVec_PeerDetailsZ() && { LDKCVec_PeerDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_PeerDetailsZ)); return res; } + ~CVec_PeerDetailsZ() { CVec_PeerDetailsZ_free(self); } + CVec_PeerDetailsZ& operator=(CVec_PeerDetailsZ&& o) { CVec_PeerDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PeerDetailsZ)); return *this; } + LDKCVec_PeerDetailsZ* operator &() { return &self; } + LDKCVec_PeerDetailsZ* operator ->() { return &self; } + const LDKCVec_PeerDetailsZ* operator &() const { return &self; } + const LDKCVec_PeerDetailsZ* operator ->() const { return &self; } +}; +class CResult_u64ShortChannelIdErrorZ { +private: + LDKCResult_u64ShortChannelIdErrorZ self; +public: + CResult_u64ShortChannelIdErrorZ(const CResult_u64ShortChannelIdErrorZ&) = delete; + CResult_u64ShortChannelIdErrorZ(CResult_u64ShortChannelIdErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u64ShortChannelIdErrorZ)); } + CResult_u64ShortChannelIdErrorZ(LDKCResult_u64ShortChannelIdErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u64ShortChannelIdErrorZ)); } + operator LDKCResult_u64ShortChannelIdErrorZ() && { LDKCResult_u64ShortChannelIdErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_u64ShortChannelIdErrorZ)); return res; } + ~CResult_u64ShortChannelIdErrorZ() { CResult_u64ShortChannelIdErrorZ_free(self); } + CResult_u64ShortChannelIdErrorZ& operator=(CResult_u64ShortChannelIdErrorZ&& o) { CResult_u64ShortChannelIdErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u64ShortChannelIdErrorZ)); return *this; } + LDKCResult_u64ShortChannelIdErrorZ* operator &() { return &self; } + LDKCResult_u64ShortChannelIdErrorZ* operator ->() { return &self; } + const LDKCResult_u64ShortChannelIdErrorZ* operator &() const { return &self; } + const LDKCResult_u64ShortChannelIdErrorZ* operator ->() const { return &self; } +}; +class CResult_QueryChannelRangeDecodeErrorZ { +private: + LDKCResult_QueryChannelRangeDecodeErrorZ self; +public: + CResult_QueryChannelRangeDecodeErrorZ(const CResult_QueryChannelRangeDecodeErrorZ&) = delete; + CResult_QueryChannelRangeDecodeErrorZ(CResult_QueryChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); } + CResult_QueryChannelRangeDecodeErrorZ(LDKCResult_QueryChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); } + operator LDKCResult_QueryChannelRangeDecodeErrorZ() && { LDKCResult_QueryChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); return res; } + ~CResult_QueryChannelRangeDecodeErrorZ() { CResult_QueryChannelRangeDecodeErrorZ_free(self); } + CResult_QueryChannelRangeDecodeErrorZ& operator=(CResult_QueryChannelRangeDecodeErrorZ&& o) { CResult_QueryChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); return *this; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_TransactionZ { +private: + LDKCVec_TransactionZ self; +public: + CVec_TransactionZ(const CVec_TransactionZ&) = delete; + CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } + CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } + operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } + ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } + CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; } + LDKCVec_TransactionZ* operator &() { return &self; } + LDKCVec_TransactionZ* operator ->() { return &self; } + const LDKCVec_TransactionZ* operator &() const { return &self; } + const LDKCVec_TransactionZ* operator ->() const { return &self; } +}; +class CResult_NoneBolt11PaymentErrorZ { +private: + LDKCResult_NoneBolt11PaymentErrorZ self; +public: + CResult_NoneBolt11PaymentErrorZ(const CResult_NoneBolt11PaymentErrorZ&) = delete; + CResult_NoneBolt11PaymentErrorZ(CResult_NoneBolt11PaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt11PaymentErrorZ)); } + CResult_NoneBolt11PaymentErrorZ(LDKCResult_NoneBolt11PaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt11PaymentErrorZ)); } + operator LDKCResult_NoneBolt11PaymentErrorZ() && { LDKCResult_NoneBolt11PaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt11PaymentErrorZ)); return res; } + ~CResult_NoneBolt11PaymentErrorZ() { CResult_NoneBolt11PaymentErrorZ_free(self); } + CResult_NoneBolt11PaymentErrorZ& operator=(CResult_NoneBolt11PaymentErrorZ&& o) { CResult_NoneBolt11PaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt11PaymentErrorZ)); return *this; } + LDKCResult_NoneBolt11PaymentErrorZ* operator &() { return &self; } + LDKCResult_NoneBolt11PaymentErrorZ* operator ->() { return &self; } + const LDKCResult_NoneBolt11PaymentErrorZ* operator &() const { return &self; } + const LDKCResult_NoneBolt11PaymentErrorZ* operator ->() const { return &self; } +}; +class CResult_ChannelReadyDecodeErrorZ { +private: + LDKCResult_ChannelReadyDecodeErrorZ self; +public: + CResult_ChannelReadyDecodeErrorZ(const CResult_ChannelReadyDecodeErrorZ&) = delete; + CResult_ChannelReadyDecodeErrorZ(CResult_ChannelReadyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); } + CResult_ChannelReadyDecodeErrorZ(LDKCResult_ChannelReadyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); } + operator LDKCResult_ChannelReadyDecodeErrorZ() && { LDKCResult_ChannelReadyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); return res; } + ~CResult_ChannelReadyDecodeErrorZ() { CResult_ChannelReadyDecodeErrorZ_free(self); } + CResult_ChannelReadyDecodeErrorZ& operator=(CResult_ChannelReadyDecodeErrorZ&& o) { CResult_ChannelReadyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); return *this; } + LDKCResult_ChannelReadyDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelReadyDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_RevocationBasepointDecodeErrorZ { +private: + LDKCResult_RevocationBasepointDecodeErrorZ self; +public: + CResult_RevocationBasepointDecodeErrorZ(const CResult_RevocationBasepointDecodeErrorZ&) = delete; + CResult_RevocationBasepointDecodeErrorZ(CResult_RevocationBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevocationBasepointDecodeErrorZ)); } + CResult_RevocationBasepointDecodeErrorZ(LDKCResult_RevocationBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevocationBasepointDecodeErrorZ)); } + operator LDKCResult_RevocationBasepointDecodeErrorZ() && { LDKCResult_RevocationBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevocationBasepointDecodeErrorZ)); return res; } + ~CResult_RevocationBasepointDecodeErrorZ() { CResult_RevocationBasepointDecodeErrorZ_free(self); } + CResult_RevocationBasepointDecodeErrorZ& operator=(CResult_RevocationBasepointDecodeErrorZ&& o) { CResult_RevocationBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevocationBasepointDecodeErrorZ)); return *this; } + LDKCResult_RevocationBasepointDecodeErrorZ* operator &() { return &self; } + LDKCResult_RevocationBasepointDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RevocationBasepointDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RevocationBasepointDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_UpdateFeeDecodeErrorZ { +private: + LDKCResult_UpdateFeeDecodeErrorZ self; +public: + CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete; + CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); } + CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); } + operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; } + ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); } + CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; } + LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { +private: + LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ self; +public: + CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(const CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&) = delete; + CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); } + CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); } + operator LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ() && { LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); return res; } + ~CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ() { CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(self); } + CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ& operator=(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& o) { CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); return *this; } + LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* 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_InvoiceRequestBolt12SemanticErrorZ { +private: + LDKCResult_InvoiceRequestBolt12SemanticErrorZ self; +public: + CResult_InvoiceRequestBolt12SemanticErrorZ(const CResult_InvoiceRequestBolt12SemanticErrorZ&) = delete; + CResult_InvoiceRequestBolt12SemanticErrorZ(CResult_InvoiceRequestBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestBolt12SemanticErrorZ)); } + CResult_InvoiceRequestBolt12SemanticErrorZ(LDKCResult_InvoiceRequestBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ)); } + operator LDKCResult_InvoiceRequestBolt12SemanticErrorZ() && { LDKCResult_InvoiceRequestBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ)); return res; } + ~CResult_InvoiceRequestBolt12SemanticErrorZ() { CResult_InvoiceRequestBolt12SemanticErrorZ_free(self); } + CResult_InvoiceRequestBolt12SemanticErrorZ& operator=(CResult_InvoiceRequestBolt12SemanticErrorZ&& o) { CResult_InvoiceRequestBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestBolt12SemanticErrorZ)); return *this; } + LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator ->() const { return &self; } +}; +class CVec_UpdateFailMalformedHTLCZ { +private: + LDKCVec_UpdateFailMalformedHTLCZ self; +public: + CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; + CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } + CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } + operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } + ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } + CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } + LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } +}; +class CResult_SpliceInitDecodeErrorZ { +private: + LDKCResult_SpliceInitDecodeErrorZ self; +public: + CResult_SpliceInitDecodeErrorZ(const CResult_SpliceInitDecodeErrorZ&) = delete; + CResult_SpliceInitDecodeErrorZ(CResult_SpliceInitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpliceInitDecodeErrorZ)); } + CResult_SpliceInitDecodeErrorZ(LDKCResult_SpliceInitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpliceInitDecodeErrorZ)); } + operator LDKCResult_SpliceInitDecodeErrorZ() && { LDKCResult_SpliceInitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpliceInitDecodeErrorZ)); return res; } + ~CResult_SpliceInitDecodeErrorZ() { CResult_SpliceInitDecodeErrorZ_free(self); } + CResult_SpliceInitDecodeErrorZ& operator=(CResult_SpliceInitDecodeErrorZ&& o) { CResult_SpliceInitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpliceInitDecodeErrorZ)); return *this; } + LDKCResult_SpliceInitDecodeErrorZ* operator &() { return &self; } + LDKCResult_SpliceInitDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SpliceInitDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SpliceInitDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { +private: + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ self; +public: + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ(const COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ&) = delete; + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ(COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ)); } + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ(LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ() && { LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ)); return res; } + ~COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ() { COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_free(self); } + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ& operator=(COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ&& o) { COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ* operator ->() const { return &self; } +}; +class CVec_RouteHopZ { +private: + LDKCVec_RouteHopZ self; +public: + CVec_RouteHopZ(const CVec_RouteHopZ&) = delete; + CVec_RouteHopZ(CVec_RouteHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHopZ)); } + CVec_RouteHopZ(LDKCVec_RouteHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHopZ)); } + operator LDKCVec_RouteHopZ() && { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } + ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } + CVec_RouteHopZ& operator=(CVec_RouteHopZ&& o) { CVec_RouteHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHopZ)); return *this; } + LDKCVec_RouteHopZ* operator &() { return &self; } + LDKCVec_RouteHopZ* operator ->() { return &self; } + const LDKCVec_RouteHopZ* operator &() const { return &self; } + const LDKCVec_RouteHopZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_u64BlindedMessagePathZZ { +private: + LDKCVec_C2Tuple_u64BlindedMessagePathZZ self; +public: + CVec_C2Tuple_u64BlindedMessagePathZZ(const CVec_C2Tuple_u64BlindedMessagePathZZ&) = delete; + CVec_C2Tuple_u64BlindedMessagePathZZ(CVec_C2Tuple_u64BlindedMessagePathZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u64BlindedMessagePathZZ)); } + CVec_C2Tuple_u64BlindedMessagePathZZ(LDKCVec_C2Tuple_u64BlindedMessagePathZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u64BlindedMessagePathZZ)); } + operator LDKCVec_C2Tuple_u64BlindedMessagePathZZ() && { LDKCVec_C2Tuple_u64BlindedMessagePathZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u64BlindedMessagePathZZ)); return res; } + ~CVec_C2Tuple_u64BlindedMessagePathZZ() { CVec_C2Tuple_u64BlindedMessagePathZZ_free(self); } + CVec_C2Tuple_u64BlindedMessagePathZZ& operator=(CVec_C2Tuple_u64BlindedMessagePathZZ&& o) { CVec_C2Tuple_u64BlindedMessagePathZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u64BlindedMessagePathZZ)); return *this; } + LDKCVec_C2Tuple_u64BlindedMessagePathZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u64BlindedMessagePathZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u64BlindedMessagePathZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u64BlindedMessagePathZZ* 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 CVec_TrampolineHopZ { +private: + LDKCVec_TrampolineHopZ self; +public: + CVec_TrampolineHopZ(const CVec_TrampolineHopZ&) = delete; + CVec_TrampolineHopZ(CVec_TrampolineHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TrampolineHopZ)); } + CVec_TrampolineHopZ(LDKCVec_TrampolineHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TrampolineHopZ)); } + operator LDKCVec_TrampolineHopZ() && { LDKCVec_TrampolineHopZ res = self; memset(&self, 0, sizeof(LDKCVec_TrampolineHopZ)); return res; } + ~CVec_TrampolineHopZ() { CVec_TrampolineHopZ_free(self); } + CVec_TrampolineHopZ& operator=(CVec_TrampolineHopZ&& o) { CVec_TrampolineHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TrampolineHopZ)); return *this; } + LDKCVec_TrampolineHopZ* operator &() { return &self; } + LDKCVec_TrampolineHopZ* operator ->() { return &self; } + const LDKCVec_TrampolineHopZ* operator &() const { return &self; } + const LDKCVec_TrampolineHopZ* operator ->() const { return &self; } +}; +class CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { +private: + LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ self; +public: + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(const CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&) = delete; + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); } + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); } + operator LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ() && { LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); return res; } + ~CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ() { CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(self); } + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ& operator=(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& o) { CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); return *this; } + LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_CVec_u8Zu16Z { +private: + LDKC2Tuple_CVec_u8Zu16Z self; +public: + C2Tuple_CVec_u8Zu16Z(const C2Tuple_CVec_u8Zu16Z&) = delete; + C2Tuple_CVec_u8Zu16Z(C2Tuple_CVec_u8Zu16Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu16Z)); } + C2Tuple_CVec_u8Zu16Z(LDKC2Tuple_CVec_u8Zu16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_u8Zu16Z)); } + operator LDKC2Tuple_CVec_u8Zu16Z() && { LDKC2Tuple_CVec_u8Zu16Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_u8Zu16Z)); return res; } + ~C2Tuple_CVec_u8Zu16Z() { C2Tuple_CVec_u8Zu16Z_free(self); } + C2Tuple_CVec_u8Zu16Z& operator=(C2Tuple_CVec_u8Zu16Z&& o) { C2Tuple_CVec_u8Zu16Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu16Z)); return *this; } + LDKC2Tuple_CVec_u8Zu16Z* operator &() { return &self; } + LDKC2Tuple_CVec_u8Zu16Z* operator ->() { return &self; } + const LDKC2Tuple_CVec_u8Zu16Z* operator &() const { return &self; } + const LDKC2Tuple_CVec_u8Zu16Z* operator ->() const { return &self; } +}; +class CVec_ThirtyTwoBytesZ { +private: + LDKCVec_ThirtyTwoBytesZ self; +public: + CVec_ThirtyTwoBytesZ(const CVec_ThirtyTwoBytesZ&) = delete; + CVec_ThirtyTwoBytesZ(CVec_ThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); } + CVec_ThirtyTwoBytesZ(LDKCVec_ThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); } + operator LDKCVec_ThirtyTwoBytesZ() && { LDKCVec_ThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); return res; } + ~CVec_ThirtyTwoBytesZ() { CVec_ThirtyTwoBytesZ_free(self); } + CVec_ThirtyTwoBytesZ& operator=(CVec_ThirtyTwoBytesZ&& o) { CVec_ThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); return *this; } + LDKCVec_ThirtyTwoBytesZ* operator &() { return &self; } + LDKCVec_ThirtyTwoBytesZ* operator ->() { return &self; } + 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_ServeStaticInvoiceDecodeErrorZ { +private: + LDKCResult_ServeStaticInvoiceDecodeErrorZ self; +public: + CResult_ServeStaticInvoiceDecodeErrorZ(const CResult_ServeStaticInvoiceDecodeErrorZ&) = delete; + CResult_ServeStaticInvoiceDecodeErrorZ(CResult_ServeStaticInvoiceDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ServeStaticInvoiceDecodeErrorZ)); } + CResult_ServeStaticInvoiceDecodeErrorZ(LDKCResult_ServeStaticInvoiceDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ServeStaticInvoiceDecodeErrorZ)); } + operator LDKCResult_ServeStaticInvoiceDecodeErrorZ() && { LDKCResult_ServeStaticInvoiceDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ServeStaticInvoiceDecodeErrorZ)); return res; } + ~CResult_ServeStaticInvoiceDecodeErrorZ() { CResult_ServeStaticInvoiceDecodeErrorZ_free(self); } + CResult_ServeStaticInvoiceDecodeErrorZ& operator=(CResult_ServeStaticInvoiceDecodeErrorZ&& o) { CResult_ServeStaticInvoiceDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ServeStaticInvoiceDecodeErrorZ)); return *this; } + LDKCResult_ServeStaticInvoiceDecodeErrorZ* operator &() { return &self; } + LDKCResult_ServeStaticInvoiceDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ServeStaticInvoiceDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ServeStaticInvoiceDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CollectionLengthDecodeErrorZ { +private: + LDKCResult_CollectionLengthDecodeErrorZ self; +public: + CResult_CollectionLengthDecodeErrorZ(const CResult_CollectionLengthDecodeErrorZ&) = delete; + CResult_CollectionLengthDecodeErrorZ(CResult_CollectionLengthDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CollectionLengthDecodeErrorZ)); } + CResult_CollectionLengthDecodeErrorZ(LDKCResult_CollectionLengthDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CollectionLengthDecodeErrorZ)); } + operator LDKCResult_CollectionLengthDecodeErrorZ() && { LDKCResult_CollectionLengthDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CollectionLengthDecodeErrorZ)); return res; } + ~CResult_CollectionLengthDecodeErrorZ() { CResult_CollectionLengthDecodeErrorZ_free(self); } + CResult_CollectionLengthDecodeErrorZ& operator=(CResult_CollectionLengthDecodeErrorZ&& o) { CResult_CollectionLengthDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CollectionLengthDecodeErrorZ)); return *this; } + LDKCResult_CollectionLengthDecodeErrorZ* operator &() { return &self; } + LDKCResult_CollectionLengthDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CollectionLengthDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CollectionLengthDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +private: + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ self; +public: + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(const CResult_CounterpartyCommitmentSecretsDecodeErrorZ&) = delete; + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } + operator LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ() && { LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return res; } + ~CResult_CounterpartyCommitmentSecretsDecodeErrorZ() { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZ& operator=(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return *this; } + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() { return &self; } + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_RouteHintHopZ { +private: + LDKCVec_RouteHintHopZ self; +public: + CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete; + CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); } + CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); } + operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; } + ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); } + CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; } + LDKCVec_RouteHintHopZ* operator &() { return &self; } + LDKCVec_RouteHintHopZ* operator ->() { return &self; } + const LDKCVec_RouteHintHopZ* operator &() const { return &self; } + const LDKCVec_RouteHintHopZ* operator ->() const { return &self; } +}; +class CResult_UntrustedStringDecodeErrorZ { +private: + LDKCResult_UntrustedStringDecodeErrorZ self; +public: + CResult_UntrustedStringDecodeErrorZ(const CResult_UntrustedStringDecodeErrorZ&) = delete; + CResult_UntrustedStringDecodeErrorZ(CResult_UntrustedStringDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UntrustedStringDecodeErrorZ)); } + CResult_UntrustedStringDecodeErrorZ(LDKCResult_UntrustedStringDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UntrustedStringDecodeErrorZ)); } + operator LDKCResult_UntrustedStringDecodeErrorZ() && { LDKCResult_UntrustedStringDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UntrustedStringDecodeErrorZ)); return res; } + ~CResult_UntrustedStringDecodeErrorZ() { CResult_UntrustedStringDecodeErrorZ_free(self); } + CResult_UntrustedStringDecodeErrorZ& operator=(CResult_UntrustedStringDecodeErrorZ&& o) { CResult_UntrustedStringDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UntrustedStringDecodeErrorZ)); return *this; } + LDKCResult_UntrustedStringDecodeErrorZ* operator &() { return &self; } + LDKCResult_UntrustedStringDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UntrustedStringDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UntrustedStringDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { +private: + LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ self; +public: + CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(const CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&) = delete; + CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); } + CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); } + operator LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ() && { LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); return res; } + ~CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ() { CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(self); } + CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ& operator=(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& o) { CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); return *this; } + LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator &() { return &self; } + LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator ->() { return &self; } + const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator &() const { return &self; } + const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator ->() const { return &self; } +}; +class CResult_PaymentParametersDecodeErrorZ { +private: + LDKCResult_PaymentParametersDecodeErrorZ self; +public: + CResult_PaymentParametersDecodeErrorZ(const CResult_PaymentParametersDecodeErrorZ&) = delete; + CResult_PaymentParametersDecodeErrorZ(CResult_PaymentParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); } + CResult_PaymentParametersDecodeErrorZ(LDKCResult_PaymentParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); } + operator LDKCResult_PaymentParametersDecodeErrorZ() && { LDKCResult_PaymentParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); return res; } + ~CResult_PaymentParametersDecodeErrorZ() { CResult_PaymentParametersDecodeErrorZ_free(self); } + CResult_PaymentParametersDecodeErrorZ& operator=(CResult_PaymentParametersDecodeErrorZ&& o) { CResult_PaymentParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); return *this; } + LDKCResult_PaymentParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_DelayedPaymentBasepointDecodeErrorZ { +private: + LDKCResult_DelayedPaymentBasepointDecodeErrorZ self; +public: + CResult_DelayedPaymentBasepointDecodeErrorZ(const CResult_DelayedPaymentBasepointDecodeErrorZ&) = delete; + CResult_DelayedPaymentBasepointDecodeErrorZ(CResult_DelayedPaymentBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentBasepointDecodeErrorZ)); } + CResult_DelayedPaymentBasepointDecodeErrorZ(LDKCResult_DelayedPaymentBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ)); } + operator LDKCResult_DelayedPaymentBasepointDecodeErrorZ() && { LDKCResult_DelayedPaymentBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ)); return res; } + ~CResult_DelayedPaymentBasepointDecodeErrorZ() { CResult_DelayedPaymentBasepointDecodeErrorZ_free(self); } + CResult_DelayedPaymentBasepointDecodeErrorZ& operator=(CResult_DelayedPaymentBasepointDecodeErrorZ&& o) { CResult_DelayedPaymentBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentBasepointDecodeErrorZ)); return *this; } + LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator &() { return &self; } + LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DelayedPaymentBasepointDecodeErrorZ* 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_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { +private: + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ self; +public: + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(const COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&) = delete; + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } + operator LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() && { LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return res; } + ~COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ& operator=(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return *this; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() { return &self; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* 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_UpdateNameIOErrorZ { +private: + LDKCResult_UpdateNameIOErrorZ self; +public: + CResult_UpdateNameIOErrorZ(const CResult_UpdateNameIOErrorZ&) = delete; + CResult_UpdateNameIOErrorZ(CResult_UpdateNameIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); } + CResult_UpdateNameIOErrorZ(LDKCResult_UpdateNameIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); } + operator LDKCResult_UpdateNameIOErrorZ() && { LDKCResult_UpdateNameIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); return res; } + ~CResult_UpdateNameIOErrorZ() { CResult_UpdateNameIOErrorZ_free(self); } + CResult_UpdateNameIOErrorZ& operator=(CResult_UpdateNameIOErrorZ&& o) { CResult_UpdateNameIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); return *this; } + LDKCResult_UpdateNameIOErrorZ* operator &() { return &self; } + LDKCResult_UpdateNameIOErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateNameIOErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateNameIOErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_ChannelIdCOption_U128ZZZ { +private: + LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ self; +public: + CVec_C2Tuple_ChannelIdCOption_U128ZZZ(const CVec_C2Tuple_ChannelIdCOption_U128ZZZ&) = delete; + CVec_C2Tuple_ChannelIdCOption_U128ZZZ(CVec_C2Tuple_ChannelIdCOption_U128ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdCOption_U128ZZZ)); } + CVec_C2Tuple_ChannelIdCOption_U128ZZZ(LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ)); } + operator LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ() && { LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ)); return res; } + ~CVec_C2Tuple_ChannelIdCOption_U128ZZZ() { CVec_C2Tuple_ChannelIdCOption_U128ZZZ_free(self); } + CVec_C2Tuple_ChannelIdCOption_U128ZZZ& operator=(CVec_C2Tuple_ChannelIdCOption_U128ZZZ&& o) { CVec_C2Tuple_ChannelIdCOption_U128ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdCOption_U128ZZZ)); return *this; } + LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ChannelIdCOption_U128ZZZ* operator ->() const { return &self; } +}; +class CResult__u832NoneZ { +private: + LDKCResult__u832NoneZ self; +public: + CResult__u832NoneZ(const CResult__u832NoneZ&) = delete; + CResult__u832NoneZ(CResult__u832NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult__u832NoneZ)); } + CResult__u832NoneZ(LDKCResult__u832NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult__u832NoneZ)); } + operator LDKCResult__u832NoneZ() && { LDKCResult__u832NoneZ res = self; memset(&self, 0, sizeof(LDKCResult__u832NoneZ)); return res; } + ~CResult__u832NoneZ() { CResult__u832NoneZ_free(self); } + CResult__u832NoneZ& operator=(CResult__u832NoneZ&& o) { CResult__u832NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult__u832NoneZ)); return *this; } + LDKCResult__u832NoneZ* operator &() { return &self; } + LDKCResult__u832NoneZ* operator ->() { return &self; } + const LDKCResult__u832NoneZ* operator &() const { return &self; } + const LDKCResult__u832NoneZ* operator ->() const { return &self; } +}; +class CResult_PongDecodeErrorZ { +private: + LDKCResult_PongDecodeErrorZ self; +public: + CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete; + CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); } + CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); } + operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; } + ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); } + CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; } + LDKCResult_PongDecodeErrorZ* operator &() { return &self; } + LDKCResult_PongDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ChannelIdAPIErrorZ { +private: + LDKCResult_ChannelIdAPIErrorZ self; +public: + CResult_ChannelIdAPIErrorZ(const CResult_ChannelIdAPIErrorZ&) = delete; + CResult_ChannelIdAPIErrorZ(CResult_ChannelIdAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelIdAPIErrorZ)); } + CResult_ChannelIdAPIErrorZ(LDKCResult_ChannelIdAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelIdAPIErrorZ)); } + operator LDKCResult_ChannelIdAPIErrorZ() && { LDKCResult_ChannelIdAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelIdAPIErrorZ)); return res; } + ~CResult_ChannelIdAPIErrorZ() { CResult_ChannelIdAPIErrorZ_free(self); } + CResult_ChannelIdAPIErrorZ& operator=(CResult_ChannelIdAPIErrorZ&& o) { CResult_ChannelIdAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelIdAPIErrorZ)); return *this; } + LDKCResult_ChannelIdAPIErrorZ* operator &() { return &self; } + LDKCResult_ChannelIdAPIErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelIdAPIErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelIdAPIErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_u8ZNoneZ { +private: + LDKCResult_CVec_u8ZNoneZ self; +public: + 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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { +private: + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ self; +public: + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&) = delete; + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } + operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return res; } + ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return *this; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() { return &self; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() const { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_ChannelIdPublicKeyZZ { +private: + LDKCVec_C2Tuple_ChannelIdPublicKeyZZ self; +public: + CVec_C2Tuple_ChannelIdPublicKeyZZ(const CVec_C2Tuple_ChannelIdPublicKeyZZ&) = delete; + CVec_C2Tuple_ChannelIdPublicKeyZZ(CVec_C2Tuple_ChannelIdPublicKeyZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdPublicKeyZZ)); } + CVec_C2Tuple_ChannelIdPublicKeyZZ(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ)); } + operator LDKCVec_C2Tuple_ChannelIdPublicKeyZZ() && { LDKCVec_C2Tuple_ChannelIdPublicKeyZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ)); return res; } + ~CVec_C2Tuple_ChannelIdPublicKeyZZ() { CVec_C2Tuple_ChannelIdPublicKeyZZ_free(self); } + CVec_C2Tuple_ChannelIdPublicKeyZZ& operator=(CVec_C2Tuple_ChannelIdPublicKeyZZ&& o) { CVec_C2Tuple_ChannelIdPublicKeyZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdPublicKeyZZ)); return *this; } + LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator ->() const { return &self; } +}; +class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { +private: + LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ self; +public: + 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_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { +private: + LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ self; +public: + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ(const CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ&) = delete; + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ(CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ)); } + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ(LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ)); } + operator LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ() && { LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ)); return res; } + ~CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ() { CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_free(self); } + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ& operator=(CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ&& o) { CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ)); return *this; } + LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ* operator &() { return &self; } + LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ* operator ->() { return &self; } + const LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ* operator &() const { return &self; } + const LDKCResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ* operator ->() const { return &self; } +}; +class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { +private: + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ self; +public: + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(const CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&) = delete; + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_DelayedPaymentOutputDescriptorDecodeErrorZ() { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_InFlightHtlcsDecodeErrorZ { +private: + LDKCResult_InFlightHtlcsDecodeErrorZ self; +public: + CResult_InFlightHtlcsDecodeErrorZ(const CResult_InFlightHtlcsDecodeErrorZ&) = delete; + CResult_InFlightHtlcsDecodeErrorZ(CResult_InFlightHtlcsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); } + CResult_InFlightHtlcsDecodeErrorZ(LDKCResult_InFlightHtlcsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); } + operator LDKCResult_InFlightHtlcsDecodeErrorZ() && { LDKCResult_InFlightHtlcsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); return res; } + ~CResult_InFlightHtlcsDecodeErrorZ() { CResult_InFlightHtlcsDecodeErrorZ_free(self); } + CResult_InFlightHtlcsDecodeErrorZ& operator=(CResult_InFlightHtlcsDecodeErrorZ&& o) { CResult_InFlightHtlcsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); return *this; } + LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() { return &self; } + LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_RouteParametersConfigDecodeErrorZ { +private: + LDKCResult_RouteParametersConfigDecodeErrorZ self; +public: + CResult_RouteParametersConfigDecodeErrorZ(const CResult_RouteParametersConfigDecodeErrorZ&) = delete; + CResult_RouteParametersConfigDecodeErrorZ(CResult_RouteParametersConfigDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersConfigDecodeErrorZ)); } + CResult_RouteParametersConfigDecodeErrorZ(LDKCResult_RouteParametersConfigDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersConfigDecodeErrorZ)); } + operator LDKCResult_RouteParametersConfigDecodeErrorZ() && { LDKCResult_RouteParametersConfigDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersConfigDecodeErrorZ)); return res; } + ~CResult_RouteParametersConfigDecodeErrorZ() { CResult_RouteParametersConfigDecodeErrorZ_free(self); } + CResult_RouteParametersConfigDecodeErrorZ& operator=(CResult_RouteParametersConfigDecodeErrorZ&& o) { CResult_RouteParametersConfigDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersConfigDecodeErrorZ)); return *this; } + LDKCResult_RouteParametersConfigDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteParametersConfigDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteParametersConfigDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteParametersConfigDecodeErrorZ* 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; +public: + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(const C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&) = delete; + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); } + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); } + operator LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ() && { LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); return res; } + ~C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ() { C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(self); } + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ& operator=(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& o) { C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); return *this; } + LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator &() { return &self; } + LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator ->() { return &self; } + const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator &() const { return &self; } + const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator ->() const { return &self; } +}; +class CResult_NoneReplayEventZ { +private: + LDKCResult_NoneReplayEventZ self; +public: + CResult_NoneReplayEventZ(const CResult_NoneReplayEventZ&) = delete; + CResult_NoneReplayEventZ(CResult_NoneReplayEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneReplayEventZ)); } + CResult_NoneReplayEventZ(LDKCResult_NoneReplayEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneReplayEventZ)); } + operator LDKCResult_NoneReplayEventZ() && { LDKCResult_NoneReplayEventZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneReplayEventZ)); return res; } + ~CResult_NoneReplayEventZ() { CResult_NoneReplayEventZ_free(self); } + CResult_NoneReplayEventZ& operator=(CResult_NoneReplayEventZ&& o) { CResult_NoneReplayEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneReplayEventZ)); return *this; } + LDKCResult_NoneReplayEventZ* operator &() { return &self; } + LDKCResult_NoneReplayEventZ* operator ->() { return &self; } + const LDKCResult_NoneReplayEventZ* operator &() const { return &self; } + const LDKCResult_NoneReplayEventZ* operator ->() const { return &self; } +}; +class CResult_BlindedHopDecodeErrorZ { +private: + LDKCResult_BlindedHopDecodeErrorZ self; +public: + CResult_BlindedHopDecodeErrorZ(const CResult_BlindedHopDecodeErrorZ&) = delete; + CResult_BlindedHopDecodeErrorZ(CResult_BlindedHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); } + CResult_BlindedHopDecodeErrorZ(LDKCResult_BlindedHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); } + operator LDKCResult_BlindedHopDecodeErrorZ() && { LDKCResult_BlindedHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); return res; } + ~CResult_BlindedHopDecodeErrorZ() { CResult_BlindedHopDecodeErrorZ_free(self); } + CResult_BlindedHopDecodeErrorZ& operator=(CResult_BlindedHopDecodeErrorZ&& o) { CResult_BlindedHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); return *this; } + LDKCResult_BlindedHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedHopDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_NonePeerHandleErrorZ { +private: + LDKCResult_NonePeerHandleErrorZ self; +public: + CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; + CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } + CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } + operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } + ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } + CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; } + LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } + LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } +}; +class CResult_FinalOnionHopDataDecodeErrorZ { +private: + LDKCResult_FinalOnionHopDataDecodeErrorZ self; +public: + CResult_FinalOnionHopDataDecodeErrorZ(const CResult_FinalOnionHopDataDecodeErrorZ&) = delete; + CResult_FinalOnionHopDataDecodeErrorZ(CResult_FinalOnionHopDataDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FinalOnionHopDataDecodeErrorZ)); } + CResult_FinalOnionHopDataDecodeErrorZ(LDKCResult_FinalOnionHopDataDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ)); } + operator LDKCResult_FinalOnionHopDataDecodeErrorZ() && { LDKCResult_FinalOnionHopDataDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ)); return res; } + ~CResult_FinalOnionHopDataDecodeErrorZ() { CResult_FinalOnionHopDataDecodeErrorZ_free(self); } + CResult_FinalOnionHopDataDecodeErrorZ& operator=(CResult_FinalOnionHopDataDecodeErrorZ&& o) { CResult_FinalOnionHopDataDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FinalOnionHopDataDecodeErrorZ)); return *this; } + LDKCResult_FinalOnionHopDataDecodeErrorZ* operator &() { return &self; } + LDKCResult_FinalOnionHopDataDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FinalOnionHopDataDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FinalOnionHopDataDecodeErrorZ* operator ->() const { return &self; } +}; +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_DNSResolverMessageDecodeErrorZ { +private: + LDKCResult_DNSResolverMessageDecodeErrorZ self; +public: + CResult_DNSResolverMessageDecodeErrorZ(const CResult_DNSResolverMessageDecodeErrorZ&) = delete; + CResult_DNSResolverMessageDecodeErrorZ(CResult_DNSResolverMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); } + CResult_DNSResolverMessageDecodeErrorZ(LDKCResult_DNSResolverMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); } + operator LDKCResult_DNSResolverMessageDecodeErrorZ() && { LDKCResult_DNSResolverMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); return res; } + ~CResult_DNSResolverMessageDecodeErrorZ() { CResult_DNSResolverMessageDecodeErrorZ_free(self); } + CResult_DNSResolverMessageDecodeErrorZ& operator=(CResult_DNSResolverMessageDecodeErrorZ&& o) { CResult_DNSResolverMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); return *this; } + LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_PublicKeyChannelIdZ { +private: + LDKC2Tuple_PublicKeyChannelIdZ self; +public: + C2Tuple_PublicKeyChannelIdZ(const C2Tuple_PublicKeyChannelIdZ&) = delete; + C2Tuple_PublicKeyChannelIdZ(C2Tuple_PublicKeyChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); } + C2Tuple_PublicKeyChannelIdZ(LDKC2Tuple_PublicKeyChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); } + operator LDKC2Tuple_PublicKeyChannelIdZ() && { LDKC2Tuple_PublicKeyChannelIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); return res; } + ~C2Tuple_PublicKeyChannelIdZ() { C2Tuple_PublicKeyChannelIdZ_free(self); } + C2Tuple_PublicKeyChannelIdZ& operator=(C2Tuple_PublicKeyChannelIdZ&& o) { C2Tuple_PublicKeyChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); return *this; } + LDKC2Tuple_PublicKeyChannelIdZ* operator &() { return &self; } + LDKC2Tuple_PublicKeyChannelIdZ* operator ->() { return &self; } + const LDKC2Tuple_PublicKeyChannelIdZ* operator &() const { return &self; } + const LDKC2Tuple_PublicKeyChannelIdZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { +private: + LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ self; +public: + 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_UpdateAddHTLCDecodeErrorZ { +private: + LDKCResult_UpdateAddHTLCDecodeErrorZ self; +public: + CResult_UpdateAddHTLCDecodeErrorZ(const CResult_UpdateAddHTLCDecodeErrorZ&) = delete; + CResult_UpdateAddHTLCDecodeErrorZ(CResult_UpdateAddHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); } + CResult_UpdateAddHTLCDecodeErrorZ(LDKCResult_UpdateAddHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); } + operator LDKCResult_UpdateAddHTLCDecodeErrorZ() && { LDKCResult_UpdateAddHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); return res; } + ~CResult_UpdateAddHTLCDecodeErrorZ() { CResult_UpdateAddHTLCDecodeErrorZ_free(self); } + CResult_UpdateAddHTLCDecodeErrorZ& operator=(CResult_UpdateAddHTLCDecodeErrorZ&& o) { CResult_UpdateAddHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); return *this; } + LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { +private: + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ self; +public: + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(const CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&) = delete; + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } + operator LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() && { LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return res; } + ~CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); } + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ& operator=(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return *this; } + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() { return &self; } + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() const { return &self; } +}; +class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { +private: + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ self; +public: + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&) = delete; + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } + operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return res; } + ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return *this; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() { return &self; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() const { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() const { return &self; } +}; +class COption_TypeZ { +private: + LDKCOption_TypeZ self; +public: + COption_TypeZ(const COption_TypeZ&) = delete; + COption_TypeZ(COption_TypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TypeZ)); } + COption_TypeZ(LDKCOption_TypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TypeZ)); } + operator LDKCOption_TypeZ() && { LDKCOption_TypeZ res = self; memset(&self, 0, sizeof(LDKCOption_TypeZ)); return res; } + ~COption_TypeZ() { COption_TypeZ_free(self); } + COption_TypeZ& operator=(COption_TypeZ&& o) { COption_TypeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TypeZ)); return *this; } + LDKCOption_TypeZ* operator &() { return &self; } + LDKCOption_TypeZ* operator ->() { return &self; } + const LDKCOption_TypeZ* operator &() const { return &self; } + const LDKCOption_TypeZ* operator ->() const { return &self; } +}; +class CResult_COption_PathFailureZDecodeErrorZ { +private: + LDKCResult_COption_PathFailureZDecodeErrorZ 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; } +}; +class CResult_UtxoDecodeErrorZ { +private: + LDKCResult_UtxoDecodeErrorZ self; +public: + CResult_UtxoDecodeErrorZ(const CResult_UtxoDecodeErrorZ&) = delete; + CResult_UtxoDecodeErrorZ(CResult_UtxoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UtxoDecodeErrorZ)); } + CResult_UtxoDecodeErrorZ(LDKCResult_UtxoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UtxoDecodeErrorZ)); } + operator LDKCResult_UtxoDecodeErrorZ() && { LDKCResult_UtxoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UtxoDecodeErrorZ)); return res; } + ~CResult_UtxoDecodeErrorZ() { CResult_UtxoDecodeErrorZ_free(self); } + CResult_UtxoDecodeErrorZ& operator=(CResult_UtxoDecodeErrorZ&& o) { CResult_UtxoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UtxoDecodeErrorZ)); return *this; } + LDKCResult_UtxoDecodeErrorZ* operator &() { return &self; } + LDKCResult_UtxoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UtxoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UtxoDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_PeerStorageDecodeErrorZ { +private: + LDKCResult_PeerStorageDecodeErrorZ self; +public: + CResult_PeerStorageDecodeErrorZ(const CResult_PeerStorageDecodeErrorZ&) = delete; + CResult_PeerStorageDecodeErrorZ(CResult_PeerStorageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PeerStorageDecodeErrorZ)); } + CResult_PeerStorageDecodeErrorZ(LDKCResult_PeerStorageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PeerStorageDecodeErrorZ)); } + operator LDKCResult_PeerStorageDecodeErrorZ() && { LDKCResult_PeerStorageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PeerStorageDecodeErrorZ)); return res; } + ~CResult_PeerStorageDecodeErrorZ() { CResult_PeerStorageDecodeErrorZ_free(self); } + CResult_PeerStorageDecodeErrorZ& operator=(CResult_PeerStorageDecodeErrorZ&& o) { CResult_PeerStorageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PeerStorageDecodeErrorZ)); return *this; } + LDKCResult_PeerStorageDecodeErrorZ* operator &() { return &self; } + LDKCResult_PeerStorageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PeerStorageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PeerStorageDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_PublicKeyChannelIdZZ { +private: + LDKCOption_C2Tuple_PublicKeyChannelIdZZ self; +public: + COption_C2Tuple_PublicKeyChannelIdZZ(const COption_C2Tuple_PublicKeyChannelIdZZ&) = delete; + COption_C2Tuple_PublicKeyChannelIdZZ(COption_C2Tuple_PublicKeyChannelIdZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); } + COption_C2Tuple_PublicKeyChannelIdZZ(LDKCOption_C2Tuple_PublicKeyChannelIdZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); } + operator LDKCOption_C2Tuple_PublicKeyChannelIdZZ() && { LDKCOption_C2Tuple_PublicKeyChannelIdZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); return res; } + ~COption_C2Tuple_PublicKeyChannelIdZZ() { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); } + COption_C2Tuple_PublicKeyChannelIdZZ& operator=(COption_C2Tuple_PublicKeyChannelIdZZ&& o) { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); return *this; } + LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() { return &self; } + LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { +private: + LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ self; +public: + 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 C2Tuple__u832u16Z { +private: + LDKC2Tuple__u832u16Z self; +public: + C2Tuple__u832u16Z(const C2Tuple__u832u16Z&) = delete; + C2Tuple__u832u16Z(C2Tuple__u832u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple__u832u16Z)); } + C2Tuple__u832u16Z(LDKC2Tuple__u832u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple__u832u16Z)); } + operator LDKC2Tuple__u832u16Z() && { LDKC2Tuple__u832u16Z res = self; memset(&self, 0, sizeof(LDKC2Tuple__u832u16Z)); return res; } + ~C2Tuple__u832u16Z() { C2Tuple__u832u16Z_free(self); } + C2Tuple__u832u16Z& operator=(C2Tuple__u832u16Z&& o) { C2Tuple__u832u16Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple__u832u16Z)); return *this; } + LDKC2Tuple__u832u16Z* operator &() { return &self; } + LDKC2Tuple__u832u16Z* operator ->() { return &self; } + const LDKC2Tuple__u832u16Z* operator &() const { return &self; } + const LDKC2Tuple__u832u16Z* operator ->() const { return &self; } +}; +class CResult_ChannelLiquiditiesDecodeErrorZ { +private: + LDKCResult_ChannelLiquiditiesDecodeErrorZ self; +public: + CResult_ChannelLiquiditiesDecodeErrorZ(const CResult_ChannelLiquiditiesDecodeErrorZ&) = delete; + CResult_ChannelLiquiditiesDecodeErrorZ(CResult_ChannelLiquiditiesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelLiquiditiesDecodeErrorZ)); } + CResult_ChannelLiquiditiesDecodeErrorZ(LDKCResult_ChannelLiquiditiesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelLiquiditiesDecodeErrorZ)); } + operator LDKCResult_ChannelLiquiditiesDecodeErrorZ() && { LDKCResult_ChannelLiquiditiesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelLiquiditiesDecodeErrorZ)); return res; } + ~CResult_ChannelLiquiditiesDecodeErrorZ() { CResult_ChannelLiquiditiesDecodeErrorZ_free(self); } + CResult_ChannelLiquiditiesDecodeErrorZ& operator=(CResult_ChannelLiquiditiesDecodeErrorZ&& o) { CResult_ChannelLiquiditiesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelLiquiditiesDecodeErrorZ)); return *this; } + LDKCResult_ChannelLiquiditiesDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelLiquiditiesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelLiquiditiesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelLiquiditiesDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_UnsignedChannelUpdateDecodeErrorZ { +private: + LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; +public: + CResult_UnsignedChannelUpdateDecodeErrorZ(const CResult_UnsignedChannelUpdateDecodeErrorZ&) = delete; + CResult_UnsignedChannelUpdateDecodeErrorZ(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); } + CResult_UnsignedChannelUpdateDecodeErrorZ(LDKCResult_UnsignedChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); } + operator LDKCResult_UnsignedChannelUpdateDecodeErrorZ() && { LDKCResult_UnsignedChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelUpdateDecodeErrorZ() { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); } + CResult_UnsignedChannelUpdateDecodeErrorZ& operator=(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } +}; +class 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 CResult_DecryptedOurPeerStorageNoneZ { +private: + LDKCResult_DecryptedOurPeerStorageNoneZ self; +public: + CResult_DecryptedOurPeerStorageNoneZ(const CResult_DecryptedOurPeerStorageNoneZ&) = delete; + CResult_DecryptedOurPeerStorageNoneZ(CResult_DecryptedOurPeerStorageNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DecryptedOurPeerStorageNoneZ)); } + CResult_DecryptedOurPeerStorageNoneZ(LDKCResult_DecryptedOurPeerStorageNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DecryptedOurPeerStorageNoneZ)); } + operator LDKCResult_DecryptedOurPeerStorageNoneZ() && { LDKCResult_DecryptedOurPeerStorageNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_DecryptedOurPeerStorageNoneZ)); return res; } + ~CResult_DecryptedOurPeerStorageNoneZ() { CResult_DecryptedOurPeerStorageNoneZ_free(self); } + CResult_DecryptedOurPeerStorageNoneZ& operator=(CResult_DecryptedOurPeerStorageNoneZ&& o) { CResult_DecryptedOurPeerStorageNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DecryptedOurPeerStorageNoneZ)); return *this; } + LDKCResult_DecryptedOurPeerStorageNoneZ* operator &() { return &self; } + LDKCResult_DecryptedOurPeerStorageNoneZ* operator ->() { return &self; } + const LDKCResult_DecryptedOurPeerStorageNoneZ* operator &() const { return &self; } + const LDKCResult_DecryptedOurPeerStorageNoneZ* operator ->() const { return &self; } +}; +class CVec_ChannelIdZ { +private: + LDKCVec_ChannelIdZ self; +public: + CVec_ChannelIdZ(const CVec_ChannelIdZ&) = delete; + CVec_ChannelIdZ(CVec_ChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelIdZ)); } + CVec_ChannelIdZ(LDKCVec_ChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelIdZ)); } + operator LDKCVec_ChannelIdZ() && { LDKCVec_ChannelIdZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelIdZ)); return res; } + ~CVec_ChannelIdZ() { CVec_ChannelIdZ_free(self); } + CVec_ChannelIdZ& operator=(CVec_ChannelIdZ&& o) { CVec_ChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelIdZ)); return *this; } + LDKCVec_ChannelIdZ* operator &() { return &self; } + LDKCVec_ChannelIdZ* operator ->() { return &self; } + const LDKCVec_ChannelIdZ* operator &() const { return &self; } + const LDKCVec_ChannelIdZ* operator ->() const { return &self; } +}; +class CResult_NonceDecodeErrorZ { +private: + LDKCResult_NonceDecodeErrorZ self; +public: + CResult_NonceDecodeErrorZ(const CResult_NonceDecodeErrorZ&) = delete; + CResult_NonceDecodeErrorZ(CResult_NonceDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonceDecodeErrorZ)); } + CResult_NonceDecodeErrorZ(LDKCResult_NonceDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonceDecodeErrorZ)); } + operator LDKCResult_NonceDecodeErrorZ() && { LDKCResult_NonceDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonceDecodeErrorZ)); return res; } + ~CResult_NonceDecodeErrorZ() { CResult_NonceDecodeErrorZ_free(self); } + CResult_NonceDecodeErrorZ& operator=(CResult_NonceDecodeErrorZ&& o) { CResult_NonceDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonceDecodeErrorZ)); return *this; } + LDKCResult_NonceDecodeErrorZ* operator &() { return &self; } + LDKCResult_NonceDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NonceDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NonceDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_OfferNoneZ { +private: + LDKCResult_OfferNoneZ self; +public: + CResult_OfferNoneZ(const CResult_OfferNoneZ&) = delete; + CResult_OfferNoneZ(CResult_OfferNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferNoneZ)); } + CResult_OfferNoneZ(LDKCResult_OfferNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferNoneZ)); } + operator LDKCResult_OfferNoneZ() && { LDKCResult_OfferNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferNoneZ)); return res; } + ~CResult_OfferNoneZ() { CResult_OfferNoneZ_free(self); } + CResult_OfferNoneZ& operator=(CResult_OfferNoneZ&& o) { CResult_OfferNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferNoneZ)); return *this; } + LDKCResult_OfferNoneZ* operator &() { return &self; } + LDKCResult_OfferNoneZ* operator ->() { return &self; } + const LDKCResult_OfferNoneZ* operator &() const { return &self; } + const LDKCResult_OfferNoneZ* operator ->() const { return &self; } +}; +class CResult_StartBatchDecodeErrorZ { +private: + LDKCResult_StartBatchDecodeErrorZ self; +public: + CResult_StartBatchDecodeErrorZ(const CResult_StartBatchDecodeErrorZ&) = delete; + CResult_StartBatchDecodeErrorZ(CResult_StartBatchDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StartBatchDecodeErrorZ)); } + CResult_StartBatchDecodeErrorZ(LDKCResult_StartBatchDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StartBatchDecodeErrorZ)); } + operator LDKCResult_StartBatchDecodeErrorZ() && { LDKCResult_StartBatchDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StartBatchDecodeErrorZ)); return res; } + ~CResult_StartBatchDecodeErrorZ() { CResult_StartBatchDecodeErrorZ_free(self); } + CResult_StartBatchDecodeErrorZ& operator=(CResult_StartBatchDecodeErrorZ&& o) { CResult_StartBatchDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StartBatchDecodeErrorZ)); return *this; } + LDKCResult_StartBatchDecodeErrorZ* operator &() { return &self; } + LDKCResult_StartBatchDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_StartBatchDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_StartBatchDecodeErrorZ* operator ->() const { return &self; } +}; +class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { +private: + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; +public: + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete; + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } + operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() && { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } + ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ& operator=(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return *this; } + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; } + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; } + const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } + const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } +}; +class CResult_RouteParametersDecodeErrorZ { +private: + LDKCResult_RouteParametersDecodeErrorZ self; +public: + CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; + CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } + CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } + operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } + ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } + CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } + LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* 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 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { +private: + LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ self; +public: + C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(const C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&) = delete; + C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); } + C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); } + operator LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ() && { LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); return res; } + ~C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ() { C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(self); } + C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ& operator=(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& o) { C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); return *this; } + LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator &() { return &self; } + LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator ->() const { return &self; } +}; +class COption_MessageContextZ { +private: + LDKCOption_MessageContextZ self; +public: + COption_MessageContextZ(const COption_MessageContextZ&) = delete; + COption_MessageContextZ(COption_MessageContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MessageContextZ)); } + COption_MessageContextZ(LDKCOption_MessageContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MessageContextZ)); } + operator LDKCOption_MessageContextZ() && { LDKCOption_MessageContextZ res = self; memset(&self, 0, sizeof(LDKCOption_MessageContextZ)); return res; } + ~COption_MessageContextZ() { COption_MessageContextZ_free(self); } + COption_MessageContextZ& operator=(COption_MessageContextZ&& o) { COption_MessageContextZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MessageContextZ)); return *this; } + LDKCOption_MessageContextZ* operator &() { return &self; } + LDKCOption_MessageContextZ* operator ->() { return &self; } + const LDKCOption_MessageContextZ* operator &() const { return &self; } + const LDKCOption_MessageContextZ* operator ->() const { return &self; } +}; +class CResult_NodeFeaturesDecodeErrorZ { +private: + LDKCResult_NodeFeaturesDecodeErrorZ self; +public: + CResult_NodeFeaturesDecodeErrorZ(const CResult_NodeFeaturesDecodeErrorZ&) = delete; + CResult_NodeFeaturesDecodeErrorZ(CResult_NodeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); } + CResult_NodeFeaturesDecodeErrorZ(LDKCResult_NodeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); } + operator LDKCResult_NodeFeaturesDecodeErrorZ() && { LDKCResult_NodeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); return res; } + ~CResult_NodeFeaturesDecodeErrorZ() { CResult_NodeFeaturesDecodeErrorZ_free(self); } + CResult_NodeFeaturesDecodeErrorZ& operator=(CResult_NodeFeaturesDecodeErrorZ&& o) { CResult_NodeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); return *this; } + LDKCResult_NodeFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_HTLCDescriptorZ { +private: + LDKCVec_HTLCDescriptorZ self; +public: + CVec_HTLCDescriptorZ(const CVec_HTLCDescriptorZ&) = delete; + CVec_HTLCDescriptorZ(CVec_HTLCDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_HTLCDescriptorZ)); } + CVec_HTLCDescriptorZ(LDKCVec_HTLCDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_HTLCDescriptorZ)); } + operator LDKCVec_HTLCDescriptorZ() && { LDKCVec_HTLCDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_HTLCDescriptorZ)); return res; } + ~CVec_HTLCDescriptorZ() { CVec_HTLCDescriptorZ_free(self); } + CVec_HTLCDescriptorZ& operator=(CVec_HTLCDescriptorZ&& o) { CVec_HTLCDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_HTLCDescriptorZ)); return *this; } + LDKCVec_HTLCDescriptorZ* operator &() { return &self; } + LDKCVec_HTLCDescriptorZ* operator ->() { return &self; } + const LDKCVec_HTLCDescriptorZ* operator &() const { return &self; } + const LDKCVec_HTLCDescriptorZ* operator ->() const { return &self; } +}; +class CResult_ChannelUpdateInfoDecodeErrorZ { +private: + LDKCResult_ChannelUpdateInfoDecodeErrorZ self; +public: + CResult_ChannelUpdateInfoDecodeErrorZ(const CResult_ChannelUpdateInfoDecodeErrorZ&) = delete; + CResult_ChannelUpdateInfoDecodeErrorZ(CResult_ChannelUpdateInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); } + CResult_ChannelUpdateInfoDecodeErrorZ(LDKCResult_ChannelUpdateInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); } + operator LDKCResult_ChannelUpdateInfoDecodeErrorZ() && { LDKCResult_ChannelUpdateInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); return res; } + ~CResult_ChannelUpdateInfoDecodeErrorZ() { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); } + CResult_ChannelUpdateInfoDecodeErrorZ& operator=(CResult_ChannelUpdateInfoDecodeErrorZ&& o) { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); return *this; } + LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_DNSResolverMessageMessageSendInstructionsZ { +private: + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ self; +public: + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(const C2Tuple_DNSResolverMessageMessageSendInstructionsZ&) = delete; + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } + operator LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ() && { LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return res; } + ~C2Tuple_DNSResolverMessageMessageSendInstructionsZ() { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); } + C2Tuple_DNSResolverMessageMessageSendInstructionsZ& operator=(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return *this; } + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() { return &self; } + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() { return &self; } + const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() const { return &self; } + const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() const { return &self; } +}; +class CVec_DestinationZ { +private: + LDKCVec_DestinationZ self; +public: + CVec_DestinationZ(const CVec_DestinationZ&) = delete; + CVec_DestinationZ(CVec_DestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_DestinationZ)); } + CVec_DestinationZ(LDKCVec_DestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_DestinationZ)); } + operator LDKCVec_DestinationZ() && { LDKCVec_DestinationZ res = self; memset(&self, 0, sizeof(LDKCVec_DestinationZ)); return res; } + ~CVec_DestinationZ() { CVec_DestinationZ_free(self); } + CVec_DestinationZ& operator=(CVec_DestinationZ&& o) { CVec_DestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_DestinationZ)); return *this; } + LDKCVec_DestinationZ* operator &() { return &self; } + LDKCVec_DestinationZ* operator ->() { return &self; } + const LDKCVec_DestinationZ* operator &() const { return &self; } + const LDKCVec_DestinationZ* operator ->() const { return &self; } +}; +class CResult_BuiltCommitmentTransactionDecodeErrorZ { +private: + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ self; +public: + CResult_BuiltCommitmentTransactionDecodeErrorZ(const CResult_BuiltCommitmentTransactionDecodeErrorZ&) = delete; + CResult_BuiltCommitmentTransactionDecodeErrorZ(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); } + CResult_BuiltCommitmentTransactionDecodeErrorZ(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_BuiltCommitmentTransactionDecodeErrorZ() && { LDKCResult_BuiltCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_BuiltCommitmentTransactionDecodeErrorZ() { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); } + CResult_BuiltCommitmentTransactionDecodeErrorZ& operator=(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_TrackedSpendableOutputDecodeErrorZ { +private: + LDKCResult_TrackedSpendableOutputDecodeErrorZ self; +public: + CResult_TrackedSpendableOutputDecodeErrorZ(const CResult_TrackedSpendableOutputDecodeErrorZ&) = delete; + CResult_TrackedSpendableOutputDecodeErrorZ(CResult_TrackedSpendableOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrackedSpendableOutputDecodeErrorZ)); } + CResult_TrackedSpendableOutputDecodeErrorZ(LDKCResult_TrackedSpendableOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ)); } + operator LDKCResult_TrackedSpendableOutputDecodeErrorZ() && { LDKCResult_TrackedSpendableOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ)); return res; } + ~CResult_TrackedSpendableOutputDecodeErrorZ() { CResult_TrackedSpendableOutputDecodeErrorZ_free(self); } + CResult_TrackedSpendableOutputDecodeErrorZ& operator=(CResult_TrackedSpendableOutputDecodeErrorZ&& o) { CResult_TrackedSpendableOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrackedSpendableOutputDecodeErrorZ)); return *this; } + LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator &() { return &self; } + LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_SpendableOutputDescriptorZ { +private: + LDKCVec_SpendableOutputDescriptorZ self; +public: + CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete; + CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); } + CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); } + operator LDKCVec_SpendableOutputDescriptorZ() && { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } + ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } + CVec_SpendableOutputDescriptorZ& operator=(CVec_SpendableOutputDescriptorZ&& o) { CVec_SpendableOutputDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); return *this; } + LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; } + LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; } + const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } + const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; } +}; +class CResult_ClosingSigDecodeErrorZ { +private: + LDKCResult_ClosingSigDecodeErrorZ self; +public: + CResult_ClosingSigDecodeErrorZ(const CResult_ClosingSigDecodeErrorZ&) = delete; + CResult_ClosingSigDecodeErrorZ(CResult_ClosingSigDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSigDecodeErrorZ)); } + CResult_ClosingSigDecodeErrorZ(LDKCResult_ClosingSigDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSigDecodeErrorZ)); } + operator LDKCResult_ClosingSigDecodeErrorZ() && { LDKCResult_ClosingSigDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSigDecodeErrorZ)); return res; } + ~CResult_ClosingSigDecodeErrorZ() { CResult_ClosingSigDecodeErrorZ_free(self); } + CResult_ClosingSigDecodeErrorZ& operator=(CResult_ClosingSigDecodeErrorZ&& o) { CResult_ClosingSigDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSigDecodeErrorZ)); return *this; } + LDKCResult_ClosingSigDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClosingSigDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClosingSigDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClosingSigDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ResponderDecodeErrorZ { +private: + LDKCResult_ResponderDecodeErrorZ self; +public: + CResult_ResponderDecodeErrorZ(const CResult_ResponderDecodeErrorZ&) = delete; + CResult_ResponderDecodeErrorZ(CResult_ResponderDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ResponderDecodeErrorZ)); } + CResult_ResponderDecodeErrorZ(LDKCResult_ResponderDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ResponderDecodeErrorZ)); } + operator LDKCResult_ResponderDecodeErrorZ() && { LDKCResult_ResponderDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ResponderDecodeErrorZ)); return res; } + ~CResult_ResponderDecodeErrorZ() { CResult_ResponderDecodeErrorZ_free(self); } + CResult_ResponderDecodeErrorZ& operator=(CResult_ResponderDecodeErrorZ&& o) { CResult_ResponderDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ResponderDecodeErrorZ)); return *this; } + LDKCResult_ResponderDecodeErrorZ* operator &() { return &self; } + LDKCResult_ResponderDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ResponderDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ResponderDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_WitnessNoneZ { +private: + LDKCResult_WitnessNoneZ self; +public: + CResult_WitnessNoneZ(const CResult_WitnessNoneZ&) = delete; + CResult_WitnessNoneZ(CResult_WitnessNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_WitnessNoneZ)); } + CResult_WitnessNoneZ(LDKCResult_WitnessNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_WitnessNoneZ)); } + operator LDKCResult_WitnessNoneZ() && { LDKCResult_WitnessNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_WitnessNoneZ)); return res; } + ~CResult_WitnessNoneZ() { CResult_WitnessNoneZ_free(self); } + CResult_WitnessNoneZ& operator=(CResult_WitnessNoneZ&& o) { CResult_WitnessNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_WitnessNoneZ)); return *this; } + LDKCResult_WitnessNoneZ* operator &() { return &self; } + LDKCResult_WitnessNoneZ* operator ->() { return &self; } + const LDKCResult_WitnessNoneZ* operator &() const { return &self; } + const LDKCResult_WitnessNoneZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_u64u64ZZ { +private: + LDKCOption_C2Tuple_u64u64ZZ self; +public: + COption_C2Tuple_u64u64ZZ(const COption_C2Tuple_u64u64ZZ&) = delete; + COption_C2Tuple_u64u64ZZ(COption_C2Tuple_u64u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); } + COption_C2Tuple_u64u64ZZ(LDKCOption_C2Tuple_u64u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); } + operator LDKCOption_C2Tuple_u64u64ZZ() && { LDKCOption_C2Tuple_u64u64ZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); return res; } + ~COption_C2Tuple_u64u64ZZ() { COption_C2Tuple_u64u64ZZ_free(self); } + COption_C2Tuple_u64u64ZZ& operator=(COption_C2Tuple_u64u64ZZ&& o) { COption_C2Tuple_u64u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); return *this; } + LDKCOption_C2Tuple_u64u64ZZ* operator &() { return &self; } + LDKCOption_C2Tuple_u64u64ZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_u64u64ZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_u64u64ZZ* operator ->() const { return &self; } +}; +class CResult_ChannelAnnouncementDecodeErrorZ { +private: + LDKCResult_ChannelAnnouncementDecodeErrorZ self; +public: + CResult_ChannelAnnouncementDecodeErrorZ(const CResult_ChannelAnnouncementDecodeErrorZ&) = delete; + CResult_ChannelAnnouncementDecodeErrorZ(CResult_ChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); } + CResult_ChannelAnnouncementDecodeErrorZ(LDKCResult_ChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); } + operator LDKCResult_ChannelAnnouncementDecodeErrorZ() && { LDKCResult_ChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); return res; } + ~CResult_ChannelAnnouncementDecodeErrorZ() { CResult_ChannelAnnouncementDecodeErrorZ_free(self); } + CResult_ChannelAnnouncementDecodeErrorZ& operator=(CResult_ChannelAnnouncementDecodeErrorZ&& o) { CResult_ChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_HTLCUpdateDecodeErrorZ { +private: + LDKCResult_HTLCUpdateDecodeErrorZ self; +public: + CResult_HTLCUpdateDecodeErrorZ(const CResult_HTLCUpdateDecodeErrorZ&) = delete; + CResult_HTLCUpdateDecodeErrorZ(CResult_HTLCUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); } + CResult_HTLCUpdateDecodeErrorZ(LDKCResult_HTLCUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); } + operator LDKCResult_HTLCUpdateDecodeErrorZ() && { LDKCResult_HTLCUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); return res; } + ~CResult_HTLCUpdateDecodeErrorZ() { CResult_HTLCUpdateDecodeErrorZ_free(self); } + CResult_HTLCUpdateDecodeErrorZ& operator=(CResult_HTLCUpdateDecodeErrorZ&& o) { CResult_HTLCUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); return *this; } + LDKCResult_HTLCUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_TxAddInputDecodeErrorZ { +private: + LDKCResult_TxAddInputDecodeErrorZ self; +public: + CResult_TxAddInputDecodeErrorZ(const CResult_TxAddInputDecodeErrorZ&) = delete; + CResult_TxAddInputDecodeErrorZ(CResult_TxAddInputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAddInputDecodeErrorZ)); } + CResult_TxAddInputDecodeErrorZ(LDKCResult_TxAddInputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAddInputDecodeErrorZ)); } + operator LDKCResult_TxAddInputDecodeErrorZ() && { LDKCResult_TxAddInputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAddInputDecodeErrorZ)); return res; } + ~CResult_TxAddInputDecodeErrorZ() { CResult_TxAddInputDecodeErrorZ_free(self); } + CResult_TxAddInputDecodeErrorZ& operator=(CResult_TxAddInputDecodeErrorZ&& o) { CResult_TxAddInputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAddInputDecodeErrorZ)); return *this; } + LDKCResult_TxAddInputDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxAddInputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxAddInputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxAddInputDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_AsyncPaymentsMessageDecodeErrorZ { +private: + LDKCResult_AsyncPaymentsMessageDecodeErrorZ self; +public: + CResult_AsyncPaymentsMessageDecodeErrorZ(const CResult_AsyncPaymentsMessageDecodeErrorZ&) = delete; + CResult_AsyncPaymentsMessageDecodeErrorZ(CResult_AsyncPaymentsMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncPaymentsMessageDecodeErrorZ)); } + CResult_AsyncPaymentsMessageDecodeErrorZ(LDKCResult_AsyncPaymentsMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncPaymentsMessageDecodeErrorZ)); } + operator LDKCResult_AsyncPaymentsMessageDecodeErrorZ() && { LDKCResult_AsyncPaymentsMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncPaymentsMessageDecodeErrorZ)); return res; } + ~CResult_AsyncPaymentsMessageDecodeErrorZ() { CResult_AsyncPaymentsMessageDecodeErrorZ_free(self); } + CResult_AsyncPaymentsMessageDecodeErrorZ& operator=(CResult_AsyncPaymentsMessageDecodeErrorZ&& o) { CResult_AsyncPaymentsMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncPaymentsMessageDecodeErrorZ)); return *this; } + LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_PeeledOnionNoneZ { +private: + LDKCResult_PeeledOnionNoneZ self; +public: + CResult_PeeledOnionNoneZ(const CResult_PeeledOnionNoneZ&) = delete; + CResult_PeeledOnionNoneZ(CResult_PeeledOnionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); } + CResult_PeeledOnionNoneZ(LDKCResult_PeeledOnionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); } + operator LDKCResult_PeeledOnionNoneZ() && { LDKCResult_PeeledOnionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); return res; } + ~CResult_PeeledOnionNoneZ() { CResult_PeeledOnionNoneZ_free(self); } + CResult_PeeledOnionNoneZ& operator=(CResult_PeeledOnionNoneZ&& o) { CResult_PeeledOnionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); return *this; } + LDKCResult_PeeledOnionNoneZ* operator &() { return &self; } + LDKCResult_PeeledOnionNoneZ* operator ->() { return &self; } + const LDKCResult_PeeledOnionNoneZ* operator &() const { return &self; } + const LDKCResult_PeeledOnionNoneZ* 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: + LDKCResult_PositiveTimestampCreationErrorZ self; +public: + CResult_PositiveTimestampCreationErrorZ(const CResult_PositiveTimestampCreationErrorZ&) = delete; + CResult_PositiveTimestampCreationErrorZ(CResult_PositiveTimestampCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); } + CResult_PositiveTimestampCreationErrorZ(LDKCResult_PositiveTimestampCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); } + operator LDKCResult_PositiveTimestampCreationErrorZ() && { LDKCResult_PositiveTimestampCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); return res; } + ~CResult_PositiveTimestampCreationErrorZ() { CResult_PositiveTimestampCreationErrorZ_free(self); } + CResult_PositiveTimestampCreationErrorZ& operator=(CResult_PositiveTimestampCreationErrorZ&& o) { CResult_PositiveTimestampCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); return *this; } + LDKCResult_PositiveTimestampCreationErrorZ* operator &() { return &self; } + LDKCResult_PositiveTimestampCreationErrorZ* operator ->() { return &self; } + const LDKCResult_PositiveTimestampCreationErrorZ* operator &() const { return &self; } + const LDKCResult_PositiveTimestampCreationErrorZ* operator ->() const { return &self; } +}; +class CResult_InvreqResponseInstructionsNoneZ { +private: + LDKCResult_InvreqResponseInstructionsNoneZ self; +public: + CResult_InvreqResponseInstructionsNoneZ(const CResult_InvreqResponseInstructionsNoneZ&) = delete; + CResult_InvreqResponseInstructionsNoneZ(CResult_InvreqResponseInstructionsNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvreqResponseInstructionsNoneZ)); } + CResult_InvreqResponseInstructionsNoneZ(LDKCResult_InvreqResponseInstructionsNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvreqResponseInstructionsNoneZ)); } + operator LDKCResult_InvreqResponseInstructionsNoneZ() && { LDKCResult_InvreqResponseInstructionsNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_InvreqResponseInstructionsNoneZ)); return res; } + ~CResult_InvreqResponseInstructionsNoneZ() { CResult_InvreqResponseInstructionsNoneZ_free(self); } + CResult_InvreqResponseInstructionsNoneZ& operator=(CResult_InvreqResponseInstructionsNoneZ&& o) { CResult_InvreqResponseInstructionsNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvreqResponseInstructionsNoneZ)); return *this; } + LDKCResult_InvreqResponseInstructionsNoneZ* operator &() { return &self; } + LDKCResult_InvreqResponseInstructionsNoneZ* operator ->() { return &self; } + const LDKCResult_InvreqResponseInstructionsNoneZ* operator &() const { return &self; } + const LDKCResult_InvreqResponseInstructionsNoneZ* operator ->() const { return &self; } +}; +class CResult_TxRemoveOutputDecodeErrorZ { +private: + LDKCResult_TxRemoveOutputDecodeErrorZ self; +public: + CResult_TxRemoveOutputDecodeErrorZ(const CResult_TxRemoveOutputDecodeErrorZ&) = delete; + CResult_TxRemoveOutputDecodeErrorZ(CResult_TxRemoveOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxRemoveOutputDecodeErrorZ)); } + CResult_TxRemoveOutputDecodeErrorZ(LDKCResult_TxRemoveOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ)); } + operator LDKCResult_TxRemoveOutputDecodeErrorZ() && { LDKCResult_TxRemoveOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ)); return res; } + ~CResult_TxRemoveOutputDecodeErrorZ() { CResult_TxRemoveOutputDecodeErrorZ_free(self); } + CResult_TxRemoveOutputDecodeErrorZ& operator=(CResult_TxRemoveOutputDecodeErrorZ&& o) { CResult_TxRemoveOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxRemoveOutputDecodeErrorZ)); return *this; } + LDKCResult_TxRemoveOutputDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxRemoveOutputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxRemoveOutputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxRemoveOutputDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_MessageContextDecodeErrorZ { +private: + LDKCResult_MessageContextDecodeErrorZ self; +public: + CResult_MessageContextDecodeErrorZ(const CResult_MessageContextDecodeErrorZ&) = delete; + CResult_MessageContextDecodeErrorZ(CResult_MessageContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MessageContextDecodeErrorZ)); } + CResult_MessageContextDecodeErrorZ(LDKCResult_MessageContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MessageContextDecodeErrorZ)); } + operator LDKCResult_MessageContextDecodeErrorZ() && { LDKCResult_MessageContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MessageContextDecodeErrorZ)); return res; } + ~CResult_MessageContextDecodeErrorZ() { CResult_MessageContextDecodeErrorZ_free(self); } + CResult_MessageContextDecodeErrorZ& operator=(CResult_MessageContextDecodeErrorZ&& o) { CResult_MessageContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MessageContextDecodeErrorZ)); return *this; } + LDKCResult_MessageContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_MessageContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_MessageContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_MessageContextDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { +private: + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ self; +public: + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(const CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&) = delete; + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } + operator LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() && { LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return res; } + ~CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); } + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ& operator=(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return *this; } + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() { return &self; } + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() const { return &self; } +}; +class CResult_RouteStrZ { +private: + LDKCResult_RouteStrZ self; +public: + CResult_RouteStrZ(const CResult_RouteStrZ&) = delete; + CResult_RouteStrZ(CResult_RouteStrZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteStrZ)); } + CResult_RouteStrZ(LDKCResult_RouteStrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteStrZ)); } + operator LDKCResult_RouteStrZ() && { LDKCResult_RouteStrZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteStrZ)); return res; } + ~CResult_RouteStrZ() { CResult_RouteStrZ_free(self); } + CResult_RouteStrZ& operator=(CResult_RouteStrZ&& o) { CResult_RouteStrZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteStrZ)); return *this; } + LDKCResult_RouteStrZ* operator &() { return &self; } + LDKCResult_RouteStrZ* operator ->() { return &self; } + const LDKCResult_RouteStrZ* operator &() const { return &self; } + const LDKCResult_RouteStrZ* operator ->() const { return &self; } +}; +class CResult_PublicKeyNoneZ { +private: + LDKCResult_PublicKeyNoneZ self; +public: + CResult_PublicKeyNoneZ(const CResult_PublicKeyNoneZ&) = delete; + CResult_PublicKeyNoneZ(CResult_PublicKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); } + CResult_PublicKeyNoneZ(LDKCResult_PublicKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); } + operator LDKCResult_PublicKeyNoneZ() && { LDKCResult_PublicKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); return res; } + ~CResult_PublicKeyNoneZ() { CResult_PublicKeyNoneZ_free(self); } + CResult_PublicKeyNoneZ& operator=(CResult_PublicKeyNoneZ&& o) { CResult_PublicKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); return *this; } + LDKCResult_PublicKeyNoneZ* operator &() { return &self; } + LDKCResult_PublicKeyNoneZ* operator ->() { return &self; } + const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; } + const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; } +}; +class CResult_CurrencyCodeCurrencyCodeErrorZ { +private: + LDKCResult_CurrencyCodeCurrencyCodeErrorZ self; +public: + CResult_CurrencyCodeCurrencyCodeErrorZ(const CResult_CurrencyCodeCurrencyCodeErrorZ&) = delete; + CResult_CurrencyCodeCurrencyCodeErrorZ(CResult_CurrencyCodeCurrencyCodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CurrencyCodeCurrencyCodeErrorZ)); } + CResult_CurrencyCodeCurrencyCodeErrorZ(LDKCResult_CurrencyCodeCurrencyCodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CurrencyCodeCurrencyCodeErrorZ)); } + operator LDKCResult_CurrencyCodeCurrencyCodeErrorZ() && { LDKCResult_CurrencyCodeCurrencyCodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CurrencyCodeCurrencyCodeErrorZ)); return res; } + ~CResult_CurrencyCodeCurrencyCodeErrorZ() { CResult_CurrencyCodeCurrencyCodeErrorZ_free(self); } + CResult_CurrencyCodeCurrencyCodeErrorZ& operator=(CResult_CurrencyCodeCurrencyCodeErrorZ&& o) { CResult_CurrencyCodeCurrencyCodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CurrencyCodeCurrencyCodeErrorZ)); return *this; } + LDKCResult_CurrencyCodeCurrencyCodeErrorZ* operator &() { return &self; } + LDKCResult_CurrencyCodeCurrencyCodeErrorZ* operator ->() { return &self; } + const LDKCResult_CurrencyCodeCurrencyCodeErrorZ* operator &() const { return &self; } + const LDKCResult_CurrencyCodeCurrencyCodeErrorZ* operator ->() const { return &self; } +}; +class CResult_InitFeaturesDecodeErrorZ { +private: + LDKCResult_InitFeaturesDecodeErrorZ self; +public: + CResult_InitFeaturesDecodeErrorZ(const CResult_InitFeaturesDecodeErrorZ&) = delete; + CResult_InitFeaturesDecodeErrorZ(CResult_InitFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); } + CResult_InitFeaturesDecodeErrorZ(LDKCResult_InitFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); } + operator LDKCResult_InitFeaturesDecodeErrorZ() && { LDKCResult_InitFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); return res; } + ~CResult_InitFeaturesDecodeErrorZ() { CResult_InitFeaturesDecodeErrorZ_free(self); } + CResult_InitFeaturesDecodeErrorZ& operator=(CResult_InitFeaturesDecodeErrorZ&& o) { CResult_InitFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); return *this; } + LDKCResult_InitFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_InitFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { +private: + LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ self; +public: + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ(const CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ&) = delete; + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ(CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ)); } + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ(LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ() && { LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ() { CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_free(self); } + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ& operator=(CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ&& o) { CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_OffersMessageMessageSendInstructionsZ { +private: + LDKC2Tuple_OffersMessageMessageSendInstructionsZ self; +public: + C2Tuple_OffersMessageMessageSendInstructionsZ(const C2Tuple_OffersMessageMessageSendInstructionsZ&) = delete; + C2Tuple_OffersMessageMessageSendInstructionsZ(C2Tuple_OffersMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OffersMessageMessageSendInstructionsZ)); } + C2Tuple_OffersMessageMessageSendInstructionsZ(LDKC2Tuple_OffersMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OffersMessageMessageSendInstructionsZ)); } + operator LDKC2Tuple_OffersMessageMessageSendInstructionsZ() && { LDKC2Tuple_OffersMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OffersMessageMessageSendInstructionsZ)); return res; } + ~C2Tuple_OffersMessageMessageSendInstructionsZ() { C2Tuple_OffersMessageMessageSendInstructionsZ_free(self); } + C2Tuple_OffersMessageMessageSendInstructionsZ& operator=(C2Tuple_OffersMessageMessageSendInstructionsZ&& o) { C2Tuple_OffersMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OffersMessageMessageSendInstructionsZ)); return *this; } + LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator &() { return &self; } + LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator ->() { return &self; } + const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator &() const { return &self; } + const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator ->() const { return &self; } +}; +class CResult_BlindedHopFeaturesDecodeErrorZ { +private: + LDKCResult_BlindedHopFeaturesDecodeErrorZ self; +public: + CResult_BlindedHopFeaturesDecodeErrorZ(const CResult_BlindedHopFeaturesDecodeErrorZ&) = delete; + CResult_BlindedHopFeaturesDecodeErrorZ(CResult_BlindedHopFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); } + CResult_BlindedHopFeaturesDecodeErrorZ(LDKCResult_BlindedHopFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); } + operator LDKCResult_BlindedHopFeaturesDecodeErrorZ() && { LDKCResult_BlindedHopFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); return res; } + ~CResult_BlindedHopFeaturesDecodeErrorZ() { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); } + CResult_BlindedHopFeaturesDecodeErrorZ& operator=(CResult_BlindedHopFeaturesDecodeErrorZ&& o) { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); return *this; } + LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_CVec_u8ZZ { +private: + LDKCVec_CVec_u8ZZ self; +public: + CVec_CVec_u8ZZ(const CVec_CVec_u8ZZ&) = delete; + CVec_CVec_u8ZZ(CVec_CVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); } + CVec_CVec_u8ZZ(LDKCVec_CVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_u8ZZ)); } + operator LDKCVec_CVec_u8ZZ() && { LDKCVec_CVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_u8ZZ)); return res; } + ~CVec_CVec_u8ZZ() { CVec_CVec_u8ZZ_free(self); } + CVec_CVec_u8ZZ& operator=(CVec_CVec_u8ZZ&& o) { CVec_CVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); return *this; } + LDKCVec_CVec_u8ZZ* operator &() { return &self; } + LDKCVec_CVec_u8ZZ* operator ->() { return &self; } + const LDKCVec_CVec_u8ZZ* operator &() const { return &self; } + const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; } +}; +class CResult_HumanReadableNameNoneZ { +private: + LDKCResult_HumanReadableNameNoneZ self; +public: + CResult_HumanReadableNameNoneZ(const CResult_HumanReadableNameNoneZ&) = delete; + CResult_HumanReadableNameNoneZ(CResult_HumanReadableNameNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); } + CResult_HumanReadableNameNoneZ(LDKCResult_HumanReadableNameNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); } + operator LDKCResult_HumanReadableNameNoneZ() && { LDKCResult_HumanReadableNameNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); return res; } + ~CResult_HumanReadableNameNoneZ() { CResult_HumanReadableNameNoneZ_free(self); } + CResult_HumanReadableNameNoneZ& operator=(CResult_HumanReadableNameNoneZ&& o) { CResult_HumanReadableNameNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); return *this; } + LDKCResult_HumanReadableNameNoneZ* operator &() { return &self; } + LDKCResult_HumanReadableNameNoneZ* operator ->() { return &self; } + const LDKCResult_HumanReadableNameNoneZ* operator &() const { return &self; } + const LDKCResult_HumanReadableNameNoneZ* operator ->() const { return &self; } +}; +class CResult_ProbabilisticScorerDecodeErrorZ { +private: + LDKCResult_ProbabilisticScorerDecodeErrorZ self; +public: + CResult_ProbabilisticScorerDecodeErrorZ(const CResult_ProbabilisticScorerDecodeErrorZ&) = delete; + CResult_ProbabilisticScorerDecodeErrorZ(CResult_ProbabilisticScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); } + CResult_ProbabilisticScorerDecodeErrorZ(LDKCResult_ProbabilisticScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); } + operator LDKCResult_ProbabilisticScorerDecodeErrorZ() && { LDKCResult_ProbabilisticScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); return res; } + ~CResult_ProbabilisticScorerDecodeErrorZ() { CResult_ProbabilisticScorerDecodeErrorZ_free(self); } + CResult_ProbabilisticScorerDecodeErrorZ& operator=(CResult_ProbabilisticScorerDecodeErrorZ&& o) { CResult_ProbabilisticScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); return *this; } + LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() { return &self; } + LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_StrZ { +private: + LDKCOption_StrZ self; +public: + COption_StrZ(const COption_StrZ&) = delete; + COption_StrZ(COption_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_StrZ)); } + COption_StrZ(LDKCOption_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_StrZ)); } + operator LDKCOption_StrZ() && { LDKCOption_StrZ res = self; memset(&self, 0, sizeof(LDKCOption_StrZ)); return res; } + ~COption_StrZ() { COption_StrZ_free(self); } + COption_StrZ& operator=(COption_StrZ&& o) { COption_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_StrZ)); return *this; } + LDKCOption_StrZ* operator &() { return &self; } + LDKCOption_StrZ* operator ->() { return &self; } + const LDKCOption_StrZ* operator &() const { return &self; } + const LDKCOption_StrZ* operator ->() const { return &self; } +}; +class CResult_CVec_BlindedPaymentPathZNoneZ { +private: + LDKCResult_CVec_BlindedPaymentPathZNoneZ self; +public: + CResult_CVec_BlindedPaymentPathZNoneZ(const CResult_CVec_BlindedPaymentPathZNoneZ&) = delete; + CResult_CVec_BlindedPaymentPathZNoneZ(CResult_CVec_BlindedPaymentPathZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_BlindedPaymentPathZNoneZ)); } + CResult_CVec_BlindedPaymentPathZNoneZ(LDKCResult_CVec_BlindedPaymentPathZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_BlindedPaymentPathZNoneZ)); } + operator LDKCResult_CVec_BlindedPaymentPathZNoneZ() && { LDKCResult_CVec_BlindedPaymentPathZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_BlindedPaymentPathZNoneZ)); return res; } + ~CResult_CVec_BlindedPaymentPathZNoneZ() { CResult_CVec_BlindedPaymentPathZNoneZ_free(self); } + CResult_CVec_BlindedPaymentPathZNoneZ& operator=(CResult_CVec_BlindedPaymentPathZNoneZ&& o) { CResult_CVec_BlindedPaymentPathZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_BlindedPaymentPathZNoneZ)); return *this; } + LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator &() { return &self; } + LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator ->() const { return &self; } +}; +class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { +private: + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ self; +public: + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(const CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&) = delete; + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } + operator LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() && { LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return res; } + ~CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ& operator=(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return *this; } + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_usizeTransactionZ { +private: + LDKC2Tuple_usizeTransactionZ self; +public: + C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; + C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } + C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } + operator LDKC2Tuple_usizeTransactionZ() && { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } + ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } + C2Tuple_usizeTransactionZ& operator=(C2Tuple_usizeTransactionZ&& o) { C2Tuple_usizeTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); return *this; } + LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } + LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } +}; +class CVec_FutureZ { +private: + LDKCVec_FutureZ self; +public: + CVec_FutureZ(const CVec_FutureZ&) = delete; + CVec_FutureZ(CVec_FutureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_FutureZ)); } + CVec_FutureZ(LDKCVec_FutureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_FutureZ)); } + operator LDKCVec_FutureZ() && { LDKCVec_FutureZ res = self; memset(&self, 0, sizeof(LDKCVec_FutureZ)); return res; } + ~CVec_FutureZ() { CVec_FutureZ_free(self); } + CVec_FutureZ& operator=(CVec_FutureZ&& o) { CVec_FutureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_FutureZ)); return *this; } + LDKCVec_FutureZ* operator &() { return &self; } + LDKCVec_FutureZ* operator ->() { return &self; } + const LDKCVec_FutureZ* operator &() const { return &self; } + const LDKCVec_FutureZ* operator ->() const { return &self; } +}; +class CResult_TxCreationKeysDecodeErrorZ { +private: + LDKCResult_TxCreationKeysDecodeErrorZ self; +public: + CResult_TxCreationKeysDecodeErrorZ(const CResult_TxCreationKeysDecodeErrorZ&) = delete; + CResult_TxCreationKeysDecodeErrorZ(CResult_TxCreationKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); } + CResult_TxCreationKeysDecodeErrorZ(LDKCResult_TxCreationKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); } + operator LDKCResult_TxCreationKeysDecodeErrorZ() && { LDKCResult_TxCreationKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); return res; } + ~CResult_TxCreationKeysDecodeErrorZ() { CResult_TxCreationKeysDecodeErrorZ_free(self); } + CResult_TxCreationKeysDecodeErrorZ& operator=(CResult_TxCreationKeysDecodeErrorZ&& o) { CResult_TxCreationKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); return *this; } + LDKCResult_TxCreationKeysDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxCreationKeysDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_AcceptChannelV2DecodeErrorZ { +private: + LDKCResult_AcceptChannelV2DecodeErrorZ self; +public: + CResult_AcceptChannelV2DecodeErrorZ(const CResult_AcceptChannelV2DecodeErrorZ&) = delete; + CResult_AcceptChannelV2DecodeErrorZ(CResult_AcceptChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelV2DecodeErrorZ)); } + CResult_AcceptChannelV2DecodeErrorZ(LDKCResult_AcceptChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ)); } + operator LDKCResult_AcceptChannelV2DecodeErrorZ() && { LDKCResult_AcceptChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ)); return res; } + ~CResult_AcceptChannelV2DecodeErrorZ() { CResult_AcceptChannelV2DecodeErrorZ_free(self); } + CResult_AcceptChannelV2DecodeErrorZ& operator=(CResult_AcceptChannelV2DecodeErrorZ&& o) { CResult_AcceptChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelV2DecodeErrorZ)); return *this; } + LDKCResult_AcceptChannelV2DecodeErrorZ* operator &() { return &self; } + LDKCResult_AcceptChannelV2DecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AcceptChannelV2DecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AcceptChannelV2DecodeErrorZ* 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_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 CResult_RouteHopDecodeErrorZ { +private: + LDKCResult_RouteHopDecodeErrorZ self; +public: + CResult_RouteHopDecodeErrorZ(const CResult_RouteHopDecodeErrorZ&) = delete; + CResult_RouteHopDecodeErrorZ(CResult_RouteHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); } + CResult_RouteHopDecodeErrorZ(LDKCResult_RouteHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); } + operator LDKCResult_RouteHopDecodeErrorZ() && { LDKCResult_RouteHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); return res; } + ~CResult_RouteHopDecodeErrorZ() { CResult_RouteHopDecodeErrorZ_free(self); } + CResult_RouteHopDecodeErrorZ& operator=(CResult_RouteHopDecodeErrorZ&& o) { CResult_RouteHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); return *this; } + LDKCResult_RouteHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHopDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_OfferIdDecodeErrorZ { +private: + LDKCResult_OfferIdDecodeErrorZ self; +public: + CResult_OfferIdDecodeErrorZ(const CResult_OfferIdDecodeErrorZ&) = delete; + CResult_OfferIdDecodeErrorZ(CResult_OfferIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferIdDecodeErrorZ)); } + CResult_OfferIdDecodeErrorZ(LDKCResult_OfferIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferIdDecodeErrorZ)); } + operator LDKCResult_OfferIdDecodeErrorZ() && { LDKCResult_OfferIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferIdDecodeErrorZ)); return res; } + ~CResult_OfferIdDecodeErrorZ() { CResult_OfferIdDecodeErrorZ_free(self); } + CResult_OfferIdDecodeErrorZ& operator=(CResult_OfferIdDecodeErrorZ&& o) { CResult_OfferIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferIdDecodeErrorZ)); return *this; } + LDKCResult_OfferIdDecodeErrorZ* operator &() { return &self; } + LDKCResult_OfferIdDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OfferIdDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OfferIdDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CoinSelectionNoneZ { +private: + LDKCResult_CoinSelectionNoneZ self; +public: + CResult_CoinSelectionNoneZ(const CResult_CoinSelectionNoneZ&) = delete; + CResult_CoinSelectionNoneZ(CResult_CoinSelectionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CoinSelectionNoneZ)); } + CResult_CoinSelectionNoneZ(LDKCResult_CoinSelectionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CoinSelectionNoneZ)); } + operator LDKCResult_CoinSelectionNoneZ() && { LDKCResult_CoinSelectionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CoinSelectionNoneZ)); return res; } + ~CResult_CoinSelectionNoneZ() { CResult_CoinSelectionNoneZ_free(self); } + CResult_CoinSelectionNoneZ& operator=(CResult_CoinSelectionNoneZ&& o) { CResult_CoinSelectionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CoinSelectionNoneZ)); return *this; } + LDKCResult_CoinSelectionNoneZ* operator &() { return &self; } + LDKCResult_CoinSelectionNoneZ* operator ->() { return &self; } + const LDKCResult_CoinSelectionNoneZ* operator &() const { return &self; } + const LDKCResult_CoinSelectionNoneZ* operator ->() const { return &self; } +}; +class CResult_StrNoneZ { +private: + LDKCResult_StrNoneZ self; +public: + CResult_StrNoneZ(const CResult_StrNoneZ&) = delete; + CResult_StrNoneZ(CResult_StrNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StrNoneZ)); } + CResult_StrNoneZ(LDKCResult_StrNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StrNoneZ)); } + operator LDKCResult_StrNoneZ() && { LDKCResult_StrNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_StrNoneZ)); return res; } + ~CResult_StrNoneZ() { CResult_StrNoneZ_free(self); } + CResult_StrNoneZ& operator=(CResult_StrNoneZ&& o) { CResult_StrNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StrNoneZ)); return *this; } + LDKCResult_StrNoneZ* operator &() { return &self; } + LDKCResult_StrNoneZ* operator ->() { return &self; } + const LDKCResult_StrNoneZ* operator &() const { return &self; } + const LDKCResult_StrNoneZ* operator ->() const { return &self; } +}; +class CVec_BalanceZ { +private: + LDKCVec_BalanceZ self; +public: + CVec_BalanceZ(const CVec_BalanceZ&) = delete; + CVec_BalanceZ(CVec_BalanceZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_BalanceZ)); } + CVec_BalanceZ(LDKCVec_BalanceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_BalanceZ)); } + operator LDKCVec_BalanceZ() && { LDKCVec_BalanceZ res = self; memset(&self, 0, sizeof(LDKCVec_BalanceZ)); return res; } + ~CVec_BalanceZ() { CVec_BalanceZ_free(self); } + CVec_BalanceZ& operator=(CVec_BalanceZ&& o) { CVec_BalanceZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_BalanceZ)); return *this; } + LDKCVec_BalanceZ* operator &() { return &self; } + LDKCVec_BalanceZ* operator ->() { return &self; } + 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; +public: + CResult_MaxDustHTLCExposureDecodeErrorZ(const CResult_MaxDustHTLCExposureDecodeErrorZ&) = delete; + CResult_MaxDustHTLCExposureDecodeErrorZ(CResult_MaxDustHTLCExposureDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MaxDustHTLCExposureDecodeErrorZ)); } + CResult_MaxDustHTLCExposureDecodeErrorZ(LDKCResult_MaxDustHTLCExposureDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ)); } + operator LDKCResult_MaxDustHTLCExposureDecodeErrorZ() && { LDKCResult_MaxDustHTLCExposureDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ)); return res; } + ~CResult_MaxDustHTLCExposureDecodeErrorZ() { CResult_MaxDustHTLCExposureDecodeErrorZ_free(self); } + CResult_MaxDustHTLCExposureDecodeErrorZ& operator=(CResult_MaxDustHTLCExposureDecodeErrorZ&& o) { CResult_MaxDustHTLCExposureDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MaxDustHTLCExposureDecodeErrorZ)); return *this; } + LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator &() { return &self; } + LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_AsyncBolt12OfferContextDecodeErrorZ { +private: + LDKCResult_AsyncBolt12OfferContextDecodeErrorZ self; +public: + CResult_AsyncBolt12OfferContextDecodeErrorZ(const CResult_AsyncBolt12OfferContextDecodeErrorZ&) = delete; + CResult_AsyncBolt12OfferContextDecodeErrorZ(CResult_AsyncBolt12OfferContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncBolt12OfferContextDecodeErrorZ)); } + CResult_AsyncBolt12OfferContextDecodeErrorZ(LDKCResult_AsyncBolt12OfferContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncBolt12OfferContextDecodeErrorZ)); } + operator LDKCResult_AsyncBolt12OfferContextDecodeErrorZ() && { LDKCResult_AsyncBolt12OfferContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncBolt12OfferContextDecodeErrorZ)); return res; } + ~CResult_AsyncBolt12OfferContextDecodeErrorZ() { CResult_AsyncBolt12OfferContextDecodeErrorZ_free(self); } + CResult_AsyncBolt12OfferContextDecodeErrorZ& operator=(CResult_AsyncBolt12OfferContextDecodeErrorZ&& o) { CResult_AsyncBolt12OfferContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncBolt12OfferContextDecodeErrorZ)); return *this; } + LDKCResult_AsyncBolt12OfferContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_AsyncBolt12OfferContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AsyncBolt12OfferContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AsyncBolt12OfferContextDecodeErrorZ* 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 CResult_InboundHTLCDetailsDecodeErrorZ { +private: + LDKCResult_InboundHTLCDetailsDecodeErrorZ self; +public: + CResult_InboundHTLCDetailsDecodeErrorZ(const CResult_InboundHTLCDetailsDecodeErrorZ&) = delete; + CResult_InboundHTLCDetailsDecodeErrorZ(CResult_InboundHTLCDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); } + CResult_InboundHTLCDetailsDecodeErrorZ(LDKCResult_InboundHTLCDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); } + operator LDKCResult_InboundHTLCDetailsDecodeErrorZ() && { LDKCResult_InboundHTLCDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); return res; } + ~CResult_InboundHTLCDetailsDecodeErrorZ() { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); } + CResult_InboundHTLCDetailsDecodeErrorZ& operator=(CResult_InboundHTLCDetailsDecodeErrorZ&& o) { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); return *this; } + LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() { return &self; } + LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InboundHTLCDetailsDecodeErrorZ* 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; +public: + CVec_PathZ(const CVec_PathZ&) = delete; + CVec_PathZ(CVec_PathZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PathZ)); } + CVec_PathZ(LDKCVec_PathZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PathZ)); } + operator LDKCVec_PathZ() && { LDKCVec_PathZ res = self; memset(&self, 0, sizeof(LDKCVec_PathZ)); return res; } + ~CVec_PathZ() { CVec_PathZ_free(self); } + CVec_PathZ& operator=(CVec_PathZ&& o) { CVec_PathZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PathZ)); return *this; } + LDKCVec_PathZ* operator &() { return &self; } + LDKCVec_PathZ* operator ->() { return &self; } + const LDKCVec_PathZ* operator &() const { return &self; } + const LDKCVec_PathZ* operator ->() const { return &self; } +}; +class CResult_NodeInfoDecodeErrorZ { +private: + LDKCResult_NodeInfoDecodeErrorZ self; +public: + CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete; + CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); } + CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); } + operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; } + ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); } + CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; } + LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_NodeIdZ { +private: + LDKCVec_NodeIdZ self; +public: + CVec_NodeIdZ(const CVec_NodeIdZ&) = delete; + CVec_NodeIdZ(CVec_NodeIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeIdZ)); } + CVec_NodeIdZ(LDKCVec_NodeIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeIdZ)); } + operator LDKCVec_NodeIdZ() && { LDKCVec_NodeIdZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeIdZ)); return res; } + ~CVec_NodeIdZ() { CVec_NodeIdZ_free(self); } + CVec_NodeIdZ& operator=(CVec_NodeIdZ&& o) { CVec_NodeIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NodeIdZ)); return *this; } + LDKCVec_NodeIdZ* operator &() { return &self; } + LDKCVec_NodeIdZ* operator ->() { return &self; } + const LDKCVec_NodeIdZ* operator &() const { return &self; } + const LDKCVec_NodeIdZ* operator ->() const { return &self; } +}; +class CVec_u8Z { +private: + LDKCVec_u8Z self; +public: + CVec_u8Z(const CVec_u8Z&) = delete; + CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); } + CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); } + operator LDKCVec_u8Z() && { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } + ~CVec_u8Z() { CVec_u8Z_free(self); } + CVec_u8Z& operator=(CVec_u8Z&& o) { CVec_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u8Z)); return *this; } + LDKCVec_u8Z* operator &() { return &self; } + LDKCVec_u8Z* operator ->() { return &self; } + const LDKCVec_u8Z* operator &() const { return &self; } + const LDKCVec_u8Z* operator ->() const { return &self; } +}; +class CResult_PeerStorageRetrievalDecodeErrorZ { +private: + LDKCResult_PeerStorageRetrievalDecodeErrorZ self; +public: + CResult_PeerStorageRetrievalDecodeErrorZ(const CResult_PeerStorageRetrievalDecodeErrorZ&) = delete; + CResult_PeerStorageRetrievalDecodeErrorZ(CResult_PeerStorageRetrievalDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PeerStorageRetrievalDecodeErrorZ)); } + CResult_PeerStorageRetrievalDecodeErrorZ(LDKCResult_PeerStorageRetrievalDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PeerStorageRetrievalDecodeErrorZ)); } + operator LDKCResult_PeerStorageRetrievalDecodeErrorZ() && { LDKCResult_PeerStorageRetrievalDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PeerStorageRetrievalDecodeErrorZ)); return res; } + ~CResult_PeerStorageRetrievalDecodeErrorZ() { CResult_PeerStorageRetrievalDecodeErrorZ_free(self); } + CResult_PeerStorageRetrievalDecodeErrorZ& operator=(CResult_PeerStorageRetrievalDecodeErrorZ&& o) { CResult_PeerStorageRetrievalDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PeerStorageRetrievalDecodeErrorZ)); return *this; } + LDKCResult_PeerStorageRetrievalDecodeErrorZ* operator &() { return &self; } + LDKCResult_PeerStorageRetrievalDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PeerStorageRetrievalDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PeerStorageRetrievalDecodeErrorZ* 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 CResult_DelayedPaymentKeyDecodeErrorZ { +private: + LDKCResult_DelayedPaymentKeyDecodeErrorZ self; +public: + CResult_DelayedPaymentKeyDecodeErrorZ(const CResult_DelayedPaymentKeyDecodeErrorZ&) = delete; + CResult_DelayedPaymentKeyDecodeErrorZ(CResult_DelayedPaymentKeyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); } + CResult_DelayedPaymentKeyDecodeErrorZ(LDKCResult_DelayedPaymentKeyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); } + operator LDKCResult_DelayedPaymentKeyDecodeErrorZ() && { LDKCResult_DelayedPaymentKeyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); return res; } + ~CResult_DelayedPaymentKeyDecodeErrorZ() { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); } + CResult_DelayedPaymentKeyDecodeErrorZ& operator=(CResult_DelayedPaymentKeyDecodeErrorZ&& o) { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); return *this; } + LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() { return &self; } + LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_HTLCHandlingFailureReasonZ { +private: + LDKCOption_HTLCHandlingFailureReasonZ self; +public: + COption_HTLCHandlingFailureReasonZ(const COption_HTLCHandlingFailureReasonZ&) = delete; + COption_HTLCHandlingFailureReasonZ(COption_HTLCHandlingFailureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCHandlingFailureReasonZ)); } + COption_HTLCHandlingFailureReasonZ(LDKCOption_HTLCHandlingFailureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCHandlingFailureReasonZ)); } + operator LDKCOption_HTLCHandlingFailureReasonZ() && { LDKCOption_HTLCHandlingFailureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCHandlingFailureReasonZ)); return res; } + ~COption_HTLCHandlingFailureReasonZ() { COption_HTLCHandlingFailureReasonZ_free(self); } + COption_HTLCHandlingFailureReasonZ& operator=(COption_HTLCHandlingFailureReasonZ&& o) { COption_HTLCHandlingFailureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCHandlingFailureReasonZ)); return *this; } + LDKCOption_HTLCHandlingFailureReasonZ* operator &() { return &self; } + LDKCOption_HTLCHandlingFailureReasonZ* operator ->() { return &self; } + const LDKCOption_HTLCHandlingFailureReasonZ* operator &() const { return &self; } + const LDKCOption_HTLCHandlingFailureReasonZ* 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 CResult_InvoiceRequestDecodeErrorZ { +private: + LDKCResult_InvoiceRequestDecodeErrorZ self; +public: + CResult_InvoiceRequestDecodeErrorZ(const CResult_InvoiceRequestDecodeErrorZ&) = delete; + CResult_InvoiceRequestDecodeErrorZ(CResult_InvoiceRequestDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); } + CResult_InvoiceRequestDecodeErrorZ(LDKCResult_InvoiceRequestDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); } + operator LDKCResult_InvoiceRequestDecodeErrorZ() && { LDKCResult_InvoiceRequestDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); return res; } + ~CResult_InvoiceRequestDecodeErrorZ() { CResult_InvoiceRequestDecodeErrorZ_free(self); } + CResult_InvoiceRequestDecodeErrorZ& operator=(CResult_InvoiceRequestDecodeErrorZ&& o) { CResult_InvoiceRequestDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); return *this; } + LDKCResult_InvoiceRequestDecodeErrorZ* operator &() { return &self; } + LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceRequestDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { +private: + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ self; +public: + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(const CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&) = delete; + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } + operator LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() && { LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return res; } + ~CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ& operator=(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return *this; } + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() { return &self; } + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() const { return &self; } +}; +class COption_u8Z { +private: + LDKCOption_u8Z self; +public: + COption_u8Z(const COption_u8Z&) = delete; + COption_u8Z(COption_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u8Z)); } + COption_u8Z(LDKCOption_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u8Z)); } + operator LDKCOption_u8Z() && { LDKCOption_u8Z res = self; memset(&self, 0, sizeof(LDKCOption_u8Z)); return res; } + ~COption_u8Z() { COption_u8Z_free(self); } + COption_u8Z& operator=(COption_u8Z&& o) { COption_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u8Z)); return *this; } + LDKCOption_u8Z* operator &() { return &self; } + LDKCOption_u8Z* operator ->() { return &self; } + const LDKCOption_u8Z* operator &() const { return &self; } + const LDKCOption_u8Z* 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_OfferBolt12SemanticErrorZ { +private: + LDKCResult_OfferBolt12SemanticErrorZ self; +public: + CResult_OfferBolt12SemanticErrorZ(const CResult_OfferBolt12SemanticErrorZ&) = delete; + CResult_OfferBolt12SemanticErrorZ(CResult_OfferBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferBolt12SemanticErrorZ)); } + CResult_OfferBolt12SemanticErrorZ(LDKCResult_OfferBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferBolt12SemanticErrorZ)); } + operator LDKCResult_OfferBolt12SemanticErrorZ() && { LDKCResult_OfferBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferBolt12SemanticErrorZ)); return res; } + ~CResult_OfferBolt12SemanticErrorZ() { CResult_OfferBolt12SemanticErrorZ_free(self); } + CResult_OfferBolt12SemanticErrorZ& operator=(CResult_OfferBolt12SemanticErrorZ&& o) { CResult_OfferBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferBolt12SemanticErrorZ)); return *this; } + LDKCResult_OfferBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_OfferBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_OfferBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_OfferBolt12SemanticErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { +private: + LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ self; +public: + 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_OutPointDecodeErrorZ { +private: + LDKCResult_OutPointDecodeErrorZ self; +public: + CResult_OutPointDecodeErrorZ(const CResult_OutPointDecodeErrorZ&) = delete; + CResult_OutPointDecodeErrorZ(CResult_OutPointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); } + CResult_OutPointDecodeErrorZ(LDKCResult_OutPointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); } + operator LDKCResult_OutPointDecodeErrorZ() && { LDKCResult_OutPointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); return res; } + ~CResult_OutPointDecodeErrorZ() { CResult_OutPointDecodeErrorZ_free(self); } + CResult_OutPointDecodeErrorZ& operator=(CResult_OutPointDecodeErrorZ&& o) { CResult_OutPointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); return *this; } + LDKCResult_OutPointDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutPointDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutPointDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutPointDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_ChannelDetailsZ { +private: + LDKCVec_ChannelDetailsZ self; +public: + CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete; + CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); } + CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); } + operator LDKCVec_ChannelDetailsZ() && { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } + ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } + CVec_ChannelDetailsZ& operator=(CVec_ChannelDetailsZ&& o) { CVec_ChannelDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); return *this; } + LDKCVec_ChannelDetailsZ* operator &() { return &self; } + LDKCVec_ChannelDetailsZ* operator ->() { return &self; } + const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } + const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; } +}; +class CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +private: + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ self; +public: + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(const CResult_Bolt11InvoiceFeaturesDecodeErrorZ&) = delete; + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } + operator LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return res; } + ~CResult_Bolt11InvoiceFeaturesDecodeErrorZ() { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); } + CResult_Bolt11InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return *this; } + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_ChannelIdCVec_u64ZZ { +private: + LDKC2Tuple_ChannelIdCVec_u64ZZ self; +public: + C2Tuple_ChannelIdCVec_u64ZZ(const C2Tuple_ChannelIdCVec_u64ZZ&) = delete; + C2Tuple_ChannelIdCVec_u64ZZ(C2Tuple_ChannelIdCVec_u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ChannelIdCVec_u64ZZ)); } + C2Tuple_ChannelIdCVec_u64ZZ(LDKC2Tuple_ChannelIdCVec_u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ChannelIdCVec_u64ZZ)); } + operator LDKC2Tuple_ChannelIdCVec_u64ZZ() && { LDKC2Tuple_ChannelIdCVec_u64ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ChannelIdCVec_u64ZZ)); return res; } + ~C2Tuple_ChannelIdCVec_u64ZZ() { C2Tuple_ChannelIdCVec_u64ZZ_free(self); } + C2Tuple_ChannelIdCVec_u64ZZ& operator=(C2Tuple_ChannelIdCVec_u64ZZ&& o) { C2Tuple_ChannelIdCVec_u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ChannelIdCVec_u64ZZ)); return *this; } + LDKC2Tuple_ChannelIdCVec_u64ZZ* operator &() { return &self; } + LDKC2Tuple_ChannelIdCVec_u64ZZ* operator ->() { return &self; } + const LDKC2Tuple_ChannelIdCVec_u64ZZ* operator &() const { return &self; } + const LDKC2Tuple_ChannelIdCVec_u64ZZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { +private: + LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ self; +public: + CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(const CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&) = delete; + CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); } + CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); } + operator LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ() && { LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); return res; } + ~CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ() { CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(self); } + CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ& operator=(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& o) { CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); return *this; } + LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator &() { return &self; } + LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator ->() const { return &self; } +}; +class CResult_RouteHintHopDecodeErrorZ { +private: + LDKCResult_RouteHintHopDecodeErrorZ self; +public: + CResult_RouteHintHopDecodeErrorZ(const CResult_RouteHintHopDecodeErrorZ&) = delete; + CResult_RouteHintHopDecodeErrorZ(CResult_RouteHintHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); } + CResult_RouteHintHopDecodeErrorZ(LDKCResult_RouteHintHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); } + operator LDKCResult_RouteHintHopDecodeErrorZ() && { LDKCResult_RouteHintHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); return res; } + ~CResult_RouteHintHopDecodeErrorZ() { CResult_RouteHintHopDecodeErrorZ_free(self); } + CResult_RouteHintHopDecodeErrorZ& operator=(CResult_RouteHintHopDecodeErrorZ&& o) { CResult_RouteHintHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); return *this; } + LDKCResult_RouteHintHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHintHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHintHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHintHopDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_ChannelShutdownStateZ { +private: + LDKCOption_ChannelShutdownStateZ self; +public: + COption_ChannelShutdownStateZ(const COption_ChannelShutdownStateZ&) = delete; + COption_ChannelShutdownStateZ(COption_ChannelShutdownStateZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ChannelShutdownStateZ)); } + COption_ChannelShutdownStateZ(LDKCOption_ChannelShutdownStateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ChannelShutdownStateZ)); } + operator LDKCOption_ChannelShutdownStateZ() && { LDKCOption_ChannelShutdownStateZ res = self; memset(&self, 0, sizeof(LDKCOption_ChannelShutdownStateZ)); return res; } + ~COption_ChannelShutdownStateZ() { COption_ChannelShutdownStateZ_free(self); } + COption_ChannelShutdownStateZ& operator=(COption_ChannelShutdownStateZ&& o) { COption_ChannelShutdownStateZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ChannelShutdownStateZ)); return *this; } + LDKCOption_ChannelShutdownStateZ* operator &() { return &self; } + LDKCOption_ChannelShutdownStateZ* operator ->() { return &self; } + const LDKCOption_ChannelShutdownStateZ* operator &() const { return &self; } + const LDKCOption_ChannelShutdownStateZ* operator ->() const { return &self; } +}; +class CResult_NoneBolt12PaymentErrorZ { +private: + LDKCResult_NoneBolt12PaymentErrorZ self; +public: + CResult_NoneBolt12PaymentErrorZ(const CResult_NoneBolt12PaymentErrorZ&) = delete; + CResult_NoneBolt12PaymentErrorZ(CResult_NoneBolt12PaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); } + CResult_NoneBolt12PaymentErrorZ(LDKCResult_NoneBolt12PaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); } + operator LDKCResult_NoneBolt12PaymentErrorZ() && { LDKCResult_NoneBolt12PaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); return res; } + ~CResult_NoneBolt12PaymentErrorZ() { CResult_NoneBolt12PaymentErrorZ_free(self); } + CResult_NoneBolt12PaymentErrorZ& operator=(CResult_NoneBolt12PaymentErrorZ&& o) { CResult_NoneBolt12PaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); return *this; } + LDKCResult_NoneBolt12PaymentErrorZ* operator &() { return &self; } + LDKCResult_NoneBolt12PaymentErrorZ* operator ->() { return &self; } + const LDKCResult_NoneBolt12PaymentErrorZ* operator &() const { return &self; } + const LDKCResult_NoneBolt12PaymentErrorZ* operator ->() const { return &self; } +}; +class CResult_AcceptChannelDecodeErrorZ { +private: + LDKCResult_AcceptChannelDecodeErrorZ self; +public: + CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete; + CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); } + CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); } + operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; } + ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); } + CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; } + LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; } + LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_OfferboolZNoneZ { +private: + LDKCResult_C2Tuple_OfferboolZNoneZ self; +public: + CResult_C2Tuple_OfferboolZNoneZ(const CResult_C2Tuple_OfferboolZNoneZ&) = delete; + CResult_C2Tuple_OfferboolZNoneZ(CResult_C2Tuple_OfferboolZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_OfferboolZNoneZ)); } + CResult_C2Tuple_OfferboolZNoneZ(LDKCResult_C2Tuple_OfferboolZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_OfferboolZNoneZ)); } + operator LDKCResult_C2Tuple_OfferboolZNoneZ() && { LDKCResult_C2Tuple_OfferboolZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_OfferboolZNoneZ)); return res; } + ~CResult_C2Tuple_OfferboolZNoneZ() { CResult_C2Tuple_OfferboolZNoneZ_free(self); } + CResult_C2Tuple_OfferboolZNoneZ& operator=(CResult_C2Tuple_OfferboolZNoneZ&& o) { CResult_C2Tuple_OfferboolZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_OfferboolZNoneZ)); return *this; } + LDKCResult_C2Tuple_OfferboolZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_OfferboolZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_OfferboolZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_OfferboolZNoneZ* operator ->() const { return &self; } +}; +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: + LDKCOption_ThirtyTwoBytesZ self; +public: + 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: + LDKCVec_u64Z self; +public: + CVec_u64Z(const CVec_u64Z&) = delete; + CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); } + CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); } + operator LDKCVec_u64Z() && { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } + ~CVec_u64Z() { CVec_u64Z_free(self); } + CVec_u64Z& operator=(CVec_u64Z&& o) { CVec_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u64Z)); return *this; } + LDKCVec_u64Z* operator &() { return &self; } + LDKCVec_u64Z* operator ->() { return &self; } + const LDKCVec_u64Z* operator &() const { return &self; } + const LDKCVec_u64Z* operator ->() const { return &self; } +}; +class CResult_NoneBolt12SemanticErrorZ { +private: + LDKCResult_NoneBolt12SemanticErrorZ self; +public: + CResult_NoneBolt12SemanticErrorZ(const CResult_NoneBolt12SemanticErrorZ&) = delete; + CResult_NoneBolt12SemanticErrorZ(CResult_NoneBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); } + CResult_NoneBolt12SemanticErrorZ(LDKCResult_NoneBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); } + operator LDKCResult_NoneBolt12SemanticErrorZ() && { LDKCResult_NoneBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); return res; } + ~CResult_NoneBolt12SemanticErrorZ() { CResult_NoneBolt12SemanticErrorZ_free(self); } + CResult_NoneBolt12SemanticErrorZ& operator=(CResult_NoneBolt12SemanticErrorZ&& o) { CResult_NoneBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); return *this; } + LDKCResult_NoneBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_NoneBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_NoneBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_NoneBolt12SemanticErrorZ* operator ->() const { return &self; } +}; +class COption_InboundHTLCStateDetailsZ { +private: + LDKCOption_InboundHTLCStateDetailsZ self; +public: + COption_InboundHTLCStateDetailsZ(const COption_InboundHTLCStateDetailsZ&) = delete; + COption_InboundHTLCStateDetailsZ(COption_InboundHTLCStateDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); } + COption_InboundHTLCStateDetailsZ(LDKCOption_InboundHTLCStateDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); } + operator LDKCOption_InboundHTLCStateDetailsZ() && { LDKCOption_InboundHTLCStateDetailsZ res = self; memset(&self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); return res; } + ~COption_InboundHTLCStateDetailsZ() { COption_InboundHTLCStateDetailsZ_free(self); } + COption_InboundHTLCStateDetailsZ& operator=(COption_InboundHTLCStateDetailsZ&& o) { COption_InboundHTLCStateDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); return *this; } + LDKCOption_InboundHTLCStateDetailsZ* operator &() { return &self; } + LDKCOption_InboundHTLCStateDetailsZ* operator ->() { return &self; } + const LDKCOption_InboundHTLCStateDetailsZ* operator &() const { return &self; } + const LDKCOption_InboundHTLCStateDetailsZ* operator ->() const { return &self; } +}; +class COption_EventZ { +private: + LDKCOption_EventZ self; +public: + COption_EventZ(const COption_EventZ&) = delete; + COption_EventZ(COption_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_EventZ)); } + COption_EventZ(LDKCOption_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_EventZ)); } + operator LDKCOption_EventZ() && { LDKCOption_EventZ res = self; memset(&self, 0, sizeof(LDKCOption_EventZ)); return res; } + ~COption_EventZ() { COption_EventZ_free(self); } + COption_EventZ& operator=(COption_EventZ&& o) { COption_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_EventZ)); return *this; } + LDKCOption_EventZ* operator &() { return &self; } + LDKCOption_EventZ* operator ->() { return &self; } + const LDKCOption_EventZ* operator &() const { return &self; } + const LDKCOption_EventZ* operator ->() const { return &self; } +}; +class COption_CVec_SocketAddressZZ { +private: + LDKCOption_CVec_SocketAddressZZ self; +public: + 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 CResult_ChannelTypeFeaturesDecodeErrorZ { +private: + LDKCResult_ChannelTypeFeaturesDecodeErrorZ self; +public: + CResult_ChannelTypeFeaturesDecodeErrorZ(const CResult_ChannelTypeFeaturesDecodeErrorZ&) = delete; + CResult_ChannelTypeFeaturesDecodeErrorZ(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); } + CResult_ChannelTypeFeaturesDecodeErrorZ(LDKCResult_ChannelTypeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); } + operator LDKCResult_ChannelTypeFeaturesDecodeErrorZ() && { LDKCResult_ChannelTypeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); return res; } + ~CResult_ChannelTypeFeaturesDecodeErrorZ() { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); } + CResult_ChannelTypeFeaturesDecodeErrorZ& operator=(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); return *this; } + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_Bolt12RefundContextDecodeErrorZ { +private: + LDKCResult_Bolt12RefundContextDecodeErrorZ self; +public: + CResult_Bolt12RefundContextDecodeErrorZ(const CResult_Bolt12RefundContextDecodeErrorZ&) = delete; + CResult_Bolt12RefundContextDecodeErrorZ(CResult_Bolt12RefundContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12RefundContextDecodeErrorZ)); } + CResult_Bolt12RefundContextDecodeErrorZ(LDKCResult_Bolt12RefundContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ)); } + operator LDKCResult_Bolt12RefundContextDecodeErrorZ() && { LDKCResult_Bolt12RefundContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ)); return res; } + ~CResult_Bolt12RefundContextDecodeErrorZ() { CResult_Bolt12RefundContextDecodeErrorZ_free(self); } + CResult_Bolt12RefundContextDecodeErrorZ& operator=(CResult_Bolt12RefundContextDecodeErrorZ&& o) { CResult_Bolt12RefundContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12RefundContextDecodeErrorZ)); return *this; } + LDKCResult_Bolt12RefundContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_Bolt12RefundContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt12RefundContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt12RefundContextDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_AsyncReceiveOfferCacheDecodeErrorZ { +private: + LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ self; +public: + CResult_AsyncReceiveOfferCacheDecodeErrorZ(const CResult_AsyncReceiveOfferCacheDecodeErrorZ&) = delete; + CResult_AsyncReceiveOfferCacheDecodeErrorZ(CResult_AsyncReceiveOfferCacheDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncReceiveOfferCacheDecodeErrorZ)); } + CResult_AsyncReceiveOfferCacheDecodeErrorZ(LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ)); } + operator LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ() && { LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ)); return res; } + ~CResult_AsyncReceiveOfferCacheDecodeErrorZ() { CResult_AsyncReceiveOfferCacheDecodeErrorZ_free(self); } + CResult_AsyncReceiveOfferCacheDecodeErrorZ& operator=(CResult_AsyncReceiveOfferCacheDecodeErrorZ&& o) { CResult_AsyncReceiveOfferCacheDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncReceiveOfferCacheDecodeErrorZ)); return *this; } + LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ* operator &() { return &self; } + LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AsyncReceiveOfferCacheDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { +private: + LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ self; +public: + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ(const CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ&) = delete; + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ(CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ)); } + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ(LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ)); } + operator LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ() && { LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ)); return res; } + ~CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ() { CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_free(self); } + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ& operator=(CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ&& o) { CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ)); return *this; } + LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ECDSASignatureNoneZ { +private: + LDKCResult_ECDSASignatureNoneZ self; +public: + 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: + LDKCVec_WitnessZ self; +public: + CVec_WitnessZ(const CVec_WitnessZ&) = delete; + CVec_WitnessZ(CVec_WitnessZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_WitnessZ)); } + CVec_WitnessZ(LDKCVec_WitnessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_WitnessZ)); } + operator LDKCVec_WitnessZ() && { LDKCVec_WitnessZ res = self; memset(&self, 0, sizeof(LDKCVec_WitnessZ)); return res; } + ~CVec_WitnessZ() { CVec_WitnessZ_free(self); } + CVec_WitnessZ& operator=(CVec_WitnessZ&& o) { CVec_WitnessZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_WitnessZ)); return *this; } + LDKCVec_WitnessZ* operator &() { return &self; } + LDKCVec_WitnessZ* operator ->() { return &self; } + const LDKCVec_WitnessZ* operator &() const { return &self; } + const LDKCVec_WitnessZ* operator ->() const { return &self; } +}; +class C2Tuple_OffersMessageResponseInstructionZ { +private: + LDKC2Tuple_OffersMessageResponseInstructionZ self; +public: + C2Tuple_OffersMessageResponseInstructionZ(const C2Tuple_OffersMessageResponseInstructionZ&) = delete; + C2Tuple_OffersMessageResponseInstructionZ(C2Tuple_OffersMessageResponseInstructionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OffersMessageResponseInstructionZ)); } + C2Tuple_OffersMessageResponseInstructionZ(LDKC2Tuple_OffersMessageResponseInstructionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OffersMessageResponseInstructionZ)); } + operator LDKC2Tuple_OffersMessageResponseInstructionZ() && { LDKC2Tuple_OffersMessageResponseInstructionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OffersMessageResponseInstructionZ)); return res; } + ~C2Tuple_OffersMessageResponseInstructionZ() { C2Tuple_OffersMessageResponseInstructionZ_free(self); } + C2Tuple_OffersMessageResponseInstructionZ& operator=(C2Tuple_OffersMessageResponseInstructionZ&& o) { C2Tuple_OffersMessageResponseInstructionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OffersMessageResponseInstructionZ)); return *this; } + LDKC2Tuple_OffersMessageResponseInstructionZ* operator &() { return &self; } + LDKC2Tuple_OffersMessageResponseInstructionZ* operator ->() { return &self; } + const LDKC2Tuple_OffersMessageResponseInstructionZ* operator &() const { return &self; } + const LDKC2Tuple_OffersMessageResponseInstructionZ* operator ->() const { return &self; } +}; +class CResult_BlindedTailDecodeErrorZ { +private: + LDKCResult_BlindedTailDecodeErrorZ self; +public: + CResult_BlindedTailDecodeErrorZ(const CResult_BlindedTailDecodeErrorZ&) = delete; + CResult_BlindedTailDecodeErrorZ(CResult_BlindedTailDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedTailDecodeErrorZ)); } + CResult_BlindedTailDecodeErrorZ(LDKCResult_BlindedTailDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedTailDecodeErrorZ)); } + operator LDKCResult_BlindedTailDecodeErrorZ() && { LDKCResult_BlindedTailDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedTailDecodeErrorZ)); return res; } + ~CResult_BlindedTailDecodeErrorZ() { CResult_BlindedTailDecodeErrorZ_free(self); } + CResult_BlindedTailDecodeErrorZ& operator=(CResult_BlindedTailDecodeErrorZ&& o) { CResult_BlindedTailDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedTailDecodeErrorZ)); return *this; } + LDKCResult_BlindedTailDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedTailDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedTailDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedTailDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { +private: + LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ self; +public: + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(const CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&) = delete; + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); } + operator LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ() && { LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); return res; } + ~CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ() { CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(self); } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ& operator=(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& o) { CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); return *this; } + LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator &() { return &self; } + LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator ->() { return &self; } + 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_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 CResult_RefundBolt12ParseErrorZ { +private: + LDKCResult_RefundBolt12ParseErrorZ self; +public: + CResult_RefundBolt12ParseErrorZ(const CResult_RefundBolt12ParseErrorZ&) = delete; + CResult_RefundBolt12ParseErrorZ(CResult_RefundBolt12ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RefundBolt12ParseErrorZ)); } + CResult_RefundBolt12ParseErrorZ(LDKCResult_RefundBolt12ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RefundBolt12ParseErrorZ)); } + operator LDKCResult_RefundBolt12ParseErrorZ() && { LDKCResult_RefundBolt12ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RefundBolt12ParseErrorZ)); return res; } + ~CResult_RefundBolt12ParseErrorZ() { CResult_RefundBolt12ParseErrorZ_free(self); } + CResult_RefundBolt12ParseErrorZ& operator=(CResult_RefundBolt12ParseErrorZ&& o) { CResult_RefundBolt12ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RefundBolt12ParseErrorZ)); return *this; } + LDKCResult_RefundBolt12ParseErrorZ* operator &() { return &self; } + LDKCResult_RefundBolt12ParseErrorZ* operator ->() { return &self; } + const LDKCResult_RefundBolt12ParseErrorZ* operator &() const { return &self; } + const LDKCResult_RefundBolt12ParseErrorZ* operator ->() const { return &self; } +}; +class CResult_u32GraphSyncErrorZ { +private: + LDKCResult_u32GraphSyncErrorZ self; +public: + CResult_u32GraphSyncErrorZ(const CResult_u32GraphSyncErrorZ&) = delete; + CResult_u32GraphSyncErrorZ(CResult_u32GraphSyncErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); } + CResult_u32GraphSyncErrorZ(LDKCResult_u32GraphSyncErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); } + operator LDKCResult_u32GraphSyncErrorZ() && { LDKCResult_u32GraphSyncErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); return res; } + ~CResult_u32GraphSyncErrorZ() { CResult_u32GraphSyncErrorZ_free(self); } + CResult_u32GraphSyncErrorZ& operator=(CResult_u32GraphSyncErrorZ&& o) { CResult_u32GraphSyncErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); return *this; } + LDKCResult_u32GraphSyncErrorZ* operator &() { return &self; } + LDKCResult_u32GraphSyncErrorZ* operator ->() { return &self; } + const LDKCResult_u32GraphSyncErrorZ* operator &() const { return &self; } + const LDKCResult_u32GraphSyncErrorZ* 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 CVec_PhantomRouteHintsZ { +private: + LDKCVec_PhantomRouteHintsZ self; +public: + CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete; + CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); } + CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); } + operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; } + ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); } + CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; } + LDKCVec_PhantomRouteHintsZ* operator &() { return &self; } + LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; } + const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; } + const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; } +}; +class CResult_NoneAPIErrorZ { +private: + LDKCResult_NoneAPIErrorZ self; +public: + CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete; + CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); } + CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); } + operator LDKCResult_NoneAPIErrorZ() && { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; } + ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); } + CResult_NoneAPIErrorZ& operator=(CResult_NoneAPIErrorZ&& o) { CResult_NoneAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); return *this; } + LDKCResult_NoneAPIErrorZ* operator &() { return &self; } + LDKCResult_NoneAPIErrorZ* operator ->() { return &self; } + const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; } + const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; } +}; +class CResult_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_PaymentContextDecodeErrorZ { +private: + LDKCResult_PaymentContextDecodeErrorZ self; +public: + CResult_PaymentContextDecodeErrorZ(const CResult_PaymentContextDecodeErrorZ&) = delete; + CResult_PaymentContextDecodeErrorZ(CResult_PaymentContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); } + CResult_PaymentContextDecodeErrorZ(LDKCResult_PaymentContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); } + operator LDKCResult_PaymentContextDecodeErrorZ() && { LDKCResult_PaymentContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); return res; } + ~CResult_PaymentContextDecodeErrorZ() { CResult_PaymentContextDecodeErrorZ_free(self); } + CResult_PaymentContextDecodeErrorZ& operator=(CResult_PaymentContextDecodeErrorZ&& o) { CResult_PaymentContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); return *this; } + LDKCResult_PaymentContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentContextDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_Bolt12InvoiceFeaturesDecodeErrorZ { +private: + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ self; +public: + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(const CResult_Bolt12InvoiceFeaturesDecodeErrorZ&) = delete; + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } + operator LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return res; } + ~CResult_Bolt12InvoiceFeaturesDecodeErrorZ() { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); } + CResult_Bolt12InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return *this; } + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_PublicKeyZ { +private: + LDKCVec_PublicKeyZ self; +public: + CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete; + CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); } + CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); } + operator LDKCVec_PublicKeyZ() && { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; } + ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); } + CVec_PublicKeyZ& operator=(CVec_PublicKeyZ&& o) { CVec_PublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PublicKeyZ)); return *this; } + LDKCVec_PublicKeyZ* operator &() { return &self; } + LDKCVec_PublicKeyZ* operator ->() { return &self; } + const LDKCVec_PublicKeyZ* operator &() const { return &self; } + const LDKCVec_PublicKeyZ* operator ->() const { return &self; } +}; +class C2Tuple_CVec_u8Zu64Z { +private: + LDKC2Tuple_CVec_u8Zu64Z self; +public: + C2Tuple_CVec_u8Zu64Z(const C2Tuple_CVec_u8Zu64Z&) = delete; + C2Tuple_CVec_u8Zu64Z(C2Tuple_CVec_u8Zu64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu64Z)); } + C2Tuple_CVec_u8Zu64Z(LDKC2Tuple_CVec_u8Zu64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_u8Zu64Z)); } + operator LDKC2Tuple_CVec_u8Zu64Z() && { LDKC2Tuple_CVec_u8Zu64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_u8Zu64Z)); return res; } + ~C2Tuple_CVec_u8Zu64Z() { C2Tuple_CVec_u8Zu64Z_free(self); } + C2Tuple_CVec_u8Zu64Z& operator=(C2Tuple_CVec_u8Zu64Z&& o) { C2Tuple_CVec_u8Zu64Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu64Z)); return *this; } + LDKC2Tuple_CVec_u8Zu64Z* operator &() { return &self; } + LDKC2Tuple_CVec_u8Zu64Z* operator ->() { return &self; } + const LDKC2Tuple_CVec_u8Zu64Z* operator &() const { return &self; } + const LDKC2Tuple_CVec_u8Zu64Z* operator ->() const { return &self; } +}; +class C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { +private: + LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ self; +public: + C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ(const C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ&) = delete; + C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ(C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ)); } + C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ(LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ)); } + operator LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ() && { LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ)); return res; } + ~C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ() { C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_free(self); } + C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ& operator=(C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ&& o) { C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ)); return *this; } + LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ* operator &() { return &self; } + LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ* operator ->() { return &self; } + const LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ* operator &() const { return &self; } + const LDKC3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { +private: + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ self; +public: + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(const COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&) = delete; + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); } + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ() && { LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); return res; } + ~COption_C2Tuple_OnionMessageContentsResponseInstructionZZ() { COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(self); } + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ& operator=(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& o) { COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator ->() const { return &self; } +}; +class CResult_RecipientOnionFieldsDecodeErrorZ { +private: + LDKCResult_RecipientOnionFieldsDecodeErrorZ self; +public: + CResult_RecipientOnionFieldsDecodeErrorZ(const CResult_RecipientOnionFieldsDecodeErrorZ&) = delete; + CResult_RecipientOnionFieldsDecodeErrorZ(CResult_RecipientOnionFieldsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecipientOnionFieldsDecodeErrorZ)); } + CResult_RecipientOnionFieldsDecodeErrorZ(LDKCResult_RecipientOnionFieldsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ)); } + operator LDKCResult_RecipientOnionFieldsDecodeErrorZ() && { LDKCResult_RecipientOnionFieldsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ)); return res; } + ~CResult_RecipientOnionFieldsDecodeErrorZ() { CResult_RecipientOnionFieldsDecodeErrorZ_free(self); } + CResult_RecipientOnionFieldsDecodeErrorZ& operator=(CResult_RecipientOnionFieldsDecodeErrorZ&& o) { CResult_RecipientOnionFieldsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecipientOnionFieldsDecodeErrorZ)); return *this; } + LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator &() { return &self; } + LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_u32TxOutZ { +private: + LDKC2Tuple_u32TxOutZ self; +public: + C2Tuple_u32TxOutZ(const C2Tuple_u32TxOutZ&) = delete; + C2Tuple_u32TxOutZ(C2Tuple_u32TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); } + C2Tuple_u32TxOutZ(LDKC2Tuple_u32TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); } + operator LDKC2Tuple_u32TxOutZ() && { LDKC2Tuple_u32TxOutZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); return res; } + ~C2Tuple_u32TxOutZ() { C2Tuple_u32TxOutZ_free(self); } + C2Tuple_u32TxOutZ& operator=(C2Tuple_u32TxOutZ&& o) { C2Tuple_u32TxOutZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); return *this; } + LDKC2Tuple_u32TxOutZ* operator &() { return &self; } + LDKC2Tuple_u32TxOutZ* operator ->() { return &self; } + const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } + const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_OutPointCVec_u8ZZZ { +private: + LDKCVec_C2Tuple_OutPointCVec_u8ZZZ self; +public: + CVec_C2Tuple_OutPointCVec_u8ZZZ(const CVec_C2Tuple_OutPointCVec_u8ZZZ&) = delete; + CVec_C2Tuple_OutPointCVec_u8ZZZ(CVec_C2Tuple_OutPointCVec_u8ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_u8ZZZ)); } + CVec_C2Tuple_OutPointCVec_u8ZZZ(LDKCVec_C2Tuple_OutPointCVec_u8ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_u8ZZZ)); } + operator LDKCVec_C2Tuple_OutPointCVec_u8ZZZ() && { LDKCVec_C2Tuple_OutPointCVec_u8ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_u8ZZZ)); return res; } + ~CVec_C2Tuple_OutPointCVec_u8ZZZ() { CVec_C2Tuple_OutPointCVec_u8ZZZ_free(self); } + CVec_C2Tuple_OutPointCVec_u8ZZZ& operator=(CVec_C2Tuple_OutPointCVec_u8ZZZ&& o) { CVec_C2Tuple_OutPointCVec_u8ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_u8ZZZ)); return *this; } + LDKCVec_C2Tuple_OutPointCVec_u8ZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_OutPointCVec_u8ZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_OutPointCVec_u8ZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_OutPointCVec_u8ZZZ* operator ->() const { return &self; } +}; +class C3Tuple_OnionPacketu64u32Z { +private: + LDKC3Tuple_OnionPacketu64u32Z self; +public: + C3Tuple_OnionPacketu64u32Z(const C3Tuple_OnionPacketu64u32Z&) = delete; + C3Tuple_OnionPacketu64u32Z(C3Tuple_OnionPacketu64u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_OnionPacketu64u32Z)); } + C3Tuple_OnionPacketu64u32Z(LDKC3Tuple_OnionPacketu64u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_OnionPacketu64u32Z)); } + operator LDKC3Tuple_OnionPacketu64u32Z() && { LDKC3Tuple_OnionPacketu64u32Z res = self; memset(&self, 0, sizeof(LDKC3Tuple_OnionPacketu64u32Z)); return res; } + ~C3Tuple_OnionPacketu64u32Z() { C3Tuple_OnionPacketu64u32Z_free(self); } + C3Tuple_OnionPacketu64u32Z& operator=(C3Tuple_OnionPacketu64u32Z&& o) { C3Tuple_OnionPacketu64u32Z_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_OnionPacketu64u32Z)); return *this; } + LDKC3Tuple_OnionPacketu64u32Z* operator &() { return &self; } + LDKC3Tuple_OnionPacketu64u32Z* operator ->() { return &self; } + const LDKC3Tuple_OnionPacketu64u32Z* operator &() const { return &self; } + const LDKC3Tuple_OnionPacketu64u32Z* operator ->() const { return &self; } +}; +class COption_C2Tuple_OfferPathsResponseInstructionZZ { +private: + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ self; +public: + COption_C2Tuple_OfferPathsResponseInstructionZZ(const COption_C2Tuple_OfferPathsResponseInstructionZZ&) = delete; + COption_C2Tuple_OfferPathsResponseInstructionZZ(COption_C2Tuple_OfferPathsResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OfferPathsResponseInstructionZZ)); } + COption_C2Tuple_OfferPathsResponseInstructionZZ(LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ() && { LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ)); return res; } + ~COption_C2Tuple_OfferPathsResponseInstructionZZ() { COption_C2Tuple_OfferPathsResponseInstructionZZ_free(self); } + COption_C2Tuple_OfferPathsResponseInstructionZZ& operator=(COption_C2Tuple_OfferPathsResponseInstructionZZ&& o) { COption_C2Tuple_OfferPathsResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OfferPathsResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_OfferPathsResponseInstructionZZ* operator ->() const { return &self; } +}; +class CResult_ChannelConfigDecodeErrorZ { +private: + LDKCResult_ChannelConfigDecodeErrorZ self; +public: + CResult_ChannelConfigDecodeErrorZ(const CResult_ChannelConfigDecodeErrorZ&) = delete; + CResult_ChannelConfigDecodeErrorZ(CResult_ChannelConfigDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelConfigDecodeErrorZ)); } + CResult_ChannelConfigDecodeErrorZ(LDKCResult_ChannelConfigDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelConfigDecodeErrorZ)); } + operator LDKCResult_ChannelConfigDecodeErrorZ() && { LDKCResult_ChannelConfigDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelConfigDecodeErrorZ)); return res; } + ~CResult_ChannelConfigDecodeErrorZ() { CResult_ChannelConfigDecodeErrorZ_free(self); } + CResult_ChannelConfigDecodeErrorZ& operator=(CResult_ChannelConfigDecodeErrorZ&& o) { CResult_ChannelConfigDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelConfigDecodeErrorZ)); return *this; } + LDKCResult_ChannelConfigDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelConfigDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelConfigDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelConfigDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_i64Z { +private: + LDKCOption_i64Z self; +public: + COption_i64Z(const COption_i64Z&) = delete; + COption_i64Z(COption_i64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_i64Z)); } + COption_i64Z(LDKCOption_i64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_i64Z)); } + operator LDKCOption_i64Z() && { LDKCOption_i64Z res = self; memset(&self, 0, sizeof(LDKCOption_i64Z)); return res; } + ~COption_i64Z() { COption_i64Z_free(self); } + COption_i64Z& operator=(COption_i64Z&& o) { COption_i64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_i64Z)); return *this; } + LDKCOption_i64Z* operator &() { return &self; } + LDKCOption_i64Z* operator ->() { return &self; } + const LDKCOption_i64Z* operator &() const { return &self; } + const LDKCOption_i64Z* operator ->() const { return &self; } +}; +class CResult_C2Tuple_CVec_u8Zu16ZNoneZ { +private: + LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ self; +public: + CResult_C2Tuple_CVec_u8Zu16ZNoneZ(const CResult_C2Tuple_CVec_u8Zu16ZNoneZ&) = delete; + CResult_C2Tuple_CVec_u8Zu16ZNoneZ(CResult_C2Tuple_CVec_u8Zu16ZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_CVec_u8Zu16ZNoneZ)); } + CResult_C2Tuple_CVec_u8Zu16ZNoneZ(LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ)); } + operator LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ() && { LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ)); return res; } + ~CResult_C2Tuple_CVec_u8Zu16ZNoneZ() { CResult_C2Tuple_CVec_u8Zu16ZNoneZ_free(self); } + CResult_C2Tuple_CVec_u8Zu16ZNoneZ& operator=(CResult_C2Tuple_CVec_u8Zu16ZNoneZ&& o) { CResult_C2Tuple_CVec_u8Zu16ZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_CVec_u8Zu16ZNoneZ)); return *this; } + LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_CVec_u8Zu16ZNoneZ* operator ->() const { return &self; } +}; +class CVec_PrivateRouteZ { +private: + LDKCVec_PrivateRouteZ self; +public: + CVec_PrivateRouteZ(const CVec_PrivateRouteZ&) = delete; + CVec_PrivateRouteZ(CVec_PrivateRouteZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PrivateRouteZ)); } + CVec_PrivateRouteZ(LDKCVec_PrivateRouteZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PrivateRouteZ)); } + operator LDKCVec_PrivateRouteZ() && { LDKCVec_PrivateRouteZ res = self; memset(&self, 0, sizeof(LDKCVec_PrivateRouteZ)); return res; } + ~CVec_PrivateRouteZ() { CVec_PrivateRouteZ_free(self); } + CVec_PrivateRouteZ& operator=(CVec_PrivateRouteZ&& o) { CVec_PrivateRouteZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PrivateRouteZ)); return *this; } + LDKCVec_PrivateRouteZ* operator &() { return &self; } + LDKCVec_PrivateRouteZ* operator ->() { return &self; } + const LDKCVec_PrivateRouteZ* operator &() const { return &self; } + const LDKCVec_PrivateRouteZ* operator ->() const { return &self; } +}; +class C2Tuple_ThirtyTwoBytesChannelManagerZ { +private: + LDKC2Tuple_ThirtyTwoBytesChannelManagerZ self; +public: + 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 CVec_CommitmentSignedZ { +private: + LDKCVec_CommitmentSignedZ self; +public: + CVec_CommitmentSignedZ(const CVec_CommitmentSignedZ&) = delete; + CVec_CommitmentSignedZ(CVec_CommitmentSignedZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CommitmentSignedZ)); } + CVec_CommitmentSignedZ(LDKCVec_CommitmentSignedZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CommitmentSignedZ)); } + operator LDKCVec_CommitmentSignedZ() && { LDKCVec_CommitmentSignedZ res = self; memset(&self, 0, sizeof(LDKCVec_CommitmentSignedZ)); return res; } + ~CVec_CommitmentSignedZ() { CVec_CommitmentSignedZ_free(self); } + CVec_CommitmentSignedZ& operator=(CVec_CommitmentSignedZ&& o) { CVec_CommitmentSignedZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CommitmentSignedZ)); return *this; } + LDKCVec_CommitmentSignedZ* operator &() { return &self; } + LDKCVec_CommitmentSignedZ* operator ->() { return &self; } + const LDKCVec_CommitmentSignedZ* operator &() const { return &self; } + const LDKCVec_CommitmentSignedZ* operator ->() const { return &self; } +}; +class CVec_MonitorEventZ { +private: + LDKCVec_MonitorEventZ self; +public: + CVec_MonitorEventZ(const CVec_MonitorEventZ&) = delete; + CVec_MonitorEventZ(CVec_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorEventZ)); } + CVec_MonitorEventZ(LDKCVec_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorEventZ)); } + operator LDKCVec_MonitorEventZ() && { LDKCVec_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorEventZ)); return res; } + ~CVec_MonitorEventZ() { CVec_MonitorEventZ_free(self); } + CVec_MonitorEventZ& operator=(CVec_MonitorEventZ&& o) { CVec_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorEventZ)); return *this; } + LDKCVec_MonitorEventZ* operator &() { return &self; } + LDKCVec_MonitorEventZ* operator ->() { return &self; } + const LDKCVec_MonitorEventZ* operator &() const { return &self; } + const LDKCVec_MonitorEventZ* operator ->() const { return &self; } +}; +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 C2Tuple_u64BlindedMessagePathZ { +private: + LDKC2Tuple_u64BlindedMessagePathZ self; +public: + C2Tuple_u64BlindedMessagePathZ(const C2Tuple_u64BlindedMessagePathZ&) = delete; + C2Tuple_u64BlindedMessagePathZ(C2Tuple_u64BlindedMessagePathZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u64BlindedMessagePathZ)); } + C2Tuple_u64BlindedMessagePathZ(LDKC2Tuple_u64BlindedMessagePathZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u64BlindedMessagePathZ)); } + operator LDKC2Tuple_u64BlindedMessagePathZ() && { LDKC2Tuple_u64BlindedMessagePathZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u64BlindedMessagePathZ)); return res; } + ~C2Tuple_u64BlindedMessagePathZ() { C2Tuple_u64BlindedMessagePathZ_free(self); } + C2Tuple_u64BlindedMessagePathZ& operator=(C2Tuple_u64BlindedMessagePathZ&& o) { C2Tuple_u64BlindedMessagePathZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u64BlindedMessagePathZ)); return *this; } + LDKC2Tuple_u64BlindedMessagePathZ* operator &() { return &self; } + LDKC2Tuple_u64BlindedMessagePathZ* operator ->() { return &self; } + const LDKC2Tuple_u64BlindedMessagePathZ* operator &() const { return &self; } + const LDKC2Tuple_u64BlindedMessagePathZ* operator ->() const { return &self; } +}; +class COption_usizeZ { +private: + LDKCOption_usizeZ self; +public: + 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 CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { +private: + LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ self; +public: + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ(const CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ&) = delete; + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ(CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ)); } + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ(LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ)); } + operator LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ() && { LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ)); return res; } + ~CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ() { CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_free(self); } + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ& operator=(CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ&& o) { CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ)); return *this; } + LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ* operator &() { return &self; } + LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ* operator ->() { return &self; } + const LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ* operator &() const { return &self; } + const LDKCResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ* operator ->() const { return &self; } +}; +class CVec_AddressZ { +private: + LDKCVec_AddressZ 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; } +}; +class CResult_NoneNoneZ { +private: + LDKCResult_NoneNoneZ self; +public: + CResult_NoneNoneZ(const CResult_NoneNoneZ&) = delete; + CResult_NoneNoneZ(CResult_NoneNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneNoneZ)); } + CResult_NoneNoneZ(LDKCResult_NoneNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneNoneZ)); } + operator LDKCResult_NoneNoneZ() && { LDKCResult_NoneNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneNoneZ)); return res; } + ~CResult_NoneNoneZ() { CResult_NoneNoneZ_free(self); } + CResult_NoneNoneZ& operator=(CResult_NoneNoneZ&& o) { CResult_NoneNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneNoneZ)); return *this; } + LDKCResult_NoneNoneZ* operator &() { return &self; } + LDKCResult_NoneNoneZ* operator ->() { return &self; } + const LDKCResult_NoneNoneZ* operator &() const { return &self; } + const LDKCResult_NoneNoneZ* operator ->() const { return &self; } +}; +class CResult_AttributionDataDecodeErrorZ { +private: + LDKCResult_AttributionDataDecodeErrorZ self; +public: + CResult_AttributionDataDecodeErrorZ(const CResult_AttributionDataDecodeErrorZ&) = delete; + CResult_AttributionDataDecodeErrorZ(CResult_AttributionDataDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AttributionDataDecodeErrorZ)); } + CResult_AttributionDataDecodeErrorZ(LDKCResult_AttributionDataDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AttributionDataDecodeErrorZ)); } + operator LDKCResult_AttributionDataDecodeErrorZ() && { LDKCResult_AttributionDataDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AttributionDataDecodeErrorZ)); return res; } + ~CResult_AttributionDataDecodeErrorZ() { CResult_AttributionDataDecodeErrorZ_free(self); } + CResult_AttributionDataDecodeErrorZ& operator=(CResult_AttributionDataDecodeErrorZ&& o) { CResult_AttributionDataDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AttributionDataDecodeErrorZ)); return *this; } + LDKCResult_AttributionDataDecodeErrorZ* operator &() { return &self; } + LDKCResult_AttributionDataDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AttributionDataDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AttributionDataDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_FundingInfoDecodeErrorZ { +private: + LDKCResult_FundingInfoDecodeErrorZ self; +public: + CResult_FundingInfoDecodeErrorZ(const CResult_FundingInfoDecodeErrorZ&) = delete; + CResult_FundingInfoDecodeErrorZ(CResult_FundingInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingInfoDecodeErrorZ)); } + CResult_FundingInfoDecodeErrorZ(LDKCResult_FundingInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingInfoDecodeErrorZ)); } + operator LDKCResult_FundingInfoDecodeErrorZ() && { LDKCResult_FundingInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingInfoDecodeErrorZ)); return res; } + ~CResult_FundingInfoDecodeErrorZ() { CResult_FundingInfoDecodeErrorZ_free(self); } + CResult_FundingInfoDecodeErrorZ& operator=(CResult_FundingInfoDecodeErrorZ&& o) { CResult_FundingInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingInfoDecodeErrorZ)); return *this; } + LDKCResult_FundingInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_FundingInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FundingInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FundingInfoDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_AmountZ { +private: + LDKCOption_AmountZ self; +public: + COption_AmountZ(const COption_AmountZ&) = delete; + COption_AmountZ(COption_AmountZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AmountZ)); } + COption_AmountZ(LDKCOption_AmountZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AmountZ)); } + operator LDKCOption_AmountZ() && { LDKCOption_AmountZ res = self; memset(&self, 0, sizeof(LDKCOption_AmountZ)); return res; } + ~COption_AmountZ() { COption_AmountZ_free(self); } + COption_AmountZ& operator=(COption_AmountZ&& o) { COption_AmountZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AmountZ)); return *this; } + LDKCOption_AmountZ* operator &() { return &self; } + LDKCOption_AmountZ* operator ->() { return &self; } + const LDKCOption_AmountZ* operator &() const { return &self; } + const LDKCOption_AmountZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +private: + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ self; +public: + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(const COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&) = delete; + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() && { LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return res; } + ~COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); } + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ& operator=(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() const { return &self; } +}; +class CResult_OpenChannelV2DecodeErrorZ { +private: + LDKCResult_OpenChannelV2DecodeErrorZ self; +public: + CResult_OpenChannelV2DecodeErrorZ(const CResult_OpenChannelV2DecodeErrorZ&) = delete; + CResult_OpenChannelV2DecodeErrorZ(CResult_OpenChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); } + CResult_OpenChannelV2DecodeErrorZ(LDKCResult_OpenChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); } + operator LDKCResult_OpenChannelV2DecodeErrorZ() && { LDKCResult_OpenChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); return res; } + ~CResult_OpenChannelV2DecodeErrorZ() { CResult_OpenChannelV2DecodeErrorZ_free(self); } + CResult_OpenChannelV2DecodeErrorZ& operator=(CResult_OpenChannelV2DecodeErrorZ&& o) { CResult_OpenChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); return *this; } + LDKCResult_OpenChannelV2DecodeErrorZ* operator &() { return &self; } + LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OpenChannelV2DecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_BestBlockDecodeErrorZ { private: - LDKNextMessageHop self; + LDKCResult_BestBlockDecodeErrorZ self; public: - NextMessageHop(const NextMessageHop&) = delete; - NextMessageHop(NextMessageHop&& o) : self(o.self) { memset(&o, 0, sizeof(NextMessageHop)); } - NextMessageHop(LDKNextMessageHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKNextMessageHop)); } - operator LDKNextMessageHop() && { LDKNextMessageHop res = self; memset(&self, 0, sizeof(LDKNextMessageHop)); return res; } - ~NextMessageHop() { NextMessageHop_free(self); } - NextMessageHop& operator=(NextMessageHop&& o) { NextMessageHop_free(self); self = o.self; memset(&o, 0, sizeof(NextMessageHop)); return *this; } - LDKNextMessageHop* operator &() { return &self; } - LDKNextMessageHop* operator ->() { return &self; } - const LDKNextMessageHop* operator &() const { return &self; } - const LDKNextMessageHop* operator ->() const { return &self; } + CResult_BestBlockDecodeErrorZ(const CResult_BestBlockDecodeErrorZ&) = delete; + CResult_BestBlockDecodeErrorZ(CResult_BestBlockDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BestBlockDecodeErrorZ)); } + CResult_BestBlockDecodeErrorZ(LDKCResult_BestBlockDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BestBlockDecodeErrorZ)); } + operator LDKCResult_BestBlockDecodeErrorZ() && { LDKCResult_BestBlockDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BestBlockDecodeErrorZ)); return res; } + ~CResult_BestBlockDecodeErrorZ() { CResult_BestBlockDecodeErrorZ_free(self); } + CResult_BestBlockDecodeErrorZ& operator=(CResult_BestBlockDecodeErrorZ&& o) { CResult_BestBlockDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BestBlockDecodeErrorZ)); return *this; } + LDKCResult_BestBlockDecodeErrorZ* operator &() { return &self; } + LDKCResult_BestBlockDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BestBlockDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BestBlockDecodeErrorZ* operator ->() const { return &self; } }; -class MessageForwardNode { +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { private: - LDKMessageForwardNode self; + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ self; public: - MessageForwardNode(const MessageForwardNode&) = delete; - MessageForwardNode(MessageForwardNode&& o) : self(o.self) { memset(&o, 0, sizeof(MessageForwardNode)); } - MessageForwardNode(LDKMessageForwardNode&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageForwardNode)); } - operator LDKMessageForwardNode() && { LDKMessageForwardNode res = self; memset(&self, 0, sizeof(LDKMessageForwardNode)); return res; } - ~MessageForwardNode() { MessageForwardNode_free(self); } - MessageForwardNode& operator=(MessageForwardNode&& o) { MessageForwardNode_free(self); self = o.self; memset(&o, 0, sizeof(MessageForwardNode)); return *this; } - LDKMessageForwardNode* operator &() { return &self; } - LDKMessageForwardNode* operator ->() { return &self; } - const LDKMessageForwardNode* operator &() const { return &self; } - const LDKMessageForwardNode* 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 MessageContext { +class CResult_OutputSpendStatusDecodeErrorZ { private: - LDKMessageContext self; + LDKCResult_OutputSpendStatusDecodeErrorZ self; public: - MessageContext(const MessageContext&) = delete; - MessageContext(MessageContext&& o) : self(o.self) { memset(&o, 0, sizeof(MessageContext)); } - MessageContext(LDKMessageContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageContext)); } - operator LDKMessageContext() && { LDKMessageContext res = self; memset(&self, 0, sizeof(LDKMessageContext)); return res; } - ~MessageContext() { MessageContext_free(self); } - MessageContext& operator=(MessageContext&& o) { MessageContext_free(self); self = o.self; memset(&o, 0, sizeof(MessageContext)); return *this; } - LDKMessageContext* operator &() { return &self; } - LDKMessageContext* operator ->() { return &self; } - const LDKMessageContext* operator &() const { return &self; } - const LDKMessageContext* operator ->() const { return &self; } + CResult_OutputSpendStatusDecodeErrorZ(const CResult_OutputSpendStatusDecodeErrorZ&) = delete; + CResult_OutputSpendStatusDecodeErrorZ(CResult_OutputSpendStatusDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); } + CResult_OutputSpendStatusDecodeErrorZ(LDKCResult_OutputSpendStatusDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); } + operator LDKCResult_OutputSpendStatusDecodeErrorZ() && { LDKCResult_OutputSpendStatusDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); return res; } + ~CResult_OutputSpendStatusDecodeErrorZ() { CResult_OutputSpendStatusDecodeErrorZ_free(self); } + CResult_OutputSpendStatusDecodeErrorZ& operator=(CResult_OutputSpendStatusDecodeErrorZ&& o) { CResult_OutputSpendStatusDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); return *this; } + LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() const { return &self; } }; -class OffersContext { +class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { private: - LDKOffersContext self; + LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ self; public: - OffersContext(const OffersContext&) = delete; - OffersContext(OffersContext&& o) : self(o.self) { memset(&o, 0, sizeof(OffersContext)); } - OffersContext(LDKOffersContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOffersContext)); } - operator LDKOffersContext() && { LDKOffersContext res = self; memset(&self, 0, sizeof(LDKOffersContext)); return res; } - ~OffersContext() { OffersContext_free(self); } - OffersContext& operator=(OffersContext&& o) { OffersContext_free(self); self = o.self; memset(&o, 0, sizeof(OffersContext)); return *this; } - LDKOffersContext* operator &() { return &self; } - LDKOffersContext* operator ->() { return &self; } - const LDKOffersContext* operator &() const { return &self; } - const LDKOffersContext* operator ->() const { return &self; } + C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(const C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&) = delete; + C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); } + C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); } + operator LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ() && { LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ res = self; memset(&self, 0, sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); return res; } + ~C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ() { C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(self); } + C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ& operator=(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& o) { C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); return *this; } + LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator &() { return &self; } + LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator ->() { return &self; } + const LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator &() const { return &self; } + const LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator ->() const { return &self; } }; -class AsyncPaymentsContext { +class CResult_BlindedFailureDecodeErrorZ { private: - LDKAsyncPaymentsContext self; + LDKCResult_BlindedFailureDecodeErrorZ self; public: - AsyncPaymentsContext(const AsyncPaymentsContext&) = delete; - AsyncPaymentsContext(AsyncPaymentsContext&& o) : self(o.self) { memset(&o, 0, sizeof(AsyncPaymentsContext)); } - AsyncPaymentsContext(LDKAsyncPaymentsContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAsyncPaymentsContext)); } - operator LDKAsyncPaymentsContext() && { LDKAsyncPaymentsContext res = self; memset(&self, 0, sizeof(LDKAsyncPaymentsContext)); return res; } - ~AsyncPaymentsContext() { AsyncPaymentsContext_free(self); } - AsyncPaymentsContext& operator=(AsyncPaymentsContext&& o) { AsyncPaymentsContext_free(self); self = o.self; memset(&o, 0, sizeof(AsyncPaymentsContext)); return *this; } - LDKAsyncPaymentsContext* operator &() { return &self; } - LDKAsyncPaymentsContext* operator ->() { return &self; } - const LDKAsyncPaymentsContext* operator &() const { return &self; } - const LDKAsyncPaymentsContext* operator ->() const { return &self; } + CResult_BlindedFailureDecodeErrorZ(const CResult_BlindedFailureDecodeErrorZ&) = delete; + CResult_BlindedFailureDecodeErrorZ(CResult_BlindedFailureDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedFailureDecodeErrorZ)); } + CResult_BlindedFailureDecodeErrorZ(LDKCResult_BlindedFailureDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedFailureDecodeErrorZ)); } + operator LDKCResult_BlindedFailureDecodeErrorZ() && { LDKCResult_BlindedFailureDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedFailureDecodeErrorZ)); return res; } + ~CResult_BlindedFailureDecodeErrorZ() { CResult_BlindedFailureDecodeErrorZ_free(self); } + CResult_BlindedFailureDecodeErrorZ& operator=(CResult_BlindedFailureDecodeErrorZ&& o) { CResult_BlindedFailureDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedFailureDecodeErrorZ)); return *this; } + LDKCResult_BlindedFailureDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedFailureDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedFailureDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedFailureDecodeErrorZ* operator ->() const { return &self; } }; -class DNSResolverContext { +class COption_QuantityZ { private: - LDKDNSResolverContext self; + LDKCOption_QuantityZ self; public: - DNSResolverContext(const DNSResolverContext&) = delete; - DNSResolverContext(DNSResolverContext&& o) : self(o.self) { memset(&o, 0, sizeof(DNSResolverContext)); } - DNSResolverContext(LDKDNSResolverContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSResolverContext)); } - operator LDKDNSResolverContext() && { LDKDNSResolverContext res = self; memset(&self, 0, sizeof(LDKDNSResolverContext)); return res; } - ~DNSResolverContext() { DNSResolverContext_free(self); } - DNSResolverContext& operator=(DNSResolverContext&& o) { DNSResolverContext_free(self); self = o.self; memset(&o, 0, sizeof(DNSResolverContext)); return *this; } - LDKDNSResolverContext* operator &() { return &self; } - LDKDNSResolverContext* operator ->() { return &self; } - const LDKDNSResolverContext* operator &() const { return &self; } - const LDKDNSResolverContext* operator ->() const { return &self; } + COption_QuantityZ(const COption_QuantityZ&) = delete; + COption_QuantityZ(COption_QuantityZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_QuantityZ)); } + COption_QuantityZ(LDKCOption_QuantityZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_QuantityZ)); } + operator LDKCOption_QuantityZ() && { LDKCOption_QuantityZ res = self; memset(&self, 0, sizeof(LDKCOption_QuantityZ)); return res; } + ~COption_QuantityZ() { COption_QuantityZ_free(self); } + COption_QuantityZ& operator=(COption_QuantityZ&& o) { COption_QuantityZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_QuantityZ)); return *this; } + LDKCOption_QuantityZ* operator &() { return &self; } + LDKCOption_QuantityZ* operator ->() { return &self; } + const LDKCOption_QuantityZ* operator &() const { return &self; } + const LDKCOption_QuantityZ* operator ->() const { return &self; } }; class CResult_HtlcKeyDecodeErrorZ { private: @@ -8763,21 +12417,6 @@ class CResult_HumanReadableNameDecodeErrorZ { const LDKCResult_HumanReadableNameDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HumanReadableNameDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TransactionU16LenLimitedNoneZ { -private: - LDKCResult_TransactionU16LenLimitedNoneZ self; -public: - CResult_TransactionU16LenLimitedNoneZ(const CResult_TransactionU16LenLimitedNoneZ&) = delete; - CResult_TransactionU16LenLimitedNoneZ(CResult_TransactionU16LenLimitedNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedNoneZ)); } - CResult_TransactionU16LenLimitedNoneZ(LDKCResult_TransactionU16LenLimitedNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionU16LenLimitedNoneZ)); } - operator LDKCResult_TransactionU16LenLimitedNoneZ() && { LDKCResult_TransactionU16LenLimitedNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionU16LenLimitedNoneZ)); return res; } - ~CResult_TransactionU16LenLimitedNoneZ() { CResult_TransactionU16LenLimitedNoneZ_free(self); } - CResult_TransactionU16LenLimitedNoneZ& operator=(CResult_TransactionU16LenLimitedNoneZ&& o) { CResult_TransactionU16LenLimitedNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedNoneZ)); return *this; } - LDKCResult_TransactionU16LenLimitedNoneZ* operator &() { return &self; } - LDKCResult_TransactionU16LenLimitedNoneZ* operator ->() { return &self; } - const LDKCResult_TransactionU16LenLimitedNoneZ* operator &() const { return &self; } - const LDKCResult_TransactionU16LenLimitedNoneZ* operator ->() const { return &self; } -}; class CVec_TrackedSpendableOutputZ { private: LDKCVec_TrackedSpendableOutputZ self; @@ -8793,36 +12432,6 @@ class CVec_TrackedSpendableOutputZ { const LDKCVec_TrackedSpendableOutputZ* operator &() const { return &self; } const LDKCVec_TrackedSpendableOutputZ* operator ->() const { return &self; } }; -class CResult_PhantomRouteHintsDecodeErrorZ { -private: - LDKCResult_PhantomRouteHintsDecodeErrorZ self; -public: - CResult_PhantomRouteHintsDecodeErrorZ(const CResult_PhantomRouteHintsDecodeErrorZ&) = delete; - CResult_PhantomRouteHintsDecodeErrorZ(CResult_PhantomRouteHintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); } - CResult_PhantomRouteHintsDecodeErrorZ(LDKCResult_PhantomRouteHintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); } - operator LDKCResult_PhantomRouteHintsDecodeErrorZ() && { LDKCResult_PhantomRouteHintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); return res; } - ~CResult_PhantomRouteHintsDecodeErrorZ() { CResult_PhantomRouteHintsDecodeErrorZ_free(self); } - CResult_PhantomRouteHintsDecodeErrorZ& operator=(CResult_PhantomRouteHintsDecodeErrorZ&& o) { CResult_PhantomRouteHintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); return *this; } - LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() { return &self; } - LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_LockedChannelMonitorNoneZ { -private: - LDKCResult_LockedChannelMonitorNoneZ self; -public: - CResult_LockedChannelMonitorNoneZ(const CResult_LockedChannelMonitorNoneZ&) = delete; - CResult_LockedChannelMonitorNoneZ(CResult_LockedChannelMonitorNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); } - CResult_LockedChannelMonitorNoneZ(LDKCResult_LockedChannelMonitorNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); } - operator LDKCResult_LockedChannelMonitorNoneZ() && { LDKCResult_LockedChannelMonitorNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); return res; } - ~CResult_LockedChannelMonitorNoneZ() { CResult_LockedChannelMonitorNoneZ_free(self); } - CResult_LockedChannelMonitorNoneZ& operator=(CResult_LockedChannelMonitorNoneZ&& o) { CResult_LockedChannelMonitorNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); return *this; } - LDKCResult_LockedChannelMonitorNoneZ* operator &() { return &self; } - LDKCResult_LockedChannelMonitorNoneZ* operator ->() { return &self; } - const LDKCResult_LockedChannelMonitorNoneZ* operator &() const { return &self; } - const LDKCResult_LockedChannelMonitorNoneZ* operator ->() const { return &self; } -}; class CResult_FundingCreatedDecodeErrorZ { private: LDKCResult_FundingCreatedDecodeErrorZ self; @@ -8853,36 +12462,6 @@ class COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { const LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator &() const { return &self; } const LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator ->() const { return &self; } }; -class CResult_RetryDecodeErrorZ { -private: - LDKCResult_RetryDecodeErrorZ self; -public: - 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 CResult_BlindedForwardDecodeErrorZ { -private: - LDKCResult_BlindedForwardDecodeErrorZ self; -public: - CResult_BlindedForwardDecodeErrorZ(const CResult_BlindedForwardDecodeErrorZ&) = delete; - CResult_BlindedForwardDecodeErrorZ(CResult_BlindedForwardDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedForwardDecodeErrorZ)); } - CResult_BlindedForwardDecodeErrorZ(LDKCResult_BlindedForwardDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedForwardDecodeErrorZ)); } - operator LDKCResult_BlindedForwardDecodeErrorZ() && { LDKCResult_BlindedForwardDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedForwardDecodeErrorZ)); return res; } - ~CResult_BlindedForwardDecodeErrorZ() { CResult_BlindedForwardDecodeErrorZ_free(self); } - CResult_BlindedForwardDecodeErrorZ& operator=(CResult_BlindedForwardDecodeErrorZ&& o) { CResult_BlindedForwardDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedForwardDecodeErrorZ)); return *this; } - LDKCResult_BlindedForwardDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedForwardDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedForwardDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedForwardDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_ChannelInfoDecodeErrorZ { private: LDKCResult_ChannelInfoDecodeErrorZ self; @@ -8892,56 +12471,26 @@ class CResult_ChannelInfoDecodeErrorZ { CResult_ChannelInfoDecodeErrorZ(LDKCResult_ChannelInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); } operator LDKCResult_ChannelInfoDecodeErrorZ() && { LDKCResult_ChannelInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); return res; } ~CResult_ChannelInfoDecodeErrorZ() { CResult_ChannelInfoDecodeErrorZ_free(self); } - CResult_ChannelInfoDecodeErrorZ& operator=(CResult_ChannelInfoDecodeErrorZ&& o) { CResult_ChannelInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); return *this; } - LDKCResult_ChannelInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelInfoDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_PaymentContextZ { -private: - LDKCOption_PaymentContextZ self; -public: - COption_PaymentContextZ(const COption_PaymentContextZ&) = delete; - COption_PaymentContextZ(COption_PaymentContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentContextZ)); } - COption_PaymentContextZ(LDKCOption_PaymentContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentContextZ)); } - operator LDKCOption_PaymentContextZ() && { LDKCOption_PaymentContextZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentContextZ)); return res; } - ~COption_PaymentContextZ() { COption_PaymentContextZ_free(self); } - COption_PaymentContextZ& operator=(COption_PaymentContextZ&& o) { COption_PaymentContextZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentContextZ)); return *this; } - LDKCOption_PaymentContextZ* operator &() { return &self; } - LDKCOption_PaymentContextZ* operator ->() { return &self; } - const LDKCOption_PaymentContextZ* operator &() const { return &self; } - const LDKCOption_PaymentContextZ* operator ->() const { return &self; } -}; -class COption_MaxDustHTLCExposureZ { -private: - LDKCOption_MaxDustHTLCExposureZ self; -public: - COption_MaxDustHTLCExposureZ(const COption_MaxDustHTLCExposureZ&) = delete; - COption_MaxDustHTLCExposureZ(COption_MaxDustHTLCExposureZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MaxDustHTLCExposureZ)); } - COption_MaxDustHTLCExposureZ(LDKCOption_MaxDustHTLCExposureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MaxDustHTLCExposureZ)); } - operator LDKCOption_MaxDustHTLCExposureZ() && { LDKCOption_MaxDustHTLCExposureZ res = self; memset(&self, 0, sizeof(LDKCOption_MaxDustHTLCExposureZ)); return res; } - ~COption_MaxDustHTLCExposureZ() { COption_MaxDustHTLCExposureZ_free(self); } - COption_MaxDustHTLCExposureZ& operator=(COption_MaxDustHTLCExposureZ&& o) { COption_MaxDustHTLCExposureZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MaxDustHTLCExposureZ)); return *this; } - LDKCOption_MaxDustHTLCExposureZ* operator &() { return &self; } - LDKCOption_MaxDustHTLCExposureZ* operator ->() { return &self; } - const LDKCOption_MaxDustHTLCExposureZ* operator &() const { return &self; } - const LDKCOption_MaxDustHTLCExposureZ* operator ->() const { return &self; } + CResult_ChannelInfoDecodeErrorZ& operator=(CResult_ChannelInfoDecodeErrorZ&& o) { CResult_ChannelInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); return *this; } + LDKCResult_ChannelInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_u32TxOutZZ { +class COption_PaymentContextZ { private: - LDKCVec_C2Tuple_u32TxOutZZ self; + LDKCOption_PaymentContextZ self; public: - CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete; - CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); } - CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); } - operator LDKCVec_C2Tuple_u32TxOutZZ() && { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } - ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } - CVec_C2Tuple_u32TxOutZZ& operator=(CVec_C2Tuple_u32TxOutZZ&& o) { CVec_C2Tuple_u32TxOutZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); return *this; } - LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; } - LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; } + COption_PaymentContextZ(const COption_PaymentContextZ&) = delete; + COption_PaymentContextZ(COption_PaymentContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentContextZ)); } + COption_PaymentContextZ(LDKCOption_PaymentContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentContextZ)); } + operator LDKCOption_PaymentContextZ() && { LDKCOption_PaymentContextZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentContextZ)); return res; } + ~COption_PaymentContextZ() { COption_PaymentContextZ_free(self); } + COption_PaymentContextZ& operator=(COption_PaymentContextZ&& o) { COption_PaymentContextZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentContextZ)); return *this; } + LDKCOption_PaymentContextZ* operator &() { return &self; } + LDKCOption_PaymentContextZ* operator ->() { return &self; } + const LDKCOption_PaymentContextZ* operator &() const { return &self; } + const LDKCOption_PaymentContextZ* operator ->() const { return &self; } }; class CResult_NoneSendErrorZ { private: @@ -9003,21 +12552,6 @@ class COption_NetworkUpdateZ { const LDKCOption_NetworkUpdateZ* operator &() const { return &self; } const LDKCOption_NetworkUpdateZ* operator ->() const { return &self; } }; -class COption_u64Z { -private: - LDKCOption_u64Z self; -public: - COption_u64Z(const COption_u64Z&) = delete; - COption_u64Z(COption_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u64Z)); } - COption_u64Z(LDKCOption_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u64Z)); } - operator LDKCOption_u64Z() && { LDKCOption_u64Z res = self; memset(&self, 0, sizeof(LDKCOption_u64Z)); return res; } - ~COption_u64Z() { COption_u64Z_free(self); } - COption_u64Z& operator=(COption_u64Z&& o) { COption_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u64Z)); return *this; } - LDKCOption_u64Z* operator &() { return &self; } - LDKCOption_u64Z* operator ->() { return &self; } - const LDKCOption_u64Z* operator &() const { return &self; } - const LDKCOption_u64Z* operator ->() const { return &self; } -}; class CResult_GossipTimestampFilterDecodeErrorZ { private: LDKCResult_GossipTimestampFilterDecodeErrorZ self; @@ -9048,35 +12582,20 @@ class C2Tuple_OnionMessageContentsResponseInstructionZ { const LDKC2Tuple_OnionMessageContentsResponseInstructionZ* operator &() const { return &self; } const LDKC2Tuple_OnionMessageContentsResponseInstructionZ* operator ->() const { return &self; } }; -class CResult_RouteHintDecodeErrorZ { -private: - LDKCResult_RouteHintDecodeErrorZ self; -public: - CResult_RouteHintDecodeErrorZ(const CResult_RouteHintDecodeErrorZ&) = delete; - CResult_RouteHintDecodeErrorZ(CResult_RouteHintDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); } - CResult_RouteHintDecodeErrorZ(LDKCResult_RouteHintDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); } - operator LDKCResult_RouteHintDecodeErrorZ() && { LDKCResult_RouteHintDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); return res; } - ~CResult_RouteHintDecodeErrorZ() { CResult_RouteHintDecodeErrorZ_free(self); } - CResult_RouteHintDecodeErrorZ& operator=(CResult_RouteHintDecodeErrorZ&& o) { CResult_RouteHintDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); return *this; } - LDKCResult_RouteHintDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHintDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_FilterZ { +class CResult_StaticInvoicePersistedDecodeErrorZ { private: - LDKCOption_FilterZ self; + LDKCResult_StaticInvoicePersistedDecodeErrorZ self; public: - COption_FilterZ(const COption_FilterZ&) = delete; - COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); } - COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); } - operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; } - ~COption_FilterZ() { COption_FilterZ_free(self); } - COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; } - LDKCOption_FilterZ* operator &() { return &self; } - LDKCOption_FilterZ* operator ->() { return &self; } - const LDKCOption_FilterZ* operator &() const { return &self; } - const LDKCOption_FilterZ* operator ->() const { return &self; } + CResult_StaticInvoicePersistedDecodeErrorZ(const CResult_StaticInvoicePersistedDecodeErrorZ&) = delete; + CResult_StaticInvoicePersistedDecodeErrorZ(CResult_StaticInvoicePersistedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticInvoicePersistedDecodeErrorZ)); } + CResult_StaticInvoicePersistedDecodeErrorZ(LDKCResult_StaticInvoicePersistedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticInvoicePersistedDecodeErrorZ)); } + operator LDKCResult_StaticInvoicePersistedDecodeErrorZ() && { LDKCResult_StaticInvoicePersistedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticInvoicePersistedDecodeErrorZ)); return res; } + ~CResult_StaticInvoicePersistedDecodeErrorZ() { CResult_StaticInvoicePersistedDecodeErrorZ_free(self); } + CResult_StaticInvoicePersistedDecodeErrorZ& operator=(CResult_StaticInvoicePersistedDecodeErrorZ&& o) { CResult_StaticInvoicePersistedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticInvoicePersistedDecodeErrorZ)); return *this; } + LDKCResult_StaticInvoicePersistedDecodeErrorZ* operator &() { return &self; } + LDKCResult_StaticInvoicePersistedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_StaticInvoicePersistedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_StaticInvoicePersistedDecodeErrorZ* operator ->() const { return &self; } }; class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { private: @@ -9093,20 +12612,20 @@ class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator &() const { return &self; } const LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ* operator ->() const { return &self; } }; -class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +class CVec_C3Tuple_StrStrStrZZ { private: - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; + LDKCVec_C3Tuple_StrStrStrZZ self; public: - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete; - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } - operator LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() && { LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } - ~COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ& operator=(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return *this; } - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; } - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; } - const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; } - const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; } + CVec_C3Tuple_StrStrStrZZ(const CVec_C3Tuple_StrStrStrZZ&) = delete; + CVec_C3Tuple_StrStrStrZZ(CVec_C3Tuple_StrStrStrZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); } + CVec_C3Tuple_StrStrStrZZ(LDKCVec_C3Tuple_StrStrStrZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); } + operator LDKCVec_C3Tuple_StrStrStrZZ() && { LDKCVec_C3Tuple_StrStrStrZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); return res; } + ~CVec_C3Tuple_StrStrStrZZ() { CVec_C3Tuple_StrStrStrZZ_free(self); } + CVec_C3Tuple_StrStrStrZZ& operator=(CVec_C3Tuple_StrStrStrZZ&& o) { CVec_C3Tuple_StrStrStrZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); return *this; } + LDKCVec_C3Tuple_StrStrStrZZ* operator &() { return &self; } + LDKCVec_C3Tuple_StrStrStrZZ* operator ->() { return &self; } + const LDKCVec_C3Tuple_StrStrStrZZ* operator &() const { return &self; } + const LDKCVec_C3Tuple_StrStrStrZZ* operator ->() const { return &self; } }; class CResult_COption_APIErrorZDecodeErrorZ { private: @@ -9123,35 +12642,35 @@ class CResult_COption_APIErrorZDecodeErrorZ { const LDKCResult_COption_APIErrorZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_APIErrorZDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C3Tuple_StrStrStrZZ { +class CResult_CommitmentSignedDecodeErrorZ { private: - LDKCVec_C3Tuple_StrStrStrZZ self; + LDKCResult_CommitmentSignedDecodeErrorZ self; public: - CVec_C3Tuple_StrStrStrZZ(const CVec_C3Tuple_StrStrStrZZ&) = delete; - CVec_C3Tuple_StrStrStrZZ(CVec_C3Tuple_StrStrStrZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); } - CVec_C3Tuple_StrStrStrZZ(LDKCVec_C3Tuple_StrStrStrZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); } - operator LDKCVec_C3Tuple_StrStrStrZZ() && { LDKCVec_C3Tuple_StrStrStrZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); return res; } - ~CVec_C3Tuple_StrStrStrZZ() { CVec_C3Tuple_StrStrStrZZ_free(self); } - CVec_C3Tuple_StrStrStrZZ& operator=(CVec_C3Tuple_StrStrStrZZ&& o) { CVec_C3Tuple_StrStrStrZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); return *this; } - LDKCVec_C3Tuple_StrStrStrZZ* operator &() { return &self; } - LDKCVec_C3Tuple_StrStrStrZZ* operator ->() { return &self; } - const LDKCVec_C3Tuple_StrStrStrZZ* operator &() const { return &self; } - const LDKCVec_C3Tuple_StrStrStrZZ* operator ->() const { return &self; } + 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 CVec_UpdateAddHTLCZ { +class COption_OutPointZ { private: - LDKCVec_UpdateAddHTLCZ self; + LDKCOption_OutPointZ self; public: - CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; - CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } - CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } - operator LDKCVec_UpdateAddHTLCZ() && { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } - ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } - CVec_UpdateAddHTLCZ& operator=(CVec_UpdateAddHTLCZ&& o) { CVec_UpdateAddHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); return *this; } - LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } - LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } + COption_OutPointZ(const COption_OutPointZ&) = delete; + COption_OutPointZ(COption_OutPointZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_OutPointZ)); } + COption_OutPointZ(LDKCOption_OutPointZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_OutPointZ)); } + operator LDKCOption_OutPointZ() && { LDKCOption_OutPointZ res = self; memset(&self, 0, sizeof(LDKCOption_OutPointZ)); return res; } + ~COption_OutPointZ() { COption_OutPointZ_free(self); } + COption_OutPointZ& operator=(COption_OutPointZ&& o) { COption_OutPointZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_OutPointZ)); return *this; } + LDKCOption_OutPointZ* operator &() { return &self; } + LDKCOption_OutPointZ* operator ->() { return &self; } + const LDKCOption_OutPointZ* operator &() const { return &self; } + const LDKCOption_OutPointZ* operator ->() const { return &self; } }; class CResult_StaticPaymentOutputDescriptorDecodeErrorZ { private: @@ -9183,36 +12702,6 @@ class COption_u32Z { const LDKCOption_u32Z* operator &() const { return &self; } const LDKCOption_u32Z* 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 CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { private: LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ self; @@ -9228,36 +12717,6 @@ class CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { const LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ* operator ->() const { return &self; } }; -class C2Tuple_HumanReadableNameThirtyTwoBytesZ { -private: - LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ self; -public: - C2Tuple_HumanReadableNameThirtyTwoBytesZ(const C2Tuple_HumanReadableNameThirtyTwoBytesZ&) = delete; - C2Tuple_HumanReadableNameThirtyTwoBytesZ(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); } - C2Tuple_HumanReadableNameThirtyTwoBytesZ(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); } - operator LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ() && { LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); return res; } - ~C2Tuple_HumanReadableNameThirtyTwoBytesZ() { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); } - C2Tuple_HumanReadableNameThirtyTwoBytesZ& operator=(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); return *this; } - LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() { return &self; } - LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() { return &self; } - const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() const { return &self; } - const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() const { return &self; } -}; -class CResult_TransactionNoneZ { -private: - LDKCResult_TransactionNoneZ self; -public: - CResult_TransactionNoneZ(const CResult_TransactionNoneZ&) = delete; - CResult_TransactionNoneZ(CResult_TransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionNoneZ)); } - CResult_TransactionNoneZ(LDKCResult_TransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionNoneZ)); } - operator LDKCResult_TransactionNoneZ() && { LDKCResult_TransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionNoneZ)); return res; } - ~CResult_TransactionNoneZ() { CResult_TransactionNoneZ_free(self); } - CResult_TransactionNoneZ& operator=(CResult_TransactionNoneZ&& o) { CResult_TransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionNoneZ)); return *this; } - LDKCResult_TransactionNoneZ* operator &() { return &self; } - LDKCResult_TransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } -}; class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { private: LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ self; @@ -9288,80 +12747,65 @@ class CResult_CVec_StrZIOErrorZ { const LDKCResult_CVec_StrZIOErrorZ* operator &() const { return &self; } const LDKCResult_CVec_StrZIOErrorZ* operator ->() const { return &self; } }; -class CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { -private: - LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ self; -public: - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(const CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&) = delete; - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); } - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); } - operator LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); return res; } - ~CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ() { CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); } - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); return *this; } - LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class COption_ECDSASignatureZ { +class CResult_CommitmentTransactionDecodeErrorZ { private: - LDKCOption_ECDSASignatureZ self; + LDKCResult_CommitmentTransactionDecodeErrorZ self; public: - COption_ECDSASignatureZ(const COption_ECDSASignatureZ&) = delete; - COption_ECDSASignatureZ(COption_ECDSASignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ECDSASignatureZ)); } - COption_ECDSASignatureZ(LDKCOption_ECDSASignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ECDSASignatureZ)); } - operator LDKCOption_ECDSASignatureZ() && { LDKCOption_ECDSASignatureZ res = self; memset(&self, 0, sizeof(LDKCOption_ECDSASignatureZ)); return res; } - ~COption_ECDSASignatureZ() { COption_ECDSASignatureZ_free(self); } - COption_ECDSASignatureZ& operator=(COption_ECDSASignatureZ&& o) { COption_ECDSASignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ECDSASignatureZ)); return *this; } - LDKCOption_ECDSASignatureZ* operator &() { return &self; } - LDKCOption_ECDSASignatureZ* operator ->() { return &self; } - const LDKCOption_ECDSASignatureZ* operator &() const { return &self; } - const LDKCOption_ECDSASignatureZ* operator ->() const { return &self; } + CResult_CommitmentTransactionDecodeErrorZ(const CResult_CommitmentTransactionDecodeErrorZ&) = delete; + CResult_CommitmentTransactionDecodeErrorZ(CResult_CommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); } + CResult_CommitmentTransactionDecodeErrorZ(LDKCResult_CommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_CommitmentTransactionDecodeErrorZ() && { LDKCResult_CommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_CommitmentTransactionDecodeErrorZ() { CResult_CommitmentTransactionDecodeErrorZ_free(self); } + CResult_CommitmentTransactionDecodeErrorZ& operator=(CResult_CommitmentTransactionDecodeErrorZ&& o) { CResult_CommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TxAbortDecodeErrorZ { +class CResult_TransactionNoneZ { private: - LDKCResult_TxAbortDecodeErrorZ self; + LDKCResult_TransactionNoneZ self; public: - CResult_TxAbortDecodeErrorZ(const CResult_TxAbortDecodeErrorZ&) = delete; - CResult_TxAbortDecodeErrorZ(CResult_TxAbortDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); } - CResult_TxAbortDecodeErrorZ(LDKCResult_TxAbortDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); } - operator LDKCResult_TxAbortDecodeErrorZ() && { LDKCResult_TxAbortDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); return res; } - ~CResult_TxAbortDecodeErrorZ() { CResult_TxAbortDecodeErrorZ_free(self); } - CResult_TxAbortDecodeErrorZ& operator=(CResult_TxAbortDecodeErrorZ&& o) { CResult_TxAbortDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); return *this; } - LDKCResult_TxAbortDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxAbortDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxAbortDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxAbortDecodeErrorZ* operator ->() const { return &self; } + CResult_TransactionNoneZ(const CResult_TransactionNoneZ&) = delete; + CResult_TransactionNoneZ(CResult_TransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionNoneZ)); } + CResult_TransactionNoneZ(LDKCResult_TransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionNoneZ)); } + operator LDKCResult_TransactionNoneZ() && { LDKCResult_TransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionNoneZ)); return res; } + ~CResult_TransactionNoneZ() { CResult_TransactionNoneZ_free(self); } + CResult_TransactionNoneZ& operator=(CResult_TransactionNoneZ&& o) { CResult_TransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionNoneZ)); return *this; } + LDKCResult_TransactionNoneZ* operator &() { return &self; } + LDKCResult_TransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } }; -class CResult_ClosingSignedFeeRangeDecodeErrorZ { +class CResult_OfferPathsDecodeErrorZ { private: - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self; + LDKCResult_OfferPathsDecodeErrorZ self; public: - CResult_ClosingSignedFeeRangeDecodeErrorZ(const CResult_ClosingSignedFeeRangeDecodeErrorZ&) = delete; - CResult_ClosingSignedFeeRangeDecodeErrorZ(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); } - CResult_ClosingSignedFeeRangeDecodeErrorZ(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); } - operator LDKCResult_ClosingSignedFeeRangeDecodeErrorZ() && { LDKCResult_ClosingSignedFeeRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); return res; } - ~CResult_ClosingSignedFeeRangeDecodeErrorZ() { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); } - CResult_ClosingSignedFeeRangeDecodeErrorZ& operator=(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); return *this; } - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() { return &self; } - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() const { return &self; } + CResult_OfferPathsDecodeErrorZ(const CResult_OfferPathsDecodeErrorZ&) = delete; + CResult_OfferPathsDecodeErrorZ(CResult_OfferPathsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferPathsDecodeErrorZ)); } + CResult_OfferPathsDecodeErrorZ(LDKCResult_OfferPathsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferPathsDecodeErrorZ)); } + operator LDKCResult_OfferPathsDecodeErrorZ() && { LDKCResult_OfferPathsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferPathsDecodeErrorZ)); return res; } + ~CResult_OfferPathsDecodeErrorZ() { CResult_OfferPathsDecodeErrorZ_free(self); } + CResult_OfferPathsDecodeErrorZ& operator=(CResult_OfferPathsDecodeErrorZ&& o) { CResult_OfferPathsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferPathsDecodeErrorZ)); return *this; } + LDKCResult_OfferPathsDecodeErrorZ* operator &() { return &self; } + LDKCResult_OfferPathsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OfferPathsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OfferPathsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CommitmentSignedDecodeErrorZ { +class CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { private: - LDKCResult_CommitmentSignedDecodeErrorZ self; + LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ 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; } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(const CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&) = delete; + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); } + operator LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); return res; } + ~CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ() { CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ)); return *this; } + LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } }; class CResult_StfuDecodeErrorZ { private: @@ -9393,110 +12837,20 @@ 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 CResult_CommitmentTransactionDecodeErrorZ { -private: - LDKCResult_CommitmentTransactionDecodeErrorZ self; -public: - CResult_CommitmentTransactionDecodeErrorZ(const CResult_CommitmentTransactionDecodeErrorZ&) = delete; - CResult_CommitmentTransactionDecodeErrorZ(CResult_CommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); } - CResult_CommitmentTransactionDecodeErrorZ(LDKCResult_CommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_CommitmentTransactionDecodeErrorZ() && { LDKCResult_CommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_CommitmentTransactionDecodeErrorZ() { CResult_CommitmentTransactionDecodeErrorZ_free(self); } - CResult_CommitmentTransactionDecodeErrorZ& operator=(CResult_CommitmentTransactionDecodeErrorZ&& o) { CResult_CommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { +class CResult_OfferPathsRequestDecodeErrorZ { private: - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ self; + LDKCResult_OfferPathsRequestDecodeErrorZ self; public: - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(const CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&) = delete; - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() && { LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); } - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ& operator=(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_APIErrorZ { -private: - LDKCOption_APIErrorZ self; -public: - COption_APIErrorZ(const COption_APIErrorZ&) = delete; - COption_APIErrorZ(COption_APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_APIErrorZ)); } - COption_APIErrorZ(LDKCOption_APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_APIErrorZ)); } - operator LDKCOption_APIErrorZ() && { LDKCOption_APIErrorZ res = self; memset(&self, 0, sizeof(LDKCOption_APIErrorZ)); return res; } - ~COption_APIErrorZ() { COption_APIErrorZ_free(self); } - COption_APIErrorZ& operator=(COption_APIErrorZ&& o) { COption_APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_APIErrorZ)); return *this; } - LDKCOption_APIErrorZ* operator &() { return &self; } - LDKCOption_APIErrorZ* operator ->() { return &self; } - const LDKCOption_APIErrorZ* operator &() const { return &self; } - const LDKCOption_APIErrorZ* operator ->() const { return &self; } -}; -class CVec_PeerDetailsZ { -private: - LDKCVec_PeerDetailsZ self; -public: - CVec_PeerDetailsZ(const CVec_PeerDetailsZ&) = delete; - CVec_PeerDetailsZ(CVec_PeerDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PeerDetailsZ)); } - CVec_PeerDetailsZ(LDKCVec_PeerDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PeerDetailsZ)); } - operator LDKCVec_PeerDetailsZ() && { LDKCVec_PeerDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_PeerDetailsZ)); return res; } - ~CVec_PeerDetailsZ() { CVec_PeerDetailsZ_free(self); } - CVec_PeerDetailsZ& operator=(CVec_PeerDetailsZ&& o) { CVec_PeerDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PeerDetailsZ)); return *this; } - LDKCVec_PeerDetailsZ* operator &() { return &self; } - LDKCVec_PeerDetailsZ* operator ->() { return &self; } - const LDKCVec_PeerDetailsZ* operator &() const { return &self; } - const LDKCVec_PeerDetailsZ* operator ->() const { return &self; } -}; -class CResult_u64ShortChannelIdErrorZ { -private: - LDKCResult_u64ShortChannelIdErrorZ self; -public: - CResult_u64ShortChannelIdErrorZ(const CResult_u64ShortChannelIdErrorZ&) = delete; - CResult_u64ShortChannelIdErrorZ(CResult_u64ShortChannelIdErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u64ShortChannelIdErrorZ)); } - CResult_u64ShortChannelIdErrorZ(LDKCResult_u64ShortChannelIdErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u64ShortChannelIdErrorZ)); } - operator LDKCResult_u64ShortChannelIdErrorZ() && { LDKCResult_u64ShortChannelIdErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_u64ShortChannelIdErrorZ)); return res; } - ~CResult_u64ShortChannelIdErrorZ() { CResult_u64ShortChannelIdErrorZ_free(self); } - CResult_u64ShortChannelIdErrorZ& operator=(CResult_u64ShortChannelIdErrorZ&& o) { CResult_u64ShortChannelIdErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u64ShortChannelIdErrorZ)); return *this; } - LDKCResult_u64ShortChannelIdErrorZ* operator &() { return &self; } - LDKCResult_u64ShortChannelIdErrorZ* operator ->() { return &self; } - const LDKCResult_u64ShortChannelIdErrorZ* operator &() const { return &self; } - const LDKCResult_u64ShortChannelIdErrorZ* operator ->() const { return &self; } -}; -class CResult_QueryChannelRangeDecodeErrorZ { -private: - LDKCResult_QueryChannelRangeDecodeErrorZ self; -public: - CResult_QueryChannelRangeDecodeErrorZ(const CResult_QueryChannelRangeDecodeErrorZ&) = delete; - CResult_QueryChannelRangeDecodeErrorZ(CResult_QueryChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); } - CResult_QueryChannelRangeDecodeErrorZ(LDKCResult_QueryChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); } - operator LDKCResult_QueryChannelRangeDecodeErrorZ() && { LDKCResult_QueryChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); return res; } - ~CResult_QueryChannelRangeDecodeErrorZ() { CResult_QueryChannelRangeDecodeErrorZ_free(self); } - CResult_QueryChannelRangeDecodeErrorZ& operator=(CResult_QueryChannelRangeDecodeErrorZ&& o) { CResult_QueryChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); return *this; } - LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() { return &self; } - LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() const { return &self; } + CResult_OfferPathsRequestDecodeErrorZ(const CResult_OfferPathsRequestDecodeErrorZ&) = delete; + CResult_OfferPathsRequestDecodeErrorZ(CResult_OfferPathsRequestDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferPathsRequestDecodeErrorZ)); } + CResult_OfferPathsRequestDecodeErrorZ(LDKCResult_OfferPathsRequestDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferPathsRequestDecodeErrorZ)); } + operator LDKCResult_OfferPathsRequestDecodeErrorZ() && { LDKCResult_OfferPathsRequestDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferPathsRequestDecodeErrorZ)); return res; } + ~CResult_OfferPathsRequestDecodeErrorZ() { CResult_OfferPathsRequestDecodeErrorZ_free(self); } + CResult_OfferPathsRequestDecodeErrorZ& operator=(CResult_OfferPathsRequestDecodeErrorZ&& o) { CResult_OfferPathsRequestDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferPathsRequestDecodeErrorZ)); return *this; } + LDKCResult_OfferPathsRequestDecodeErrorZ* operator &() { return &self; } + LDKCResult_OfferPathsRequestDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OfferPathsRequestDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OfferPathsRequestDecodeErrorZ* operator ->() const { return &self; } }; class CVec_InputZ { private: @@ -9513,20 +12867,20 @@ class CVec_InputZ { const LDKCVec_InputZ* operator &() const { return &self; } const LDKCVec_InputZ* operator ->() const { return &self; } }; -class CVec_TransactionZ { +class CResult_ChannelFeaturesDecodeErrorZ { private: - LDKCVec_TransactionZ self; + LDKCResult_ChannelFeaturesDecodeErrorZ self; public: - CVec_TransactionZ(const CVec_TransactionZ&) = delete; - CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } - CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } - operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } - ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } - CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; } - LDKCVec_TransactionZ* operator &() { return &self; } - LDKCVec_TransactionZ* operator ->() { return &self; } - const LDKCVec_TransactionZ* operator &() const { return &self; } - const LDKCVec_TransactionZ* operator ->() const { return &self; } + CResult_ChannelFeaturesDecodeErrorZ(const CResult_ChannelFeaturesDecodeErrorZ&) = delete; + CResult_ChannelFeaturesDecodeErrorZ(CResult_ChannelFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); } + CResult_ChannelFeaturesDecodeErrorZ(LDKCResult_ChannelFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); } + operator LDKCResult_ChannelFeaturesDecodeErrorZ() && { LDKCResult_ChannelFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); return res; } + ~CResult_ChannelFeaturesDecodeErrorZ() { CResult_ChannelFeaturesDecodeErrorZ_free(self); } + CResult_ChannelFeaturesDecodeErrorZ& operator=(CResult_ChannelFeaturesDecodeErrorZ&& o) { CResult_ChannelFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); return *this; } + LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() const { return &self; } }; class C2Tuple_DNSResolverMessageResponseInstructionZ { private: @@ -9543,36 +12897,6 @@ class C2Tuple_DNSResolverMessageResponseInstructionZ { const LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator &() const { return &self; } const LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator ->() const { return &self; } }; -class CResult_ChannelReadyDecodeErrorZ { -private: - LDKCResult_ChannelReadyDecodeErrorZ self; -public: - CResult_ChannelReadyDecodeErrorZ(const CResult_ChannelReadyDecodeErrorZ&) = delete; - CResult_ChannelReadyDecodeErrorZ(CResult_ChannelReadyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); } - CResult_ChannelReadyDecodeErrorZ(LDKCResult_ChannelReadyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); } - operator LDKCResult_ChannelReadyDecodeErrorZ() && { LDKCResult_ChannelReadyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); return res; } - ~CResult_ChannelReadyDecodeErrorZ() { CResult_ChannelReadyDecodeErrorZ_free(self); } - CResult_ChannelReadyDecodeErrorZ& operator=(CResult_ChannelReadyDecodeErrorZ&& o) { CResult_ChannelReadyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); return *this; } - LDKCResult_ChannelReadyDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelReadyDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_UpdateFeeDecodeErrorZ { -private: - LDKCResult_UpdateFeeDecodeErrorZ self; -public: - CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete; - CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); } - CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); } - operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; } - ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); } - CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; } - LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_NoneBolt11SemanticErrorZ { private: LDKCResult_NoneBolt11SemanticErrorZ self; @@ -9588,36 +12912,6 @@ class CResult_NoneBolt11SemanticErrorZ { const LDKCResult_NoneBolt11SemanticErrorZ* operator &() const { return &self; } const LDKCResult_NoneBolt11SemanticErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelFeaturesDecodeErrorZ { -private: - LDKCResult_ChannelFeaturesDecodeErrorZ self; -public: - CResult_ChannelFeaturesDecodeErrorZ(const CResult_ChannelFeaturesDecodeErrorZ&) = delete; - CResult_ChannelFeaturesDecodeErrorZ(CResult_ChannelFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); } - CResult_ChannelFeaturesDecodeErrorZ(LDKCResult_ChannelFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); } - operator LDKCResult_ChannelFeaturesDecodeErrorZ() && { LDKCResult_ChannelFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); return res; } - ~CResult_ChannelFeaturesDecodeErrorZ() { CResult_ChannelFeaturesDecodeErrorZ_free(self); } - CResult_ChannelFeaturesDecodeErrorZ& operator=(CResult_ChannelFeaturesDecodeErrorZ&& o) { CResult_ChannelFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); return *this; } - LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_RevocationBasepointDecodeErrorZ { -private: - LDKCResult_RevocationBasepointDecodeErrorZ self; -public: - CResult_RevocationBasepointDecodeErrorZ(const CResult_RevocationBasepointDecodeErrorZ&) = delete; - CResult_RevocationBasepointDecodeErrorZ(CResult_RevocationBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevocationBasepointDecodeErrorZ)); } - CResult_RevocationBasepointDecodeErrorZ(LDKCResult_RevocationBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevocationBasepointDecodeErrorZ)); } - operator LDKCResult_RevocationBasepointDecodeErrorZ() && { LDKCResult_RevocationBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevocationBasepointDecodeErrorZ)); return res; } - ~CResult_RevocationBasepointDecodeErrorZ() { CResult_RevocationBasepointDecodeErrorZ_free(self); } - CResult_RevocationBasepointDecodeErrorZ& operator=(CResult_RevocationBasepointDecodeErrorZ&& o) { CResult_RevocationBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevocationBasepointDecodeErrorZ)); return *this; } - LDKCResult_RevocationBasepointDecodeErrorZ* operator &() { return &self; } - LDKCResult_RevocationBasepointDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RevocationBasepointDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RevocationBasepointDecodeErrorZ* operator ->() const { return &self; } -}; class COption_OnionMessageContentsZ { private: LDKCOption_OnionMessageContentsZ self; @@ -9648,50 +12942,35 @@ class CResult_NoneRetryableSendFailureZ { const LDKCResult_NoneRetryableSendFailureZ* operator &() const { return &self; } const LDKCResult_NoneRetryableSendFailureZ* operator ->() const { return &self; } }; -class CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { +class CResult_HTLCOutputInCommitmentDecodeErrorZ { private: - LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ self; + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ self; public: - CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(const CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&) = delete; - CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); } - CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); } - operator LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ() && { LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); return res; } - ~CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ() { CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(self); } - CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ& operator=(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ&& o) { CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ)); return *this; } - LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } + 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_NodeIdDecodeErrorZ { private: LDKCResult_NodeIdDecodeErrorZ self; public: CResult_NodeIdDecodeErrorZ(const CResult_NodeIdDecodeErrorZ&) = delete; - CResult_NodeIdDecodeErrorZ(CResult_NodeIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); } - CResult_NodeIdDecodeErrorZ(LDKCResult_NodeIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); } - operator LDKCResult_NodeIdDecodeErrorZ() && { LDKCResult_NodeIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); return res; } - ~CResult_NodeIdDecodeErrorZ() { CResult_NodeIdDecodeErrorZ_free(self); } - CResult_NodeIdDecodeErrorZ& operator=(CResult_NodeIdDecodeErrorZ&& o) { CResult_NodeIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); return *this; } - LDKCResult_NodeIdDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeIdDecodeErrorZ* operator ->() { return &self; } - 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; } + CResult_NodeIdDecodeErrorZ(CResult_NodeIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); } + CResult_NodeIdDecodeErrorZ(LDKCResult_NodeIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); } + operator LDKCResult_NodeIdDecodeErrorZ() && { LDKCResult_NodeIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); return res; } + ~CResult_NodeIdDecodeErrorZ() { CResult_NodeIdDecodeErrorZ_free(self); } + CResult_NodeIdDecodeErrorZ& operator=(CResult_NodeIdDecodeErrorZ&& o) { CResult_NodeIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); return *this; } + LDKCResult_NodeIdDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeIdDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeIdDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeIdDecodeErrorZ* operator ->() const { return &self; } }; class CResult_ChannelShutdownStateDecodeErrorZ { private: @@ -9723,20 +13002,20 @@ class CResult_NodeAnnouncementInfoDecodeErrorZ { const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_InvoiceRequestBolt12SemanticErrorZ { +class CResult_ShutdownScriptInvalidShutdownScriptZ { private: - LDKCResult_InvoiceRequestBolt12SemanticErrorZ self; + LDKCResult_ShutdownScriptInvalidShutdownScriptZ self; public: - CResult_InvoiceRequestBolt12SemanticErrorZ(const CResult_InvoiceRequestBolt12SemanticErrorZ&) = delete; - CResult_InvoiceRequestBolt12SemanticErrorZ(CResult_InvoiceRequestBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestBolt12SemanticErrorZ)); } - CResult_InvoiceRequestBolt12SemanticErrorZ(LDKCResult_InvoiceRequestBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ)); } - operator LDKCResult_InvoiceRequestBolt12SemanticErrorZ() && { LDKCResult_InvoiceRequestBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestBolt12SemanticErrorZ)); return res; } - ~CResult_InvoiceRequestBolt12SemanticErrorZ() { CResult_InvoiceRequestBolt12SemanticErrorZ_free(self); } - CResult_InvoiceRequestBolt12SemanticErrorZ& operator=(CResult_InvoiceRequestBolt12SemanticErrorZ&& o) { CResult_InvoiceRequestBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestBolt12SemanticErrorZ)); return *this; } - LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceRequestBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceRequestBolt12SemanticErrorZ* 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: @@ -9753,21 +13032,6 @@ class CResult_COption_NetworkUpdateZDecodeErrorZ { const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_UpdateFailMalformedHTLCZ { -private: - LDKCVec_UpdateFailMalformedHTLCZ self; -public: - CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; - CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } - CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } - operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } - ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } - CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } - LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } -}; class CResult_ShutdownScriptNoneZ { private: LDKCResult_ShutdownScriptNoneZ self; @@ -9798,21 +13062,6 @@ class CResult_PendingHTLCInfoInboundHTLCErrZ { const LDKCResult_PendingHTLCInfoInboundHTLCErrZ* operator &() const { return &self; } const LDKCResult_PendingHTLCInfoInboundHTLCErrZ* operator ->() const { return &self; } }; -class CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { -private: - LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ self; -public: - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ(const CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ&) = delete; - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ(CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ)); } - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ)); } - operator LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ() && { LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ)); return res; } - ~CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ() { CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(self); } - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ& operator=(CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ&& o) { CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ)); return *this; } - LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* operator &() { return &self; } - LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* operator ->() { return &self; } - const LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* operator &() const { return &self; } - const LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ* operator ->() const { return &self; } -}; class CResult_PendingHTLCInfoDecodeErrorZ { private: LDKCResult_PendingHTLCInfoDecodeErrorZ self; @@ -9828,66 +13077,6 @@ class CResult_PendingHTLCInfoDecodeErrorZ { const LDKCResult_PendingHTLCInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PendingHTLCInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SpliceInitDecodeErrorZ { -private: - LDKCResult_SpliceInitDecodeErrorZ self; -public: - CResult_SpliceInitDecodeErrorZ(const CResult_SpliceInitDecodeErrorZ&) = delete; - CResult_SpliceInitDecodeErrorZ(CResult_SpliceInitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpliceInitDecodeErrorZ)); } - CResult_SpliceInitDecodeErrorZ(LDKCResult_SpliceInitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpliceInitDecodeErrorZ)); } - operator LDKCResult_SpliceInitDecodeErrorZ() && { LDKCResult_SpliceInitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpliceInitDecodeErrorZ)); return res; } - ~CResult_SpliceInitDecodeErrorZ() { CResult_SpliceInitDecodeErrorZ_free(self); } - CResult_SpliceInitDecodeErrorZ& operator=(CResult_SpliceInitDecodeErrorZ&& o) { CResult_SpliceInitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpliceInitDecodeErrorZ)); return *this; } - LDKCResult_SpliceInitDecodeErrorZ* operator &() { return &self; } - LDKCResult_SpliceInitDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_SpliceInitDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_SpliceInitDecodeErrorZ* 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 CVec_RouteHopZ { -private: - LDKCVec_RouteHopZ self; -public: - CVec_RouteHopZ(const CVec_RouteHopZ&) = delete; - CVec_RouteHopZ(CVec_RouteHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHopZ)); } - CVec_RouteHopZ(LDKCVec_RouteHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHopZ)); } - operator LDKCVec_RouteHopZ() && { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } - ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } - CVec_RouteHopZ& operator=(CVec_RouteHopZ&& o) { CVec_RouteHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHopZ)); return *this; } - LDKCVec_RouteHopZ* operator &() { return &self; } - LDKCVec_RouteHopZ* operator ->() { return &self; } - const LDKCVec_RouteHopZ* operator &() const { return &self; } - const LDKCVec_RouteHopZ* operator ->() const { return &self; } -}; -class CResult_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 CResult_CVec_UtxoZNoneZ { private: LDKCResult_CVec_UtxoZNoneZ self; @@ -9903,80 +13092,35 @@ 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_HTLCDestinationZ { -private: - LDKCOption_HTLCDestinationZ self; -public: - COption_HTLCDestinationZ(const COption_HTLCDestinationZ&) = delete; - COption_HTLCDestinationZ(COption_HTLCDestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCDestinationZ)); } - COption_HTLCDestinationZ(LDKCOption_HTLCDestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCDestinationZ)); } - operator LDKCOption_HTLCDestinationZ() && { LDKCOption_HTLCDestinationZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCDestinationZ)); return res; } - ~COption_HTLCDestinationZ() { COption_HTLCDestinationZ_free(self); } - COption_HTLCDestinationZ& operator=(COption_HTLCDestinationZ&& o) { COption_HTLCDestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCDestinationZ)); return *this; } - LDKCOption_HTLCDestinationZ* operator &() { return &self; } - LDKCOption_HTLCDestinationZ* operator ->() { return &self; } - const LDKCOption_HTLCDestinationZ* operator &() const { return &self; } - const LDKCOption_HTLCDestinationZ* operator ->() const { return &self; } -}; -class CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { -private: - LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ self; -public: - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(const CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&) = delete; - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); } - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); } - operator LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ() && { LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); return res; } - ~CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ() { CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(self); } - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ& operator=(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ&& o) { CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ)); return *this; } - LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class CVec_ThirtyTwoBytesZ { +class CResult_HTLCHandlingFailureReasonDecodeErrorZ { private: - LDKCVec_ThirtyTwoBytesZ self; + LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ self; public: - CVec_ThirtyTwoBytesZ(const CVec_ThirtyTwoBytesZ&) = delete; - CVec_ThirtyTwoBytesZ(CVec_ThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); } - CVec_ThirtyTwoBytesZ(LDKCVec_ThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); } - operator LDKCVec_ThirtyTwoBytesZ() && { LDKCVec_ThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); return res; } - ~CVec_ThirtyTwoBytesZ() { CVec_ThirtyTwoBytesZ_free(self); } - CVec_ThirtyTwoBytesZ& operator=(CVec_ThirtyTwoBytesZ&& o) { CVec_ThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); return *this; } - LDKCVec_ThirtyTwoBytesZ* operator &() { return &self; } - LDKCVec_ThirtyTwoBytesZ* operator ->() { return &self; } - const LDKCVec_ThirtyTwoBytesZ* operator &() const { return &self; } - const LDKCVec_ThirtyTwoBytesZ* operator ->() const { return &self; } + CResult_HTLCHandlingFailureReasonDecodeErrorZ(const CResult_HTLCHandlingFailureReasonDecodeErrorZ&) = delete; + CResult_HTLCHandlingFailureReasonDecodeErrorZ(CResult_HTLCHandlingFailureReasonDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCHandlingFailureReasonDecodeErrorZ)); } + CResult_HTLCHandlingFailureReasonDecodeErrorZ(LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ)); } + operator LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ() && { LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ)); return res; } + ~CResult_HTLCHandlingFailureReasonDecodeErrorZ() { CResult_HTLCHandlingFailureReasonDecodeErrorZ_free(self); } + CResult_HTLCHandlingFailureReasonDecodeErrorZ& operator=(CResult_HTLCHandlingFailureReasonDecodeErrorZ&& o) { CResult_HTLCHandlingFailureReasonDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCHandlingFailureReasonDecodeErrorZ)); return *this; } + LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCHandlingFailureReasonDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelMonitorUpdateStatusNoneZ { +class CVec_FundingTxInputZ { private: - LDKCResult_ChannelMonitorUpdateStatusNoneZ self; + LDKCVec_FundingTxInputZ 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; } + CVec_FundingTxInputZ(const CVec_FundingTxInputZ&) = delete; + CVec_FundingTxInputZ(CVec_FundingTxInputZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_FundingTxInputZ)); } + CVec_FundingTxInputZ(LDKCVec_FundingTxInputZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_FundingTxInputZ)); } + operator LDKCVec_FundingTxInputZ() && { LDKCVec_FundingTxInputZ res = self; memset(&self, 0, sizeof(LDKCVec_FundingTxInputZ)); return res; } + ~CVec_FundingTxInputZ() { CVec_FundingTxInputZ_free(self); } + CVec_FundingTxInputZ& operator=(CVec_FundingTxInputZ&& o) { CVec_FundingTxInputZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_FundingTxInputZ)); return *this; } + LDKCVec_FundingTxInputZ* operator &() { return &self; } + LDKCVec_FundingTxInputZ* operator ->() { return &self; } + const LDKCVec_FundingTxInputZ* operator &() const { return &self; } + const LDKCVec_FundingTxInputZ* operator ->() const { return &self; } }; class CResult_ClosingSignedDecodeErrorZ { private: @@ -10023,140 +13167,65 @@ class C2Tuple_ReleaseHeldHtlcResponseInstructionZ { const LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ* operator &() const { return &self; } const LDKC2Tuple_ReleaseHeldHtlcResponseInstructionZ* operator ->() const { return &self; } }; -class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +class COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { private: - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ self; + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ self; public: - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(const CResult_CounterpartyCommitmentSecretsDecodeErrorZ&) = delete; - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } - operator LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ() && { LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return res; } - ~CResult_CounterpartyCommitmentSecretsDecodeErrorZ() { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZ& operator=(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return *this; } - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() { return &self; } - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() const { return &self; } + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ(const COption_C2Tuple_ServeStaticInvoiceMessageContextZZ&) = delete; + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ(COption_C2Tuple_ServeStaticInvoiceMessageContextZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ServeStaticInvoiceMessageContextZZ)); } + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ(LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ)); } + operator LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ() && { LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ)); return res; } + ~COption_C2Tuple_ServeStaticInvoiceMessageContextZZ() { COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_free(self); } + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ& operator=(COption_C2Tuple_ServeStaticInvoiceMessageContextZZ&& o) { COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ServeStaticInvoiceMessageContextZZ)); return *this; } + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ* operator &() { return &self; } + LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_ServeStaticInvoiceMessageContextZZ* 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; -public: - CVec_RecentPaymentDetailsZ(const CVec_RecentPaymentDetailsZ&) = delete; - CVec_RecentPaymentDetailsZ(CVec_RecentPaymentDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RecentPaymentDetailsZ)); } - CVec_RecentPaymentDetailsZ(LDKCVec_RecentPaymentDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RecentPaymentDetailsZ)); } - operator LDKCVec_RecentPaymentDetailsZ() && { LDKCVec_RecentPaymentDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_RecentPaymentDetailsZ)); return res; } - ~CVec_RecentPaymentDetailsZ() { CVec_RecentPaymentDetailsZ_free(self); } - CVec_RecentPaymentDetailsZ& operator=(CVec_RecentPaymentDetailsZ&& o) { CVec_RecentPaymentDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RecentPaymentDetailsZ)); return *this; } - LDKCVec_RecentPaymentDetailsZ* operator &() { return &self; } - LDKCVec_RecentPaymentDetailsZ* operator ->() { return &self; } - const LDKCVec_RecentPaymentDetailsZ* operator &() const { return &self; } - const LDKCVec_RecentPaymentDetailsZ* operator ->() const { return &self; } -}; -class CVec_RouteHintHopZ { -private: - LDKCVec_RouteHintHopZ self; -public: - CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete; - CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); } - CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); } - operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; } - ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); } - CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; } - LDKCVec_RouteHintHopZ* operator &() { return &self; } - LDKCVec_RouteHintHopZ* operator ->() { return &self; } - const LDKCVec_RouteHintHopZ* operator &() const { return &self; } - const LDKCVec_RouteHintHopZ* operator ->() const { return &self; } -}; -class CResult_UntrustedStringDecodeErrorZ { -private: - LDKCResult_UntrustedStringDecodeErrorZ self; -public: - CResult_UntrustedStringDecodeErrorZ(const CResult_UntrustedStringDecodeErrorZ&) = delete; - CResult_UntrustedStringDecodeErrorZ(CResult_UntrustedStringDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UntrustedStringDecodeErrorZ)); } - CResult_UntrustedStringDecodeErrorZ(LDKCResult_UntrustedStringDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UntrustedStringDecodeErrorZ)); } - operator LDKCResult_UntrustedStringDecodeErrorZ() && { LDKCResult_UntrustedStringDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UntrustedStringDecodeErrorZ)); return res; } - ~CResult_UntrustedStringDecodeErrorZ() { CResult_UntrustedStringDecodeErrorZ_free(self); } - CResult_UntrustedStringDecodeErrorZ& operator=(CResult_UntrustedStringDecodeErrorZ&& o) { CResult_UntrustedStringDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UntrustedStringDecodeErrorZ)); return *this; } - LDKCResult_UntrustedStringDecodeErrorZ* operator &() { return &self; } - LDKCResult_UntrustedStringDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UntrustedStringDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UntrustedStringDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { -private: - LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ self; -public: - CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(const CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&) = delete; - CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); } - CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); } - operator LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ() && { LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); return res; } - ~CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ() { CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(self); } - CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ& operator=(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ&& o) { CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ)); return *this; } - LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator &() { return &self; } - LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator ->() { return &self; } - const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator &() const { return &self; } - const LDKCVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ* operator ->() const { return &self; } -}; -class CResult_PaymentParametersDecodeErrorZ { -private: - LDKCResult_PaymentParametersDecodeErrorZ self; + LDKCResult_HTLCDescriptorDecodeErrorZ self; public: - CResult_PaymentParametersDecodeErrorZ(const CResult_PaymentParametersDecodeErrorZ&) = delete; - CResult_PaymentParametersDecodeErrorZ(CResult_PaymentParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); } - CResult_PaymentParametersDecodeErrorZ(LDKCResult_PaymentParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); } - operator LDKCResult_PaymentParametersDecodeErrorZ() && { LDKCResult_PaymentParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); return res; } - ~CResult_PaymentParametersDecodeErrorZ() { CResult_PaymentParametersDecodeErrorZ_free(self); } - CResult_PaymentParametersDecodeErrorZ& operator=(CResult_PaymentParametersDecodeErrorZ&& o) { CResult_PaymentParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); return *this; } - LDKCResult_PaymentParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; } + 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 CResult_DelayedPaymentBasepointDecodeErrorZ { +class CVec_RecentPaymentDetailsZ { private: - LDKCResult_DelayedPaymentBasepointDecodeErrorZ self; + LDKCVec_RecentPaymentDetailsZ self; public: - CResult_DelayedPaymentBasepointDecodeErrorZ(const CResult_DelayedPaymentBasepointDecodeErrorZ&) = delete; - CResult_DelayedPaymentBasepointDecodeErrorZ(CResult_DelayedPaymentBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentBasepointDecodeErrorZ)); } - CResult_DelayedPaymentBasepointDecodeErrorZ(LDKCResult_DelayedPaymentBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ)); } - operator LDKCResult_DelayedPaymentBasepointDecodeErrorZ() && { LDKCResult_DelayedPaymentBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentBasepointDecodeErrorZ)); return res; } - ~CResult_DelayedPaymentBasepointDecodeErrorZ() { CResult_DelayedPaymentBasepointDecodeErrorZ_free(self); } - CResult_DelayedPaymentBasepointDecodeErrorZ& operator=(CResult_DelayedPaymentBasepointDecodeErrorZ&& o) { CResult_DelayedPaymentBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentBasepointDecodeErrorZ)); return *this; } - LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator &() { return &self; } - LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DelayedPaymentBasepointDecodeErrorZ* operator ->() const { return &self; } + CVec_RecentPaymentDetailsZ(const CVec_RecentPaymentDetailsZ&) = delete; + CVec_RecentPaymentDetailsZ(CVec_RecentPaymentDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RecentPaymentDetailsZ)); } + CVec_RecentPaymentDetailsZ(LDKCVec_RecentPaymentDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RecentPaymentDetailsZ)); } + operator LDKCVec_RecentPaymentDetailsZ() && { LDKCVec_RecentPaymentDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_RecentPaymentDetailsZ)); return res; } + ~CVec_RecentPaymentDetailsZ() { CVec_RecentPaymentDetailsZ_free(self); } + CVec_RecentPaymentDetailsZ& operator=(CVec_RecentPaymentDetailsZ&& o) { CVec_RecentPaymentDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RecentPaymentDetailsZ)); return *this; } + LDKCVec_RecentPaymentDetailsZ* operator &() { return &self; } + LDKCVec_RecentPaymentDetailsZ* operator ->() { return &self; } + const LDKCVec_RecentPaymentDetailsZ* operator &() const { return &self; } + const LDKCVec_RecentPaymentDetailsZ* operator ->() const { return &self; } }; -class C2Tuple_ThirtyTwoBytesChannelMonitorZ { +class C2Tuple_ServeStaticInvoiceMessageContextZ { private: - LDKC2Tuple_ThirtyTwoBytesChannelMonitorZ self; + LDKC2Tuple_ServeStaticInvoiceMessageContextZ 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; } + C2Tuple_ServeStaticInvoiceMessageContextZ(const C2Tuple_ServeStaticInvoiceMessageContextZ&) = delete; + C2Tuple_ServeStaticInvoiceMessageContextZ(C2Tuple_ServeStaticInvoiceMessageContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ServeStaticInvoiceMessageContextZ)); } + C2Tuple_ServeStaticInvoiceMessageContextZ(LDKC2Tuple_ServeStaticInvoiceMessageContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ServeStaticInvoiceMessageContextZ)); } + operator LDKC2Tuple_ServeStaticInvoiceMessageContextZ() && { LDKC2Tuple_ServeStaticInvoiceMessageContextZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ServeStaticInvoiceMessageContextZ)); return res; } + ~C2Tuple_ServeStaticInvoiceMessageContextZ() { C2Tuple_ServeStaticInvoiceMessageContextZ_free(self); } + C2Tuple_ServeStaticInvoiceMessageContextZ& operator=(C2Tuple_ServeStaticInvoiceMessageContextZ&& o) { C2Tuple_ServeStaticInvoiceMessageContextZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ServeStaticInvoiceMessageContextZ)); return *this; } + LDKC2Tuple_ServeStaticInvoiceMessageContextZ* operator &() { return &self; } + LDKC2Tuple_ServeStaticInvoiceMessageContextZ* operator ->() { return &self; } + const LDKC2Tuple_ServeStaticInvoiceMessageContextZ* operator &() const { return &self; } + const LDKC2Tuple_ServeStaticInvoiceMessageContextZ* operator ->() const { return &self; } }; class COption_U128Z { private: @@ -10173,50 +13242,35 @@ class COption_U128Z { const LDKCOption_U128Z* operator &() const { return &self; } const LDKCOption_U128Z* operator ->() const { return &self; } }; -class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { -private: - LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ self; -public: - COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(const COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&) = delete; - COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } - COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } - operator LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() && { LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return res; } - ~COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); } - COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ& operator=(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return *this; } - LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() { return &self; } - LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator ->() const { return &self; } -}; -class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { +class COption_PaidBolt12InvoiceZ { private: - LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ self; + LDKCOption_PaidBolt12InvoiceZ 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; } + COption_PaidBolt12InvoiceZ(const COption_PaidBolt12InvoiceZ&) = delete; + COption_PaidBolt12InvoiceZ(COption_PaidBolt12InvoiceZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaidBolt12InvoiceZ)); } + COption_PaidBolt12InvoiceZ(LDKCOption_PaidBolt12InvoiceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaidBolt12InvoiceZ)); } + operator LDKCOption_PaidBolt12InvoiceZ() && { LDKCOption_PaidBolt12InvoiceZ res = self; memset(&self, 0, sizeof(LDKCOption_PaidBolt12InvoiceZ)); return res; } + ~COption_PaidBolt12InvoiceZ() { COption_PaidBolt12InvoiceZ_free(self); } + COption_PaidBolt12InvoiceZ& operator=(COption_PaidBolt12InvoiceZ&& o) { COption_PaidBolt12InvoiceZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaidBolt12InvoiceZ)); return *this; } + LDKCOption_PaidBolt12InvoiceZ* operator &() { return &self; } + LDKCOption_PaidBolt12InvoiceZ* operator ->() { return &self; } + const LDKCOption_PaidBolt12InvoiceZ* operator &() const { return &self; } + const LDKCOption_PaidBolt12InvoiceZ* operator ->() const { return &self; } }; -class CResult_UpdateNameIOErrorZ { +class CResult_FundingTxInputDecodeErrorZ { private: - LDKCResult_UpdateNameIOErrorZ self; + LDKCResult_FundingTxInputDecodeErrorZ self; public: - CResult_UpdateNameIOErrorZ(const CResult_UpdateNameIOErrorZ&) = delete; - CResult_UpdateNameIOErrorZ(CResult_UpdateNameIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); } - CResult_UpdateNameIOErrorZ(LDKCResult_UpdateNameIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); } - operator LDKCResult_UpdateNameIOErrorZ() && { LDKCResult_UpdateNameIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); return res; } - ~CResult_UpdateNameIOErrorZ() { CResult_UpdateNameIOErrorZ_free(self); } - CResult_UpdateNameIOErrorZ& operator=(CResult_UpdateNameIOErrorZ&& o) { CResult_UpdateNameIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); return *this; } - LDKCResult_UpdateNameIOErrorZ* operator &() { return &self; } - LDKCResult_UpdateNameIOErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateNameIOErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateNameIOErrorZ* operator ->() const { return &self; } + CResult_FundingTxInputDecodeErrorZ(const CResult_FundingTxInputDecodeErrorZ&) = delete; + CResult_FundingTxInputDecodeErrorZ(CResult_FundingTxInputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingTxInputDecodeErrorZ)); } + CResult_FundingTxInputDecodeErrorZ(LDKCResult_FundingTxInputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingTxInputDecodeErrorZ)); } + operator LDKCResult_FundingTxInputDecodeErrorZ() && { LDKCResult_FundingTxInputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingTxInputDecodeErrorZ)); return res; } + ~CResult_FundingTxInputDecodeErrorZ() { CResult_FundingTxInputDecodeErrorZ_free(self); } + CResult_FundingTxInputDecodeErrorZ& operator=(CResult_FundingTxInputDecodeErrorZ&& o) { CResult_FundingTxInputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingTxInputDecodeErrorZ)); return *this; } + LDKCResult_FundingTxInputDecodeErrorZ* operator &() { return &self; } + LDKCResult_FundingTxInputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FundingTxInputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FundingTxInputDecodeErrorZ* operator ->() const { return &self; } }; class CVec_MessageForwardNodeZ { private: @@ -10233,6 +13287,21 @@ class CVec_MessageForwardNodeZ { const LDKCVec_MessageForwardNodeZ* operator &() const { return &self; } const LDKCVec_MessageForwardNodeZ* operator ->() const { return &self; } }; +class C2Tuple_ChannelIdCOption_U128ZZ { +private: + LDKC2Tuple_ChannelIdCOption_U128ZZ self; +public: + C2Tuple_ChannelIdCOption_U128ZZ(const C2Tuple_ChannelIdCOption_U128ZZ&) = delete; + C2Tuple_ChannelIdCOption_U128ZZ(C2Tuple_ChannelIdCOption_U128ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ChannelIdCOption_U128ZZ)); } + C2Tuple_ChannelIdCOption_U128ZZ(LDKC2Tuple_ChannelIdCOption_U128ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ChannelIdCOption_U128ZZ)); } + operator LDKC2Tuple_ChannelIdCOption_U128ZZ() && { LDKC2Tuple_ChannelIdCOption_U128ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ChannelIdCOption_U128ZZ)); return res; } + ~C2Tuple_ChannelIdCOption_U128ZZ() { C2Tuple_ChannelIdCOption_U128ZZ_free(self); } + C2Tuple_ChannelIdCOption_U128ZZ& operator=(C2Tuple_ChannelIdCOption_U128ZZ&& o) { C2Tuple_ChannelIdCOption_U128ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ChannelIdCOption_U128ZZ)); return *this; } + LDKC2Tuple_ChannelIdCOption_U128ZZ* operator &() { return &self; } + LDKC2Tuple_ChannelIdCOption_U128ZZ* operator ->() { return &self; } + const LDKC2Tuple_ChannelIdCOption_U128ZZ* operator &() const { return &self; } + const LDKC2Tuple_ChannelIdCOption_U128ZZ* operator ->() const { return &self; } +}; class CResult_TxAckRbfDecodeErrorZ { private: LDKCResult_TxAckRbfDecodeErrorZ self; @@ -10278,35 +13347,20 @@ class COption_UtxoLookupZ { const LDKCOption_UtxoLookupZ* operator &() const { return &self; } const LDKCOption_UtxoLookupZ* operator ->() const { return &self; } }; -class CResult__u832NoneZ { -private: - LDKCResult__u832NoneZ self; -public: - CResult__u832NoneZ(const CResult__u832NoneZ&) = delete; - CResult__u832NoneZ(CResult__u832NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult__u832NoneZ)); } - CResult__u832NoneZ(LDKCResult__u832NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult__u832NoneZ)); } - operator LDKCResult__u832NoneZ() && { LDKCResult__u832NoneZ res = self; memset(&self, 0, sizeof(LDKCResult__u832NoneZ)); return res; } - ~CResult__u832NoneZ() { CResult__u832NoneZ_free(self); } - CResult__u832NoneZ& operator=(CResult__u832NoneZ&& o) { CResult__u832NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult__u832NoneZ)); return *this; } - LDKCResult__u832NoneZ* operator &() { return &self; } - LDKCResult__u832NoneZ* operator ->() { return &self; } - const LDKCResult__u832NoneZ* operator &() const { return &self; } - const LDKCResult__u832NoneZ* operator ->() const { return &self; } -}; -class CResult_PongDecodeErrorZ { +class C2Tuple_OfferPathsMessageContextZ { private: - LDKCResult_PongDecodeErrorZ self; + LDKC2Tuple_OfferPathsMessageContextZ self; public: - CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete; - CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); } - CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); } - operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; } - ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); } - CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; } - LDKCResult_PongDecodeErrorZ* operator &() { return &self; } - LDKCResult_PongDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_OfferPathsMessageContextZ(const C2Tuple_OfferPathsMessageContextZ&) = delete; + C2Tuple_OfferPathsMessageContextZ(C2Tuple_OfferPathsMessageContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OfferPathsMessageContextZ)); } + C2Tuple_OfferPathsMessageContextZ(LDKC2Tuple_OfferPathsMessageContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OfferPathsMessageContextZ)); } + operator LDKC2Tuple_OfferPathsMessageContextZ() && { LDKC2Tuple_OfferPathsMessageContextZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OfferPathsMessageContextZ)); return res; } + ~C2Tuple_OfferPathsMessageContextZ() { C2Tuple_OfferPathsMessageContextZ_free(self); } + C2Tuple_OfferPathsMessageContextZ& operator=(C2Tuple_OfferPathsMessageContextZ&& o) { C2Tuple_OfferPathsMessageContextZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OfferPathsMessageContextZ)); return *this; } + LDKC2Tuple_OfferPathsMessageContextZ* operator &() { return &self; } + LDKC2Tuple_OfferPathsMessageContextZ* operator ->() { return &self; } + const LDKC2Tuple_OfferPathsMessageContextZ* operator &() const { return &self; } + const LDKC2Tuple_OfferPathsMessageContextZ* operator ->() const { return &self; } }; class CResult_UnsignedChannelAnnouncementDecodeErrorZ { private: @@ -10315,178 +13369,43 @@ class CResult_UnsignedChannelAnnouncementDecodeErrorZ { CResult_UnsignedChannelAnnouncementDecodeErrorZ(const CResult_UnsignedChannelAnnouncementDecodeErrorZ&) = delete; CResult_UnsignedChannelAnnouncementDecodeErrorZ(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); } CResult_UnsignedChannelAnnouncementDecodeErrorZ(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); } - operator LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); return res; } - ~CResult_UnsignedChannelAnnouncementDecodeErrorZ() { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); } - CResult_UnsignedChannelAnnouncementDecodeErrorZ& operator=(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_ChannelIdAPIErrorZ { -private: - LDKCResult_ChannelIdAPIErrorZ self; -public: - CResult_ChannelIdAPIErrorZ(const CResult_ChannelIdAPIErrorZ&) = delete; - CResult_ChannelIdAPIErrorZ(CResult_ChannelIdAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelIdAPIErrorZ)); } - CResult_ChannelIdAPIErrorZ(LDKCResult_ChannelIdAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelIdAPIErrorZ)); } - operator LDKCResult_ChannelIdAPIErrorZ() && { LDKCResult_ChannelIdAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelIdAPIErrorZ)); return res; } - ~CResult_ChannelIdAPIErrorZ() { CResult_ChannelIdAPIErrorZ_free(self); } - CResult_ChannelIdAPIErrorZ& operator=(CResult_ChannelIdAPIErrorZ&& o) { CResult_ChannelIdAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelIdAPIErrorZ)); return *this; } - LDKCResult_ChannelIdAPIErrorZ* operator &() { return &self; } - LDKCResult_ChannelIdAPIErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelIdAPIErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelIdAPIErrorZ* operator ->() const { return &self; } -}; -class CResult_CVec_u8ZNoneZ { -private: - LDKCResult_CVec_u8ZNoneZ self; -public: - 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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { -private: - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ self; -public: - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&) = delete; - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } - operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return res; } - ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); } - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return *this; } - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() { return &self; } - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() { return &self; } - const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() const { return &self; } - const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_ChannelIdPublicKeyZZ { -private: - LDKCVec_C2Tuple_ChannelIdPublicKeyZZ self; -public: - CVec_C2Tuple_ChannelIdPublicKeyZZ(const CVec_C2Tuple_ChannelIdPublicKeyZZ&) = delete; - CVec_C2Tuple_ChannelIdPublicKeyZZ(CVec_C2Tuple_ChannelIdPublicKeyZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdPublicKeyZZ)); } - CVec_C2Tuple_ChannelIdPublicKeyZZ(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ)); } - operator LDKCVec_C2Tuple_ChannelIdPublicKeyZZ() && { LDKCVec_C2Tuple_ChannelIdPublicKeyZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdPublicKeyZZ)); return res; } - ~CVec_C2Tuple_ChannelIdPublicKeyZZ() { CVec_C2Tuple_ChannelIdPublicKeyZZ_free(self); } - CVec_C2Tuple_ChannelIdPublicKeyZZ& operator=(CVec_C2Tuple_ChannelIdPublicKeyZZ&& o) { CVec_C2Tuple_ChannelIdPublicKeyZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdPublicKeyZZ)); return *this; } - LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator &() { return &self; } - LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_ChannelIdPublicKeyZZ* operator ->() const { return &self; } -}; -class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { -private: - LDKC2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ self; -public: - 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: - LDKCResult_ChannelTransactionParametersDecodeErrorZ self; -public: - CResult_ChannelTransactionParametersDecodeErrorZ(const CResult_ChannelTransactionParametersDecodeErrorZ&) = delete; - CResult_ChannelTransactionParametersDecodeErrorZ(CResult_ChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); } - CResult_ChannelTransactionParametersDecodeErrorZ(LDKCResult_ChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); } - operator LDKCResult_ChannelTransactionParametersDecodeErrorZ() && { LDKCResult_ChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); return res; } - ~CResult_ChannelTransactionParametersDecodeErrorZ() { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); } - CResult_ChannelTransactionParametersDecodeErrorZ& operator=(CResult_ChannelTransactionParametersDecodeErrorZ&& o) { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); return *this; } - LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { -private: - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ self; -public: - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(const CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&) = delete; - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } - operator LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return res; } - ~CResult_DelayedPaymentOutputDescriptorDecodeErrorZ() { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); } - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return *this; } - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_LSPSRequestIdAPIErrorZ { -private: - LDKCResult_LSPSRequestIdAPIErrorZ self; -public: - CResult_LSPSRequestIdAPIErrorZ(const CResult_LSPSRequestIdAPIErrorZ&) = delete; - CResult_LSPSRequestIdAPIErrorZ(CResult_LSPSRequestIdAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LSPSRequestIdAPIErrorZ)); } - CResult_LSPSRequestIdAPIErrorZ(LDKCResult_LSPSRequestIdAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LSPSRequestIdAPIErrorZ)); } - operator LDKCResult_LSPSRequestIdAPIErrorZ() && { LDKCResult_LSPSRequestIdAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_LSPSRequestIdAPIErrorZ)); return res; } - ~CResult_LSPSRequestIdAPIErrorZ() { CResult_LSPSRequestIdAPIErrorZ_free(self); } - CResult_LSPSRequestIdAPIErrorZ& operator=(CResult_LSPSRequestIdAPIErrorZ&& o) { CResult_LSPSRequestIdAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LSPSRequestIdAPIErrorZ)); return *this; } - LDKCResult_LSPSRequestIdAPIErrorZ* operator &() { return &self; } - LDKCResult_LSPSRequestIdAPIErrorZ* operator ->() { return &self; } - const LDKCResult_LSPSRequestIdAPIErrorZ* operator &() const { return &self; } - const LDKCResult_LSPSRequestIdAPIErrorZ* operator ->() const { return &self; } -}; -class CResult_InFlightHtlcsDecodeErrorZ { -private: - LDKCResult_InFlightHtlcsDecodeErrorZ self; -public: - CResult_InFlightHtlcsDecodeErrorZ(const CResult_InFlightHtlcsDecodeErrorZ&) = delete; - CResult_InFlightHtlcsDecodeErrorZ(CResult_InFlightHtlcsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); } - CResult_InFlightHtlcsDecodeErrorZ(LDKCResult_InFlightHtlcsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); } - operator LDKCResult_InFlightHtlcsDecodeErrorZ() && { LDKCResult_InFlightHtlcsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); return res; } - ~CResult_InFlightHtlcsDecodeErrorZ() { CResult_InFlightHtlcsDecodeErrorZ_free(self); } - CResult_InFlightHtlcsDecodeErrorZ& operator=(CResult_InFlightHtlcsDecodeErrorZ&& o) { CResult_InFlightHtlcsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); return *this; } - LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() { return &self; } - LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() const { return &self; } + operator LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelAnnouncementDecodeErrorZ() { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); } + CResult_UnsignedChannelAnnouncementDecodeErrorZ& operator=(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CommitmentSignedBatchDecodeErrorZ { +class CResult_ChannelTransactionParametersDecodeErrorZ { private: - LDKCResult_CommitmentSignedBatchDecodeErrorZ self; + LDKCResult_ChannelTransactionParametersDecodeErrorZ self; public: - CResult_CommitmentSignedBatchDecodeErrorZ(const CResult_CommitmentSignedBatchDecodeErrorZ&) = delete; - CResult_CommitmentSignedBatchDecodeErrorZ(CResult_CommitmentSignedBatchDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentSignedBatchDecodeErrorZ)); } - CResult_CommitmentSignedBatchDecodeErrorZ(LDKCResult_CommitmentSignedBatchDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentSignedBatchDecodeErrorZ)); } - operator LDKCResult_CommitmentSignedBatchDecodeErrorZ() && { LDKCResult_CommitmentSignedBatchDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentSignedBatchDecodeErrorZ)); return res; } - ~CResult_CommitmentSignedBatchDecodeErrorZ() { CResult_CommitmentSignedBatchDecodeErrorZ_free(self); } - CResult_CommitmentSignedBatchDecodeErrorZ& operator=(CResult_CommitmentSignedBatchDecodeErrorZ&& o) { CResult_CommitmentSignedBatchDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentSignedBatchDecodeErrorZ)); return *this; } - LDKCResult_CommitmentSignedBatchDecodeErrorZ* operator &() { return &self; } - LDKCResult_CommitmentSignedBatchDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CommitmentSignedBatchDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CommitmentSignedBatchDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelTransactionParametersDecodeErrorZ(const CResult_ChannelTransactionParametersDecodeErrorZ&) = delete; + CResult_ChannelTransactionParametersDecodeErrorZ(CResult_ChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); } + CResult_ChannelTransactionParametersDecodeErrorZ(LDKCResult_ChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); } + operator LDKCResult_ChannelTransactionParametersDecodeErrorZ() && { LDKCResult_ChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); return res; } + ~CResult_ChannelTransactionParametersDecodeErrorZ() { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); } + CResult_ChannelTransactionParametersDecodeErrorZ& operator=(CResult_ChannelTransactionParametersDecodeErrorZ&& o) { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); return *this; } + LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_HTLCDestinationZDecodeErrorZ { +class CVec_HolderCommitmentTransactionBalanceZ { private: - LDKCResult_COption_HTLCDestinationZDecodeErrorZ self; + LDKCVec_HolderCommitmentTransactionBalanceZ self; public: - CResult_COption_HTLCDestinationZDecodeErrorZ(const CResult_COption_HTLCDestinationZDecodeErrorZ&) = delete; - CResult_COption_HTLCDestinationZDecodeErrorZ(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); } - CResult_COption_HTLCDestinationZDecodeErrorZ(LDKCResult_COption_HTLCDestinationZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); } - operator LDKCResult_COption_HTLCDestinationZDecodeErrorZ() && { LDKCResult_COption_HTLCDestinationZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); return res; } - ~CResult_COption_HTLCDestinationZDecodeErrorZ() { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); } - CResult_COption_HTLCDestinationZDecodeErrorZ& operator=(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); return *this; } - LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() const { return &self; } + CVec_HolderCommitmentTransactionBalanceZ(const CVec_HolderCommitmentTransactionBalanceZ&) = delete; + CVec_HolderCommitmentTransactionBalanceZ(CVec_HolderCommitmentTransactionBalanceZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_HolderCommitmentTransactionBalanceZ)); } + CVec_HolderCommitmentTransactionBalanceZ(LDKCVec_HolderCommitmentTransactionBalanceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_HolderCommitmentTransactionBalanceZ)); } + operator LDKCVec_HolderCommitmentTransactionBalanceZ() && { LDKCVec_HolderCommitmentTransactionBalanceZ res = self; memset(&self, 0, sizeof(LDKCVec_HolderCommitmentTransactionBalanceZ)); return res; } + ~CVec_HolderCommitmentTransactionBalanceZ() { CVec_HolderCommitmentTransactionBalanceZ_free(self); } + CVec_HolderCommitmentTransactionBalanceZ& operator=(CVec_HolderCommitmentTransactionBalanceZ&& o) { CVec_HolderCommitmentTransactionBalanceZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_HolderCommitmentTransactionBalanceZ)); return *this; } + LDKCVec_HolderCommitmentTransactionBalanceZ* operator &() { return &self; } + LDKCVec_HolderCommitmentTransactionBalanceZ* operator ->() { return &self; } + const LDKCVec_HolderCommitmentTransactionBalanceZ* operator &() const { return &self; } + const LDKCVec_HolderCommitmentTransactionBalanceZ* operator ->() const { return &self; } }; class CResult_Bolt12OfferContextDecodeErrorZ { private: @@ -10503,35 +13422,20 @@ class CResult_Bolt12OfferContextDecodeErrorZ { const LDKCResult_Bolt12OfferContextDecodeErrorZ* operator &() const { return &self; } const LDKCResult_Bolt12OfferContextDecodeErrorZ* 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 { +class CResult_PaidBolt12InvoiceDecodeErrorZ { private: - LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ self; + LDKCResult_PaidBolt12InvoiceDecodeErrorZ self; public: - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(const C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&) = delete; - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); } - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); } - operator LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ() && { LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); return res; } - ~C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ() { C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(self); } - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ& operator=(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ&& o) { C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ)); return *this; } - LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator &() { return &self; } - LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator ->() { return &self; } - const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator &() const { return &self; } - const LDKC3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ* operator ->() const { return &self; } + CResult_PaidBolt12InvoiceDecodeErrorZ(const CResult_PaidBolt12InvoiceDecodeErrorZ&) = delete; + CResult_PaidBolt12InvoiceDecodeErrorZ(CResult_PaidBolt12InvoiceDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaidBolt12InvoiceDecodeErrorZ)); } + CResult_PaidBolt12InvoiceDecodeErrorZ(LDKCResult_PaidBolt12InvoiceDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaidBolt12InvoiceDecodeErrorZ)); } + operator LDKCResult_PaidBolt12InvoiceDecodeErrorZ() && { LDKCResult_PaidBolt12InvoiceDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaidBolt12InvoiceDecodeErrorZ)); return res; } + ~CResult_PaidBolt12InvoiceDecodeErrorZ() { CResult_PaidBolt12InvoiceDecodeErrorZ_free(self); } + CResult_PaidBolt12InvoiceDecodeErrorZ& operator=(CResult_PaidBolt12InvoiceDecodeErrorZ&& o) { CResult_PaidBolt12InvoiceDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaidBolt12InvoiceDecodeErrorZ)); return *this; } + LDKCResult_PaidBolt12InvoiceDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaidBolt12InvoiceDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaidBolt12InvoiceDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaidBolt12InvoiceDecodeErrorZ* operator ->() const { return &self; } }; class CResult_SendSuccessSendErrorZ { private: @@ -10548,51 +13452,6 @@ class CResult_SendSuccessSendErrorZ { const LDKCResult_SendSuccessSendErrorZ* operator &() const { return &self; } const LDKCResult_SendSuccessSendErrorZ* operator ->() const { return &self; } }; -class CResult_NoneReplayEventZ { -private: - LDKCResult_NoneReplayEventZ self; -public: - CResult_NoneReplayEventZ(const CResult_NoneReplayEventZ&) = delete; - CResult_NoneReplayEventZ(CResult_NoneReplayEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneReplayEventZ)); } - CResult_NoneReplayEventZ(LDKCResult_NoneReplayEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneReplayEventZ)); } - operator LDKCResult_NoneReplayEventZ() && { LDKCResult_NoneReplayEventZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneReplayEventZ)); return res; } - ~CResult_NoneReplayEventZ() { CResult_NoneReplayEventZ_free(self); } - CResult_NoneReplayEventZ& operator=(CResult_NoneReplayEventZ&& o) { CResult_NoneReplayEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneReplayEventZ)); return *this; } - LDKCResult_NoneReplayEventZ* operator &() { return &self; } - LDKCResult_NoneReplayEventZ* operator ->() { return &self; } - const LDKCResult_NoneReplayEventZ* operator &() const { return &self; } - const LDKCResult_NoneReplayEventZ* operator ->() const { return &self; } -}; -class C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { -private: - LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ self; -public: - C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ(const C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ&) = delete; - C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ(C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ)); } - C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ)); } - operator LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ() && { LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ)); return res; } - ~C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ() { C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(self); } - C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ& operator=(C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ&& o) { C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ)); return *this; } - LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* operator &() { return &self; } - LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* operator ->() { return &self; } - const LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* operator &() const { return &self; } - const LDKC3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ* operator ->() const { return &self; } -}; -class CResult_BlindedHopDecodeErrorZ { -private: - LDKCResult_BlindedHopDecodeErrorZ self; -public: - CResult_BlindedHopDecodeErrorZ(const CResult_BlindedHopDecodeErrorZ&) = delete; - CResult_BlindedHopDecodeErrorZ(CResult_BlindedHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); } - CResult_BlindedHopDecodeErrorZ(LDKCResult_BlindedHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); } - operator LDKCResult_BlindedHopDecodeErrorZ() && { LDKCResult_BlindedHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); return res; } - ~CResult_BlindedHopDecodeErrorZ() { CResult_BlindedHopDecodeErrorZ_free(self); } - CResult_BlindedHopDecodeErrorZ& operator=(CResult_BlindedHopDecodeErrorZ&& o) { CResult_BlindedHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); return *this; } - LDKCResult_BlindedHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedHopDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_NoneLightningErrorZ { private: LDKCResult_NoneLightningErrorZ self; @@ -10623,51 +13482,6 @@ class CResult_FixedPenaltyScorerDecodeErrorZ { const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator &() const { return &self; } const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NonePeerHandleErrorZ { -private: - LDKCResult_NonePeerHandleErrorZ self; -public: - CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; - CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } - CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } - operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } - ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } - CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; } - LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } - LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } -}; -class CResult_RawLSPSMessageDecodeErrorZ { -private: - LDKCResult_RawLSPSMessageDecodeErrorZ self; -public: - CResult_RawLSPSMessageDecodeErrorZ(const CResult_RawLSPSMessageDecodeErrorZ&) = delete; - CResult_RawLSPSMessageDecodeErrorZ(CResult_RawLSPSMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RawLSPSMessageDecodeErrorZ)); } - CResult_RawLSPSMessageDecodeErrorZ(LDKCResult_RawLSPSMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RawLSPSMessageDecodeErrorZ)); } - operator LDKCResult_RawLSPSMessageDecodeErrorZ() && { LDKCResult_RawLSPSMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RawLSPSMessageDecodeErrorZ)); return res; } - ~CResult_RawLSPSMessageDecodeErrorZ() { CResult_RawLSPSMessageDecodeErrorZ_free(self); } - CResult_RawLSPSMessageDecodeErrorZ& operator=(CResult_RawLSPSMessageDecodeErrorZ&& o) { CResult_RawLSPSMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RawLSPSMessageDecodeErrorZ)); return *this; } - LDKCResult_RawLSPSMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_RawLSPSMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RawLSPSMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RawLSPSMessageDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_FinalOnionHopDataDecodeErrorZ { -private: - LDKCResult_FinalOnionHopDataDecodeErrorZ self; -public: - CResult_FinalOnionHopDataDecodeErrorZ(const CResult_FinalOnionHopDataDecodeErrorZ&) = delete; - CResult_FinalOnionHopDataDecodeErrorZ(CResult_FinalOnionHopDataDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FinalOnionHopDataDecodeErrorZ)); } - CResult_FinalOnionHopDataDecodeErrorZ(LDKCResult_FinalOnionHopDataDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ)); } - operator LDKCResult_FinalOnionHopDataDecodeErrorZ() && { LDKCResult_FinalOnionHopDataDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FinalOnionHopDataDecodeErrorZ)); return res; } - ~CResult_FinalOnionHopDataDecodeErrorZ() { CResult_FinalOnionHopDataDecodeErrorZ_free(self); } - CResult_FinalOnionHopDataDecodeErrorZ& operator=(CResult_FinalOnionHopDataDecodeErrorZ&& o) { CResult_FinalOnionHopDataDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FinalOnionHopDataDecodeErrorZ)); return *this; } - LDKCResult_FinalOnionHopDataDecodeErrorZ* operator &() { return &self; } - LDKCResult_FinalOnionHopDataDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_FinalOnionHopDataDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_FinalOnionHopDataDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_TrustedCommitmentTransactionNoneZ { private: LDKCResult_TrustedCommitmentTransactionNoneZ self; @@ -10683,51 +13497,6 @@ class CResult_TrustedCommitmentTransactionNoneZ { const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } }; -class CResult_DNSResolverMessageDecodeErrorZ { -private: - LDKCResult_DNSResolverMessageDecodeErrorZ self; -public: - CResult_DNSResolverMessageDecodeErrorZ(const CResult_DNSResolverMessageDecodeErrorZ&) = delete; - CResult_DNSResolverMessageDecodeErrorZ(CResult_DNSResolverMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); } - CResult_DNSResolverMessageDecodeErrorZ(LDKCResult_DNSResolverMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); } - operator LDKCResult_DNSResolverMessageDecodeErrorZ() && { LDKCResult_DNSResolverMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); return res; } - ~CResult_DNSResolverMessageDecodeErrorZ() { CResult_DNSResolverMessageDecodeErrorZ_free(self); } - CResult_DNSResolverMessageDecodeErrorZ& operator=(CResult_DNSResolverMessageDecodeErrorZ&& o) { CResult_DNSResolverMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); return *this; } - LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_PublicKeyChannelIdZ { -private: - LDKC2Tuple_PublicKeyChannelIdZ self; -public: - C2Tuple_PublicKeyChannelIdZ(const C2Tuple_PublicKeyChannelIdZ&) = delete; - C2Tuple_PublicKeyChannelIdZ(C2Tuple_PublicKeyChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); } - C2Tuple_PublicKeyChannelIdZ(LDKC2Tuple_PublicKeyChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); } - operator LDKC2Tuple_PublicKeyChannelIdZ() && { LDKC2Tuple_PublicKeyChannelIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); return res; } - ~C2Tuple_PublicKeyChannelIdZ() { C2Tuple_PublicKeyChannelIdZ_free(self); } - C2Tuple_PublicKeyChannelIdZ& operator=(C2Tuple_PublicKeyChannelIdZ&& o) { C2Tuple_PublicKeyChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); return *this; } - LDKC2Tuple_PublicKeyChannelIdZ* operator &() { return &self; } - LDKC2Tuple_PublicKeyChannelIdZ* operator ->() { return &self; } - const LDKC2Tuple_PublicKeyChannelIdZ* operator &() const { return &self; } - const LDKC2Tuple_PublicKeyChannelIdZ* operator ->() const { return &self; } -}; -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 COption_SocketAddressZ { private: LDKCOption_SocketAddressZ self; @@ -10758,21 +13527,6 @@ class CResult_COption_MonitorEventZDecodeErrorZ { const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; } }; -class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { -private: - LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ self; -public: - 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_COption_OutboundHTLCStateDetailsZDecodeErrorZ { private: LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ self; @@ -10788,6 +13542,21 @@ class CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { const LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_DescriptionCreationErrorZ { +private: + LDKCResult_DescriptionCreationErrorZ self; +public: + CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; + CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } + CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } + operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } + ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } + CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } + LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } + LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } +}; class CResult_RoutingFeesDecodeErrorZ { private: LDKCResult_RoutingFeesDecodeErrorZ self; @@ -10818,20 +13587,20 @@ class CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ* operator ->() const { return &self; } }; -class CResult_DescriptionCreationErrorZ { +class CResult_PacketDecodeErrorZ { private: - LDKCResult_DescriptionCreationErrorZ self; + LDKCResult_PacketDecodeErrorZ self; public: - CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; - CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } - CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } - operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } - ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } - CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } - LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } - LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } + CResult_PacketDecodeErrorZ(const CResult_PacketDecodeErrorZ&) = delete; + CResult_PacketDecodeErrorZ(CResult_PacketDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PacketDecodeErrorZ)); } + CResult_PacketDecodeErrorZ(LDKCResult_PacketDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PacketDecodeErrorZ)); } + operator LDKCResult_PacketDecodeErrorZ() && { LDKCResult_PacketDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PacketDecodeErrorZ)); return res; } + ~CResult_PacketDecodeErrorZ() { CResult_PacketDecodeErrorZ_free(self); } + CResult_PacketDecodeErrorZ& operator=(CResult_PacketDecodeErrorZ&& o) { CResult_PacketDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PacketDecodeErrorZ)); return *this; } + LDKCResult_PacketDecodeErrorZ* operator &() { return &self; } + LDKCResult_PacketDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PacketDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PacketDecodeErrorZ* operator ->() const { return &self; } }; class CResult_PaymentRelayDecodeErrorZ { private: @@ -10878,35 +13647,35 @@ class CResult_VerifiedInvoiceRequestNoneZ { const LDKCResult_VerifiedInvoiceRequestNoneZ* operator &() const { return &self; } const LDKCResult_VerifiedInvoiceRequestNoneZ* operator ->() const { return &self; } }; -class CResult_UpdateAddHTLCDecodeErrorZ { +class COption_HTLCHandlingFailureTypeZ { private: - LDKCResult_UpdateAddHTLCDecodeErrorZ self; + LDKCOption_HTLCHandlingFailureTypeZ self; public: - CResult_UpdateAddHTLCDecodeErrorZ(const CResult_UpdateAddHTLCDecodeErrorZ&) = delete; - CResult_UpdateAddHTLCDecodeErrorZ(CResult_UpdateAddHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); } - CResult_UpdateAddHTLCDecodeErrorZ(LDKCResult_UpdateAddHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); } - operator LDKCResult_UpdateAddHTLCDecodeErrorZ() && { LDKCResult_UpdateAddHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); return res; } - ~CResult_UpdateAddHTLCDecodeErrorZ() { CResult_UpdateAddHTLCDecodeErrorZ_free(self); } - CResult_UpdateAddHTLCDecodeErrorZ& operator=(CResult_UpdateAddHTLCDecodeErrorZ&& o) { CResult_UpdateAddHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); return *this; } - LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } + COption_HTLCHandlingFailureTypeZ(const COption_HTLCHandlingFailureTypeZ&) = delete; + COption_HTLCHandlingFailureTypeZ(COption_HTLCHandlingFailureTypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCHandlingFailureTypeZ)); } + COption_HTLCHandlingFailureTypeZ(LDKCOption_HTLCHandlingFailureTypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCHandlingFailureTypeZ)); } + operator LDKCOption_HTLCHandlingFailureTypeZ() && { LDKCOption_HTLCHandlingFailureTypeZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCHandlingFailureTypeZ)); return res; } + ~COption_HTLCHandlingFailureTypeZ() { COption_HTLCHandlingFailureTypeZ_free(self); } + COption_HTLCHandlingFailureTypeZ& operator=(COption_HTLCHandlingFailureTypeZ&& o) { COption_HTLCHandlingFailureTypeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCHandlingFailureTypeZ)); return *this; } + LDKCOption_HTLCHandlingFailureTypeZ* operator &() { return &self; } + LDKCOption_HTLCHandlingFailureTypeZ* operator ->() { return &self; } + const LDKCOption_HTLCHandlingFailureTypeZ* operator &() const { return &self; } + const LDKCOption_HTLCHandlingFailureTypeZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { +class CVec_u32Z { private: - LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ self; + LDKCVec_u32Z self; public: - CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(const CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&) = delete; - CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } - CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } - operator LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() && { LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return res; } - ~CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); } - CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ& operator=(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return *this; } - LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() { return &self; } - LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() const { return &self; } + CVec_u32Z(const CVec_u32Z&) = delete; + CVec_u32Z(CVec_u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u32Z)); } + CVec_u32Z(LDKCVec_u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u32Z)); } + operator LDKCVec_u32Z() && { LDKCVec_u32Z res = self; memset(&self, 0, sizeof(LDKCVec_u32Z)); return res; } + ~CVec_u32Z() { CVec_u32Z_free(self); } + CVec_u32Z& operator=(CVec_u32Z&& o) { CVec_u32Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u32Z)); return *this; } + LDKCVec_u32Z* operator &() { return &self; } + LDKCVec_u32Z* operator ->() { return &self; } + const LDKCVec_u32Z* operator &() const { return &self; } + const LDKCVec_u32Z* operator ->() const { return &self; } }; class COption_OutboundHTLCStateDetailsZ { private: @@ -10953,21 +13722,6 @@ class CResult_COption_TypeZDecodeErrorZ { const LDKCResult_COption_TypeZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_TypeZDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { -private: - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ self; -public: - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&) = delete; - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } - operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return res; } - ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); } - C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return *this; } - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() { return &self; } - LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() { return &self; } - const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() const { return &self; } - const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() const { return &self; } -}; class CResult_OfferDecodeErrorZ { private: LDKCResult_OfferDecodeErrorZ self; @@ -10979,24 +13733,24 @@ class CResult_OfferDecodeErrorZ { ~CResult_OfferDecodeErrorZ() { CResult_OfferDecodeErrorZ_free(self); } CResult_OfferDecodeErrorZ& operator=(CResult_OfferDecodeErrorZ&& o) { CResult_OfferDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferDecodeErrorZ)); return *this; } LDKCResult_OfferDecodeErrorZ* operator &() { return &self; } - LDKCResult_OfferDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OfferDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OfferDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_TypeZ { -private: - LDKCOption_TypeZ self; -public: - COption_TypeZ(const COption_TypeZ&) = delete; - COption_TypeZ(COption_TypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TypeZ)); } - COption_TypeZ(LDKCOption_TypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TypeZ)); } - operator LDKCOption_TypeZ() && { LDKCOption_TypeZ res = self; memset(&self, 0, sizeof(LDKCOption_TypeZ)); return res; } - ~COption_TypeZ() { COption_TypeZ_free(self); } - COption_TypeZ& operator=(COption_TypeZ&& o) { COption_TypeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TypeZ)); return *this; } - LDKCOption_TypeZ* operator &() { return &self; } - LDKCOption_TypeZ* operator ->() { return &self; } - const LDKCOption_TypeZ* operator &() const { return &self; } - const LDKCOption_TypeZ* operator ->() const { return &self; } + LDKCResult_OfferDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OfferDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OfferDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_OfferboolZ { +private: + LDKC2Tuple_OfferboolZ self; +public: + C2Tuple_OfferboolZ(const C2Tuple_OfferboolZ&) = delete; + C2Tuple_OfferboolZ(C2Tuple_OfferboolZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OfferboolZ)); } + C2Tuple_OfferboolZ(LDKC2Tuple_OfferboolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OfferboolZ)); } + operator LDKC2Tuple_OfferboolZ() && { LDKC2Tuple_OfferboolZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OfferboolZ)); return res; } + ~C2Tuple_OfferboolZ() { C2Tuple_OfferboolZ_free(self); } + C2Tuple_OfferboolZ& operator=(C2Tuple_OfferboolZ&& o) { C2Tuple_OfferboolZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OfferboolZ)); return *this; } + LDKC2Tuple_OfferboolZ* operator &() { return &self; } + LDKC2Tuple_OfferboolZ* operator ->() { return &self; } + const LDKC2Tuple_OfferboolZ* operator &() const { return &self; } + const LDKC2Tuple_OfferboolZ* operator ->() const { return &self; } }; class CResult_Bolt11InvoiceSignOrCreationErrorZ { private: @@ -11013,21 +13767,6 @@ class CResult_Bolt11InvoiceSignOrCreationErrorZ { const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator &() const { return &self; } const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator ->() const { return &self; } }; -class CResult_COption_PathFailureZDecodeErrorZ { -private: - LDKCResult_COption_PathFailureZDecodeErrorZ 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; } -}; class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { private: LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ self; @@ -11043,21 +13782,6 @@ class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator &() const { return &self; } const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator ->() const { return &self; } }; -class COption_C2Tuple_PublicKeyChannelIdZZ { -private: - LDKCOption_C2Tuple_PublicKeyChannelIdZZ self; -public: - COption_C2Tuple_PublicKeyChannelIdZZ(const COption_C2Tuple_PublicKeyChannelIdZZ&) = delete; - COption_C2Tuple_PublicKeyChannelIdZZ(COption_C2Tuple_PublicKeyChannelIdZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); } - COption_C2Tuple_PublicKeyChannelIdZZ(LDKCOption_C2Tuple_PublicKeyChannelIdZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); } - operator LDKCOption_C2Tuple_PublicKeyChannelIdZZ() && { LDKCOption_C2Tuple_PublicKeyChannelIdZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); return res; } - ~COption_C2Tuple_PublicKeyChannelIdZZ() { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); } - COption_C2Tuple_PublicKeyChannelIdZZ& operator=(COption_C2Tuple_PublicKeyChannelIdZZ&& o) { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); return *this; } - LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() { return &self; } - LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() const { return &self; } -}; class CResult_UpdateFailHTLCDecodeErrorZ { private: LDKCResult_UpdateFailHTLCDecodeErrorZ self; @@ -11103,36 +13827,6 @@ class CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { const LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { -private: - LDKCVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ self; -public: - 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_SpendableOutputDescriptorDecodeErrorZ { -private: - LDKCResult_SpendableOutputDescriptorDecodeErrorZ self; -public: - CResult_SpendableOutputDescriptorDecodeErrorZ(const CResult_SpendableOutputDescriptorDecodeErrorZ&) = delete; - CResult_SpendableOutputDescriptorDecodeErrorZ(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); } - CResult_SpendableOutputDescriptorDecodeErrorZ(LDKCResult_SpendableOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); } - operator LDKCResult_SpendableOutputDescriptorDecodeErrorZ() && { LDKCResult_SpendableOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); return res; } - ~CResult_SpendableOutputDescriptorDecodeErrorZ() { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); } - CResult_SpendableOutputDescriptorDecodeErrorZ& operator=(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); return *this; } - LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() { return &self; } - LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_RevokeAndACKDecodeErrorZ { private: LDKCResult_RevokeAndACKDecodeErrorZ self; @@ -11148,65 +13842,35 @@ class CResult_RevokeAndACKDecodeErrorZ { const LDKCResult_RevokeAndACKDecodeErrorZ* operator &() const { return &self; } const LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_UnsignedChannelUpdateDecodeErrorZ { -private: - LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; -public: - CResult_UnsignedChannelUpdateDecodeErrorZ(const CResult_UnsignedChannelUpdateDecodeErrorZ&) = delete; - CResult_UnsignedChannelUpdateDecodeErrorZ(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); } - CResult_UnsignedChannelUpdateDecodeErrorZ(LDKCResult_UnsignedChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); } - operator LDKCResult_UnsignedChannelUpdateDecodeErrorZ() && { LDKCResult_UnsignedChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); return res; } - ~CResult_UnsignedChannelUpdateDecodeErrorZ() { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); } - CResult_UnsignedChannelUpdateDecodeErrorZ& operator=(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); return *this; } - LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_MonitorNameIOErrorZ { -private: - LDKCResult_MonitorNameIOErrorZ self; -public: - CResult_MonitorNameIOErrorZ(const CResult_MonitorNameIOErrorZ&) = delete; - CResult_MonitorNameIOErrorZ(CResult_MonitorNameIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MonitorNameIOErrorZ)); } - CResult_MonitorNameIOErrorZ(LDKCResult_MonitorNameIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MonitorNameIOErrorZ)); } - operator LDKCResult_MonitorNameIOErrorZ() && { LDKCResult_MonitorNameIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MonitorNameIOErrorZ)); return res; } - ~CResult_MonitorNameIOErrorZ() { CResult_MonitorNameIOErrorZ_free(self); } - CResult_MonitorNameIOErrorZ& operator=(CResult_MonitorNameIOErrorZ&& o) { CResult_MonitorNameIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MonitorNameIOErrorZ)); return *this; } - LDKCResult_MonitorNameIOErrorZ* operator &() { return &self; } - LDKCResult_MonitorNameIOErrorZ* operator ->() { return &self; } - const LDKCResult_MonitorNameIOErrorZ* operator &() const { return &self; } - const LDKCResult_MonitorNameIOErrorZ* operator ->() const { return &self; } -}; -class CResult_PayeePubKeySecp256k1ErrorZ { +class CResult_SpendableOutputDescriptorDecodeErrorZ { private: - LDKCResult_PayeePubKeySecp256k1ErrorZ self; + LDKCResult_SpendableOutputDescriptorDecodeErrorZ 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; } + CResult_SpendableOutputDescriptorDecodeErrorZ(const CResult_SpendableOutputDescriptorDecodeErrorZ&) = delete; + CResult_SpendableOutputDescriptorDecodeErrorZ(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); } + CResult_SpendableOutputDescriptorDecodeErrorZ(LDKCResult_SpendableOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_SpendableOutputDescriptorDecodeErrorZ() && { LDKCResult_SpendableOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_SpendableOutputDescriptorDecodeErrorZ() { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); } + CResult_SpendableOutputDescriptorDecodeErrorZ& operator=(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple__u832u16Z { +class CResult_EncryptedOurPeerStorageNoneZ { private: - LDKC2Tuple__u832u16Z self; + LDKCResult_EncryptedOurPeerStorageNoneZ self; public: - C2Tuple__u832u16Z(const C2Tuple__u832u16Z&) = delete; - C2Tuple__u832u16Z(C2Tuple__u832u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple__u832u16Z)); } - C2Tuple__u832u16Z(LDKC2Tuple__u832u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple__u832u16Z)); } - operator LDKC2Tuple__u832u16Z() && { LDKC2Tuple__u832u16Z res = self; memset(&self, 0, sizeof(LDKC2Tuple__u832u16Z)); return res; } - ~C2Tuple__u832u16Z() { C2Tuple__u832u16Z_free(self); } - C2Tuple__u832u16Z& operator=(C2Tuple__u832u16Z&& o) { C2Tuple__u832u16Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple__u832u16Z)); return *this; } - LDKC2Tuple__u832u16Z* operator &() { return &self; } - LDKC2Tuple__u832u16Z* operator ->() { return &self; } - const LDKC2Tuple__u832u16Z* operator &() const { return &self; } - const LDKC2Tuple__u832u16Z* operator ->() const { return &self; } + CResult_EncryptedOurPeerStorageNoneZ(const CResult_EncryptedOurPeerStorageNoneZ&) = delete; + CResult_EncryptedOurPeerStorageNoneZ(CResult_EncryptedOurPeerStorageNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_EncryptedOurPeerStorageNoneZ)); } + CResult_EncryptedOurPeerStorageNoneZ(LDKCResult_EncryptedOurPeerStorageNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_EncryptedOurPeerStorageNoneZ)); } + operator LDKCResult_EncryptedOurPeerStorageNoneZ() && { LDKCResult_EncryptedOurPeerStorageNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_EncryptedOurPeerStorageNoneZ)); return res; } + ~CResult_EncryptedOurPeerStorageNoneZ() { CResult_EncryptedOurPeerStorageNoneZ_free(self); } + CResult_EncryptedOurPeerStorageNoneZ& operator=(CResult_EncryptedOurPeerStorageNoneZ&& o) { CResult_EncryptedOurPeerStorageNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_EncryptedOurPeerStorageNoneZ)); return *this; } + LDKCResult_EncryptedOurPeerStorageNoneZ* operator &() { return &self; } + LDKCResult_EncryptedOurPeerStorageNoneZ* operator ->() { return &self; } + const LDKCResult_EncryptedOurPeerStorageNoneZ* operator &() const { return &self; } + const LDKCResult_EncryptedOurPeerStorageNoneZ* operator ->() const { return &self; } }; class CResult_BlindedMessagePathDecodeErrorZ { private: @@ -11223,21 +13887,6 @@ class CResult_BlindedMessagePathDecodeErrorZ { const LDKCResult_BlindedMessagePathDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedMessagePathDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_BlindedMessagePathNoneZ { -private: - LDKCResult_BlindedMessagePathNoneZ self; -public: - CResult_BlindedMessagePathNoneZ(const CResult_BlindedMessagePathNoneZ&) = delete; - CResult_BlindedMessagePathNoneZ(CResult_BlindedMessagePathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); } - CResult_BlindedMessagePathNoneZ(LDKCResult_BlindedMessagePathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); } - operator LDKCResult_BlindedMessagePathNoneZ() && { LDKCResult_BlindedMessagePathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); return res; } - ~CResult_BlindedMessagePathNoneZ() { CResult_BlindedMessagePathNoneZ_free(self); } - CResult_BlindedMessagePathNoneZ& operator=(CResult_BlindedMessagePathNoneZ&& o) { CResult_BlindedMessagePathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); return *this; } - LDKCResult_BlindedMessagePathNoneZ* operator &() { return &self; } - LDKCResult_BlindedMessagePathNoneZ* operator ->() { return &self; } - const LDKCResult_BlindedMessagePathNoneZ* operator &() const { return &self; } - const LDKCResult_BlindedMessagePathNoneZ* operator ->() const { return &self; } -}; class CResult_CVec_BlindedMessagePathZNoneZ { private: LDKCResult_CVec_BlindedMessagePathZNoneZ self; @@ -11268,20 +13917,20 @@ class COption_BigEndianScalarZ { const LDKCOption_BigEndianScalarZ* operator &() const { return &self; } const LDKCOption_BigEndianScalarZ* operator ->() const { return &self; } }; -class CVec_ChannelIdZ { +class C2Tuple_OnionMessageContentsMessageSendInstructionsZ { private: - LDKCVec_ChannelIdZ self; + LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ self; public: - CVec_ChannelIdZ(const CVec_ChannelIdZ&) = delete; - CVec_ChannelIdZ(CVec_ChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelIdZ)); } - CVec_ChannelIdZ(LDKCVec_ChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelIdZ)); } - operator LDKCVec_ChannelIdZ() && { LDKCVec_ChannelIdZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelIdZ)); return res; } - ~CVec_ChannelIdZ() { CVec_ChannelIdZ_free(self); } - CVec_ChannelIdZ& operator=(CVec_ChannelIdZ&& o) { CVec_ChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelIdZ)); return *this; } - LDKCVec_ChannelIdZ* operator &() { return &self; } - LDKCVec_ChannelIdZ* operator ->() { return &self; } - const LDKCVec_ChannelIdZ* operator &() const { return &self; } - const LDKCVec_ChannelIdZ* operator ->() const { return &self; } + C2Tuple_OnionMessageContentsMessageSendInstructionsZ(const C2Tuple_OnionMessageContentsMessageSendInstructionsZ&) = delete; + C2Tuple_OnionMessageContentsMessageSendInstructionsZ(C2Tuple_OnionMessageContentsMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OnionMessageContentsMessageSendInstructionsZ)); } + C2Tuple_OnionMessageContentsMessageSendInstructionsZ(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ)); } + operator LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ() && { LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ)); return res; } + ~C2Tuple_OnionMessageContentsMessageSendInstructionsZ() { C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(self); } + C2Tuple_OnionMessageContentsMessageSendInstructionsZ& operator=(C2Tuple_OnionMessageContentsMessageSendInstructionsZ&& o) { C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OnionMessageContentsMessageSendInstructionsZ)); return *this; } + LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator &() { return &self; } + LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator ->() { return &self; } + const LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator &() const { return &self; } + const LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator ->() const { return &self; } }; class CResult_PublicKeySecp256k1ErrorZ { private: @@ -11298,20 +13947,20 @@ class CResult_PublicKeySecp256k1ErrorZ { const LDKCResult_PublicKeySecp256k1ErrorZ* operator &() const { return &self; } const LDKCResult_PublicKeySecp256k1ErrorZ* operator ->() const { return &self; } }; -class C2Tuple_OnionMessageContentsMessageSendInstructionsZ { +class CResult_TrampolineOnionPacketDecodeErrorZ { private: - LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ self; + LDKCResult_TrampolineOnionPacketDecodeErrorZ self; public: - C2Tuple_OnionMessageContentsMessageSendInstructionsZ(const C2Tuple_OnionMessageContentsMessageSendInstructionsZ&) = delete; - C2Tuple_OnionMessageContentsMessageSendInstructionsZ(C2Tuple_OnionMessageContentsMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OnionMessageContentsMessageSendInstructionsZ)); } - C2Tuple_OnionMessageContentsMessageSendInstructionsZ(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ)); } - operator LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ() && { LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ)); return res; } - ~C2Tuple_OnionMessageContentsMessageSendInstructionsZ() { C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(self); } - C2Tuple_OnionMessageContentsMessageSendInstructionsZ& operator=(C2Tuple_OnionMessageContentsMessageSendInstructionsZ&& o) { C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OnionMessageContentsMessageSendInstructionsZ)); return *this; } - LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator &() { return &self; } - LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator ->() { return &self; } - const LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator &() const { return &self; } - const LDKC2Tuple_OnionMessageContentsMessageSendInstructionsZ* operator ->() const { return &self; } + CResult_TrampolineOnionPacketDecodeErrorZ(const CResult_TrampolineOnionPacketDecodeErrorZ&) = delete; + CResult_TrampolineOnionPacketDecodeErrorZ(CResult_TrampolineOnionPacketDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrampolineOnionPacketDecodeErrorZ)); } + CResult_TrampolineOnionPacketDecodeErrorZ(LDKCResult_TrampolineOnionPacketDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrampolineOnionPacketDecodeErrorZ)); } + operator LDKCResult_TrampolineOnionPacketDecodeErrorZ() && { LDKCResult_TrampolineOnionPacketDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TrampolineOnionPacketDecodeErrorZ)); return res; } + ~CResult_TrampolineOnionPacketDecodeErrorZ() { CResult_TrampolineOnionPacketDecodeErrorZ_free(self); } + CResult_TrampolineOnionPacketDecodeErrorZ& operator=(CResult_TrampolineOnionPacketDecodeErrorZ&& o) { CResult_TrampolineOnionPacketDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrampolineOnionPacketDecodeErrorZ)); return *this; } + LDKCResult_TrampolineOnionPacketDecodeErrorZ* operator &() { return &self; } + LDKCResult_TrampolineOnionPacketDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TrampolineOnionPacketDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TrampolineOnionPacketDecodeErrorZ* operator ->() const { return &self; } }; class CVec_BlindedHopZ { private: @@ -11373,95 +14022,20 @@ class CResult_COption_ClosureReasonZDecodeErrorZ { const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; } }; -class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { -private: - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; -public: - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete; - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } - operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() && { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } - ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ& operator=(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return *this; } - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; } - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; } - const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } - const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } -}; -class CResult_NonceDecodeErrorZ { -private: - LDKCResult_NonceDecodeErrorZ self; -public: - CResult_NonceDecodeErrorZ(const CResult_NonceDecodeErrorZ&) = delete; - CResult_NonceDecodeErrorZ(CResult_NonceDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonceDecodeErrorZ)); } - CResult_NonceDecodeErrorZ(LDKCResult_NonceDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonceDecodeErrorZ)); } - operator LDKCResult_NonceDecodeErrorZ() && { LDKCResult_NonceDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonceDecodeErrorZ)); return res; } - ~CResult_NonceDecodeErrorZ() { CResult_NonceDecodeErrorZ_free(self); } - CResult_NonceDecodeErrorZ& operator=(CResult_NonceDecodeErrorZ&& o) { CResult_NonceDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonceDecodeErrorZ)); return *this; } - LDKCResult_NonceDecodeErrorZ* operator &() { return &self; } - LDKCResult_NonceDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NonceDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NonceDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_RouteParametersDecodeErrorZ { -private: - LDKCResult_RouteParametersDecodeErrorZ self; -public: - CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; - CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } - CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } - operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } - ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } - CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } - LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_LSPSDateTimeNoneZ { -private: - LDKCResult_LSPSDateTimeNoneZ self; -public: - CResult_LSPSDateTimeNoneZ(const CResult_LSPSDateTimeNoneZ&) = delete; - CResult_LSPSDateTimeNoneZ(CResult_LSPSDateTimeNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LSPSDateTimeNoneZ)); } - CResult_LSPSDateTimeNoneZ(LDKCResult_LSPSDateTimeNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LSPSDateTimeNoneZ)); } - operator LDKCResult_LSPSDateTimeNoneZ() && { LDKCResult_LSPSDateTimeNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_LSPSDateTimeNoneZ)); return res; } - ~CResult_LSPSDateTimeNoneZ() { CResult_LSPSDateTimeNoneZ_free(self); } - CResult_LSPSDateTimeNoneZ& operator=(CResult_LSPSDateTimeNoneZ&& o) { CResult_LSPSDateTimeNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LSPSDateTimeNoneZ)); return *this; } - LDKCResult_LSPSDateTimeNoneZ* operator &() { return &self; } - LDKCResult_LSPSDateTimeNoneZ* operator ->() { return &self; } - const LDKCResult_LSPSDateTimeNoneZ* operator &() const { return &self; } - const LDKCResult_LSPSDateTimeNoneZ* operator ->() const { return &self; } -}; -class CResult_u64NoneZ { -private: - LDKCResult_u64NoneZ self; -public: - CResult_u64NoneZ(const CResult_u64NoneZ&) = delete; - CResult_u64NoneZ(CResult_u64NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u64NoneZ)); } - CResult_u64NoneZ(LDKCResult_u64NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u64NoneZ)); } - operator LDKCResult_u64NoneZ() && { LDKCResult_u64NoneZ res = self; memset(&self, 0, sizeof(LDKCResult_u64NoneZ)); return res; } - ~CResult_u64NoneZ() { CResult_u64NoneZ_free(self); } - CResult_u64NoneZ& operator=(CResult_u64NoneZ&& o) { CResult_u64NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u64NoneZ)); return *this; } - LDKCResult_u64NoneZ* operator &() { return &self; } - LDKCResult_u64NoneZ* operator ->() { return &self; } - const LDKCResult_u64NoneZ* operator &() const { return &self; } - const LDKCResult_u64NoneZ* operator ->() const { return &self; } -}; -class CResult_NodeAliasDecodeErrorZ { +class CResult_InvoiceErrorDecodeErrorZ { private: - LDKCResult_NodeAliasDecodeErrorZ self; + LDKCResult_InvoiceErrorDecodeErrorZ self; public: - CResult_NodeAliasDecodeErrorZ(const CResult_NodeAliasDecodeErrorZ&) = delete; - CResult_NodeAliasDecodeErrorZ(CResult_NodeAliasDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); } - CResult_NodeAliasDecodeErrorZ(LDKCResult_NodeAliasDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); } - operator LDKCResult_NodeAliasDecodeErrorZ() && { LDKCResult_NodeAliasDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); return res; } - ~CResult_NodeAliasDecodeErrorZ() { CResult_NodeAliasDecodeErrorZ_free(self); } - CResult_NodeAliasDecodeErrorZ& operator=(CResult_NodeAliasDecodeErrorZ&& o) { CResult_NodeAliasDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); return *this; } - LDKCResult_NodeAliasDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeAliasDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeAliasDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeAliasDecodeErrorZ* operator ->() const { return &self; } + 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_PrivateRouteCreationErrorZ { private: @@ -11478,35 +14052,20 @@ class CResult_PrivateRouteCreationErrorZ { const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; } const LDKCResult_PrivateRouteCreationErrorZ* 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 C2Tuple_BestBlockOutputSweeperZ { +class CResult_NodeAliasDecodeErrorZ { private: - LDKC2Tuple_BestBlockOutputSweeperZ self; + LDKCResult_NodeAliasDecodeErrorZ self; public: - C2Tuple_BestBlockOutputSweeperZ(const C2Tuple_BestBlockOutputSweeperZ&) = delete; - C2Tuple_BestBlockOutputSweeperZ(C2Tuple_BestBlockOutputSweeperZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BestBlockOutputSweeperZ)); } - C2Tuple_BestBlockOutputSweeperZ(LDKC2Tuple_BestBlockOutputSweeperZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BestBlockOutputSweeperZ)); } - operator LDKC2Tuple_BestBlockOutputSweeperZ() && { LDKC2Tuple_BestBlockOutputSweeperZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BestBlockOutputSweeperZ)); return res; } - ~C2Tuple_BestBlockOutputSweeperZ() { C2Tuple_BestBlockOutputSweeperZ_free(self); } - C2Tuple_BestBlockOutputSweeperZ& operator=(C2Tuple_BestBlockOutputSweeperZ&& o) { C2Tuple_BestBlockOutputSweeperZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BestBlockOutputSweeperZ)); return *this; } - LDKC2Tuple_BestBlockOutputSweeperZ* operator &() { return &self; } - LDKC2Tuple_BestBlockOutputSweeperZ* operator ->() { return &self; } - const LDKC2Tuple_BestBlockOutputSweeperZ* operator &() const { return &self; } - const LDKC2Tuple_BestBlockOutputSweeperZ* operator ->() const { return &self; } + CResult_NodeAliasDecodeErrorZ(const CResult_NodeAliasDecodeErrorZ&) = delete; + CResult_NodeAliasDecodeErrorZ(CResult_NodeAliasDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); } + CResult_NodeAliasDecodeErrorZ(LDKCResult_NodeAliasDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); } + operator LDKCResult_NodeAliasDecodeErrorZ() && { LDKCResult_NodeAliasDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); return res; } + ~CResult_NodeAliasDecodeErrorZ() { CResult_NodeAliasDecodeErrorZ_free(self); } + CResult_NodeAliasDecodeErrorZ& operator=(CResult_NodeAliasDecodeErrorZ&& o) { CResult_NodeAliasDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); return *this; } + LDKCResult_NodeAliasDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAliasDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAliasDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAliasDecodeErrorZ* operator ->() const { return &self; } }; class CVec_UpdateFulfillHTLCZ { private: @@ -11523,36 +14082,6 @@ 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 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { -private: - LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ self; -public: - C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(const C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&) = delete; - C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); } - C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); } - operator LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ() && { LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); return res; } - ~C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ() { C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(self); } - C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ& operator=(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ&& o) { C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ)); return *this; } - LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator &() { return &self; } - LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator ->() { return &self; } - const LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator &() const { return &self; } - const LDKC3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ* operator ->() const { return &self; } -}; class CResult_AnnouncementSignaturesDecodeErrorZ { private: LDKCResult_AnnouncementSignaturesDecodeErrorZ self; @@ -11568,21 +14097,6 @@ class CResult_AnnouncementSignaturesDecodeErrorZ { const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator &() const { return &self; } const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TxCompleteDecodeErrorZ { -private: - LDKCResult_TxCompleteDecodeErrorZ self; -public: - CResult_TxCompleteDecodeErrorZ(const CResult_TxCompleteDecodeErrorZ&) = delete; - CResult_TxCompleteDecodeErrorZ(CResult_TxCompleteDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCompleteDecodeErrorZ)); } - CResult_TxCompleteDecodeErrorZ(LDKCResult_TxCompleteDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCompleteDecodeErrorZ)); } - operator LDKCResult_TxCompleteDecodeErrorZ() && { LDKCResult_TxCompleteDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCompleteDecodeErrorZ)); return res; } - ~CResult_TxCompleteDecodeErrorZ() { CResult_TxCompleteDecodeErrorZ_free(self); } - CResult_TxCompleteDecodeErrorZ& operator=(CResult_TxCompleteDecodeErrorZ&& o) { CResult_TxCompleteDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCompleteDecodeErrorZ)); return *this; } - LDKCResult_TxCompleteDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxCompleteDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxCompleteDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxCompleteDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_UpdateFulfillHTLCDecodeErrorZ { private: LDKCResult_UpdateFulfillHTLCDecodeErrorZ self; @@ -11598,35 +14112,35 @@ class CResult_UpdateFulfillHTLCDecodeErrorZ { const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NodeFeaturesDecodeErrorZ { +class CResult_TxCompleteDecodeErrorZ { private: - LDKCResult_NodeFeaturesDecodeErrorZ self; + LDKCResult_TxCompleteDecodeErrorZ self; public: - CResult_NodeFeaturesDecodeErrorZ(const CResult_NodeFeaturesDecodeErrorZ&) = delete; - CResult_NodeFeaturesDecodeErrorZ(CResult_NodeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); } - CResult_NodeFeaturesDecodeErrorZ(LDKCResult_NodeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); } - operator LDKCResult_NodeFeaturesDecodeErrorZ() && { LDKCResult_NodeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); return res; } - ~CResult_NodeFeaturesDecodeErrorZ() { CResult_NodeFeaturesDecodeErrorZ_free(self); } - CResult_NodeFeaturesDecodeErrorZ& operator=(CResult_NodeFeaturesDecodeErrorZ&& o) { CResult_NodeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); return *this; } - LDKCResult_NodeFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() const { return &self; } + CResult_TxCompleteDecodeErrorZ(const CResult_TxCompleteDecodeErrorZ&) = delete; + CResult_TxCompleteDecodeErrorZ(CResult_TxCompleteDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCompleteDecodeErrorZ)); } + CResult_TxCompleteDecodeErrorZ(LDKCResult_TxCompleteDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCompleteDecodeErrorZ)); } + operator LDKCResult_TxCompleteDecodeErrorZ() && { LDKCResult_TxCompleteDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCompleteDecodeErrorZ)); return res; } + ~CResult_TxCompleteDecodeErrorZ() { CResult_TxCompleteDecodeErrorZ_free(self); } + CResult_TxCompleteDecodeErrorZ& operator=(CResult_TxCompleteDecodeErrorZ&& o) { CResult_TxCompleteDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCompleteDecodeErrorZ)); return *this; } + LDKCResult_TxCompleteDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxCompleteDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxCompleteDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxCompleteDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_InMemorySignerDecodeErrorZ { +class CResult_ReplyShortChannelIdsEndDecodeErrorZ { private: - LDKCResult_InMemorySignerDecodeErrorZ self; + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self; public: - CResult_InMemorySignerDecodeErrorZ(const CResult_InMemorySignerDecodeErrorZ&) = delete; - CResult_InMemorySignerDecodeErrorZ(CResult_InMemorySignerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); } - CResult_InMemorySignerDecodeErrorZ(LDKCResult_InMemorySignerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); } - operator LDKCResult_InMemorySignerDecodeErrorZ() && { LDKCResult_InMemorySignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); return res; } - ~CResult_InMemorySignerDecodeErrorZ() { CResult_InMemorySignerDecodeErrorZ_free(self); } - CResult_InMemorySignerDecodeErrorZ& operator=(CResult_InMemorySignerDecodeErrorZ&& o) { CResult_InMemorySignerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); return *this; } - LDKCResult_InMemorySignerDecodeErrorZ* operator &() { return &self; } - LDKCResult_InMemorySignerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InMemorySignerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InMemorySignerDecodeErrorZ* operator ->() const { return &self; } + CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete; + CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; } + ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } }; class CResult_TxSignaturesDecodeErrorZ { private: @@ -11643,36 +14157,6 @@ class CResult_TxSignaturesDecodeErrorZ { const LDKCResult_TxSignaturesDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxSignaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_HTLCDescriptorZ { -private: - LDKCVec_HTLCDescriptorZ self; -public: - CVec_HTLCDescriptorZ(const CVec_HTLCDescriptorZ&) = delete; - CVec_HTLCDescriptorZ(CVec_HTLCDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_HTLCDescriptorZ)); } - CVec_HTLCDescriptorZ(LDKCVec_HTLCDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_HTLCDescriptorZ)); } - operator LDKCVec_HTLCDescriptorZ() && { LDKCVec_HTLCDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_HTLCDescriptorZ)); return res; } - ~CVec_HTLCDescriptorZ() { CVec_HTLCDescriptorZ_free(self); } - CVec_HTLCDescriptorZ& operator=(CVec_HTLCDescriptorZ&& o) { CVec_HTLCDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_HTLCDescriptorZ)); return *this; } - LDKCVec_HTLCDescriptorZ* operator &() { return &self; } - LDKCVec_HTLCDescriptorZ* operator ->() { return &self; } - const LDKCVec_HTLCDescriptorZ* operator &() const { return &self; } - const LDKCVec_HTLCDescriptorZ* operator ->() const { return &self; } -}; -class CResult_ReplyShortChannelIdsEndDecodeErrorZ { -private: - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self; -public: - CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete; - CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); } - CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); } - operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; } - ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); } - CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; } - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; } - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } -}; class COption_PathFailureZ { private: LDKCOption_PathFailureZ self; @@ -11688,21 +14172,6 @@ class COption_PathFailureZ { const LDKCOption_PathFailureZ* operator &() const { return &self; } const LDKCOption_PathFailureZ* operator ->() const { return &self; } }; -class COption_MessageContextZ { -private: - LDKCOption_MessageContextZ self; -public: - COption_MessageContextZ(const COption_MessageContextZ&) = delete; - COption_MessageContextZ(COption_MessageContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MessageContextZ)); } - COption_MessageContextZ(LDKCOption_MessageContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MessageContextZ)); } - operator LDKCOption_MessageContextZ() && { LDKCOption_MessageContextZ res = self; memset(&self, 0, sizeof(LDKCOption_MessageContextZ)); return res; } - ~COption_MessageContextZ() { COption_MessageContextZ_free(self); } - COption_MessageContextZ& operator=(COption_MessageContextZ&& o) { COption_MessageContextZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MessageContextZ)); return *this; } - LDKCOption_MessageContextZ* operator &() { return &self; } - LDKCOption_MessageContextZ* operator ->() { return &self; } - const LDKCOption_MessageContextZ* operator &() const { return &self; } - const LDKCOption_MessageContextZ* operator ->() const { return &self; } -}; class CVec_ECDSASignatureZ { private: LDKCVec_ECDSASignatureZ self; @@ -11718,35 +14187,35 @@ class CVec_ECDSASignatureZ { const LDKCVec_ECDSASignatureZ* operator &() const { return &self; } const LDKCVec_ECDSASignatureZ* operator ->() const { return &self; } }; -class C2Tuple_DNSResolverMessageMessageSendInstructionsZ { +class CVec_UpdateFailHTLCZ { private: - LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ self; + LDKCVec_UpdateFailHTLCZ self; public: - C2Tuple_DNSResolverMessageMessageSendInstructionsZ(const C2Tuple_DNSResolverMessageMessageSendInstructionsZ&) = delete; - C2Tuple_DNSResolverMessageMessageSendInstructionsZ(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } - C2Tuple_DNSResolverMessageMessageSendInstructionsZ(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } - operator LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ() && { LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return res; } - ~C2Tuple_DNSResolverMessageMessageSendInstructionsZ() { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); } - C2Tuple_DNSResolverMessageMessageSendInstructionsZ& operator=(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return *this; } - LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() { return &self; } - LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() { return &self; } - const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() const { return &self; } - const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() const { return &self; } + CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; + CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } + CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } + operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } + ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } + CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; } + LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } }; -class CResult_ChannelUpdateInfoDecodeErrorZ { +class CVec_C2Tuple_ChannelIdu64ZZ { private: - LDKCResult_ChannelUpdateInfoDecodeErrorZ self; + LDKCVec_C2Tuple_ChannelIdu64ZZ self; public: - CResult_ChannelUpdateInfoDecodeErrorZ(const CResult_ChannelUpdateInfoDecodeErrorZ&) = delete; - CResult_ChannelUpdateInfoDecodeErrorZ(CResult_ChannelUpdateInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); } - CResult_ChannelUpdateInfoDecodeErrorZ(LDKCResult_ChannelUpdateInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); } - operator LDKCResult_ChannelUpdateInfoDecodeErrorZ() && { LDKCResult_ChannelUpdateInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); return res; } - ~CResult_ChannelUpdateInfoDecodeErrorZ() { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); } - CResult_ChannelUpdateInfoDecodeErrorZ& operator=(CResult_ChannelUpdateInfoDecodeErrorZ&& o) { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); return *this; } - LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_ChannelIdu64ZZ(const CVec_C2Tuple_ChannelIdu64ZZ&) = delete; + CVec_C2Tuple_ChannelIdu64ZZ(CVec_C2Tuple_ChannelIdu64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdu64ZZ)); } + CVec_C2Tuple_ChannelIdu64ZZ(LDKCVec_C2Tuple_ChannelIdu64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdu64ZZ)); } + operator LDKCVec_C2Tuple_ChannelIdu64ZZ() && { LDKCVec_C2Tuple_ChannelIdu64ZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdu64ZZ)); return res; } + ~CVec_C2Tuple_ChannelIdu64ZZ() { CVec_C2Tuple_ChannelIdu64ZZ_free(self); } + CVec_C2Tuple_ChannelIdu64ZZ& operator=(CVec_C2Tuple_ChannelIdu64ZZ&& o) { CVec_C2Tuple_ChannelIdu64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdu64ZZ)); return *this; } + LDKCVec_C2Tuple_ChannelIdu64ZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ChannelIdu64ZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ChannelIdu64ZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ChannelIdu64ZZ* operator ->() const { return &self; } }; class CVec_TxOutZ { private: @@ -11763,36 +14232,6 @@ class CVec_TxOutZ { const LDKCVec_TxOutZ* operator &() const { return &self; } const LDKCVec_TxOutZ* operator ->() const { return &self; } }; -class CVec_DestinationZ { -private: - LDKCVec_DestinationZ self; -public: - CVec_DestinationZ(const CVec_DestinationZ&) = delete; - CVec_DestinationZ(CVec_DestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_DestinationZ)); } - CVec_DestinationZ(LDKCVec_DestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_DestinationZ)); } - operator LDKCVec_DestinationZ() && { LDKCVec_DestinationZ res = self; memset(&self, 0, sizeof(LDKCVec_DestinationZ)); return res; } - ~CVec_DestinationZ() { CVec_DestinationZ_free(self); } - CVec_DestinationZ& operator=(CVec_DestinationZ&& o) { CVec_DestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_DestinationZ)); return *this; } - LDKCVec_DestinationZ* operator &() { return &self; } - LDKCVec_DestinationZ* operator ->() { return &self; } - const LDKCVec_DestinationZ* operator &() const { return &self; } - const LDKCVec_DestinationZ* operator ->() const { return &self; } -}; -class CVec_UpdateFailHTLCZ { -private: - LDKCVec_UpdateFailHTLCZ self; -public: - CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; - CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } - CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } - operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } - ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } - CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; } - LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } -}; class CVec_InboundHTLCDetailsZ { private: LDKCVec_InboundHTLCDetailsZ self; @@ -11823,36 +14262,6 @@ class CVec_OutboundHTLCDetailsZ { const LDKCVec_OutboundHTLCDetailsZ* operator &() const { return &self; } const LDKCVec_OutboundHTLCDetailsZ* operator ->() const { return &self; } }; -class CResult_BuiltCommitmentTransactionDecodeErrorZ { -private: - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ self; -public: - CResult_BuiltCommitmentTransactionDecodeErrorZ(const CResult_BuiltCommitmentTransactionDecodeErrorZ&) = delete; - CResult_BuiltCommitmentTransactionDecodeErrorZ(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); } - CResult_BuiltCommitmentTransactionDecodeErrorZ(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_BuiltCommitmentTransactionDecodeErrorZ() && { LDKCResult_BuiltCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_BuiltCommitmentTransactionDecodeErrorZ() { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); } - CResult_BuiltCommitmentTransactionDecodeErrorZ& operator=(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_boolboolZ { -private: - LDKC2Tuple_boolboolZ self; -public: - C2Tuple_boolboolZ(const C2Tuple_boolboolZ&) = delete; - C2Tuple_boolboolZ(C2Tuple_boolboolZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_boolboolZ)); } - C2Tuple_boolboolZ(LDKC2Tuple_boolboolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_boolboolZ)); } - operator LDKC2Tuple_boolboolZ() && { LDKC2Tuple_boolboolZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_boolboolZ)); return res; } - ~C2Tuple_boolboolZ() { C2Tuple_boolboolZ_free(self); } - C2Tuple_boolboolZ& operator=(C2Tuple_boolboolZ&& o) { C2Tuple_boolboolZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_boolboolZ)); return *this; } - LDKC2Tuple_boolboolZ* operator &() { return &self; } - LDKC2Tuple_boolboolZ* operator ->() { return &self; } - const LDKC2Tuple_boolboolZ* operator &() const { return &self; } - const LDKC2Tuple_boolboolZ* operator ->() const { return &self; } -}; class CVec_PaymentForwardNodeZ { private: LDKCVec_PaymentForwardNodeZ self; @@ -11868,65 +14277,50 @@ class CVec_PaymentForwardNodeZ { const LDKCVec_PaymentForwardNodeZ* operator &() const { return &self; } const LDKCVec_PaymentForwardNodeZ* operator ->() const { return &self; } }; -class CResult_TrackedSpendableOutputDecodeErrorZ { -private: - LDKCResult_TrackedSpendableOutputDecodeErrorZ self; -public: - CResult_TrackedSpendableOutputDecodeErrorZ(const CResult_TrackedSpendableOutputDecodeErrorZ&) = delete; - CResult_TrackedSpendableOutputDecodeErrorZ(CResult_TrackedSpendableOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrackedSpendableOutputDecodeErrorZ)); } - CResult_TrackedSpendableOutputDecodeErrorZ(LDKCResult_TrackedSpendableOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ)); } - operator LDKCResult_TrackedSpendableOutputDecodeErrorZ() && { LDKCResult_TrackedSpendableOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TrackedSpendableOutputDecodeErrorZ)); return res; } - ~CResult_TrackedSpendableOutputDecodeErrorZ() { CResult_TrackedSpendableOutputDecodeErrorZ_free(self); } - CResult_TrackedSpendableOutputDecodeErrorZ& operator=(CResult_TrackedSpendableOutputDecodeErrorZ&& o) { CResult_TrackedSpendableOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrackedSpendableOutputDecodeErrorZ)); return *this; } - LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator &() { return &self; } - LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TrackedSpendableOutputDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_SpendableOutputDescriptorZ { -private: - LDKCVec_SpendableOutputDescriptorZ self; -public: - CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete; - CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); } - CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); } - operator LDKCVec_SpendableOutputDescriptorZ() && { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } - ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } - CVec_SpendableOutputDescriptorZ& operator=(CVec_SpendableOutputDescriptorZ&& o) { CVec_SpendableOutputDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); return *this; } - LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; } - LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; } - const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } - const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; } +class C2Tuple_boolboolZ { +private: + LDKC2Tuple_boolboolZ self; +public: + C2Tuple_boolboolZ(const C2Tuple_boolboolZ&) = delete; + C2Tuple_boolboolZ(C2Tuple_boolboolZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_boolboolZ)); } + C2Tuple_boolboolZ(LDKC2Tuple_boolboolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_boolboolZ)); } + operator LDKC2Tuple_boolboolZ() && { LDKC2Tuple_boolboolZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_boolboolZ)); return res; } + ~C2Tuple_boolboolZ() { C2Tuple_boolboolZ_free(self); } + C2Tuple_boolboolZ& operator=(C2Tuple_boolboolZ&& o) { C2Tuple_boolboolZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_boolboolZ)); return *this; } + LDKC2Tuple_boolboolZ* operator &() { return &self; } + LDKC2Tuple_boolboolZ* operator ->() { return &self; } + const LDKC2Tuple_boolboolZ* operator &() const { return &self; } + const LDKC2Tuple_boolboolZ* operator ->() const { return &self; } }; -class C2Tuple_OutPointCVec_u64ZZ { +class C2Tuple_BestBlockOutputSweeperSyncZ { private: - LDKC2Tuple_OutPointCVec_u64ZZ self; + LDKC2Tuple_BestBlockOutputSweeperSyncZ self; public: - C2Tuple_OutPointCVec_u64ZZ(const C2Tuple_OutPointCVec_u64ZZ&) = delete; - C2Tuple_OutPointCVec_u64ZZ(C2Tuple_OutPointCVec_u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointCVec_u64ZZ)); } - C2Tuple_OutPointCVec_u64ZZ(LDKC2Tuple_OutPointCVec_u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointCVec_u64ZZ)); } - operator LDKC2Tuple_OutPointCVec_u64ZZ() && { LDKC2Tuple_OutPointCVec_u64ZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointCVec_u64ZZ)); return res; } - ~C2Tuple_OutPointCVec_u64ZZ() { C2Tuple_OutPointCVec_u64ZZ_free(self); } - C2Tuple_OutPointCVec_u64ZZ& operator=(C2Tuple_OutPointCVec_u64ZZ&& o) { C2Tuple_OutPointCVec_u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointCVec_u64ZZ)); return *this; } - LDKC2Tuple_OutPointCVec_u64ZZ* operator &() { return &self; } - LDKC2Tuple_OutPointCVec_u64ZZ* operator ->() { return &self; } - const LDKC2Tuple_OutPointCVec_u64ZZ* operator &() const { return &self; } - const LDKC2Tuple_OutPointCVec_u64ZZ* operator ->() const { return &self; } + C2Tuple_BestBlockOutputSweeperSyncZ(const C2Tuple_BestBlockOutputSweeperSyncZ&) = delete; + C2Tuple_BestBlockOutputSweeperSyncZ(C2Tuple_BestBlockOutputSweeperSyncZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BestBlockOutputSweeperSyncZ)); } + C2Tuple_BestBlockOutputSweeperSyncZ(LDKC2Tuple_BestBlockOutputSweeperSyncZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BestBlockOutputSweeperSyncZ)); } + operator LDKC2Tuple_BestBlockOutputSweeperSyncZ() && { LDKC2Tuple_BestBlockOutputSweeperSyncZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BestBlockOutputSweeperSyncZ)); return res; } + ~C2Tuple_BestBlockOutputSweeperSyncZ() { C2Tuple_BestBlockOutputSweeperSyncZ_free(self); } + C2Tuple_BestBlockOutputSweeperSyncZ& operator=(C2Tuple_BestBlockOutputSweeperSyncZ&& o) { C2Tuple_BestBlockOutputSweeperSyncZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BestBlockOutputSweeperSyncZ)); return *this; } + LDKC2Tuple_BestBlockOutputSweeperSyncZ* operator &() { return &self; } + LDKC2Tuple_BestBlockOutputSweeperSyncZ* operator ->() { return &self; } + const LDKC2Tuple_BestBlockOutputSweeperSyncZ* operator &() const { return &self; } + const LDKC2Tuple_BestBlockOutputSweeperSyncZ* operator ->() const { return &self; } }; -class CResult_ResponderDecodeErrorZ { +class COption_C2Tuple_OfferPathsMessageContextZZ { private: - LDKCResult_ResponderDecodeErrorZ self; + LDKCOption_C2Tuple_OfferPathsMessageContextZZ self; public: - CResult_ResponderDecodeErrorZ(const CResult_ResponderDecodeErrorZ&) = delete; - CResult_ResponderDecodeErrorZ(CResult_ResponderDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ResponderDecodeErrorZ)); } - CResult_ResponderDecodeErrorZ(LDKCResult_ResponderDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ResponderDecodeErrorZ)); } - operator LDKCResult_ResponderDecodeErrorZ() && { LDKCResult_ResponderDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ResponderDecodeErrorZ)); return res; } - ~CResult_ResponderDecodeErrorZ() { CResult_ResponderDecodeErrorZ_free(self); } - CResult_ResponderDecodeErrorZ& operator=(CResult_ResponderDecodeErrorZ&& o) { CResult_ResponderDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ResponderDecodeErrorZ)); return *this; } - LDKCResult_ResponderDecodeErrorZ* operator &() { return &self; } - LDKCResult_ResponderDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ResponderDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ResponderDecodeErrorZ* operator ->() const { return &self; } + COption_C2Tuple_OfferPathsMessageContextZZ(const COption_C2Tuple_OfferPathsMessageContextZZ&) = delete; + COption_C2Tuple_OfferPathsMessageContextZZ(COption_C2Tuple_OfferPathsMessageContextZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OfferPathsMessageContextZZ)); } + COption_C2Tuple_OfferPathsMessageContextZZ(LDKCOption_C2Tuple_OfferPathsMessageContextZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OfferPathsMessageContextZZ)); } + operator LDKCOption_C2Tuple_OfferPathsMessageContextZZ() && { LDKCOption_C2Tuple_OfferPathsMessageContextZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OfferPathsMessageContextZZ)); return res; } + ~COption_C2Tuple_OfferPathsMessageContextZZ() { COption_C2Tuple_OfferPathsMessageContextZZ_free(self); } + COption_C2Tuple_OfferPathsMessageContextZZ& operator=(COption_C2Tuple_OfferPathsMessageContextZZ&& o) { COption_C2Tuple_OfferPathsMessageContextZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OfferPathsMessageContextZZ)); return *this; } + LDKCOption_C2Tuple_OfferPathsMessageContextZZ* operator &() { return &self; } + LDKCOption_C2Tuple_OfferPathsMessageContextZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_OfferPathsMessageContextZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_OfferPathsMessageContextZZ* operator ->() const { return &self; } }; class C2Tuple_OutPointCVec_u8ZZ { private: @@ -11943,81 +14337,6 @@ class C2Tuple_OutPointCVec_u8ZZ { const LDKC2Tuple_OutPointCVec_u8ZZ* operator &() const { return &self; } const LDKC2Tuple_OutPointCVec_u8ZZ* operator ->() const { return &self; } }; -class CResult_WitnessNoneZ { -private: - LDKCResult_WitnessNoneZ self; -public: - CResult_WitnessNoneZ(const CResult_WitnessNoneZ&) = delete; - CResult_WitnessNoneZ(CResult_WitnessNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_WitnessNoneZ)); } - CResult_WitnessNoneZ(LDKCResult_WitnessNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_WitnessNoneZ)); } - operator LDKCResult_WitnessNoneZ() && { LDKCResult_WitnessNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_WitnessNoneZ)); return res; } - ~CResult_WitnessNoneZ() { CResult_WitnessNoneZ_free(self); } - CResult_WitnessNoneZ& operator=(CResult_WitnessNoneZ&& o) { CResult_WitnessNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_WitnessNoneZ)); return *this; } - LDKCResult_WitnessNoneZ* operator &() { return &self; } - LDKCResult_WitnessNoneZ* operator ->() { return &self; } - const LDKCResult_WitnessNoneZ* operator &() const { return &self; } - const LDKCResult_WitnessNoneZ* operator ->() const { return &self; } -}; -class COption_C2Tuple_u64u64ZZ { -private: - LDKCOption_C2Tuple_u64u64ZZ self; -public: - COption_C2Tuple_u64u64ZZ(const COption_C2Tuple_u64u64ZZ&) = delete; - COption_C2Tuple_u64u64ZZ(COption_C2Tuple_u64u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); } - COption_C2Tuple_u64u64ZZ(LDKCOption_C2Tuple_u64u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); } - operator LDKCOption_C2Tuple_u64u64ZZ() && { LDKCOption_C2Tuple_u64u64ZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); return res; } - ~COption_C2Tuple_u64u64ZZ() { COption_C2Tuple_u64u64ZZ_free(self); } - COption_C2Tuple_u64u64ZZ& operator=(COption_C2Tuple_u64u64ZZ&& o) { COption_C2Tuple_u64u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); return *this; } - LDKCOption_C2Tuple_u64u64ZZ* operator &() { return &self; } - LDKCOption_C2Tuple_u64u64ZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_u64u64ZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_u64u64ZZ* operator ->() const { return &self; } -}; -class CResult_ChannelAnnouncementDecodeErrorZ { -private: - LDKCResult_ChannelAnnouncementDecodeErrorZ self; -public: - CResult_ChannelAnnouncementDecodeErrorZ(const CResult_ChannelAnnouncementDecodeErrorZ&) = delete; - CResult_ChannelAnnouncementDecodeErrorZ(CResult_ChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); } - CResult_ChannelAnnouncementDecodeErrorZ(LDKCResult_ChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); } - operator LDKCResult_ChannelAnnouncementDecodeErrorZ() && { LDKCResult_ChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); return res; } - ~CResult_ChannelAnnouncementDecodeErrorZ() { CResult_ChannelAnnouncementDecodeErrorZ_free(self); } - CResult_ChannelAnnouncementDecodeErrorZ& operator=(CResult_ChannelAnnouncementDecodeErrorZ&& o) { CResult_ChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_HTLCUpdateDecodeErrorZ { -private: - LDKCResult_HTLCUpdateDecodeErrorZ self; -public: - CResult_HTLCUpdateDecodeErrorZ(const CResult_HTLCUpdateDecodeErrorZ&) = delete; - CResult_HTLCUpdateDecodeErrorZ(CResult_HTLCUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); } - CResult_HTLCUpdateDecodeErrorZ(LDKCResult_HTLCUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); } - operator LDKCResult_HTLCUpdateDecodeErrorZ() && { LDKCResult_HTLCUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); return res; } - ~CResult_HTLCUpdateDecodeErrorZ() { CResult_HTLCUpdateDecodeErrorZ_free(self); } - CResult_HTLCUpdateDecodeErrorZ& operator=(CResult_HTLCUpdateDecodeErrorZ&& o) { CResult_HTLCUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); return *this; } - LDKCResult_HTLCUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HTLCUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_TxAddInputDecodeErrorZ { -private: - LDKCResult_TxAddInputDecodeErrorZ self; -public: - CResult_TxAddInputDecodeErrorZ(const CResult_TxAddInputDecodeErrorZ&) = delete; - CResult_TxAddInputDecodeErrorZ(CResult_TxAddInputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAddInputDecodeErrorZ)); } - CResult_TxAddInputDecodeErrorZ(LDKCResult_TxAddInputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAddInputDecodeErrorZ)); } - operator LDKCResult_TxAddInputDecodeErrorZ() && { LDKCResult_TxAddInputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAddInputDecodeErrorZ)); return res; } - ~CResult_TxAddInputDecodeErrorZ() { CResult_TxAddInputDecodeErrorZ_free(self); } - CResult_TxAddInputDecodeErrorZ& operator=(CResult_TxAddInputDecodeErrorZ&& o) { CResult_TxAddInputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAddInputDecodeErrorZ)); return *this; } - LDKCResult_TxAddInputDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxAddInputDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxAddInputDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxAddInputDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_HeldHtlcAvailableDecodeErrorZ { private: LDKCResult_HeldHtlcAvailableDecodeErrorZ self; @@ -12033,6 +14352,21 @@ class CResult_HeldHtlcAvailableDecodeErrorZ { const LDKCResult_HeldHtlcAvailableDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HeldHtlcAvailableDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_OutPointZ { +private: + LDKCVec_OutPointZ 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; } +}; class CResult_TxInitRbfDecodeErrorZ { private: LDKCResult_TxInitRbfDecodeErrorZ self; @@ -12063,51 +14397,6 @@ class COption_WriteableScoreZ { 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_AsyncPaymentsMessageDecodeErrorZ { -private: - LDKCResult_AsyncPaymentsMessageDecodeErrorZ self; -public: - CResult_AsyncPaymentsMessageDecodeErrorZ(const CResult_AsyncPaymentsMessageDecodeErrorZ&) = delete; - CResult_AsyncPaymentsMessageDecodeErrorZ(CResult_AsyncPaymentsMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncPaymentsMessageDecodeErrorZ)); } - CResult_AsyncPaymentsMessageDecodeErrorZ(LDKCResult_AsyncPaymentsMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncPaymentsMessageDecodeErrorZ)); } - operator LDKCResult_AsyncPaymentsMessageDecodeErrorZ() && { LDKCResult_AsyncPaymentsMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncPaymentsMessageDecodeErrorZ)); return res; } - ~CResult_AsyncPaymentsMessageDecodeErrorZ() { CResult_AsyncPaymentsMessageDecodeErrorZ_free(self); } - CResult_AsyncPaymentsMessageDecodeErrorZ& operator=(CResult_AsyncPaymentsMessageDecodeErrorZ&& o) { CResult_AsyncPaymentsMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncPaymentsMessageDecodeErrorZ)); return *this; } - LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AsyncPaymentsMessageDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_LSPS2OpeningFeeParamsZ { -private: - LDKCVec_LSPS2OpeningFeeParamsZ self; -public: - CVec_LSPS2OpeningFeeParamsZ(const CVec_LSPS2OpeningFeeParamsZ&) = delete; - CVec_LSPS2OpeningFeeParamsZ(CVec_LSPS2OpeningFeeParamsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_LSPS2OpeningFeeParamsZ)); } - CVec_LSPS2OpeningFeeParamsZ(LDKCVec_LSPS2OpeningFeeParamsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_LSPS2OpeningFeeParamsZ)); } - operator LDKCVec_LSPS2OpeningFeeParamsZ() && { LDKCVec_LSPS2OpeningFeeParamsZ res = self; memset(&self, 0, sizeof(LDKCVec_LSPS2OpeningFeeParamsZ)); return res; } - ~CVec_LSPS2OpeningFeeParamsZ() { CVec_LSPS2OpeningFeeParamsZ_free(self); } - CVec_LSPS2OpeningFeeParamsZ& operator=(CVec_LSPS2OpeningFeeParamsZ&& o) { CVec_LSPS2OpeningFeeParamsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_LSPS2OpeningFeeParamsZ)); return *this; } - LDKCVec_LSPS2OpeningFeeParamsZ* operator &() { return &self; } - LDKCVec_LSPS2OpeningFeeParamsZ* operator ->() { return &self; } - const LDKCVec_LSPS2OpeningFeeParamsZ* operator &() const { return &self; } - const LDKCVec_LSPS2OpeningFeeParamsZ* operator ->() const { return &self; } -}; class CResult_SpliceAckDecodeErrorZ { private: LDKCResult_SpliceAckDecodeErrorZ self; @@ -12123,51 +14412,6 @@ class CResult_SpliceAckDecodeErrorZ { const LDKCResult_SpliceAckDecodeErrorZ* operator &() const { return &self; } const LDKCResult_SpliceAckDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PositiveTimestampCreationErrorZ { -private: - LDKCResult_PositiveTimestampCreationErrorZ self; -public: - CResult_PositiveTimestampCreationErrorZ(const CResult_PositiveTimestampCreationErrorZ&) = delete; - CResult_PositiveTimestampCreationErrorZ(CResult_PositiveTimestampCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); } - CResult_PositiveTimestampCreationErrorZ(LDKCResult_PositiveTimestampCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); } - operator LDKCResult_PositiveTimestampCreationErrorZ() && { LDKCResult_PositiveTimestampCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); return res; } - ~CResult_PositiveTimestampCreationErrorZ() { CResult_PositiveTimestampCreationErrorZ_free(self); } - CResult_PositiveTimestampCreationErrorZ& operator=(CResult_PositiveTimestampCreationErrorZ&& o) { CResult_PositiveTimestampCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); return *this; } - LDKCResult_PositiveTimestampCreationErrorZ* operator &() { return &self; } - LDKCResult_PositiveTimestampCreationErrorZ* operator ->() { return &self; } - const LDKCResult_PositiveTimestampCreationErrorZ* operator &() const { return &self; } - const LDKCResult_PositiveTimestampCreationErrorZ* operator ->() const { return &self; } -}; -class CResult_PeeledOnionNoneZ { -private: - LDKCResult_PeeledOnionNoneZ self; -public: - CResult_PeeledOnionNoneZ(const CResult_PeeledOnionNoneZ&) = delete; - CResult_PeeledOnionNoneZ(CResult_PeeledOnionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); } - CResult_PeeledOnionNoneZ(LDKCResult_PeeledOnionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); } - operator LDKCResult_PeeledOnionNoneZ() && { LDKCResult_PeeledOnionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PeeledOnionNoneZ)); return res; } - ~CResult_PeeledOnionNoneZ() { CResult_PeeledOnionNoneZ_free(self); } - CResult_PeeledOnionNoneZ& operator=(CResult_PeeledOnionNoneZ&& o) { CResult_PeeledOnionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PeeledOnionNoneZ)); return *this; } - LDKCResult_PeeledOnionNoneZ* operator &() { return &self; } - LDKCResult_PeeledOnionNoneZ* operator ->() { return &self; } - const LDKCResult_PeeledOnionNoneZ* operator &() const { return &self; } - const LDKCResult_PeeledOnionNoneZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_OutPointChannelIdZZ { -private: - LDKCVec_C2Tuple_OutPointChannelIdZZ self; -public: - CVec_C2Tuple_OutPointChannelIdZZ(const CVec_C2Tuple_OutPointChannelIdZZ&) = delete; - CVec_C2Tuple_OutPointChannelIdZZ(CVec_C2Tuple_OutPointChannelIdZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OutPointChannelIdZZ)); } - CVec_C2Tuple_OutPointChannelIdZZ(LDKCVec_C2Tuple_OutPointChannelIdZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OutPointChannelIdZZ)); } - operator LDKCVec_C2Tuple_OutPointChannelIdZZ() && { LDKCVec_C2Tuple_OutPointChannelIdZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OutPointChannelIdZZ)); return res; } - ~CVec_C2Tuple_OutPointChannelIdZZ() { CVec_C2Tuple_OutPointChannelIdZZ_free(self); } - CVec_C2Tuple_OutPointChannelIdZZ& operator=(CVec_C2Tuple_OutPointChannelIdZZ&& o) { CVec_C2Tuple_OutPointChannelIdZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OutPointChannelIdZZ)); return *this; } - LDKCVec_C2Tuple_OutPointChannelIdZZ* operator &() { return &self; } - LDKCVec_C2Tuple_OutPointChannelIdZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_OutPointChannelIdZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_OutPointChannelIdZZ* operator ->() const { return &self; } -}; class CResult_ChannelMonitorUpdateDecodeErrorZ { private: LDKCResult_ChannelMonitorUpdateDecodeErrorZ self; @@ -12243,21 +14487,6 @@ class C2Tuple_PublicKeyTypeZ { const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; } const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; } }; -class CResult_TxRemoveOutputDecodeErrorZ { -private: - LDKCResult_TxRemoveOutputDecodeErrorZ self; -public: - CResult_TxRemoveOutputDecodeErrorZ(const CResult_TxRemoveOutputDecodeErrorZ&) = delete; - CResult_TxRemoveOutputDecodeErrorZ(CResult_TxRemoveOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxRemoveOutputDecodeErrorZ)); } - CResult_TxRemoveOutputDecodeErrorZ(LDKCResult_TxRemoveOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ)); } - operator LDKCResult_TxRemoveOutputDecodeErrorZ() && { LDKCResult_TxRemoveOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxRemoveOutputDecodeErrorZ)); return res; } - ~CResult_TxRemoveOutputDecodeErrorZ() { CResult_TxRemoveOutputDecodeErrorZ_free(self); } - CResult_TxRemoveOutputDecodeErrorZ& operator=(CResult_TxRemoveOutputDecodeErrorZ&& o) { CResult_TxRemoveOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxRemoveOutputDecodeErrorZ)); return *this; } - LDKCResult_TxRemoveOutputDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxRemoveOutputDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxRemoveOutputDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxRemoveOutputDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_ChannelReestablishDecodeErrorZ { private: LDKCResult_ChannelReestablishDecodeErrorZ self; @@ -12288,80 +14517,35 @@ class CResult_OnionMessageDecodeErrorZ { const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_Bolt11InvoiceParseOrSemanticErrorZ { -private: - LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ self; -public: - CResult_Bolt11InvoiceParseOrSemanticErrorZ(const CResult_Bolt11InvoiceParseOrSemanticErrorZ&) = delete; - CResult_Bolt11InvoiceParseOrSemanticErrorZ(CResult_Bolt11InvoiceParseOrSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceParseOrSemanticErrorZ)); } - CResult_Bolt11InvoiceParseOrSemanticErrorZ(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ)); } - operator LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ() && { LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ)); return res; } - ~CResult_Bolt11InvoiceParseOrSemanticErrorZ() { CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(self); } - CResult_Bolt11InvoiceParseOrSemanticErrorZ& operator=(CResult_Bolt11InvoiceParseOrSemanticErrorZ&& o) { CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceParseOrSemanticErrorZ)); return *this; } - LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator &() { return &self; } - LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator ->() const { return &self; } -}; -class CResult_MessageContextDecodeErrorZ { -private: - LDKCResult_MessageContextDecodeErrorZ self; -public: - CResult_MessageContextDecodeErrorZ(const CResult_MessageContextDecodeErrorZ&) = delete; - CResult_MessageContextDecodeErrorZ(CResult_MessageContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MessageContextDecodeErrorZ)); } - CResult_MessageContextDecodeErrorZ(LDKCResult_MessageContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MessageContextDecodeErrorZ)); } - operator LDKCResult_MessageContextDecodeErrorZ() && { LDKCResult_MessageContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MessageContextDecodeErrorZ)); return res; } - ~CResult_MessageContextDecodeErrorZ() { CResult_MessageContextDecodeErrorZ_free(self); } - CResult_MessageContextDecodeErrorZ& operator=(CResult_MessageContextDecodeErrorZ&& o) { CResult_MessageContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MessageContextDecodeErrorZ)); return *this; } - LDKCResult_MessageContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_MessageContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_MessageContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_MessageContextDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { -private: - LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ self; -public: - CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(const CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&) = delete; - CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } - CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } - operator LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() && { LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return res; } - ~CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); } - CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ& operator=(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return *this; } - LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() { return &self; } - LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() const { return &self; } -}; -class CResult_InitFeaturesDecodeErrorZ { +class C2Tuple_OfferPathsResponseInstructionZ { private: - LDKCResult_InitFeaturesDecodeErrorZ self; + LDKC2Tuple_OfferPathsResponseInstructionZ self; public: - CResult_InitFeaturesDecodeErrorZ(const CResult_InitFeaturesDecodeErrorZ&) = delete; - CResult_InitFeaturesDecodeErrorZ(CResult_InitFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); } - CResult_InitFeaturesDecodeErrorZ(LDKCResult_InitFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); } - operator LDKCResult_InitFeaturesDecodeErrorZ() && { LDKCResult_InitFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); return res; } - ~CResult_InitFeaturesDecodeErrorZ() { CResult_InitFeaturesDecodeErrorZ_free(self); } - CResult_InitFeaturesDecodeErrorZ& operator=(CResult_InitFeaturesDecodeErrorZ&& o) { CResult_InitFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); return *this; } - LDKCResult_InitFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_InitFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_OfferPathsResponseInstructionZ(const C2Tuple_OfferPathsResponseInstructionZ&) = delete; + C2Tuple_OfferPathsResponseInstructionZ(C2Tuple_OfferPathsResponseInstructionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OfferPathsResponseInstructionZ)); } + C2Tuple_OfferPathsResponseInstructionZ(LDKC2Tuple_OfferPathsResponseInstructionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OfferPathsResponseInstructionZ)); } + operator LDKC2Tuple_OfferPathsResponseInstructionZ() && { LDKC2Tuple_OfferPathsResponseInstructionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OfferPathsResponseInstructionZ)); return res; } + ~C2Tuple_OfferPathsResponseInstructionZ() { C2Tuple_OfferPathsResponseInstructionZ_free(self); } + C2Tuple_OfferPathsResponseInstructionZ& operator=(C2Tuple_OfferPathsResponseInstructionZ&& o) { C2Tuple_OfferPathsResponseInstructionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OfferPathsResponseInstructionZ)); return *this; } + LDKC2Tuple_OfferPathsResponseInstructionZ* operator &() { return &self; } + LDKC2Tuple_OfferPathsResponseInstructionZ* operator ->() { return &self; } + const LDKC2Tuple_OfferPathsResponseInstructionZ* operator &() const { return &self; } + const LDKC2Tuple_OfferPathsResponseInstructionZ* operator ->() const { return &self; } }; -class CResult_PublicKeyNoneZ { +class CResult_Bolt11InvoiceParseOrSemanticErrorZ { private: - LDKCResult_PublicKeyNoneZ self; + LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ self; public: - CResult_PublicKeyNoneZ(const CResult_PublicKeyNoneZ&) = delete; - CResult_PublicKeyNoneZ(CResult_PublicKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); } - CResult_PublicKeyNoneZ(LDKCResult_PublicKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); } - operator LDKCResult_PublicKeyNoneZ() && { LDKCResult_PublicKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); return res; } - ~CResult_PublicKeyNoneZ() { CResult_PublicKeyNoneZ_free(self); } - CResult_PublicKeyNoneZ& operator=(CResult_PublicKeyNoneZ&& o) { CResult_PublicKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); return *this; } - LDKCResult_PublicKeyNoneZ* operator &() { return &self; } - LDKCResult_PublicKeyNoneZ* operator ->() { return &self; } - const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; } - const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; } + CResult_Bolt11InvoiceParseOrSemanticErrorZ(const CResult_Bolt11InvoiceParseOrSemanticErrorZ&) = delete; + CResult_Bolt11InvoiceParseOrSemanticErrorZ(CResult_Bolt11InvoiceParseOrSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceParseOrSemanticErrorZ)); } + CResult_Bolt11InvoiceParseOrSemanticErrorZ(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ)); } + operator LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ() && { LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ)); return res; } + ~CResult_Bolt11InvoiceParseOrSemanticErrorZ() { CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(self); } + CResult_Bolt11InvoiceParseOrSemanticErrorZ& operator=(CResult_Bolt11InvoiceParseOrSemanticErrorZ&& o) { CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceParseOrSemanticErrorZ)); return *this; } + LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator &() { return &self; } + LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt11InvoiceParseOrSemanticErrorZ* operator ->() const { return &self; } }; class C3Tuple_StrStrStrZ { private: @@ -12408,20 +14592,20 @@ class CResult_RevocationKeyDecodeErrorZ { const LDKCResult_RevocationKeyDecodeErrorZ* operator &() const { return &self; } const LDKCResult_RevocationKeyDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_OffersMessageMessageSendInstructionsZ { +class C2Tuple_OffersMessageCOption_MessageContextZZ { private: - LDKC2Tuple_OffersMessageMessageSendInstructionsZ self; + LDKC2Tuple_OffersMessageCOption_MessageContextZZ self; public: - C2Tuple_OffersMessageMessageSendInstructionsZ(const C2Tuple_OffersMessageMessageSendInstructionsZ&) = delete; - C2Tuple_OffersMessageMessageSendInstructionsZ(C2Tuple_OffersMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OffersMessageMessageSendInstructionsZ)); } - C2Tuple_OffersMessageMessageSendInstructionsZ(LDKC2Tuple_OffersMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OffersMessageMessageSendInstructionsZ)); } - operator LDKC2Tuple_OffersMessageMessageSendInstructionsZ() && { LDKC2Tuple_OffersMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OffersMessageMessageSendInstructionsZ)); return res; } - ~C2Tuple_OffersMessageMessageSendInstructionsZ() { C2Tuple_OffersMessageMessageSendInstructionsZ_free(self); } - C2Tuple_OffersMessageMessageSendInstructionsZ& operator=(C2Tuple_OffersMessageMessageSendInstructionsZ&& o) { C2Tuple_OffersMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OffersMessageMessageSendInstructionsZ)); return *this; } - LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator &() { return &self; } - LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator ->() { return &self; } - const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator &() const { return &self; } - const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator ->() const { return &self; } + C2Tuple_OffersMessageCOption_MessageContextZZ(const C2Tuple_OffersMessageCOption_MessageContextZZ&) = delete; + C2Tuple_OffersMessageCOption_MessageContextZZ(C2Tuple_OffersMessageCOption_MessageContextZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OffersMessageCOption_MessageContextZZ)); } + C2Tuple_OffersMessageCOption_MessageContextZZ(LDKC2Tuple_OffersMessageCOption_MessageContextZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OffersMessageCOption_MessageContextZZ)); } + operator LDKC2Tuple_OffersMessageCOption_MessageContextZZ() && { LDKC2Tuple_OffersMessageCOption_MessageContextZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OffersMessageCOption_MessageContextZZ)); return res; } + ~C2Tuple_OffersMessageCOption_MessageContextZZ() { C2Tuple_OffersMessageCOption_MessageContextZZ_free(self); } + C2Tuple_OffersMessageCOption_MessageContextZZ& operator=(C2Tuple_OffersMessageCOption_MessageContextZZ&& o) { C2Tuple_OffersMessageCOption_MessageContextZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OffersMessageCOption_MessageContextZZ)); return *this; } + LDKC2Tuple_OffersMessageCOption_MessageContextZZ* operator &() { return &self; } + LDKC2Tuple_OffersMessageCOption_MessageContextZZ* operator ->() { return &self; } + const LDKC2Tuple_OffersMessageCOption_MessageContextZZ* operator &() const { return &self; } + const LDKC2Tuple_OffersMessageCOption_MessageContextZZ* operator ->() const { return &self; } }; class CResult_ChannelIdDecodeErrorZ { private: @@ -12438,21 +14622,6 @@ class CResult_ChannelIdDecodeErrorZ { const LDKCResult_ChannelIdDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelIdDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_BlindedHopFeaturesDecodeErrorZ { -private: - LDKCResult_BlindedHopFeaturesDecodeErrorZ self; -public: - CResult_BlindedHopFeaturesDecodeErrorZ(const CResult_BlindedHopFeaturesDecodeErrorZ&) = delete; - CResult_BlindedHopFeaturesDecodeErrorZ(CResult_BlindedHopFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); } - CResult_BlindedHopFeaturesDecodeErrorZ(LDKCResult_BlindedHopFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); } - operator LDKCResult_BlindedHopFeaturesDecodeErrorZ() && { LDKCResult_BlindedHopFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); return res; } - ~CResult_BlindedHopFeaturesDecodeErrorZ() { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); } - CResult_BlindedHopFeaturesDecodeErrorZ& operator=(CResult_BlindedHopFeaturesDecodeErrorZ&& o) { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); return *this; } - LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; class CVec_TransactionOutputsZ { private: LDKCVec_TransactionOutputsZ self; @@ -12498,20 +14667,35 @@ class CVec_BlindedPaymentPathZ { const LDKCVec_BlindedPaymentPathZ* operator &() const { return &self; } const LDKCVec_BlindedPaymentPathZ* operator ->() const { return &self; } }; -class CResult_HumanReadableNameNoneZ { +class CResult_NoneSecp256k1ErrorZ { private: - LDKCResult_HumanReadableNameNoneZ self; + LDKCResult_NoneSecp256k1ErrorZ self; public: - CResult_HumanReadableNameNoneZ(const CResult_HumanReadableNameNoneZ&) = delete; - CResult_HumanReadableNameNoneZ(CResult_HumanReadableNameNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); } - CResult_HumanReadableNameNoneZ(LDKCResult_HumanReadableNameNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); } - operator LDKCResult_HumanReadableNameNoneZ() && { LDKCResult_HumanReadableNameNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); return res; } - ~CResult_HumanReadableNameNoneZ() { CResult_HumanReadableNameNoneZ_free(self); } - CResult_HumanReadableNameNoneZ& operator=(CResult_HumanReadableNameNoneZ&& o) { CResult_HumanReadableNameNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); return *this; } - LDKCResult_HumanReadableNameNoneZ* operator &() { return &self; } - LDKCResult_HumanReadableNameNoneZ* operator ->() { return &self; } - const LDKCResult_HumanReadableNameNoneZ* operator &() const { return &self; } - const LDKCResult_HumanReadableNameNoneZ* operator ->() const { return &self; } + CResult_NoneSecp256k1ErrorZ(const CResult_NoneSecp256k1ErrorZ&) = delete; + CResult_NoneSecp256k1ErrorZ(CResult_NoneSecp256k1ErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneSecp256k1ErrorZ)); } + CResult_NoneSecp256k1ErrorZ(LDKCResult_NoneSecp256k1ErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneSecp256k1ErrorZ)); } + operator LDKCResult_NoneSecp256k1ErrorZ() && { LDKCResult_NoneSecp256k1ErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneSecp256k1ErrorZ)); return res; } + ~CResult_NoneSecp256k1ErrorZ() { CResult_NoneSecp256k1ErrorZ_free(self); } + CResult_NoneSecp256k1ErrorZ& operator=(CResult_NoneSecp256k1ErrorZ&& o) { CResult_NoneSecp256k1ErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneSecp256k1ErrorZ)); return *this; } + LDKCResult_NoneSecp256k1ErrorZ* operator &() { return &self; } + LDKCResult_NoneSecp256k1ErrorZ* operator ->() { return &self; } + const LDKCResult_NoneSecp256k1ErrorZ* operator &() const { return &self; } + const LDKCResult_NoneSecp256k1ErrorZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_OffersMessageResponseInstructionZZ { +private: + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ self; +public: + COption_C2Tuple_OffersMessageResponseInstructionZZ(const COption_C2Tuple_OffersMessageResponseInstructionZZ&) = delete; + COption_C2Tuple_OffersMessageResponseInstructionZZ(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); } + COption_C2Tuple_OffersMessageResponseInstructionZZ(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ() && { LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); return res; } + ~COption_C2Tuple_OffersMessageResponseInstructionZZ() { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); } + COption_C2Tuple_OffersMessageResponseInstructionZZ& operator=(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() const { return &self; } }; class COption_boolZ { private: @@ -12528,65 +14712,20 @@ class COption_boolZ { const LDKCOption_boolZ* operator &() const { return &self; } const LDKCOption_boolZ* operator ->() const { return &self; } }; -class CResult_ProbabilisticScorerDecodeErrorZ { -private: - LDKCResult_ProbabilisticScorerDecodeErrorZ self; -public: - CResult_ProbabilisticScorerDecodeErrorZ(const CResult_ProbabilisticScorerDecodeErrorZ&) = delete; - CResult_ProbabilisticScorerDecodeErrorZ(CResult_ProbabilisticScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); } - CResult_ProbabilisticScorerDecodeErrorZ(LDKCResult_ProbabilisticScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); } - operator LDKCResult_ProbabilisticScorerDecodeErrorZ() && { LDKCResult_ProbabilisticScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); return res; } - ~CResult_ProbabilisticScorerDecodeErrorZ() { CResult_ProbabilisticScorerDecodeErrorZ_free(self); } - CResult_ProbabilisticScorerDecodeErrorZ& operator=(CResult_ProbabilisticScorerDecodeErrorZ&& o) { CResult_ProbabilisticScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); return *this; } - LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() { return &self; } - LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_CVec_BlindedPaymentPathZNoneZ { -private: - LDKCResult_CVec_BlindedPaymentPathZNoneZ self; -public: - CResult_CVec_BlindedPaymentPathZNoneZ(const CResult_CVec_BlindedPaymentPathZNoneZ&) = delete; - CResult_CVec_BlindedPaymentPathZNoneZ(CResult_CVec_BlindedPaymentPathZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_BlindedPaymentPathZNoneZ)); } - CResult_CVec_BlindedPaymentPathZNoneZ(LDKCResult_CVec_BlindedPaymentPathZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_BlindedPaymentPathZNoneZ)); } - operator LDKCResult_CVec_BlindedPaymentPathZNoneZ() && { LDKCResult_CVec_BlindedPaymentPathZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_BlindedPaymentPathZNoneZ)); return res; } - ~CResult_CVec_BlindedPaymentPathZNoneZ() { CResult_CVec_BlindedPaymentPathZNoneZ_free(self); } - CResult_CVec_BlindedPaymentPathZNoneZ& operator=(CResult_CVec_BlindedPaymentPathZNoneZ&& o) { CResult_CVec_BlindedPaymentPathZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_BlindedPaymentPathZNoneZ)); return *this; } - LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator &() { return &self; } - LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator ->() { return &self; } - const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator &() const { return &self; } - const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator ->() const { return &self; } -}; -class COption_StrZ { -private: - LDKCOption_StrZ self; -public: - COption_StrZ(const COption_StrZ&) = delete; - COption_StrZ(COption_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_StrZ)); } - COption_StrZ(LDKCOption_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_StrZ)); } - operator LDKCOption_StrZ() && { LDKCOption_StrZ res = self; memset(&self, 0, sizeof(LDKCOption_StrZ)); return res; } - ~COption_StrZ() { COption_StrZ_free(self); } - COption_StrZ& operator=(COption_StrZ&& o) { COption_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_StrZ)); return *this; } - LDKCOption_StrZ* operator &() { return &self; } - LDKCOption_StrZ* operator ->() { return &self; } - const LDKCOption_StrZ* operator &() const { return &self; } - const LDKCOption_StrZ* operator ->() const { return &self; } -}; -class C2Tuple_usizeTransactionZ { +class CResult_NodeAnnouncementDecodeErrorZ { private: - LDKC2Tuple_usizeTransactionZ self; + LDKCResult_NodeAnnouncementDecodeErrorZ self; public: - C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; - C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } - C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } - operator LDKC2Tuple_usizeTransactionZ() && { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } - ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } - C2Tuple_usizeTransactionZ& operator=(C2Tuple_usizeTransactionZ&& o) { C2Tuple_usizeTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); return *this; } - LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } - LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } + CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete; + CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); } + CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); } + operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; } + ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); } + CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; class COption_OffersContextZ { private: @@ -12603,21 +14742,6 @@ class COption_OffersContextZ { const LDKCOption_OffersContextZ* operator &() const { return &self; } const LDKCOption_OffersContextZ* operator ->() const { return &self; } }; -class COption_C2Tuple_OffersMessageResponseInstructionZZ { -private: - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ self; -public: - COption_C2Tuple_OffersMessageResponseInstructionZZ(const COption_C2Tuple_OffersMessageResponseInstructionZZ&) = delete; - COption_C2Tuple_OffersMessageResponseInstructionZZ(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); } - COption_C2Tuple_OffersMessageResponseInstructionZZ(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); } - operator LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ() && { LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); return res; } - ~COption_C2Tuple_OffersMessageResponseInstructionZZ() { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); } - COption_C2Tuple_OffersMessageResponseInstructionZZ& operator=(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); return *this; } - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() { return &self; } - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() const { return &self; } -}; class CVec_ChannelMonitorZ { private: LDKCVec_ChannelMonitorZ self; @@ -12633,66 +14757,6 @@ class CVec_ChannelMonitorZ { const LDKCVec_ChannelMonitorZ* operator &() const { return &self; } const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; } }; -class CResult_AcceptChannelV2DecodeErrorZ { -private: - LDKCResult_AcceptChannelV2DecodeErrorZ self; -public: - CResult_AcceptChannelV2DecodeErrorZ(const CResult_AcceptChannelV2DecodeErrorZ&) = delete; - CResult_AcceptChannelV2DecodeErrorZ(CResult_AcceptChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelV2DecodeErrorZ)); } - CResult_AcceptChannelV2DecodeErrorZ(LDKCResult_AcceptChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ)); } - operator LDKCResult_AcceptChannelV2DecodeErrorZ() && { LDKCResult_AcceptChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelV2DecodeErrorZ)); return res; } - ~CResult_AcceptChannelV2DecodeErrorZ() { CResult_AcceptChannelV2DecodeErrorZ_free(self); } - CResult_AcceptChannelV2DecodeErrorZ& operator=(CResult_AcceptChannelV2DecodeErrorZ&& o) { CResult_AcceptChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelV2DecodeErrorZ)); return *this; } - LDKCResult_AcceptChannelV2DecodeErrorZ* operator &() { return &self; } - LDKCResult_AcceptChannelV2DecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AcceptChannelV2DecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AcceptChannelV2DecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_NodeAnnouncementDecodeErrorZ { -private: - LDKCResult_NodeAnnouncementDecodeErrorZ self; -public: - CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete; - CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); } - CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); } - operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; } - ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); } - CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_RouteHopDecodeErrorZ { -private: - LDKCResult_RouteHopDecodeErrorZ self; -public: - CResult_RouteHopDecodeErrorZ(const CResult_RouteHopDecodeErrorZ&) = delete; - CResult_RouteHopDecodeErrorZ(CResult_RouteHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); } - CResult_RouteHopDecodeErrorZ(LDKCResult_RouteHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); } - operator LDKCResult_RouteHopDecodeErrorZ() && { LDKCResult_RouteHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); return res; } - ~CResult_RouteHopDecodeErrorZ() { CResult_RouteHopDecodeErrorZ_free(self); } - CResult_RouteHopDecodeErrorZ& operator=(CResult_RouteHopDecodeErrorZ&& o) { CResult_RouteHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); return *this; } - LDKCResult_RouteHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHopDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_OfferIdDecodeErrorZ { -private: - LDKCResult_OfferIdDecodeErrorZ self; -public: - CResult_OfferIdDecodeErrorZ(const CResult_OfferIdDecodeErrorZ&) = delete; - CResult_OfferIdDecodeErrorZ(CResult_OfferIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferIdDecodeErrorZ)); } - CResult_OfferIdDecodeErrorZ(LDKCResult_OfferIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferIdDecodeErrorZ)); } - operator LDKCResult_OfferIdDecodeErrorZ() && { LDKCResult_OfferIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferIdDecodeErrorZ)); return res; } - ~CResult_OfferIdDecodeErrorZ() { CResult_OfferIdDecodeErrorZ_free(self); } - CResult_OfferIdDecodeErrorZ& operator=(CResult_OfferIdDecodeErrorZ&& o) { CResult_OfferIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferIdDecodeErrorZ)); return *this; } - LDKCResult_OfferIdDecodeErrorZ* operator &() { return &self; } - LDKCResult_OfferIdDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OfferIdDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OfferIdDecodeErrorZ* operator ->() const { return &self; } -}; class CVec_HTLCOutputInCommitmentZ { private: LDKCVec_HTLCOutputInCommitmentZ self; @@ -12704,54 +14768,9 @@ class CVec_HTLCOutputInCommitmentZ { ~CVec_HTLCOutputInCommitmentZ() { CVec_HTLCOutputInCommitmentZ_free(self); } CVec_HTLCOutputInCommitmentZ& operator=(CVec_HTLCOutputInCommitmentZ&& o) { CVec_HTLCOutputInCommitmentZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_HTLCOutputInCommitmentZ)); return *this; } LDKCVec_HTLCOutputInCommitmentZ* operator &() { return &self; } - LDKCVec_HTLCOutputInCommitmentZ* operator ->() { return &self; } - const LDKCVec_HTLCOutputInCommitmentZ* operator &() const { return &self; } - const LDKCVec_HTLCOutputInCommitmentZ* operator ->() const { return &self; } -}; -class CResult_CoinSelectionNoneZ { -private: - LDKCResult_CoinSelectionNoneZ self; -public: - CResult_CoinSelectionNoneZ(const CResult_CoinSelectionNoneZ&) = delete; - CResult_CoinSelectionNoneZ(CResult_CoinSelectionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CoinSelectionNoneZ)); } - CResult_CoinSelectionNoneZ(LDKCResult_CoinSelectionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CoinSelectionNoneZ)); } - operator LDKCResult_CoinSelectionNoneZ() && { LDKCResult_CoinSelectionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CoinSelectionNoneZ)); return res; } - ~CResult_CoinSelectionNoneZ() { CResult_CoinSelectionNoneZ_free(self); } - CResult_CoinSelectionNoneZ& operator=(CResult_CoinSelectionNoneZ&& o) { CResult_CoinSelectionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CoinSelectionNoneZ)); return *this; } - LDKCResult_CoinSelectionNoneZ* operator &() { return &self; } - LDKCResult_CoinSelectionNoneZ* operator ->() { return &self; } - const LDKCResult_CoinSelectionNoneZ* operator &() const { return &self; } - const LDKCResult_CoinSelectionNoneZ* operator ->() const { return &self; } -}; -class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { -private: - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ self; -public: - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(const CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&) = delete; - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } - operator LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() && { LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return res; } - ~CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ& operator=(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return *this; } - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_FutureZ { -private: - LDKCVec_FutureZ self; -public: - CVec_FutureZ(const CVec_FutureZ&) = delete; - CVec_FutureZ(CVec_FutureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_FutureZ)); } - CVec_FutureZ(LDKCVec_FutureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_FutureZ)); } - operator LDKCVec_FutureZ() && { LDKCVec_FutureZ res = self; memset(&self, 0, sizeof(LDKCVec_FutureZ)); return res; } - ~CVec_FutureZ() { CVec_FutureZ_free(self); } - CVec_FutureZ& operator=(CVec_FutureZ&& o) { CVec_FutureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_FutureZ)); return *this; } - LDKCVec_FutureZ* operator &() { return &self; } - LDKCVec_FutureZ* operator ->() { return &self; } - const LDKCVec_FutureZ* operator &() const { return &self; } - const LDKCVec_FutureZ* operator ->() const { return &self; } + LDKCVec_HTLCOutputInCommitmentZ* operator ->() { return &self; } + const LDKCVec_HTLCOutputInCommitmentZ* operator &() const { return &self; } + const LDKCVec_HTLCOutputInCommitmentZ* operator ->() const { return &self; } }; class CResult_RefundBolt12SemanticErrorZ { private: @@ -12768,51 +14787,6 @@ class CResult_RefundBolt12SemanticErrorZ { const LDKCResult_RefundBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_RefundBolt12SemanticErrorZ* 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; -public: - CResult_MaxDustHTLCExposureDecodeErrorZ(const CResult_MaxDustHTLCExposureDecodeErrorZ&) = delete; - CResult_MaxDustHTLCExposureDecodeErrorZ(CResult_MaxDustHTLCExposureDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MaxDustHTLCExposureDecodeErrorZ)); } - CResult_MaxDustHTLCExposureDecodeErrorZ(LDKCResult_MaxDustHTLCExposureDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ)); } - operator LDKCResult_MaxDustHTLCExposureDecodeErrorZ() && { LDKCResult_MaxDustHTLCExposureDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MaxDustHTLCExposureDecodeErrorZ)); return res; } - ~CResult_MaxDustHTLCExposureDecodeErrorZ() { CResult_MaxDustHTLCExposureDecodeErrorZ_free(self); } - CResult_MaxDustHTLCExposureDecodeErrorZ& operator=(CResult_MaxDustHTLCExposureDecodeErrorZ&& o) { CResult_MaxDustHTLCExposureDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MaxDustHTLCExposureDecodeErrorZ)); return *this; } - LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator &() { return &self; } - LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_MaxDustHTLCExposureDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_BalanceZ { -private: - LDKCVec_BalanceZ self; -public: - CVec_BalanceZ(const CVec_BalanceZ&) = delete; - CVec_BalanceZ(CVec_BalanceZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_BalanceZ)); } - CVec_BalanceZ(LDKCVec_BalanceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_BalanceZ)); } - operator LDKCVec_BalanceZ() && { LDKCVec_BalanceZ res = self; memset(&self, 0, sizeof(LDKCVec_BalanceZ)); return res; } - ~CVec_BalanceZ() { CVec_BalanceZ_free(self); } - CVec_BalanceZ& operator=(CVec_BalanceZ&& o) { CVec_BalanceZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_BalanceZ)); return *this; } - LDKCVec_BalanceZ* operator &() { return &self; } - LDKCVec_BalanceZ* operator ->() { return &self; } - const LDKCVec_BalanceZ* operator &() const { return &self; } - const LDKCVec_BalanceZ* operator ->() const { return &self; } -}; class CVec_CommitmentTransactionZ { private: LDKCVec_CommitmentTransactionZ self; @@ -12858,20 +14832,20 @@ class CResult_RecoverableSignatureNoneZ { const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; } const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; } }; -class CResult_SocketAddressDecodeErrorZ { +class CResult_FundingTxInputNoneZ { private: - LDKCResult_SocketAddressDecodeErrorZ self; + LDKCResult_FundingTxInputNoneZ 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; } + CResult_FundingTxInputNoneZ(const CResult_FundingTxInputNoneZ&) = delete; + CResult_FundingTxInputNoneZ(CResult_FundingTxInputNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingTxInputNoneZ)); } + CResult_FundingTxInputNoneZ(LDKCResult_FundingTxInputNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingTxInputNoneZ)); } + operator LDKCResult_FundingTxInputNoneZ() && { LDKCResult_FundingTxInputNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingTxInputNoneZ)); return res; } + ~CResult_FundingTxInputNoneZ() { CResult_FundingTxInputNoneZ_free(self); } + CResult_FundingTxInputNoneZ& operator=(CResult_FundingTxInputNoneZ&& o) { CResult_FundingTxInputNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingTxInputNoneZ)); return *this; } + LDKCResult_FundingTxInputNoneZ* operator &() { return &self; } + LDKCResult_FundingTxInputNoneZ* operator ->() { return &self; } + const LDKCResult_FundingTxInputNoneZ* operator &() const { return &self; } + const LDKCResult_FundingTxInputNoneZ* operator ->() const { return &self; } }; class C2Tuple_Z { private: @@ -12903,81 +14877,6 @@ class COption_AddressZ { const LDKCOption_AddressZ* operator &() const { return &self; } const LDKCOption_AddressZ* operator ->() const { return &self; } }; -class CResult_InboundHTLCDetailsDecodeErrorZ { -private: - LDKCResult_InboundHTLCDetailsDecodeErrorZ self; -public: - CResult_InboundHTLCDetailsDecodeErrorZ(const CResult_InboundHTLCDetailsDecodeErrorZ&) = delete; - CResult_InboundHTLCDetailsDecodeErrorZ(CResult_InboundHTLCDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); } - CResult_InboundHTLCDetailsDecodeErrorZ(LDKCResult_InboundHTLCDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); } - operator LDKCResult_InboundHTLCDetailsDecodeErrorZ() && { LDKCResult_InboundHTLCDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InboundHTLCDetailsDecodeErrorZ)); return res; } - ~CResult_InboundHTLCDetailsDecodeErrorZ() { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); } - CResult_InboundHTLCDetailsDecodeErrorZ& operator=(CResult_InboundHTLCDetailsDecodeErrorZ&& o) { CResult_InboundHTLCDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InboundHTLCDetailsDecodeErrorZ)); return *this; } - LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() { return &self; } - LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_TxCreationKeysDecodeErrorZ { -private: - LDKCResult_TxCreationKeysDecodeErrorZ self; -public: - CResult_TxCreationKeysDecodeErrorZ(const CResult_TxCreationKeysDecodeErrorZ&) = delete; - CResult_TxCreationKeysDecodeErrorZ(CResult_TxCreationKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); } - CResult_TxCreationKeysDecodeErrorZ(LDKCResult_TxCreationKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); } - operator LDKCResult_TxCreationKeysDecodeErrorZ() && { LDKCResult_TxCreationKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); return res; } - ~CResult_TxCreationKeysDecodeErrorZ() { CResult_TxCreationKeysDecodeErrorZ_free(self); } - CResult_TxCreationKeysDecodeErrorZ& operator=(CResult_TxCreationKeysDecodeErrorZ&& o) { CResult_TxCreationKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); return *this; } - LDKCResult_TxCreationKeysDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxCreationKeysDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxCreationKeysDecodeErrorZ* 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 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 CVec_PathZ { -private: - LDKCVec_PathZ self; -public: - CVec_PathZ(const CVec_PathZ&) = delete; - CVec_PathZ(CVec_PathZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PathZ)); } - CVec_PathZ(LDKCVec_PathZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PathZ)); } - operator LDKCVec_PathZ() && { LDKCVec_PathZ res = self; memset(&self, 0, sizeof(LDKCVec_PathZ)); return res; } - ~CVec_PathZ() { CVec_PathZ_free(self); } - CVec_PathZ& operator=(CVec_PathZ&& o) { CVec_PathZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PathZ)); return *this; } - LDKCVec_PathZ* operator &() { return &self; } - LDKCVec_PathZ* operator ->() { return &self; } - const LDKCVec_PathZ* operator &() const { return &self; } - const LDKCVec_PathZ* operator ->() const { return &self; } -}; class CResult_NetworkGraphDecodeErrorZ { private: LDKCResult_NetworkGraphDecodeErrorZ self; @@ -12993,80 +14892,20 @@ class CResult_NetworkGraphDecodeErrorZ { const LDKCResult_NetworkGraphDecodeErrorZ* operator &() const { return &self; } const LDKCResult_NetworkGraphDecodeErrorZ* 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_NodeInfoDecodeErrorZ { -private: - LDKCResult_NodeInfoDecodeErrorZ self; -public: - CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete; - CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); } - CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); } - operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; } - ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); } - CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; } - LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_NodeIdZ { -private: - LDKCVec_NodeIdZ self; -public: - CVec_NodeIdZ(const CVec_NodeIdZ&) = delete; - CVec_NodeIdZ(CVec_NodeIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeIdZ)); } - CVec_NodeIdZ(LDKCVec_NodeIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeIdZ)); } - operator LDKCVec_NodeIdZ() && { LDKCVec_NodeIdZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeIdZ)); return res; } - ~CVec_NodeIdZ() { CVec_NodeIdZ_free(self); } - CVec_NodeIdZ& operator=(CVec_NodeIdZ&& o) { CVec_NodeIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NodeIdZ)); return *this; } - LDKCVec_NodeIdZ* operator &() { return &self; } - LDKCVec_NodeIdZ* operator ->() { return &self; } - const LDKCVec_NodeIdZ* operator &() const { return &self; } - const LDKCVec_NodeIdZ* operator ->() const { return &self; } -}; -class CVec_u8Z { -private: - LDKCVec_u8Z self; -public: - CVec_u8Z(const CVec_u8Z&) = delete; - CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); } - CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); } - operator LDKCVec_u8Z() && { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } - ~CVec_u8Z() { CVec_u8Z_free(self); } - CVec_u8Z& operator=(CVec_u8Z&& o) { CVec_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u8Z)); return *this; } - LDKCVec_u8Z* operator &() { return &self; } - LDKCVec_u8Z* operator ->() { return &self; } - const LDKCVec_u8Z* operator &() const { return &self; } - const LDKCVec_u8Z* operator ->() const { return &self; } -}; -class CResult_RouteLightningErrorZ { +class CResult_AsyncPaymentsContextDecodeErrorZ { private: - LDKCResult_RouteLightningErrorZ self; + LDKCResult_AsyncPaymentsContextDecodeErrorZ self; public: - CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete; - CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); } - CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); } - operator LDKCResult_RouteLightningErrorZ() && { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; } - ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); } - CResult_RouteLightningErrorZ& operator=(CResult_RouteLightningErrorZ&& o) { CResult_RouteLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); return *this; } - LDKCResult_RouteLightningErrorZ* operator &() { return &self; } - LDKCResult_RouteLightningErrorZ* operator ->() { return &self; } - const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } - const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } + CResult_AsyncPaymentsContextDecodeErrorZ(const CResult_AsyncPaymentsContextDecodeErrorZ&) = delete; + CResult_AsyncPaymentsContextDecodeErrorZ(CResult_AsyncPaymentsContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); } + CResult_AsyncPaymentsContextDecodeErrorZ(LDKCResult_AsyncPaymentsContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); } + operator LDKCResult_AsyncPaymentsContextDecodeErrorZ() && { LDKCResult_AsyncPaymentsContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); return res; } + ~CResult_AsyncPaymentsContextDecodeErrorZ() { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); } + CResult_AsyncPaymentsContextDecodeErrorZ& operator=(CResult_AsyncPaymentsContextDecodeErrorZ&& o) { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); return *this; } + LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() const { return &self; } }; class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { private: @@ -13078,70 +14917,25 @@ class CResult_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; -public: - CResult_ChannelPublicKeysDecodeErrorZ(const CResult_ChannelPublicKeysDecodeErrorZ&) = delete; - CResult_ChannelPublicKeysDecodeErrorZ(CResult_ChannelPublicKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); } - CResult_ChannelPublicKeysDecodeErrorZ(LDKCResult_ChannelPublicKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); } - operator LDKCResult_ChannelPublicKeysDecodeErrorZ() && { LDKCResult_ChannelPublicKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); return res; } - ~CResult_ChannelPublicKeysDecodeErrorZ() { CResult_ChannelPublicKeysDecodeErrorZ_free(self); } - CResult_ChannelPublicKeysDecodeErrorZ& operator=(CResult_ChannelPublicKeysDecodeErrorZ&& o) { CResult_ChannelPublicKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); return *this; } - LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelPublicKeysDecodeErrorZ* 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 CResult_DelayedPaymentKeyDecodeErrorZ { -private: - LDKCResult_DelayedPaymentKeyDecodeErrorZ self; -public: - CResult_DelayedPaymentKeyDecodeErrorZ(const CResult_DelayedPaymentKeyDecodeErrorZ&) = delete; - CResult_DelayedPaymentKeyDecodeErrorZ(CResult_DelayedPaymentKeyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); } - CResult_DelayedPaymentKeyDecodeErrorZ(LDKCResult_DelayedPaymentKeyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); } - operator LDKCResult_DelayedPaymentKeyDecodeErrorZ() && { LDKCResult_DelayedPaymentKeyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); return res; } - ~CResult_DelayedPaymentKeyDecodeErrorZ() { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); } - CResult_DelayedPaymentKeyDecodeErrorZ& operator=(CResult_DelayedPaymentKeyDecodeErrorZ&& o) { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); return *this; } - LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() { return &self; } - LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() const { return &self; } + 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 COption_CVec_ThirtyTwoBytesZZ { +class CResult_ChannelPublicKeysDecodeErrorZ { private: - LDKCOption_CVec_ThirtyTwoBytesZZ self; + LDKCResult_ChannelPublicKeysDecodeErrorZ 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; } + CResult_ChannelPublicKeysDecodeErrorZ(const CResult_ChannelPublicKeysDecodeErrorZ&) = delete; + CResult_ChannelPublicKeysDecodeErrorZ(CResult_ChannelPublicKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); } + CResult_ChannelPublicKeysDecodeErrorZ(LDKCResult_ChannelPublicKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); } + operator LDKCResult_ChannelPublicKeysDecodeErrorZ() && { LDKCResult_ChannelPublicKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); return res; } + ~CResult_ChannelPublicKeysDecodeErrorZ() { CResult_ChannelPublicKeysDecodeErrorZ_free(self); } + CResult_ChannelPublicKeysDecodeErrorZ& operator=(CResult_ChannelPublicKeysDecodeErrorZ&& o) { CResult_ChannelPublicKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); return *this; } + LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() const { return &self; } }; class CVec_SocketAddressZ { private: @@ -13173,35 +14967,20 @@ class CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ* operator &() const { return &self; } const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ* operator ->() const { return &self; } }; -class CResult_InvoiceRequestDecodeErrorZ { -private: - LDKCResult_InvoiceRequestDecodeErrorZ self; -public: - CResult_InvoiceRequestDecodeErrorZ(const CResult_InvoiceRequestDecodeErrorZ&) = delete; - CResult_InvoiceRequestDecodeErrorZ(CResult_InvoiceRequestDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); } - CResult_InvoiceRequestDecodeErrorZ(LDKCResult_InvoiceRequestDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); } - operator LDKCResult_InvoiceRequestDecodeErrorZ() && { LDKCResult_InvoiceRequestDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); return res; } - ~CResult_InvoiceRequestDecodeErrorZ() { CResult_InvoiceRequestDecodeErrorZ_free(self); } - CResult_InvoiceRequestDecodeErrorZ& operator=(CResult_InvoiceRequestDecodeErrorZ&& o) { CResult_InvoiceRequestDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); return *this; } - LDKCResult_InvoiceRequestDecodeErrorZ* operator &() { return &self; } - LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceRequestDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { +class CResult_HolderCommitmentTransactionDecodeErrorZ { private: - LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ self; + LDKCResult_HolderCommitmentTransactionDecodeErrorZ self; public: - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(const CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&) = delete; - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } - operator LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() && { LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return res; } - ~CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); } - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ& operator=(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return *this; } - LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() { return &self; } - LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() const { return &self; } + CResult_HolderCommitmentTransactionDecodeErrorZ(const CResult_HolderCommitmentTransactionDecodeErrorZ&) = delete; + CResult_HolderCommitmentTransactionDecodeErrorZ(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); } + CResult_HolderCommitmentTransactionDecodeErrorZ(LDKCResult_HolderCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_HolderCommitmentTransactionDecodeErrorZ() && { LDKCResult_HolderCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_HolderCommitmentTransactionDecodeErrorZ() { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); } + CResult_HolderCommitmentTransactionDecodeErrorZ& operator=(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; class CResult_WarningMessageDecodeErrorZ { private: @@ -13233,201 +15012,6 @@ class CResult_ChannelCounterpartyDecodeErrorZ { const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_HolderCommitmentTransactionDecodeErrorZ { -private: - LDKCResult_HolderCommitmentTransactionDecodeErrorZ self; -public: - CResult_HolderCommitmentTransactionDecodeErrorZ(const CResult_HolderCommitmentTransactionDecodeErrorZ&) = delete; - CResult_HolderCommitmentTransactionDecodeErrorZ(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); } - CResult_HolderCommitmentTransactionDecodeErrorZ(LDKCResult_HolderCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_HolderCommitmentTransactionDecodeErrorZ() && { LDKCResult_HolderCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_HolderCommitmentTransactionDecodeErrorZ() { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); } - CResult_HolderCommitmentTransactionDecodeErrorZ& operator=(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_AsyncPaymentsContextDecodeErrorZ { -private: - LDKCResult_AsyncPaymentsContextDecodeErrorZ self; -public: - CResult_AsyncPaymentsContextDecodeErrorZ(const CResult_AsyncPaymentsContextDecodeErrorZ&) = delete; - CResult_AsyncPaymentsContextDecodeErrorZ(CResult_AsyncPaymentsContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); } - CResult_AsyncPaymentsContextDecodeErrorZ(LDKCResult_AsyncPaymentsContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); } - operator LDKCResult_AsyncPaymentsContextDecodeErrorZ() && { LDKCResult_AsyncPaymentsContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); return res; } - ~CResult_AsyncPaymentsContextDecodeErrorZ() { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); } - CResult_AsyncPaymentsContextDecodeErrorZ& operator=(CResult_AsyncPaymentsContextDecodeErrorZ&& o) { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); return *this; } - LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() const { return &self; } -}; -class C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { -private: - LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ self; -public: - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ(const C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ&) = delete; - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ(C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ)); } - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ)); } - operator LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ() && { LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ)); return res; } - ~C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ() { C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(self); } - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ& operator=(C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ&& o) { C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ)); return *this; } - LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* operator &() { return &self; } - LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* operator ->() { return &self; } - const LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* operator &() const { return &self; } - const LDKC3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ* operator ->() const { return &self; } -}; -class CResult_OfferBolt12SemanticErrorZ { -private: - LDKCResult_OfferBolt12SemanticErrorZ self; -public: - CResult_OfferBolt12SemanticErrorZ(const CResult_OfferBolt12SemanticErrorZ&) = delete; - CResult_OfferBolt12SemanticErrorZ(CResult_OfferBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferBolt12SemanticErrorZ)); } - CResult_OfferBolt12SemanticErrorZ(LDKCResult_OfferBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferBolt12SemanticErrorZ)); } - operator LDKCResult_OfferBolt12SemanticErrorZ() && { LDKCResult_OfferBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferBolt12SemanticErrorZ)); return res; } - ~CResult_OfferBolt12SemanticErrorZ() { CResult_OfferBolt12SemanticErrorZ_free(self); } - CResult_OfferBolt12SemanticErrorZ& operator=(CResult_OfferBolt12SemanticErrorZ&& o) { CResult_OfferBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferBolt12SemanticErrorZ)); return *this; } - LDKCResult_OfferBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_OfferBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_OfferBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_OfferBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { -private: - LDKCResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ self; -public: - 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 CVec_LSPS2RawOpeningFeeParamsZ { -private: - LDKCVec_LSPS2RawOpeningFeeParamsZ self; -public: - CVec_LSPS2RawOpeningFeeParamsZ(const CVec_LSPS2RawOpeningFeeParamsZ&) = delete; - CVec_LSPS2RawOpeningFeeParamsZ(CVec_LSPS2RawOpeningFeeParamsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_LSPS2RawOpeningFeeParamsZ)); } - CVec_LSPS2RawOpeningFeeParamsZ(LDKCVec_LSPS2RawOpeningFeeParamsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_LSPS2RawOpeningFeeParamsZ)); } - operator LDKCVec_LSPS2RawOpeningFeeParamsZ() && { LDKCVec_LSPS2RawOpeningFeeParamsZ res = self; memset(&self, 0, sizeof(LDKCVec_LSPS2RawOpeningFeeParamsZ)); return res; } - ~CVec_LSPS2RawOpeningFeeParamsZ() { CVec_LSPS2RawOpeningFeeParamsZ_free(self); } - CVec_LSPS2RawOpeningFeeParamsZ& operator=(CVec_LSPS2RawOpeningFeeParamsZ&& o) { CVec_LSPS2RawOpeningFeeParamsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_LSPS2RawOpeningFeeParamsZ)); return *this; } - LDKCVec_LSPS2RawOpeningFeeParamsZ* operator &() { return &self; } - LDKCVec_LSPS2RawOpeningFeeParamsZ* operator ->() { return &self; } - const LDKCVec_LSPS2RawOpeningFeeParamsZ* operator &() const { return &self; } - const LDKCVec_LSPS2RawOpeningFeeParamsZ* operator ->() const { return &self; } -}; -class CResult_InitDecodeErrorZ { -private: - LDKCResult_InitDecodeErrorZ self; -public: - CResult_InitDecodeErrorZ(const CResult_InitDecodeErrorZ&) = delete; - CResult_InitDecodeErrorZ(CResult_InitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); } - CResult_InitDecodeErrorZ(LDKCResult_InitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); } - operator LDKCResult_InitDecodeErrorZ() && { LDKCResult_InitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); return res; } - ~CResult_InitDecodeErrorZ() { CResult_InitDecodeErrorZ_free(self); } - CResult_InitDecodeErrorZ& operator=(CResult_InitDecodeErrorZ&& o) { CResult_InitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); return *this; } - LDKCResult_InitDecodeErrorZ* operator &() { return &self; } - LDKCResult_InitDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_PaymentPurposeDecodeErrorZ { -private: - LDKCResult_PaymentPurposeDecodeErrorZ self; -public: - CResult_PaymentPurposeDecodeErrorZ(const CResult_PaymentPurposeDecodeErrorZ&) = delete; - CResult_PaymentPurposeDecodeErrorZ(CResult_PaymentPurposeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); } - CResult_PaymentPurposeDecodeErrorZ(LDKCResult_PaymentPurposeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); } - operator LDKCResult_PaymentPurposeDecodeErrorZ() && { LDKCResult_PaymentPurposeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); return res; } - ~CResult_PaymentPurposeDecodeErrorZ() { CResult_PaymentPurposeDecodeErrorZ_free(self); } - CResult_PaymentPurposeDecodeErrorZ& operator=(CResult_PaymentPurposeDecodeErrorZ&& o) { CResult_PaymentPurposeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); return *this; } - LDKCResult_PaymentPurposeDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentPurposeDecodeErrorZ* 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 CVec_ChannelDetailsZ { -private: - LDKCVec_ChannelDetailsZ self; -public: - CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete; - CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); } - CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); } - operator LDKCVec_ChannelDetailsZ() && { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } - ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } - CVec_ChannelDetailsZ& operator=(CVec_ChannelDetailsZ&& o) { CVec_ChannelDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); return *this; } - LDKCVec_ChannelDetailsZ* operator &() { return &self; } - LDKCVec_ChannelDetailsZ* operator ->() { return &self; } - const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } - const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; } -}; -class CResult_OutPointDecodeErrorZ { -private: - LDKCResult_OutPointDecodeErrorZ self; -public: - CResult_OutPointDecodeErrorZ(const CResult_OutPointDecodeErrorZ&) = delete; - CResult_OutPointDecodeErrorZ(CResult_OutPointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); } - CResult_OutPointDecodeErrorZ(LDKCResult_OutPointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); } - operator LDKCResult_OutPointDecodeErrorZ() && { LDKCResult_OutPointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); return res; } - ~CResult_OutPointDecodeErrorZ() { CResult_OutPointDecodeErrorZ_free(self); } - CResult_OutPointDecodeErrorZ& operator=(CResult_OutPointDecodeErrorZ&& o) { CResult_OutPointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); return *this; } - LDKCResult_OutPointDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutPointDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutPointDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutPointDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_MessageSendEventZ { -private: - LDKCVec_MessageSendEventZ self; -public: - CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete; - CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); } - CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); } - operator LDKCVec_MessageSendEventZ() && { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } - ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } - CVec_MessageSendEventZ& operator=(CVec_MessageSendEventZ&& o) { CVec_MessageSendEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MessageSendEventZ)); return *this; } - LDKCVec_MessageSendEventZ* operator &() { return &self; } - LDKCVec_MessageSendEventZ* operator ->() { return &self; } - const LDKCVec_MessageSendEventZ* operator &() const { return &self; } - const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } -}; -class CResult_Bolt11InvoiceFeaturesDecodeErrorZ { -private: - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ self; -public: - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(const CResult_Bolt11InvoiceFeaturesDecodeErrorZ&) = delete; - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } - operator LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return res; } - ~CResult_Bolt11InvoiceFeaturesDecodeErrorZ() { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return *this; } - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_DNSResolverContextDecodeErrorZ { private: LDKCResult_DNSResolverContextDecodeErrorZ self; @@ -13443,50 +15027,50 @@ class CResult_DNSResolverContextDecodeErrorZ { const LDKCResult_DNSResolverContextDecodeErrorZ* operator &() const { return &self; } const LDKCResult_DNSResolverContextDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { +class CResult_InitDecodeErrorZ { private: - LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ self; + LDKCResult_InitDecodeErrorZ self; public: - CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(const CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&) = delete; - CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); } - CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); } - operator LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ() && { LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); return res; } - ~CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ() { CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(self); } - CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ& operator=(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ&& o) { CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ)); return *this; } - LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator &() { return &self; } - LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ* operator ->() const { return &self; } + CResult_InitDecodeErrorZ(const CResult_InitDecodeErrorZ&) = delete; + CResult_InitDecodeErrorZ(CResult_InitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); } + CResult_InitDecodeErrorZ(LDKCResult_InitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); } + operator LDKCResult_InitDecodeErrorZ() && { LDKCResult_InitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); return res; } + ~CResult_InitDecodeErrorZ() { CResult_InitDecodeErrorZ_free(self); } + CResult_InitDecodeErrorZ& operator=(CResult_InitDecodeErrorZ&& o) { CResult_InitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); return *this; } + LDKCResult_InitDecodeErrorZ* operator &() { return &self; } + LDKCResult_InitDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RouteHintHopDecodeErrorZ { +class CResult_PaymentPurposeDecodeErrorZ { private: - LDKCResult_RouteHintHopDecodeErrorZ self; + LDKCResult_PaymentPurposeDecodeErrorZ self; public: - CResult_RouteHintHopDecodeErrorZ(const CResult_RouteHintHopDecodeErrorZ&) = delete; - CResult_RouteHintHopDecodeErrorZ(CResult_RouteHintHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); } - CResult_RouteHintHopDecodeErrorZ(LDKCResult_RouteHintHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); } - operator LDKCResult_RouteHintHopDecodeErrorZ() && { LDKCResult_RouteHintHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); return res; } - ~CResult_RouteHintHopDecodeErrorZ() { CResult_RouteHintHopDecodeErrorZ_free(self); } - CResult_RouteHintHopDecodeErrorZ& operator=(CResult_RouteHintHopDecodeErrorZ&& o) { CResult_RouteHintHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); return *this; } - LDKCResult_RouteHintHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHintHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHintHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHintHopDecodeErrorZ* operator ->() const { return &self; } + CResult_PaymentPurposeDecodeErrorZ(const CResult_PaymentPurposeDecodeErrorZ&) = delete; + CResult_PaymentPurposeDecodeErrorZ(CResult_PaymentPurposeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); } + CResult_PaymentPurposeDecodeErrorZ(LDKCResult_PaymentPurposeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); } + operator LDKCResult_PaymentPurposeDecodeErrorZ() && { LDKCResult_PaymentPurposeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); return res; } + ~CResult_PaymentPurposeDecodeErrorZ() { CResult_PaymentPurposeDecodeErrorZ_free(self); } + CResult_PaymentPurposeDecodeErrorZ& operator=(CResult_PaymentPurposeDecodeErrorZ&& o) { CResult_PaymentPurposeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); return *this; } + LDKCResult_PaymentPurposeDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { +class CVec_MessageSendEventZ { private: - LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ self; + LDKCVec_MessageSendEventZ self; public: - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ(const CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ&) = delete; - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ(CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ)); } - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ)); } - operator LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ() && { LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ)); return res; } - ~CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ() { CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(self); } - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ& operator=(CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ&& o) { CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ)); return *this; } - LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* operator &() { return &self; } - LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* operator ->() { return &self; } - const LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* operator &() const { return &self; } - const LDKCResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ* operator ->() const { return &self; } + CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete; + CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); } + CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); } + operator LDKCVec_MessageSendEventZ() && { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } + ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } + CVec_MessageSendEventZ& operator=(CVec_MessageSendEventZ&& o) { CVec_MessageSendEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MessageSendEventZ)); return *this; } + LDKCVec_MessageSendEventZ* operator &() { return &self; } + LDKCVec_MessageSendEventZ* operator ->() { return &self; } + const LDKCVec_MessageSendEventZ* operator &() const { return &self; } + const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } }; class CResult_UpdateFailMalformedHTLCDecodeErrorZ { private: @@ -13533,21 +15117,6 @@ class CResult_ThirtyTwoBytesAPIErrorZ { const LDKCResult_ThirtyTwoBytesAPIErrorZ* operator &() const { return &self; } const LDKCResult_ThirtyTwoBytesAPIErrorZ* operator ->() const { return &self; } }; -class COption_ChannelShutdownStateZ { -private: - LDKCOption_ChannelShutdownStateZ self; -public: - COption_ChannelShutdownStateZ(const COption_ChannelShutdownStateZ&) = delete; - COption_ChannelShutdownStateZ(COption_ChannelShutdownStateZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ChannelShutdownStateZ)); } - COption_ChannelShutdownStateZ(LDKCOption_ChannelShutdownStateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ChannelShutdownStateZ)); } - operator LDKCOption_ChannelShutdownStateZ() && { LDKCOption_ChannelShutdownStateZ res = self; memset(&self, 0, sizeof(LDKCOption_ChannelShutdownStateZ)); return res; } - ~COption_ChannelShutdownStateZ() { COption_ChannelShutdownStateZ_free(self); } - COption_ChannelShutdownStateZ& operator=(COption_ChannelShutdownStateZ&& o) { COption_ChannelShutdownStateZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ChannelShutdownStateZ)); return *this; } - LDKCOption_ChannelShutdownStateZ* operator &() { return &self; } - LDKCOption_ChannelShutdownStateZ* operator ->() { return &self; } - const LDKCOption_ChannelShutdownStateZ* operator &() const { return &self; } - const LDKCOption_ChannelShutdownStateZ* operator ->() const { return &self; } -}; class CResult_Bolt12InvoiceBolt12SemanticErrorZ { private: LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ self; @@ -13563,6 +15132,21 @@ class CResult_Bolt12InvoiceBolt12SemanticErrorZ { const LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ* operator ->() const { return &self; } }; +class C2Tuple_ChannelIdu64Z { +private: + LDKC2Tuple_ChannelIdu64Z self; +public: + C2Tuple_ChannelIdu64Z(const C2Tuple_ChannelIdu64Z&) = delete; + C2Tuple_ChannelIdu64Z(C2Tuple_ChannelIdu64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ChannelIdu64Z)); } + C2Tuple_ChannelIdu64Z(LDKC2Tuple_ChannelIdu64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ChannelIdu64Z)); } + operator LDKC2Tuple_ChannelIdu64Z() && { LDKC2Tuple_ChannelIdu64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_ChannelIdu64Z)); return res; } + ~C2Tuple_ChannelIdu64Z() { C2Tuple_ChannelIdu64Z_free(self); } + C2Tuple_ChannelIdu64Z& operator=(C2Tuple_ChannelIdu64Z&& o) { C2Tuple_ChannelIdu64Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ChannelIdu64Z)); return *this; } + LDKC2Tuple_ChannelIdu64Z* operator &() { return &self; } + LDKC2Tuple_ChannelIdu64Z* operator ->() { return &self; } + const LDKC2Tuple_ChannelIdu64Z* operator &() const { return &self; } + const LDKC2Tuple_ChannelIdu64Z* operator ->() const { return &self; } +}; class CResult_InvoiceRequestFieldsDecodeErrorZ { private: LDKCResult_InvoiceRequestFieldsDecodeErrorZ self; @@ -13578,36 +15162,6 @@ class CResult_InvoiceRequestFieldsDecodeErrorZ { const LDKCResult_InvoiceRequestFieldsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_InvoiceRequestFieldsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NoneBolt12PaymentErrorZ { -private: - LDKCResult_NoneBolt12PaymentErrorZ self; -public: - CResult_NoneBolt12PaymentErrorZ(const CResult_NoneBolt12PaymentErrorZ&) = delete; - CResult_NoneBolt12PaymentErrorZ(CResult_NoneBolt12PaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); } - CResult_NoneBolt12PaymentErrorZ(LDKCResult_NoneBolt12PaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); } - operator LDKCResult_NoneBolt12PaymentErrorZ() && { LDKCResult_NoneBolt12PaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); return res; } - ~CResult_NoneBolt12PaymentErrorZ() { CResult_NoneBolt12PaymentErrorZ_free(self); } - CResult_NoneBolt12PaymentErrorZ& operator=(CResult_NoneBolt12PaymentErrorZ&& o) { CResult_NoneBolt12PaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); return *this; } - LDKCResult_NoneBolt12PaymentErrorZ* operator &() { return &self; } - LDKCResult_NoneBolt12PaymentErrorZ* operator ->() { return &self; } - const LDKCResult_NoneBolt12PaymentErrorZ* operator &() const { return &self; } - const LDKCResult_NoneBolt12PaymentErrorZ* operator ->() const { return &self; } -}; -class CResult_AcceptChannelDecodeErrorZ { -private: - LDKCResult_AcceptChannelDecodeErrorZ self; -public: - CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete; - CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); } - CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); } - operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; } - ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); } - CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; } - LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; } - LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_RefundDecodeErrorZ { private: LDKCResult_RefundDecodeErrorZ self; @@ -13638,96 +15192,6 @@ class CResult_HostnameDecodeErrorZ { const LDKCResult_HostnameDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HostnameDecodeErrorZ* operator ->() const { return &self; } }; -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: - LDKCOption_ThirtyTwoBytesZ self; -public: - 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: - LDKCVec_u64Z self; -public: - CVec_u64Z(const CVec_u64Z&) = delete; - CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); } - CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); } - operator LDKCVec_u64Z() && { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } - ~CVec_u64Z() { CVec_u64Z_free(self); } - CVec_u64Z& operator=(CVec_u64Z&& o) { CVec_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u64Z)); return *this; } - LDKCVec_u64Z* operator &() { return &self; } - LDKCVec_u64Z* operator ->() { return &self; } - const LDKCVec_u64Z* operator &() const { return &self; } - const LDKCVec_u64Z* operator ->() const { return &self; } -}; -class CResult_NoneBolt12SemanticErrorZ { -private: - LDKCResult_NoneBolt12SemanticErrorZ self; -public: - CResult_NoneBolt12SemanticErrorZ(const CResult_NoneBolt12SemanticErrorZ&) = delete; - CResult_NoneBolt12SemanticErrorZ(CResult_NoneBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); } - CResult_NoneBolt12SemanticErrorZ(LDKCResult_NoneBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); } - operator LDKCResult_NoneBolt12SemanticErrorZ() && { LDKCResult_NoneBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12SemanticErrorZ)); return res; } - ~CResult_NoneBolt12SemanticErrorZ() { CResult_NoneBolt12SemanticErrorZ_free(self); } - CResult_NoneBolt12SemanticErrorZ& operator=(CResult_NoneBolt12SemanticErrorZ&& o) { CResult_NoneBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12SemanticErrorZ)); return *this; } - LDKCResult_NoneBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_NoneBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_NoneBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_NoneBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class COption_InboundHTLCStateDetailsZ { -private: - LDKCOption_InboundHTLCStateDetailsZ self; -public: - COption_InboundHTLCStateDetailsZ(const COption_InboundHTLCStateDetailsZ&) = delete; - COption_InboundHTLCStateDetailsZ(COption_InboundHTLCStateDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); } - COption_InboundHTLCStateDetailsZ(LDKCOption_InboundHTLCStateDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); } - operator LDKCOption_InboundHTLCStateDetailsZ() && { LDKCOption_InboundHTLCStateDetailsZ res = self; memset(&self, 0, sizeof(LDKCOption_InboundHTLCStateDetailsZ)); return res; } - ~COption_InboundHTLCStateDetailsZ() { COption_InboundHTLCStateDetailsZ_free(self); } - COption_InboundHTLCStateDetailsZ& operator=(COption_InboundHTLCStateDetailsZ&& o) { COption_InboundHTLCStateDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_InboundHTLCStateDetailsZ)); return *this; } - LDKCOption_InboundHTLCStateDetailsZ* operator &() { return &self; } - LDKCOption_InboundHTLCStateDetailsZ* operator ->() { return &self; } - const LDKCOption_InboundHTLCStateDetailsZ* operator &() const { return &self; } - const LDKCOption_InboundHTLCStateDetailsZ* operator ->() const { return &self; } -}; -class CResult_OutputSweeperDecodeErrorZ { -private: - LDKCResult_OutputSweeperDecodeErrorZ self; -public: - CResult_OutputSweeperDecodeErrorZ(const CResult_OutputSweeperDecodeErrorZ&) = delete; - CResult_OutputSweeperDecodeErrorZ(CResult_OutputSweeperDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); } - CResult_OutputSweeperDecodeErrorZ(LDKCResult_OutputSweeperDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); } - operator LDKCResult_OutputSweeperDecodeErrorZ() && { LDKCResult_OutputSweeperDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSweeperDecodeErrorZ)); return res; } - ~CResult_OutputSweeperDecodeErrorZ() { CResult_OutputSweeperDecodeErrorZ_free(self); } - CResult_OutputSweeperDecodeErrorZ& operator=(CResult_OutputSweeperDecodeErrorZ&& o) { CResult_OutputSweeperDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSweeperDecodeErrorZ)); return *this; } - LDKCResult_OutputSweeperDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutputSweeperDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutputSweeperDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutputSweeperDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_C2Tuple_CVec_u8Zu64ZNoneZ { private: LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ self; @@ -13743,51 +15207,6 @@ class CResult_C2Tuple_CVec_u8Zu64ZNoneZ { const LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_CVec_u8Zu64ZNoneZ* operator ->() const { return &self; } }; -class COption_EventZ { -private: - LDKCOption_EventZ self; -public: - COption_EventZ(const COption_EventZ&) = delete; - COption_EventZ(COption_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_EventZ)); } - COption_EventZ(LDKCOption_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_EventZ)); } - operator LDKCOption_EventZ() && { LDKCOption_EventZ res = self; memset(&self, 0, sizeof(LDKCOption_EventZ)); return res; } - ~COption_EventZ() { COption_EventZ_free(self); } - COption_EventZ& operator=(COption_EventZ&& o) { COption_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_EventZ)); return *this; } - LDKCOption_EventZ* operator &() { return &self; } - LDKCOption_EventZ* operator ->() { return &self; } - const LDKCOption_EventZ* operator &() const { return &self; } - const LDKCOption_EventZ* operator ->() const { return &self; } -}; -class COption_CVec_SocketAddressZZ { -private: - LDKCOption_CVec_SocketAddressZZ self; -public: - 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 CResult_ChannelTypeFeaturesDecodeErrorZ { -private: - LDKCResult_ChannelTypeFeaturesDecodeErrorZ self; -public: - CResult_ChannelTypeFeaturesDecodeErrorZ(const CResult_ChannelTypeFeaturesDecodeErrorZ&) = delete; - CResult_ChannelTypeFeaturesDecodeErrorZ(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); } - CResult_ChannelTypeFeaturesDecodeErrorZ(LDKCResult_ChannelTypeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); } - operator LDKCResult_ChannelTypeFeaturesDecodeErrorZ() && { LDKCResult_ChannelTypeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); return res; } - ~CResult_ChannelTypeFeaturesDecodeErrorZ() { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); } - CResult_ChannelTypeFeaturesDecodeErrorZ& operator=(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); return *this; } - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; class CVec_RouteHintZ { private: LDKCVec_RouteHintZ self; @@ -13819,49 +15238,19 @@ class COption_u16Z { const LDKCOption_u16Z* operator ->() const { return &self; } }; class COption_PaymentFailureReasonZ { -private: - LDKCOption_PaymentFailureReasonZ self; -public: - COption_PaymentFailureReasonZ(const COption_PaymentFailureReasonZ&) = delete; - COption_PaymentFailureReasonZ(COption_PaymentFailureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentFailureReasonZ)); } - COption_PaymentFailureReasonZ(LDKCOption_PaymentFailureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentFailureReasonZ)); } - operator LDKCOption_PaymentFailureReasonZ() && { LDKCOption_PaymentFailureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentFailureReasonZ)); return res; } - ~COption_PaymentFailureReasonZ() { COption_PaymentFailureReasonZ_free(self); } - COption_PaymentFailureReasonZ& operator=(COption_PaymentFailureReasonZ&& o) { COption_PaymentFailureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentFailureReasonZ)); return *this; } - LDKCOption_PaymentFailureReasonZ* operator &() { return &self; } - LDKCOption_PaymentFailureReasonZ* operator ->() { return &self; } - const LDKCOption_PaymentFailureReasonZ* operator &() const { return &self; } - const LDKCOption_PaymentFailureReasonZ* operator ->() const { return &self; } -}; -class CResult_Bolt12RefundContextDecodeErrorZ { -private: - LDKCResult_Bolt12RefundContextDecodeErrorZ self; -public: - CResult_Bolt12RefundContextDecodeErrorZ(const CResult_Bolt12RefundContextDecodeErrorZ&) = delete; - CResult_Bolt12RefundContextDecodeErrorZ(CResult_Bolt12RefundContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12RefundContextDecodeErrorZ)); } - CResult_Bolt12RefundContextDecodeErrorZ(LDKCResult_Bolt12RefundContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ)); } - operator LDKCResult_Bolt12RefundContextDecodeErrorZ() && { LDKCResult_Bolt12RefundContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12RefundContextDecodeErrorZ)); return res; } - ~CResult_Bolt12RefundContextDecodeErrorZ() { CResult_Bolt12RefundContextDecodeErrorZ_free(self); } - CResult_Bolt12RefundContextDecodeErrorZ& operator=(CResult_Bolt12RefundContextDecodeErrorZ&& o) { CResult_Bolt12RefundContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12RefundContextDecodeErrorZ)); return *this; } - LDKCResult_Bolt12RefundContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_Bolt12RefundContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt12RefundContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt12RefundContextDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_ECDSASignatureNoneZ { -private: - LDKCResult_ECDSASignatureNoneZ self; -public: - 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; } +private: + LDKCOption_PaymentFailureReasonZ self; +public: + COption_PaymentFailureReasonZ(const COption_PaymentFailureReasonZ&) = delete; + COption_PaymentFailureReasonZ(COption_PaymentFailureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_PaymentFailureReasonZ)); } + COption_PaymentFailureReasonZ(LDKCOption_PaymentFailureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_PaymentFailureReasonZ)); } + operator LDKCOption_PaymentFailureReasonZ() && { LDKCOption_PaymentFailureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_PaymentFailureReasonZ)); return res; } + ~COption_PaymentFailureReasonZ() { COption_PaymentFailureReasonZ_free(self); } + COption_PaymentFailureReasonZ& operator=(COption_PaymentFailureReasonZ&& o) { COption_PaymentFailureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_PaymentFailureReasonZ)); return *this; } + LDKCOption_PaymentFailureReasonZ* operator &() { return &self; } + LDKCOption_PaymentFailureReasonZ* operator ->() { return &self; } + const LDKCOption_PaymentFailureReasonZ* operator &() const { return &self; } + const LDKCOption_PaymentFailureReasonZ* operator ->() const { return &self; } }; class C2Tuple_ChannelIdPublicKeyZ { private: @@ -13878,65 +15267,35 @@ class C2Tuple_ChannelIdPublicKeyZ { const LDKC2Tuple_ChannelIdPublicKeyZ* operator &() const { return &self; } const LDKC2Tuple_ChannelIdPublicKeyZ* operator ->() const { return &self; } }; -class C2Tuple_OffersMessageResponseInstructionZ { -private: - LDKC2Tuple_OffersMessageResponseInstructionZ self; -public: - C2Tuple_OffersMessageResponseInstructionZ(const C2Tuple_OffersMessageResponseInstructionZ&) = delete; - C2Tuple_OffersMessageResponseInstructionZ(C2Tuple_OffersMessageResponseInstructionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OffersMessageResponseInstructionZ)); } - C2Tuple_OffersMessageResponseInstructionZ(LDKC2Tuple_OffersMessageResponseInstructionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OffersMessageResponseInstructionZ)); } - operator LDKC2Tuple_OffersMessageResponseInstructionZ() && { LDKC2Tuple_OffersMessageResponseInstructionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OffersMessageResponseInstructionZ)); return res; } - ~C2Tuple_OffersMessageResponseInstructionZ() { C2Tuple_OffersMessageResponseInstructionZ_free(self); } - C2Tuple_OffersMessageResponseInstructionZ& operator=(C2Tuple_OffersMessageResponseInstructionZ&& o) { C2Tuple_OffersMessageResponseInstructionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OffersMessageResponseInstructionZ)); return *this; } - LDKC2Tuple_OffersMessageResponseInstructionZ* operator &() { return &self; } - LDKC2Tuple_OffersMessageResponseInstructionZ* operator ->() { return &self; } - const LDKC2Tuple_OffersMessageResponseInstructionZ* operator &() const { return &self; } - const LDKC2Tuple_OffersMessageResponseInstructionZ* operator ->() const { return &self; } -}; -class CResult_EcdsaChannelSignerDecodeErrorZ { -private: - LDKCResult_EcdsaChannelSignerDecodeErrorZ self; -public: - CResult_EcdsaChannelSignerDecodeErrorZ(const CResult_EcdsaChannelSignerDecodeErrorZ&) = delete; - CResult_EcdsaChannelSignerDecodeErrorZ(CResult_EcdsaChannelSignerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_EcdsaChannelSignerDecodeErrorZ)); } - CResult_EcdsaChannelSignerDecodeErrorZ(LDKCResult_EcdsaChannelSignerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_EcdsaChannelSignerDecodeErrorZ)); } - operator LDKCResult_EcdsaChannelSignerDecodeErrorZ() && { LDKCResult_EcdsaChannelSignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_EcdsaChannelSignerDecodeErrorZ)); return res; } - ~CResult_EcdsaChannelSignerDecodeErrorZ() { CResult_EcdsaChannelSignerDecodeErrorZ_free(self); } - CResult_EcdsaChannelSignerDecodeErrorZ& operator=(CResult_EcdsaChannelSignerDecodeErrorZ&& o) { CResult_EcdsaChannelSignerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_EcdsaChannelSignerDecodeErrorZ)); return *this; } - LDKCResult_EcdsaChannelSignerDecodeErrorZ* operator &() { return &self; } - LDKCResult_EcdsaChannelSignerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_EcdsaChannelSignerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_EcdsaChannelSignerDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_BlindedTailDecodeErrorZ { +class CResult_COption_PaymentFailureReasonZDecodeErrorZ { private: - LDKCResult_BlindedTailDecodeErrorZ self; + LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ self; public: - CResult_BlindedTailDecodeErrorZ(const CResult_BlindedTailDecodeErrorZ&) = delete; - CResult_BlindedTailDecodeErrorZ(CResult_BlindedTailDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedTailDecodeErrorZ)); } - CResult_BlindedTailDecodeErrorZ(LDKCResult_BlindedTailDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedTailDecodeErrorZ)); } - operator LDKCResult_BlindedTailDecodeErrorZ() && { LDKCResult_BlindedTailDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedTailDecodeErrorZ)); return res; } - ~CResult_BlindedTailDecodeErrorZ() { CResult_BlindedTailDecodeErrorZ_free(self); } - CResult_BlindedTailDecodeErrorZ& operator=(CResult_BlindedTailDecodeErrorZ&& o) { CResult_BlindedTailDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedTailDecodeErrorZ)); return *this; } - LDKCResult_BlindedTailDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedTailDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedTailDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedTailDecodeErrorZ* operator ->() const { return &self; } + CResult_COption_PaymentFailureReasonZDecodeErrorZ(const CResult_COption_PaymentFailureReasonZDecodeErrorZ&) = delete; + CResult_COption_PaymentFailureReasonZDecodeErrorZ(CResult_COption_PaymentFailureReasonZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PaymentFailureReasonZDecodeErrorZ)); } + CResult_COption_PaymentFailureReasonZDecodeErrorZ(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ)); } + operator LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ() && { LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ)); return res; } + ~CResult_COption_PaymentFailureReasonZDecodeErrorZ() { CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(self); } + CResult_COption_PaymentFailureReasonZDecodeErrorZ& operator=(CResult_COption_PaymentFailureReasonZDecodeErrorZ&& o) { CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PaymentFailureReasonZDecodeErrorZ)); return *this; } + LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_WitnessZ { +class CResult_SocketAddressSocketAddressParseErrorZ { private: - LDKCVec_WitnessZ self; + LDKCResult_SocketAddressSocketAddressParseErrorZ self; public: - CVec_WitnessZ(const CVec_WitnessZ&) = delete; - CVec_WitnessZ(CVec_WitnessZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_WitnessZ)); } - CVec_WitnessZ(LDKCVec_WitnessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_WitnessZ)); } - operator LDKCVec_WitnessZ() && { LDKCVec_WitnessZ res = self; memset(&self, 0, sizeof(LDKCVec_WitnessZ)); return res; } - ~CVec_WitnessZ() { CVec_WitnessZ_free(self); } - CVec_WitnessZ& operator=(CVec_WitnessZ&& o) { CVec_WitnessZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_WitnessZ)); return *this; } - LDKCVec_WitnessZ* operator &() { return &self; } - LDKCVec_WitnessZ* operator ->() { return &self; } - const LDKCVec_WitnessZ* operator &() const { return &self; } - const LDKCVec_WitnessZ* operator ->() const { return &self; } + 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: @@ -13953,50 +15312,35 @@ class COption_C2Tuple_u64u16ZZ { const LDKCOption_C2Tuple_u64u16ZZ* operator &() const { return &self; } const LDKCOption_C2Tuple_u64u16ZZ* 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 CResult_COption_PaymentFailureReasonZDecodeErrorZ { +class CResult_StaticInvoiceSignErrorZ { private: - LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ self; + LDKCResult_StaticInvoiceSignErrorZ self; public: - CResult_COption_PaymentFailureReasonZDecodeErrorZ(const CResult_COption_PaymentFailureReasonZDecodeErrorZ&) = delete; - CResult_COption_PaymentFailureReasonZDecodeErrorZ(CResult_COption_PaymentFailureReasonZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PaymentFailureReasonZDecodeErrorZ)); } - CResult_COption_PaymentFailureReasonZDecodeErrorZ(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ)); } - operator LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ() && { LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ)); return res; } - ~CResult_COption_PaymentFailureReasonZDecodeErrorZ() { CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(self); } - CResult_COption_PaymentFailureReasonZDecodeErrorZ& operator=(CResult_COption_PaymentFailureReasonZDecodeErrorZ&& o) { CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PaymentFailureReasonZDecodeErrorZ)); return *this; } - LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ* operator ->() const { return &self; } + CResult_StaticInvoiceSignErrorZ(const CResult_StaticInvoiceSignErrorZ&) = delete; + CResult_StaticInvoiceSignErrorZ(CResult_StaticInvoiceSignErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticInvoiceSignErrorZ)); } + CResult_StaticInvoiceSignErrorZ(LDKCResult_StaticInvoiceSignErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticInvoiceSignErrorZ)); } + operator LDKCResult_StaticInvoiceSignErrorZ() && { LDKCResult_StaticInvoiceSignErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticInvoiceSignErrorZ)); return res; } + ~CResult_StaticInvoiceSignErrorZ() { CResult_StaticInvoiceSignErrorZ_free(self); } + CResult_StaticInvoiceSignErrorZ& operator=(CResult_StaticInvoiceSignErrorZ&& o) { CResult_StaticInvoiceSignErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticInvoiceSignErrorZ)); return *this; } + LDKCResult_StaticInvoiceSignErrorZ* operator &() { return &self; } + LDKCResult_StaticInvoiceSignErrorZ* operator ->() { return &self; } + const LDKCResult_StaticInvoiceSignErrorZ* operator &() const { return &self; } + const LDKCResult_StaticInvoiceSignErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { +class CResult_ClosingCompleteDecodeErrorZ { private: - LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ self; + LDKCResult_ClosingCompleteDecodeErrorZ 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; } + CResult_ClosingCompleteDecodeErrorZ(const CResult_ClosingCompleteDecodeErrorZ&) = delete; + CResult_ClosingCompleteDecodeErrorZ(CResult_ClosingCompleteDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingCompleteDecodeErrorZ)); } + CResult_ClosingCompleteDecodeErrorZ(LDKCResult_ClosingCompleteDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingCompleteDecodeErrorZ)); } + operator LDKCResult_ClosingCompleteDecodeErrorZ() && { LDKCResult_ClosingCompleteDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingCompleteDecodeErrorZ)); return res; } + ~CResult_ClosingCompleteDecodeErrorZ() { CResult_ClosingCompleteDecodeErrorZ_free(self); } + CResult_ClosingCompleteDecodeErrorZ& operator=(CResult_ClosingCompleteDecodeErrorZ&& o) { CResult_ClosingCompleteDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingCompleteDecodeErrorZ)); return *this; } + LDKCResult_ClosingCompleteDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClosingCompleteDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClosingCompleteDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClosingCompleteDecodeErrorZ* operator ->() const { return &self; } }; class CResult_ChannelDerivationParametersDecodeErrorZ { private: @@ -14013,51 +15357,6 @@ class CResult_ChannelDerivationParametersDecodeErrorZ { const LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelDerivationParametersDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { -private: - LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ self; -public: - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(const CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&) = delete; - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); } - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); } - operator LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ() && { LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); return res; } - ~CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ() { CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(self); } - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ& operator=(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ&& o) { CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ)); return *this; } - LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator &() { return &self; } - LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator ->() { return &self; } - const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator &() const { return &self; } - const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* 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; @@ -14073,21 +15372,6 @@ class CVec_C2Tuple_PublicKeyTypeZZ { const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; } }; -class CVec_u16Z { -private: - LDKCVec_u16Z self; -public: - CVec_u16Z(const CVec_u16Z&) = delete; - CVec_u16Z(CVec_u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u16Z)); } - CVec_u16Z(LDKCVec_u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u16Z)); } - operator LDKCVec_u16Z() && { LDKCVec_u16Z res = self; memset(&self, 0, sizeof(LDKCVec_u16Z)); return res; } - ~CVec_u16Z() { CVec_u16Z_free(self); } - CVec_u16Z& operator=(CVec_u16Z&& o) { CVec_u16Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u16Z)); return *this; } - LDKCVec_u16Z* operator &() { return &self; } - LDKCVec_u16Z* operator ->() { return &self; } - const LDKCVec_u16Z* operator &() const { return &self; } - const LDKCVec_u16Z* operator ->() const { return &self; } -}; class CResult_OutboundHTLCDetailsDecodeErrorZ { private: LDKCResult_OutboundHTLCDetailsDecodeErrorZ self; @@ -14103,66 +15387,6 @@ class CResult_OutboundHTLCDetailsDecodeErrorZ { const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RefundBolt12ParseErrorZ { -private: - LDKCResult_RefundBolt12ParseErrorZ self; -public: - CResult_RefundBolt12ParseErrorZ(const CResult_RefundBolt12ParseErrorZ&) = delete; - CResult_RefundBolt12ParseErrorZ(CResult_RefundBolt12ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RefundBolt12ParseErrorZ)); } - CResult_RefundBolt12ParseErrorZ(LDKCResult_RefundBolt12ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RefundBolt12ParseErrorZ)); } - operator LDKCResult_RefundBolt12ParseErrorZ() && { LDKCResult_RefundBolt12ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RefundBolt12ParseErrorZ)); return res; } - ~CResult_RefundBolt12ParseErrorZ() { CResult_RefundBolt12ParseErrorZ_free(self); } - CResult_RefundBolt12ParseErrorZ& operator=(CResult_RefundBolt12ParseErrorZ&& o) { CResult_RefundBolt12ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RefundBolt12ParseErrorZ)); return *this; } - LDKCResult_RefundBolt12ParseErrorZ* operator &() { return &self; } - LDKCResult_RefundBolt12ParseErrorZ* operator ->() { return &self; } - const LDKCResult_RefundBolt12ParseErrorZ* operator &() const { return &self; } - const LDKCResult_RefundBolt12ParseErrorZ* operator ->() const { return &self; } -}; -class CResult_u32GraphSyncErrorZ { -private: - LDKCResult_u32GraphSyncErrorZ self; -public: - CResult_u32GraphSyncErrorZ(const CResult_u32GraphSyncErrorZ&) = delete; - CResult_u32GraphSyncErrorZ(CResult_u32GraphSyncErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); } - CResult_u32GraphSyncErrorZ(LDKCResult_u32GraphSyncErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); } - operator LDKCResult_u32GraphSyncErrorZ() && { LDKCResult_u32GraphSyncErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_u32GraphSyncErrorZ)); return res; } - ~CResult_u32GraphSyncErrorZ() { CResult_u32GraphSyncErrorZ_free(self); } - CResult_u32GraphSyncErrorZ& operator=(CResult_u32GraphSyncErrorZ&& o) { CResult_u32GraphSyncErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_u32GraphSyncErrorZ)); return *this; } - LDKCResult_u32GraphSyncErrorZ* operator &() { return &self; } - LDKCResult_u32GraphSyncErrorZ* operator ->() { return &self; } - const LDKCResult_u32GraphSyncErrorZ* operator &() const { return &self; } - const LDKCResult_u32GraphSyncErrorZ* 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_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_OnionMessagePathNoneZ { private: LDKCResult_OnionMessagePathNoneZ self; @@ -14178,36 +15402,21 @@ class CResult_OnionMessagePathNoneZ { const LDKCResult_OnionMessagePathNoneZ* operator &() const { return &self; } const LDKCResult_OnionMessagePathNoneZ* operator ->() const { return &self; } }; -class CResult_NoneAPIErrorZ { -private: - LDKCResult_NoneAPIErrorZ self; -public: - CResult_NoneAPIErrorZ(const CResult_NoneAPIErrorZ&) = delete; - CResult_NoneAPIErrorZ(CResult_NoneAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); } - CResult_NoneAPIErrorZ(LDKCResult_NoneAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); } - operator LDKCResult_NoneAPIErrorZ() && { LDKCResult_NoneAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneAPIErrorZ)); return res; } - ~CResult_NoneAPIErrorZ() { CResult_NoneAPIErrorZ_free(self); } - CResult_NoneAPIErrorZ& operator=(CResult_NoneAPIErrorZ&& o) { CResult_NoneAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneAPIErrorZ)); return *this; } - LDKCResult_NoneAPIErrorZ* operator &() { return &self; } - LDKCResult_NoneAPIErrorZ* operator ->() { return &self; } - const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; } - const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; } -}; -class CResult_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 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 COption_f64Z { private: LDKCOption_f64Z self; @@ -14238,36 +15447,6 @@ class CResult_TxRemoveInputDecodeErrorZ { const LDKCResult_TxRemoveInputDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxRemoveInputDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_PublicKeyZ { -private: - LDKCVec_PublicKeyZ self; -public: - CVec_PublicKeyZ(const CVec_PublicKeyZ&) = delete; - CVec_PublicKeyZ(CVec_PublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PublicKeyZ)); } - CVec_PublicKeyZ(LDKCVec_PublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PublicKeyZ)); } - operator LDKCVec_PublicKeyZ() && { LDKCVec_PublicKeyZ res = self; memset(&self, 0, sizeof(LDKCVec_PublicKeyZ)); return res; } - ~CVec_PublicKeyZ() { CVec_PublicKeyZ_free(self); } - CVec_PublicKeyZ& operator=(CVec_PublicKeyZ&& o) { CVec_PublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PublicKeyZ)); return *this; } - LDKCVec_PublicKeyZ* operator &() { return &self; } - LDKCVec_PublicKeyZ* operator ->() { return &self; } - const LDKCVec_PublicKeyZ* operator &() const { return &self; } - const LDKCVec_PublicKeyZ* operator ->() const { return &self; } -}; -class C2Tuple_CVec_u8Zu64Z { -private: - LDKC2Tuple_CVec_u8Zu64Z self; -public: - C2Tuple_CVec_u8Zu64Z(const C2Tuple_CVec_u8Zu64Z&) = delete; - C2Tuple_CVec_u8Zu64Z(C2Tuple_CVec_u8Zu64Z&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu64Z)); } - C2Tuple_CVec_u8Zu64Z(LDKC2Tuple_CVec_u8Zu64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_u8Zu64Z)); } - operator LDKC2Tuple_CVec_u8Zu64Z() && { LDKC2Tuple_CVec_u8Zu64Z res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_u8Zu64Z)); return res; } - ~C2Tuple_CVec_u8Zu64Z() { C2Tuple_CVec_u8Zu64Z_free(self); } - C2Tuple_CVec_u8Zu64Z& operator=(C2Tuple_CVec_u8Zu64Z&& o) { C2Tuple_CVec_u8Zu64Z_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_u8Zu64Z)); return *this; } - LDKC2Tuple_CVec_u8Zu64Z* operator &() { return &self; } - LDKC2Tuple_CVec_u8Zu64Z* operator ->() { return &self; } - const LDKC2Tuple_CVec_u8Zu64Z* operator &() const { return &self; } - const LDKC2Tuple_CVec_u8Zu64Z* operator ->() const { return &self; } -}; class CVec_C2Tuple_usizeTransactionZZ { private: LDKCVec_C2Tuple_usizeTransactionZZ self; @@ -14283,6 +15462,36 @@ class CVec_C2Tuple_usizeTransactionZZ { const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; } }; +class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { +private: + LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ self; +public: + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(const CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&) = delete; + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); } + operator LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); return res; } + ~CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ() { CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); return *this; } + LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } +}; +class CResult_ChannelDetailsDecodeErrorZ { +private: + LDKCResult_ChannelDetailsDecodeErrorZ self; +public: + CResult_ChannelDetailsDecodeErrorZ(const CResult_ChannelDetailsDecodeErrorZ&) = delete; + CResult_ChannelDetailsDecodeErrorZ(CResult_ChannelDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); } + CResult_ChannelDetailsDecodeErrorZ(LDKCResult_ChannelDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); } + operator LDKCResult_ChannelDetailsDecodeErrorZ() && { LDKCResult_ChannelDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); return res; } + ~CResult_ChannelDetailsDecodeErrorZ() { CResult_ChannelDetailsDecodeErrorZ_free(self); } + CResult_ChannelDetailsDecodeErrorZ& operator=(CResult_ChannelDetailsDecodeErrorZ&& o) { CResult_ChannelDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); return *this; } + LDKCResult_ChannelDetailsDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { private: LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ self; @@ -14358,96 +15567,6 @@ class CResult_PendingHTLCRoutingDecodeErrorZ { const LDKCResult_PendingHTLCRoutingDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PendingHTLCRoutingDecodeErrorZ* operator ->() const { return &self; } }; -class COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { -private: - LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ self; -public: - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(const COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&) = delete; - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); } - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); } - operator LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ() && { LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); return res; } - ~COption_C2Tuple_OnionMessageContentsResponseInstructionZZ() { COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(self); } - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ& operator=(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ&& o) { COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OnionMessageContentsResponseInstructionZZ)); return *this; } - LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator &() { return &self; } - LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_OnionMessageContentsResponseInstructionZZ* operator ->() const { return &self; } -}; -class CResult_RecipientOnionFieldsDecodeErrorZ { -private: - LDKCResult_RecipientOnionFieldsDecodeErrorZ self; -public: - CResult_RecipientOnionFieldsDecodeErrorZ(const CResult_RecipientOnionFieldsDecodeErrorZ&) = delete; - CResult_RecipientOnionFieldsDecodeErrorZ(CResult_RecipientOnionFieldsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecipientOnionFieldsDecodeErrorZ)); } - CResult_RecipientOnionFieldsDecodeErrorZ(LDKCResult_RecipientOnionFieldsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ)); } - operator LDKCResult_RecipientOnionFieldsDecodeErrorZ() && { LDKCResult_RecipientOnionFieldsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RecipientOnionFieldsDecodeErrorZ)); return res; } - ~CResult_RecipientOnionFieldsDecodeErrorZ() { CResult_RecipientOnionFieldsDecodeErrorZ_free(self); } - CResult_RecipientOnionFieldsDecodeErrorZ& operator=(CResult_RecipientOnionFieldsDecodeErrorZ&& o) { CResult_RecipientOnionFieldsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecipientOnionFieldsDecodeErrorZ)); return *this; } - LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator &() { return &self; } - LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RecipientOnionFieldsDecodeErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_u32TxOutZ { -private: - LDKC2Tuple_u32TxOutZ self; -public: - C2Tuple_u32TxOutZ(const C2Tuple_u32TxOutZ&) = delete; - C2Tuple_u32TxOutZ(C2Tuple_u32TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); } - C2Tuple_u32TxOutZ(LDKC2Tuple_u32TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); } - operator LDKC2Tuple_u32TxOutZ() && { LDKC2Tuple_u32TxOutZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32TxOutZ)); return res; } - ~C2Tuple_u32TxOutZ() { C2Tuple_u32TxOutZ_free(self); } - C2Tuple_u32TxOutZ& operator=(C2Tuple_u32TxOutZ&& o) { C2Tuple_u32TxOutZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32TxOutZ)); return *this; } - LDKC2Tuple_u32TxOutZ* operator &() { return &self; } - LDKC2Tuple_u32TxOutZ* operator ->() { return &self; } - const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } - const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } -}; -class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { -private: - LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ self; -public: - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(const CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&) = delete; - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); } - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); } - operator LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); return res; } - ~CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ() { CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); } - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ)); return *this; } - LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class CResult_ChannelDetailsDecodeErrorZ { -private: - LDKCResult_ChannelDetailsDecodeErrorZ self; -public: - CResult_ChannelDetailsDecodeErrorZ(const CResult_ChannelDetailsDecodeErrorZ&) = delete; - CResult_ChannelDetailsDecodeErrorZ(CResult_ChannelDetailsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); } - CResult_ChannelDetailsDecodeErrorZ(LDKCResult_ChannelDetailsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); } - operator LDKCResult_ChannelDetailsDecodeErrorZ() && { LDKCResult_ChannelDetailsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelDetailsDecodeErrorZ)); return res; } - ~CResult_ChannelDetailsDecodeErrorZ() { CResult_ChannelDetailsDecodeErrorZ_free(self); } - CResult_ChannelDetailsDecodeErrorZ& operator=(CResult_ChannelDetailsDecodeErrorZ&& o) { CResult_ChannelDetailsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelDetailsDecodeErrorZ)); return *this; } - LDKCResult_ChannelDetailsDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_Bolt12InvoiceFeaturesDecodeErrorZ { -private: - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ self; -public: - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(const CResult_Bolt12InvoiceFeaturesDecodeErrorZ&) = delete; - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } - operator LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return res; } - ~CResult_Bolt12InvoiceFeaturesDecodeErrorZ() { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return *this; } - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; class CVec_UtxoZ { private: LDKCVec_UtxoZ self; @@ -14463,21 +15582,6 @@ class CVec_UtxoZ { const LDKCVec_UtxoZ* operator &() const { return &self; } const LDKCVec_UtxoZ* operator ->() const { return &self; } }; -class CResult_PaymentContextDecodeErrorZ { -private: - LDKCResult_PaymentContextDecodeErrorZ self; -public: - CResult_PaymentContextDecodeErrorZ(const CResult_PaymentContextDecodeErrorZ&) = delete; - CResult_PaymentContextDecodeErrorZ(CResult_PaymentContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); } - CResult_PaymentContextDecodeErrorZ(LDKCResult_PaymentContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); } - operator LDKCResult_PaymentContextDecodeErrorZ() && { LDKCResult_PaymentContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); return res; } - ~CResult_PaymentContextDecodeErrorZ() { CResult_PaymentContextDecodeErrorZ_free(self); } - CResult_PaymentContextDecodeErrorZ& operator=(CResult_PaymentContextDecodeErrorZ&& o) { CResult_PaymentContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); return *this; } - LDKCResult_PaymentContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentContextDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { private: LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ self; @@ -14493,95 +15597,20 @@ class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator ->() const { return &self; } }; -class CResult_ChannelConfigDecodeErrorZ { -private: - LDKCResult_ChannelConfigDecodeErrorZ self; -public: - CResult_ChannelConfigDecodeErrorZ(const CResult_ChannelConfigDecodeErrorZ&) = delete; - CResult_ChannelConfigDecodeErrorZ(CResult_ChannelConfigDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelConfigDecodeErrorZ)); } - CResult_ChannelConfigDecodeErrorZ(LDKCResult_ChannelConfigDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelConfigDecodeErrorZ)); } - operator LDKCResult_ChannelConfigDecodeErrorZ() && { LDKCResult_ChannelConfigDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelConfigDecodeErrorZ)); return res; } - ~CResult_ChannelConfigDecodeErrorZ() { CResult_ChannelConfigDecodeErrorZ_free(self); } - CResult_ChannelConfigDecodeErrorZ& operator=(CResult_ChannelConfigDecodeErrorZ&& o) { CResult_ChannelConfigDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelConfigDecodeErrorZ)); return *this; } - LDKCResult_ChannelConfigDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelConfigDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelConfigDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelConfigDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_i64Z { -private: - LDKCOption_i64Z self; -public: - COption_i64Z(const COption_i64Z&) = delete; - COption_i64Z(COption_i64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_i64Z)); } - COption_i64Z(LDKCOption_i64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_i64Z)); } - operator LDKCOption_i64Z() && { LDKCOption_i64Z res = self; memset(&self, 0, sizeof(LDKCOption_i64Z)); return res; } - ~COption_i64Z() { COption_i64Z_free(self); } - COption_i64Z& operator=(COption_i64Z&& o) { COption_i64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_i64Z)); return *this; } - LDKCOption_i64Z* operator &() { return &self; } - LDKCOption_i64Z* operator ->() { return &self; } - const LDKCOption_i64Z* operator &() const { return &self; } - const LDKCOption_i64Z* operator ->() const { return &self; } -}; -class CVec_PrivateRouteZ { -private: - LDKCVec_PrivateRouteZ self; -public: - CVec_PrivateRouteZ(const CVec_PrivateRouteZ&) = delete; - CVec_PrivateRouteZ(CVec_PrivateRouteZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PrivateRouteZ)); } - CVec_PrivateRouteZ(LDKCVec_PrivateRouteZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PrivateRouteZ)); } - operator LDKCVec_PrivateRouteZ() && { LDKCVec_PrivateRouteZ res = self; memset(&self, 0, sizeof(LDKCVec_PrivateRouteZ)); return res; } - ~CVec_PrivateRouteZ() { CVec_PrivateRouteZ_free(self); } - CVec_PrivateRouteZ& operator=(CVec_PrivateRouteZ&& o) { CVec_PrivateRouteZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PrivateRouteZ)); return *this; } - LDKCVec_PrivateRouteZ* operator &() { return &self; } - LDKCVec_PrivateRouteZ* operator ->() { return &self; } - const LDKCVec_PrivateRouteZ* operator &() const { return &self; } - const LDKCVec_PrivateRouteZ* operator ->() const { return &self; } -}; -class CVec_PhantomRouteHintsZ { -private: - LDKCVec_PhantomRouteHintsZ self; -public: - CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete; - CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); } - CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); } - operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; } - ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); } - CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; } - LDKCVec_PhantomRouteHintsZ* operator &() { return &self; } - LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; } - const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; } - const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; } -}; -class CVec_C2Tuple_OutPointCVec_u64ZZZ { +class CResult_TrampolineHopDecodeErrorZ { private: - LDKCVec_C2Tuple_OutPointCVec_u64ZZZ self; -public: - CVec_C2Tuple_OutPointCVec_u64ZZZ(const CVec_C2Tuple_OutPointCVec_u64ZZZ&) = delete; - CVec_C2Tuple_OutPointCVec_u64ZZZ(CVec_C2Tuple_OutPointCVec_u64ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_u64ZZZ)); } - CVec_C2Tuple_OutPointCVec_u64ZZZ(LDKCVec_C2Tuple_OutPointCVec_u64ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_u64ZZZ)); } - operator LDKCVec_C2Tuple_OutPointCVec_u64ZZZ() && { LDKCVec_C2Tuple_OutPointCVec_u64ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_u64ZZZ)); return res; } - ~CVec_C2Tuple_OutPointCVec_u64ZZZ() { CVec_C2Tuple_OutPointCVec_u64ZZZ_free(self); } - CVec_C2Tuple_OutPointCVec_u64ZZZ& operator=(CVec_C2Tuple_OutPointCVec_u64ZZZ&& o) { CVec_C2Tuple_OutPointCVec_u64ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_u64ZZZ)); return *this; } - LDKCVec_C2Tuple_OutPointCVec_u64ZZZ* operator &() { return &self; } - LDKCVec_C2Tuple_OutPointCVec_u64ZZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_OutPointCVec_u64ZZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_OutPointCVec_u64ZZZ* operator ->() const { return &self; } -}; -class C2Tuple_ThirtyTwoBytesChannelManagerZ { -private: - LDKC2Tuple_ThirtyTwoBytesChannelManagerZ self; -public: - 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; } + LDKCResult_TrampolineHopDecodeErrorZ self; +public: + CResult_TrampolineHopDecodeErrorZ(const CResult_TrampolineHopDecodeErrorZ&) = delete; + CResult_TrampolineHopDecodeErrorZ(CResult_TrampolineHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrampolineHopDecodeErrorZ)); } + CResult_TrampolineHopDecodeErrorZ(LDKCResult_TrampolineHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrampolineHopDecodeErrorZ)); } + operator LDKCResult_TrampolineHopDecodeErrorZ() && { LDKCResult_TrampolineHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TrampolineHopDecodeErrorZ)); return res; } + ~CResult_TrampolineHopDecodeErrorZ() { CResult_TrampolineHopDecodeErrorZ_free(self); } + CResult_TrampolineHopDecodeErrorZ& operator=(CResult_TrampolineHopDecodeErrorZ&& o) { CResult_TrampolineHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrampolineHopDecodeErrorZ)); return *this; } + LDKCResult_TrampolineHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_TrampolineHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TrampolineHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TrampolineHopDecodeErrorZ* operator ->() const { return &self; } }; class CResult_COption_OnionMessageContentsZDecodeErrorZ { private: @@ -14598,6 +15627,21 @@ class CResult_COption_OnionMessageContentsZDecodeErrorZ { const LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_OnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_ShutdownDecodeErrorZ { +private: + LDKCResult_ShutdownDecodeErrorZ self; +public: + CResult_ShutdownDecodeErrorZ(const CResult_ShutdownDecodeErrorZ&) = delete; + CResult_ShutdownDecodeErrorZ(CResult_ShutdownDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); } + CResult_ShutdownDecodeErrorZ(LDKCResult_ShutdownDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); } + operator LDKCResult_ShutdownDecodeErrorZ() && { LDKCResult_ShutdownDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); return res; } + ~CResult_ShutdownDecodeErrorZ() { CResult_ShutdownDecodeErrorZ_free(self); } + CResult_ShutdownDecodeErrorZ& operator=(CResult_ShutdownDecodeErrorZ&& o) { CResult_ShutdownDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); return *this; } + LDKCResult_ShutdownDecodeErrorZ* operator &() { return &self; } + LDKCResult_ShutdownDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; } +}; class C2Tuple_u64CVec_u8ZZ { private: LDKC2Tuple_u64CVec_u8ZZ self; @@ -14643,21 +15687,6 @@ class CResult_ThirtyTwoBytesRetryableSendFailureZ { const LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator &() const { return &self; } const LDKCResult_ThirtyTwoBytesRetryableSendFailureZ* operator ->() const { return &self; } }; -class CVec_MonitorEventZ { -private: - LDKCVec_MonitorEventZ self; -public: - CVec_MonitorEventZ(const CVec_MonitorEventZ&) = delete; - CVec_MonitorEventZ(CVec_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorEventZ)); } - CVec_MonitorEventZ(LDKCVec_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorEventZ)); } - operator LDKCVec_MonitorEventZ() && { LDKCVec_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorEventZ)); return res; } - ~CVec_MonitorEventZ() { CVec_MonitorEventZ_free(self); } - CVec_MonitorEventZ& operator=(CVec_MonitorEventZ&& o) { CVec_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorEventZ)); return *this; } - LDKCVec_MonitorEventZ* operator &() { return &self; } - LDKCVec_MonitorEventZ* operator ->() { return &self; } - const LDKCVec_MonitorEventZ* operator &() const { return &self; } - const LDKCVec_MonitorEventZ* operator ->() const { return &self; } -}; class CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { private: LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ self; @@ -14673,21 +15702,6 @@ class CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticEr const LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } }; -class CResult_ShutdownDecodeErrorZ { -private: - LDKCResult_ShutdownDecodeErrorZ self; -public: - CResult_ShutdownDecodeErrorZ(const CResult_ShutdownDecodeErrorZ&) = delete; - CResult_ShutdownDecodeErrorZ(CResult_ShutdownDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); } - CResult_ShutdownDecodeErrorZ(LDKCResult_ShutdownDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); } - operator LDKCResult_ShutdownDecodeErrorZ() && { LDKCResult_ShutdownDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownDecodeErrorZ)); return res; } - ~CResult_ShutdownDecodeErrorZ() { CResult_ShutdownDecodeErrorZ_free(self); } - CResult_ShutdownDecodeErrorZ& operator=(CResult_ShutdownDecodeErrorZ&& o) { CResult_ShutdownDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownDecodeErrorZ)); return *this; } - LDKCResult_ShutdownDecodeErrorZ* operator &() { return &self; } - LDKCResult_ShutdownDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_BigSizeDecodeErrorZ { private: LDKCResult_BigSizeDecodeErrorZ self; @@ -14703,35 +15717,20 @@ class CResult_BigSizeDecodeErrorZ { const LDKCResult_BigSizeDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BigSizeDecodeErrorZ* operator ->() const { return &self; } }; -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 COption_usizeZ { +class C2Tuple_ServeStaticInvoiceResponseInstructionZ { private: - LDKCOption_usizeZ self; + LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ self; public: - 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; } + C2Tuple_ServeStaticInvoiceResponseInstructionZ(const C2Tuple_ServeStaticInvoiceResponseInstructionZ&) = delete; + C2Tuple_ServeStaticInvoiceResponseInstructionZ(C2Tuple_ServeStaticInvoiceResponseInstructionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_ServeStaticInvoiceResponseInstructionZ)); } + C2Tuple_ServeStaticInvoiceResponseInstructionZ(LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ)); } + operator LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ() && { LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ)); return res; } + ~C2Tuple_ServeStaticInvoiceResponseInstructionZ() { C2Tuple_ServeStaticInvoiceResponseInstructionZ_free(self); } + C2Tuple_ServeStaticInvoiceResponseInstructionZ& operator=(C2Tuple_ServeStaticInvoiceResponseInstructionZ&& o) { C2Tuple_ServeStaticInvoiceResponseInstructionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_ServeStaticInvoiceResponseInstructionZ)); return *this; } + LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ* operator &() { return &self; } + LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ* operator ->() { return &self; } + const LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ* operator &() const { return &self; } + const LDKC2Tuple_ServeStaticInvoiceResponseInstructionZ* operator ->() const { return &self; } }; class CVec_BlindedMessagePathZ { private: @@ -14763,50 +15762,35 @@ class CResult_OffersContextDecodeErrorZ { const LDKCResult_OffersContextDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OffersContextDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_AddressZ { -private: - LDKCVec_AddressZ 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; } -}; -class CResult_NoneNoneZ { +class COption_ClosureReasonZ { private: - LDKCResult_NoneNoneZ self; + LDKCOption_ClosureReasonZ self; public: - CResult_NoneNoneZ(const CResult_NoneNoneZ&) = delete; - CResult_NoneNoneZ(CResult_NoneNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneNoneZ)); } - CResult_NoneNoneZ(LDKCResult_NoneNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneNoneZ)); } - operator LDKCResult_NoneNoneZ() && { LDKCResult_NoneNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneNoneZ)); return res; } - ~CResult_NoneNoneZ() { CResult_NoneNoneZ_free(self); } - CResult_NoneNoneZ& operator=(CResult_NoneNoneZ&& o) { CResult_NoneNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneNoneZ)); return *this; } - LDKCResult_NoneNoneZ* operator &() { return &self; } - LDKCResult_NoneNoneZ* operator ->() { return &self; } - const LDKCResult_NoneNoneZ* operator &() const { return &self; } - const LDKCResult_NoneNoneZ* operator ->() const { return &self; } + COption_ClosureReasonZ(const COption_ClosureReasonZ&) = delete; + COption_ClosureReasonZ(COption_ClosureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ClosureReasonZ)); } + COption_ClosureReasonZ(LDKCOption_ClosureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ClosureReasonZ)); } + operator LDKCOption_ClosureReasonZ() && { LDKCOption_ClosureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_ClosureReasonZ)); return res; } + ~COption_ClosureReasonZ() { COption_ClosureReasonZ_free(self); } + COption_ClosureReasonZ& operator=(COption_ClosureReasonZ&& o) { COption_ClosureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ClosureReasonZ)); return *this; } + LDKCOption_ClosureReasonZ* operator &() { return &self; } + LDKCOption_ClosureReasonZ* operator ->() { return &self; } + const LDKCOption_ClosureReasonZ* operator &() const { return &self; } + const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } }; -class CResult_boolPeerHandleErrorZ { +class CResult_ChannelUpdateDecodeErrorZ { private: - LDKCResult_boolPeerHandleErrorZ self; + LDKCResult_ChannelUpdateDecodeErrorZ self; public: - CResult_boolPeerHandleErrorZ(const CResult_boolPeerHandleErrorZ&) = delete; - CResult_boolPeerHandleErrorZ(CResult_boolPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); } - CResult_boolPeerHandleErrorZ(LDKCResult_boolPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); } - operator LDKCResult_boolPeerHandleErrorZ() && { LDKCResult_boolPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolPeerHandleErrorZ)); return res; } - ~CResult_boolPeerHandleErrorZ() { CResult_boolPeerHandleErrorZ_free(self); } - CResult_boolPeerHandleErrorZ& operator=(CResult_boolPeerHandleErrorZ&& o) { CResult_boolPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolPeerHandleErrorZ)); return *this; } - LDKCResult_boolPeerHandleErrorZ* operator &() { return &self; } - LDKCResult_boolPeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; } + CResult_ChannelUpdateDecodeErrorZ(const CResult_ChannelUpdateDecodeErrorZ&) = delete; + CResult_ChannelUpdateDecodeErrorZ(CResult_ChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateDecodeErrorZ)); } + CResult_ChannelUpdateDecodeErrorZ(LDKCResult_ChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateDecodeErrorZ)); } + operator LDKCResult_ChannelUpdateDecodeErrorZ() && { LDKCResult_ChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateDecodeErrorZ)); return res; } + ~CResult_ChannelUpdateDecodeErrorZ() { CResult_ChannelUpdateDecodeErrorZ_free(self); } + CResult_ChannelUpdateDecodeErrorZ& operator=(CResult_ChannelUpdateDecodeErrorZ&& o) { CResult_ChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateDecodeErrorZ)); return *this; } + LDKCResult_ChannelUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; class COption_TxOutZ { private: @@ -14823,35 +15807,20 @@ class COption_TxOutZ { const LDKCOption_TxOutZ* operator &() const { return &self; } const LDKCOption_TxOutZ* operator ->() const { return &self; } }; -class CResult_ChannelUpdateDecodeErrorZ { -private: - LDKCResult_ChannelUpdateDecodeErrorZ self; -public: - CResult_ChannelUpdateDecodeErrorZ(const CResult_ChannelUpdateDecodeErrorZ&) = delete; - CResult_ChannelUpdateDecodeErrorZ(CResult_ChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateDecodeErrorZ)); } - CResult_ChannelUpdateDecodeErrorZ(LDKCResult_ChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateDecodeErrorZ)); } - operator LDKCResult_ChannelUpdateDecodeErrorZ() && { LDKCResult_ChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateDecodeErrorZ)); return res; } - ~CResult_ChannelUpdateDecodeErrorZ() { CResult_ChannelUpdateDecodeErrorZ_free(self); } - CResult_ChannelUpdateDecodeErrorZ& operator=(CResult_ChannelUpdateDecodeErrorZ&& o) { CResult_ChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateDecodeErrorZ)); return *this; } - LDKCResult_ChannelUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_ClosureReasonZ { +class CVec_C2Tuple_ChannelIdCVec_u64ZZZ { private: - LDKCOption_ClosureReasonZ self; + LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ self; public: - COption_ClosureReasonZ(const COption_ClosureReasonZ&) = delete; - COption_ClosureReasonZ(COption_ClosureReasonZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ClosureReasonZ)); } - COption_ClosureReasonZ(LDKCOption_ClosureReasonZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ClosureReasonZ)); } - operator LDKCOption_ClosureReasonZ() && { LDKCOption_ClosureReasonZ res = self; memset(&self, 0, sizeof(LDKCOption_ClosureReasonZ)); return res; } - ~COption_ClosureReasonZ() { COption_ClosureReasonZ_free(self); } - COption_ClosureReasonZ& operator=(COption_ClosureReasonZ&& o) { COption_ClosureReasonZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ClosureReasonZ)); return *this; } - LDKCOption_ClosureReasonZ* operator &() { return &self; } - LDKCOption_ClosureReasonZ* operator ->() { return &self; } - const LDKCOption_ClosureReasonZ* operator &() const { return &self; } - const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } + CVec_C2Tuple_ChannelIdCVec_u64ZZZ(const CVec_C2Tuple_ChannelIdCVec_u64ZZZ&) = delete; + CVec_C2Tuple_ChannelIdCVec_u64ZZZ(CVec_C2Tuple_ChannelIdCVec_u64ZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdCVec_u64ZZZ)); } + CVec_C2Tuple_ChannelIdCVec_u64ZZZ(LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ)); } + operator LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ() && { LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ)); return res; } + ~CVec_C2Tuple_ChannelIdCVec_u64ZZZ() { CVec_C2Tuple_ChannelIdCVec_u64ZZZ_free(self); } + CVec_C2Tuple_ChannelIdCVec_u64ZZZ& operator=(CVec_C2Tuple_ChannelIdCVec_u64ZZZ&& o) { CVec_C2Tuple_ChannelIdCVec_u64ZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_ChannelIdCVec_u64ZZZ)); return *this; } + LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_ChannelIdCVec_u64ZZZ* operator ->() const { return &self; } }; class CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { private: @@ -14883,51 +15852,6 @@ class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator ->() const { return &self; } }; -class CResult_TransactionU16LenLimitedDecodeErrorZ { -private: - LDKCResult_TransactionU16LenLimitedDecodeErrorZ self; -public: - CResult_TransactionU16LenLimitedDecodeErrorZ(const CResult_TransactionU16LenLimitedDecodeErrorZ&) = delete; - CResult_TransactionU16LenLimitedDecodeErrorZ(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); } - CResult_TransactionU16LenLimitedDecodeErrorZ(LDKCResult_TransactionU16LenLimitedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); } - operator LDKCResult_TransactionU16LenLimitedDecodeErrorZ() && { LDKCResult_TransactionU16LenLimitedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); return res; } - ~CResult_TransactionU16LenLimitedDecodeErrorZ() { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); } - CResult_TransactionU16LenLimitedDecodeErrorZ& operator=(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); return *this; } - LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() { return &self; } - LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_FundingInfoDecodeErrorZ { -private: - LDKCResult_FundingInfoDecodeErrorZ self; -public: - CResult_FundingInfoDecodeErrorZ(const CResult_FundingInfoDecodeErrorZ&) = delete; - CResult_FundingInfoDecodeErrorZ(CResult_FundingInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingInfoDecodeErrorZ)); } - CResult_FundingInfoDecodeErrorZ(LDKCResult_FundingInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingInfoDecodeErrorZ)); } - operator LDKCResult_FundingInfoDecodeErrorZ() && { LDKCResult_FundingInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingInfoDecodeErrorZ)); return res; } - ~CResult_FundingInfoDecodeErrorZ() { CResult_FundingInfoDecodeErrorZ_free(self); } - CResult_FundingInfoDecodeErrorZ& operator=(CResult_FundingInfoDecodeErrorZ&& o) { CResult_FundingInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingInfoDecodeErrorZ)); return *this; } - LDKCResult_FundingInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_FundingInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_FundingInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_FundingInfoDecodeErrorZ* operator ->() const { return &self; } -}; -class COption_AmountZ { -private: - LDKCOption_AmountZ self; -public: - COption_AmountZ(const COption_AmountZ&) = delete; - COption_AmountZ(COption_AmountZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AmountZ)); } - COption_AmountZ(LDKCOption_AmountZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AmountZ)); } - operator LDKCOption_AmountZ() && { LDKCOption_AmountZ res = self; memset(&self, 0, sizeof(LDKCOption_AmountZ)); return res; } - ~COption_AmountZ() { COption_AmountZ_free(self); } - COption_AmountZ& operator=(COption_AmountZ&& o) { COption_AmountZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AmountZ)); return *this; } - LDKCOption_AmountZ* operator &() { return &self; } - LDKCOption_AmountZ* operator ->() { return &self; } - const LDKCOption_AmountZ* operator &() const { return &self; } - const LDKCOption_AmountZ* operator ->() const { return &self; } -}; class C2Tuple_DNSSECQueryDNSResolverContextZ { private: LDKC2Tuple_DNSSECQueryDNSResolverContextZ self; @@ -14958,65 +15882,20 @@ class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator ->() const { return &self; } }; -class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { -private: - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ self; -public: - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(const COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&) = delete; - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } - operator LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() && { LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return res; } - ~COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); } - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ& operator=(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return *this; } - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() { return &self; } - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() const { return &self; } -}; -class CResult_BestBlockDecodeErrorZ { -private: - LDKCResult_BestBlockDecodeErrorZ self; -public: - CResult_BestBlockDecodeErrorZ(const CResult_BestBlockDecodeErrorZ&) = delete; - CResult_BestBlockDecodeErrorZ(CResult_BestBlockDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BestBlockDecodeErrorZ)); } - CResult_BestBlockDecodeErrorZ(LDKCResult_BestBlockDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BestBlockDecodeErrorZ)); } - operator LDKCResult_BestBlockDecodeErrorZ() && { LDKCResult_BestBlockDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BestBlockDecodeErrorZ)); return res; } - ~CResult_BestBlockDecodeErrorZ() { CResult_BestBlockDecodeErrorZ_free(self); } - CResult_BestBlockDecodeErrorZ& operator=(CResult_BestBlockDecodeErrorZ&& o) { CResult_BestBlockDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BestBlockDecodeErrorZ)); return *this; } - LDKCResult_BestBlockDecodeErrorZ* operator &() { return &self; } - LDKCResult_BestBlockDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BestBlockDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BestBlockDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { -private: - LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ self; -public: - 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 CResult_OpenChannelV2DecodeErrorZ { +class CResult_NextFundingDecodeErrorZ { private: - LDKCResult_OpenChannelV2DecodeErrorZ self; + LDKCResult_NextFundingDecodeErrorZ self; public: - CResult_OpenChannelV2DecodeErrorZ(const CResult_OpenChannelV2DecodeErrorZ&) = delete; - CResult_OpenChannelV2DecodeErrorZ(CResult_OpenChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); } - CResult_OpenChannelV2DecodeErrorZ(LDKCResult_OpenChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); } - operator LDKCResult_OpenChannelV2DecodeErrorZ() && { LDKCResult_OpenChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); return res; } - ~CResult_OpenChannelV2DecodeErrorZ() { CResult_OpenChannelV2DecodeErrorZ_free(self); } - CResult_OpenChannelV2DecodeErrorZ& operator=(CResult_OpenChannelV2DecodeErrorZ&& o) { CResult_OpenChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); return *this; } - LDKCResult_OpenChannelV2DecodeErrorZ* operator &() { return &self; } - LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OpenChannelV2DecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() const { return &self; } + CResult_NextFundingDecodeErrorZ(const CResult_NextFundingDecodeErrorZ&) = delete; + CResult_NextFundingDecodeErrorZ(CResult_NextFundingDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NextFundingDecodeErrorZ)); } + CResult_NextFundingDecodeErrorZ(LDKCResult_NextFundingDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NextFundingDecodeErrorZ)); } + operator LDKCResult_NextFundingDecodeErrorZ() && { LDKCResult_NextFundingDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NextFundingDecodeErrorZ)); return res; } + ~CResult_NextFundingDecodeErrorZ() { CResult_NextFundingDecodeErrorZ_free(self); } + CResult_NextFundingDecodeErrorZ& operator=(CResult_NextFundingDecodeErrorZ&& o) { CResult_NextFundingDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NextFundingDecodeErrorZ)); return *this; } + LDKCResult_NextFundingDecodeErrorZ* operator &() { return &self; } + LDKCResult_NextFundingDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NextFundingDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NextFundingDecodeErrorZ* operator ->() const { return &self; } }; class CResult_CounterpartyForwardingInfoDecodeErrorZ { private: @@ -15033,20 +15912,50 @@ class CResult_CounterpartyForwardingInfoDecodeErrorZ { const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; } }; -class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { +class CResult_HtlcBasepointDecodeErrorZ { +private: + LDKCResult_HtlcBasepointDecodeErrorZ self; +public: + CResult_HtlcBasepointDecodeErrorZ(const CResult_HtlcBasepointDecodeErrorZ&) = delete; + CResult_HtlcBasepointDecodeErrorZ(CResult_HtlcBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HtlcBasepointDecodeErrorZ)); } + CResult_HtlcBasepointDecodeErrorZ(LDKCResult_HtlcBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HtlcBasepointDecodeErrorZ)); } + operator LDKCResult_HtlcBasepointDecodeErrorZ() && { LDKCResult_HtlcBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HtlcBasepointDecodeErrorZ)); return res; } + ~CResult_HtlcBasepointDecodeErrorZ() { CResult_HtlcBasepointDecodeErrorZ_free(self); } + CResult_HtlcBasepointDecodeErrorZ& operator=(CResult_HtlcBasepointDecodeErrorZ&& o) { CResult_HtlcBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HtlcBasepointDecodeErrorZ)); return *this; } + LDKCResult_HtlcBasepointDecodeErrorZ* operator &() { return &self; } + LDKCResult_HtlcBasepointDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HtlcBasepointDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HtlcBasepointDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_StaticInvoiceDecodeErrorZ { private: - LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ self; + LDKCResult_StaticInvoiceDecodeErrorZ self; public: - C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(const C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&) = delete; - C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); } - C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); } - operator LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ() && { LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ res = self; memset(&self, 0, sizeof(LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); return res; } - ~C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ() { C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(self); } - C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ& operator=(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ&& o) { C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ)); return *this; } - LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator &() { return &self; } - LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator ->() { return &self; } - const LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator &() const { return &self; } - const LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ* operator ->() const { return &self; } + CResult_StaticInvoiceDecodeErrorZ(const CResult_StaticInvoiceDecodeErrorZ&) = delete; + CResult_StaticInvoiceDecodeErrorZ(CResult_StaticInvoiceDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticInvoiceDecodeErrorZ)); } + CResult_StaticInvoiceDecodeErrorZ(LDKCResult_StaticInvoiceDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticInvoiceDecodeErrorZ)); } + operator LDKCResult_StaticInvoiceDecodeErrorZ() && { LDKCResult_StaticInvoiceDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticInvoiceDecodeErrorZ)); return res; } + ~CResult_StaticInvoiceDecodeErrorZ() { CResult_StaticInvoiceDecodeErrorZ_free(self); } + CResult_StaticInvoiceDecodeErrorZ& operator=(CResult_StaticInvoiceDecodeErrorZ&& o) { CResult_StaticInvoiceDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticInvoiceDecodeErrorZ)); return *this; } + LDKCResult_StaticInvoiceDecodeErrorZ* operator &() { return &self; } + LDKCResult_StaticInvoiceDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_StaticInvoiceDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_StaticInvoiceDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_SpliceLockedDecodeErrorZ { +private: + LDKCResult_SpliceLockedDecodeErrorZ self; +public: + CResult_SpliceLockedDecodeErrorZ(const CResult_SpliceLockedDecodeErrorZ&) = delete; + CResult_SpliceLockedDecodeErrorZ(CResult_SpliceLockedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpliceLockedDecodeErrorZ)); } + CResult_SpliceLockedDecodeErrorZ(LDKCResult_SpliceLockedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpliceLockedDecodeErrorZ)); } + operator LDKCResult_SpliceLockedDecodeErrorZ() && { LDKCResult_SpliceLockedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpliceLockedDecodeErrorZ)); return res; } + ~CResult_SpliceLockedDecodeErrorZ() { CResult_SpliceLockedDecodeErrorZ_free(self); } + CResult_SpliceLockedDecodeErrorZ& operator=(CResult_SpliceLockedDecodeErrorZ&& o) { CResult_SpliceLockedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpliceLockedDecodeErrorZ)); return *this; } + LDKCResult_SpliceLockedDecodeErrorZ* operator &() { return &self; } + LDKCResult_SpliceLockedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SpliceLockedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SpliceLockedDecodeErrorZ* operator ->() const { return &self; } }; class CResult_RouteDecodeErrorZ { private: @@ -15063,20 +15972,20 @@ class CResult_RouteDecodeErrorZ { const LDKCResult_RouteDecodeErrorZ* operator &() const { return &self; } const LDKCResult_RouteDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_BlindedFailureDecodeErrorZ { +class COption_NoneZ { private: - LDKCResult_BlindedFailureDecodeErrorZ self; + LDKCOption_NoneZ self; public: - CResult_BlindedFailureDecodeErrorZ(const CResult_BlindedFailureDecodeErrorZ&) = delete; - CResult_BlindedFailureDecodeErrorZ(CResult_BlindedFailureDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedFailureDecodeErrorZ)); } - CResult_BlindedFailureDecodeErrorZ(LDKCResult_BlindedFailureDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedFailureDecodeErrorZ)); } - operator LDKCResult_BlindedFailureDecodeErrorZ() && { LDKCResult_BlindedFailureDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedFailureDecodeErrorZ)); return res; } - ~CResult_BlindedFailureDecodeErrorZ() { CResult_BlindedFailureDecodeErrorZ_free(self); } - CResult_BlindedFailureDecodeErrorZ& operator=(CResult_BlindedFailureDecodeErrorZ&& o) { CResult_BlindedFailureDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedFailureDecodeErrorZ)); return *this; } - LDKCResult_BlindedFailureDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedFailureDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedFailureDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedFailureDecodeErrorZ* operator ->() const { return &self; } + COption_NoneZ(const COption_NoneZ&) = delete; + COption_NoneZ(COption_NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NoneZ)); } + COption_NoneZ(LDKCOption_NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NoneZ)); } + operator LDKCOption_NoneZ() && { LDKCOption_NoneZ res = self; memset(&self, 0, sizeof(LDKCOption_NoneZ)); return res; } + ~COption_NoneZ() { COption_NoneZ_free(self); } + COption_NoneZ& operator=(COption_NoneZ&& o) { COption_NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NoneZ)); return *this; } + LDKCOption_NoneZ* operator &() { return &self; } + LDKCOption_NoneZ* operator ->() { return &self; } + const LDKCOption_NoneZ* operator &() const { return &self; } + const LDKCOption_NoneZ* operator ->() const { return &self; } }; class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { private: @@ -15093,35 +16002,20 @@ class CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { 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; -public: - COption_NoneZ(const COption_NoneZ&) = delete; - COption_NoneZ(COption_NoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NoneZ)); } - COption_NoneZ(LDKCOption_NoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NoneZ)); } - operator LDKCOption_NoneZ() && { LDKCOption_NoneZ res = self; memset(&self, 0, sizeof(LDKCOption_NoneZ)); return res; } - ~COption_NoneZ() { COption_NoneZ_free(self); } - COption_NoneZ& operator=(COption_NoneZ&& o) { COption_NoneZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NoneZ)); return *this; } - LDKCOption_NoneZ* operator &() { return &self; } - LDKCOption_NoneZ* operator ->() { return &self; } - const LDKCOption_NoneZ* operator &() const { return &self; } - const LDKCOption_NoneZ* operator ->() const { return &self; } -}; -class CResult_SpliceLockedDecodeErrorZ { +class CResult_TxAddOutputDecodeErrorZ { private: - LDKCResult_SpliceLockedDecodeErrorZ self; + LDKCResult_TxAddOutputDecodeErrorZ self; public: - CResult_SpliceLockedDecodeErrorZ(const CResult_SpliceLockedDecodeErrorZ&) = delete; - CResult_SpliceLockedDecodeErrorZ(CResult_SpliceLockedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpliceLockedDecodeErrorZ)); } - CResult_SpliceLockedDecodeErrorZ(LDKCResult_SpliceLockedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpliceLockedDecodeErrorZ)); } - operator LDKCResult_SpliceLockedDecodeErrorZ() && { LDKCResult_SpliceLockedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpliceLockedDecodeErrorZ)); return res; } - ~CResult_SpliceLockedDecodeErrorZ() { CResult_SpliceLockedDecodeErrorZ_free(self); } - CResult_SpliceLockedDecodeErrorZ& operator=(CResult_SpliceLockedDecodeErrorZ&& o) { CResult_SpliceLockedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpliceLockedDecodeErrorZ)); return *this; } - LDKCResult_SpliceLockedDecodeErrorZ* operator &() { return &self; } - LDKCResult_SpliceLockedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_SpliceLockedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_SpliceLockedDecodeErrorZ* operator ->() const { return &self; } + CResult_TxAddOutputDecodeErrorZ(const CResult_TxAddOutputDecodeErrorZ&) = delete; + CResult_TxAddOutputDecodeErrorZ(CResult_TxAddOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAddOutputDecodeErrorZ)); } + CResult_TxAddOutputDecodeErrorZ(LDKCResult_TxAddOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAddOutputDecodeErrorZ)); } + operator LDKCResult_TxAddOutputDecodeErrorZ() && { LDKCResult_TxAddOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAddOutputDecodeErrorZ)); return res; } + ~CResult_TxAddOutputDecodeErrorZ() { CResult_TxAddOutputDecodeErrorZ_free(self); } + CResult_TxAddOutputDecodeErrorZ& operator=(CResult_TxAddOutputDecodeErrorZ&& o) { CResult_TxAddOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAddOutputDecodeErrorZ)); return *this; } + LDKCResult_TxAddOutputDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxAddOutputDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxAddOutputDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxAddOutputDecodeErrorZ* operator ->() const { return &self; } }; class COption_CVec_u8ZZ { private: @@ -15138,20 +16032,20 @@ class COption_CVec_u8ZZ { const LDKCOption_CVec_u8ZZ* operator &() const { return &self; } const LDKCOption_CVec_u8ZZ* operator ->() const { return &self; } }; -class COption_QuantityZ { +class CResult_FundingLockedDecodeErrorZ { private: - LDKCOption_QuantityZ self; + LDKCResult_FundingLockedDecodeErrorZ self; public: - COption_QuantityZ(const COption_QuantityZ&) = delete; - COption_QuantityZ(COption_QuantityZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_QuantityZ)); } - COption_QuantityZ(LDKCOption_QuantityZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_QuantityZ)); } - operator LDKCOption_QuantityZ() && { LDKCOption_QuantityZ res = self; memset(&self, 0, sizeof(LDKCOption_QuantityZ)); return res; } - ~COption_QuantityZ() { COption_QuantityZ_free(self); } - COption_QuantityZ& operator=(COption_QuantityZ&& o) { COption_QuantityZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_QuantityZ)); return *this; } - LDKCOption_QuantityZ* operator &() { return &self; } - LDKCOption_QuantityZ* operator ->() { return &self; } - const LDKCOption_QuantityZ* operator &() const { return &self; } - const LDKCOption_QuantityZ* operator ->() const { return &self; } + CResult_FundingLockedDecodeErrorZ(const CResult_FundingLockedDecodeErrorZ&) = delete; + CResult_FundingLockedDecodeErrorZ(CResult_FundingLockedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingLockedDecodeErrorZ)); } + CResult_FundingLockedDecodeErrorZ(LDKCResult_FundingLockedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingLockedDecodeErrorZ)); } + operator LDKCResult_FundingLockedDecodeErrorZ() && { LDKCResult_FundingLockedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingLockedDecodeErrorZ)); return res; } + ~CResult_FundingLockedDecodeErrorZ() { CResult_FundingLockedDecodeErrorZ_free(self); } + CResult_FundingLockedDecodeErrorZ& operator=(CResult_FundingLockedDecodeErrorZ&& o) { CResult_FundingLockedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingLockedDecodeErrorZ)); return *this; } + LDKCResult_FundingLockedDecodeErrorZ* operator &() { return &self; } + LDKCResult_FundingLockedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FundingLockedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FundingLockedDecodeErrorZ* operator ->() const { return &self; } }; class CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { private: @@ -15168,66 +16062,6 @@ class CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { const LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator ->() const { return &self; } }; -class CResult_TxAddOutputDecodeErrorZ { -private: - LDKCResult_TxAddOutputDecodeErrorZ self; -public: - CResult_TxAddOutputDecodeErrorZ(const CResult_TxAddOutputDecodeErrorZ&) = delete; - CResult_TxAddOutputDecodeErrorZ(CResult_TxAddOutputDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAddOutputDecodeErrorZ)); } - CResult_TxAddOutputDecodeErrorZ(LDKCResult_TxAddOutputDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAddOutputDecodeErrorZ)); } - operator LDKCResult_TxAddOutputDecodeErrorZ() && { LDKCResult_TxAddOutputDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAddOutputDecodeErrorZ)); return res; } - ~CResult_TxAddOutputDecodeErrorZ() { CResult_TxAddOutputDecodeErrorZ_free(self); } - CResult_TxAddOutputDecodeErrorZ& operator=(CResult_TxAddOutputDecodeErrorZ&& o) { CResult_TxAddOutputDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAddOutputDecodeErrorZ)); return *this; } - LDKCResult_TxAddOutputDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxAddOutputDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxAddOutputDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxAddOutputDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_OutputSpendStatusDecodeErrorZ { -private: - LDKCResult_OutputSpendStatusDecodeErrorZ self; -public: - CResult_OutputSpendStatusDecodeErrorZ(const CResult_OutputSpendStatusDecodeErrorZ&) = delete; - CResult_OutputSpendStatusDecodeErrorZ(CResult_OutputSpendStatusDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); } - CResult_OutputSpendStatusDecodeErrorZ(LDKCResult_OutputSpendStatusDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); } - operator LDKCResult_OutputSpendStatusDecodeErrorZ() && { LDKCResult_OutputSpendStatusDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); return res; } - ~CResult_OutputSpendStatusDecodeErrorZ() { CResult_OutputSpendStatusDecodeErrorZ_free(self); } - CResult_OutputSpendStatusDecodeErrorZ& operator=(CResult_OutputSpendStatusDecodeErrorZ&& o) { CResult_OutputSpendStatusDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); return *this; } - LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_HtlcBasepointDecodeErrorZ { -private: - LDKCResult_HtlcBasepointDecodeErrorZ self; -public: - CResult_HtlcBasepointDecodeErrorZ(const CResult_HtlcBasepointDecodeErrorZ&) = delete; - CResult_HtlcBasepointDecodeErrorZ(CResult_HtlcBasepointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HtlcBasepointDecodeErrorZ)); } - CResult_HtlcBasepointDecodeErrorZ(LDKCResult_HtlcBasepointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HtlcBasepointDecodeErrorZ)); } - operator LDKCResult_HtlcBasepointDecodeErrorZ() && { LDKCResult_HtlcBasepointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HtlcBasepointDecodeErrorZ)); return res; } - ~CResult_HtlcBasepointDecodeErrorZ() { CResult_HtlcBasepointDecodeErrorZ_free(self); } - CResult_HtlcBasepointDecodeErrorZ& operator=(CResult_HtlcBasepointDecodeErrorZ&& o) { CResult_HtlcBasepointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HtlcBasepointDecodeErrorZ)); return *this; } - LDKCResult_HtlcBasepointDecodeErrorZ* operator &() { return &self; } - LDKCResult_HtlcBasepointDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HtlcBasepointDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HtlcBasepointDecodeErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_OutPointChannelIdZ { -private: - LDKC2Tuple_OutPointChannelIdZ self; -public: - C2Tuple_OutPointChannelIdZ(const C2Tuple_OutPointChannelIdZ&) = delete; - C2Tuple_OutPointChannelIdZ(C2Tuple_OutPointChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointChannelIdZ)); } - C2Tuple_OutPointChannelIdZ(LDKC2Tuple_OutPointChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointChannelIdZ)); } - operator LDKC2Tuple_OutPointChannelIdZ() && { LDKC2Tuple_OutPointChannelIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointChannelIdZ)); return res; } - ~C2Tuple_OutPointChannelIdZ() { C2Tuple_OutPointChannelIdZ_free(self); } - C2Tuple_OutPointChannelIdZ& operator=(C2Tuple_OutPointChannelIdZ&& o) { C2Tuple_OutPointChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointChannelIdZ)); return *this; } - LDKC2Tuple_OutPointChannelIdZ* operator &() { return &self; } - LDKC2Tuple_OutPointChannelIdZ* operator ->() { return &self; } - const LDKC2Tuple_OutPointChannelIdZ* operator &() const { return &self; } - const LDKC2Tuple_OutPointChannelIdZ* operator ->() const { return &self; } -}; inline LDK::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ DNSResolverMessageHandler::handle_dnssec_query(struct LDKDNSSECQuery message, struct LDKResponder responder) { LDK::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ ret = (self.handle_dnssec_query)(self.this_arg, message, responder); @@ -15264,19 +16098,32 @@ inline LDK::CResult_NoneNoneZ ChannelSigner::validate_counterparty_revocation(ui LDK::CResult_NoneNoneZ ret = (self.validate_counterparty_revocation)(self.this_arg, idx, secret); return ret; } +inline LDK::ChannelPublicKeys ChannelSigner::pubkeys() { + LDK::ChannelPublicKeys ret = (self.pubkeys)(self.this_arg); + return ret; +} +inline LDKPublicKey ChannelSigner::new_funding_pubkey(struct LDKThirtyTwoBytes splice_parent_funding_txid) { + LDKPublicKey ret = (self.new_funding_pubkey)(self.this_arg, splice_parent_funding_txid); + return ret; +} inline LDKThirtyTwoBytes ChannelSigner::channel_keys_id() { LDKThirtyTwoBytes ret = (self.channel_keys_id)(self.this_arg); return ret; } -inline void ChannelSigner::provide_channel_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters) { - (self.provide_channel_parameters)(self.this_arg, channel_parameters); -} inline LDKThirtyTwoBytes EntropySource::get_secure_random_bytes() { LDKThirtyTwoBytes ret = (self.get_secure_random_bytes)(self.this_arg); return ret; } -inline LDK::ExpandedKey NodeSigner::get_inbound_payment_key() { - LDK::ExpandedKey ret = (self.get_inbound_payment_key)(self.this_arg); +inline LDK::ExpandedKey NodeSigner::get_expanded_key() { + LDK::ExpandedKey ret = (self.get_expanded_key)(self.this_arg); + return ret; +} +inline LDK::PeerStorageKey NodeSigner::get_peer_storage_key() { + LDK::PeerStorageKey ret = (self.get_peer_storage_key)(self.this_arg); + return ret; +} +inline LDK::ReceiveAuthKey NodeSigner::get_receive_auth_key() { + LDK::ReceiveAuthKey ret = (self.get_receive_auth_key)(self.this_arg); return ret; } inline LDK::CResult_PublicKeyNoneZ NodeSigner::get_node_id(enum LDKRecipient recipient) { @@ -15299,20 +16146,20 @@ inline LDK::CResult_ECDSASignatureNoneZ NodeSigner::sign_gossip_message(struct L LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_gossip_message)(self.this_arg, msg); return ret; } -inline LDK::CResult_TransactionNoneZ OutputSpender::spend_spendable_outputs(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) { - LDK::CResult_TransactionNoneZ ret = (self.spend_spendable_outputs)(self.this_arg, descriptors, outputs, change_destination_script, feerate_sat_per_1000_weight, locktime); +inline LDK::CResult_StrNoneZ NodeSigner::sign_message(struct LDKu8slice msg) { + LDK::CResult_StrNoneZ ret = (self.sign_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) { - LDKThirtyTwoBytes ret = (self.generate_channel_keys_id)(self.this_arg, inbound, channel_value_satoshis, user_channel_id); +inline LDK::CResult_TransactionNoneZ OutputSpender::spend_spendable_outputs(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) { + LDK::CResult_TransactionNoneZ ret = (self.spend_spendable_outputs)(self.this_arg, descriptors, outputs, change_destination_script, feerate_sat_per_1000_weight, locktime); return ret; } -inline LDK::EcdsaChannelSigner SignerProvider::derive_channel_signer(uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id) { - LDK::EcdsaChannelSigner ret = (self.derive_channel_signer)(self.this_arg, channel_value_satoshis, channel_keys_id); +inline LDKThirtyTwoBytes SignerProvider::generate_channel_keys_id(bool inbound, struct LDKU128 user_channel_id) { + LDKThirtyTwoBytes ret = (self.generate_channel_keys_id)(self.this_arg, inbound, user_channel_id); return ret; } -inline LDK::CResult_EcdsaChannelSignerDecodeErrorZ SignerProvider::read_chan_signer(struct LDKu8slice reader) { - LDK::CResult_EcdsaChannelSignerDecodeErrorZ ret = (self.read_chan_signer)(self.this_arg, reader); +inline LDK::EcdsaChannelSigner SignerProvider::derive_channel_signer(struct LDKThirtyTwoBytes channel_keys_id) { + LDK::EcdsaChannelSigner ret = (self.derive_channel_signer)(self.this_arg, channel_keys_id); return ret; } inline LDK::CResult_CVec_u8ZNoneZ SignerProvider::get_destination_script(struct LDKThirtyTwoBytes channel_keys_id) { @@ -15323,19 +16170,19 @@ inline LDK::CResult_ShutdownScriptNoneZ SignerProvider::get_shutdown_scriptpubke LDK::CResult_ShutdownScriptNoneZ ret = (self.get_shutdown_scriptpubkey)(self.this_arg); return ret; } -inline LDK::CResult_CVec_u8ZNoneZ ChangeDestinationSource::get_change_destination_script() { +inline LDK::CResult_CVec_u8ZNoneZ ChangeDestinationSourceSync::get_change_destination_script() { LDK::CResult_CVec_u8ZNoneZ ret = (self.get_change_destination_script)(self.this_arg); return ret; } -inline LDK::CResult_RouteLightningErrorZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs) { - LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, route_params, first_hops, inflight_htlcs); +inline LDK::CResult_RouteStrZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs) { + LDK::CResult_RouteStrZ ret = (self.find_route)(self.this_arg, payer, route_params, first_hops, inflight_htlcs); return ret; } -inline LDK::CResult_RouteLightningErrorZ Router::find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id) { - LDK::CResult_RouteLightningErrorZ ret = (self.find_route_with_id)(self.this_arg, payer, route_params, first_hops, inflight_htlcs, _payment_hash, _payment_id); +inline LDK::CResult_RouteStrZ Router::find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id) { + LDK::CResult_RouteStrZ ret = (self.find_route_with_id)(self.this_arg, payer, route_params, first_hops, inflight_htlcs, _payment_hash, _payment_id); return ret; } -inline LDK::CResult_CVec_BlindedPaymentPathZNoneZ Router::create_blinded_payment_paths(struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats) { +inline LDK::CResult_CVec_BlindedPaymentPathZNoneZ Router::create_blinded_payment_paths(struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, struct LDKCOption_u64Z amount_msats) { LDK::CResult_CVec_BlindedPaymentPathZNoneZ ret = (self.create_blinded_payment_paths)(self.this_arg, recipient, first_hops, tlvs, amount_msats); return ret; } @@ -15372,8 +16219,8 @@ inline void Listen::filtered_block_connected(const uint8_t (*header)[80], struct inline void Listen::block_connected(struct LDKu8slice block, uint32_t height) { (self.block_connected)(self.this_arg, block, height); } -inline void Listen::block_disconnected(const uint8_t (*header)[80], uint32_t height) { - (self.block_disconnected)(self.this_arg, header, height); +inline void Listen::blocks_disconnected(struct LDKBestBlock fork_point_block) { + (self.blocks_disconnected)(self.this_arg, fork_point_block); } inline void Confirm::transactions_confirmed(const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height) { (self.transactions_confirmed)(self.this_arg, header, txdata, height); @@ -15388,12 +16235,12 @@ inline LDK::CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ Confirm::get LDK::CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ ret = (self.get_relevant_txids)(self.this_arg); return ret; } -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); +inline LDK::CResult_ChannelMonitorUpdateStatusNoneZ Watch::watch_channel(struct LDKChannelId channel_id, struct LDKChannelMonitor monitor) { + LDK::CResult_ChannelMonitorUpdateStatusNoneZ ret = (self.watch_channel)(self.this_arg, channel_id, monitor); return ret; } -inline LDK::ChannelMonitorUpdateStatus Watch::update_channel(struct LDKOutPoint funding_txo, const struct LDKChannelMonitorUpdate *NONNULL_PTR update) { - LDK::ChannelMonitorUpdateStatus ret = (self.update_channel)(self.this_arg, funding_txo, update); +inline LDK::ChannelMonitorUpdateStatus Watch::update_channel(struct LDKChannelId channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update) { + LDK::ChannelMonitorUpdateStatus ret = (self.update_channel)(self.this_arg, channel_id, update); return ret; } inline LDK::CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ Watch::release_pending_monitor_events() { @@ -15406,23 +16253,23 @@ inline void Filter::register_tx(const uint8_t (*txid)[32], struct LDKu8slice scr inline void Filter::register_output(struct LDKWatchedOutput output) { (self.register_output)(self.this_arg, output); } -inline LDK::CResult_CoinSelectionNoneZ CoinSelectionSource::select_confirmed_utxos(struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight) { - LDK::CResult_CoinSelectionNoneZ ret = (self.select_confirmed_utxos)(self.this_arg, claim_id, must_spend, must_pay_to, target_feerate_sat_per_1000_weight); +inline LDK::CResult_CVec_UtxoZNoneZ WalletSourceSync::list_confirmed_utxos() { + LDK::CResult_CVec_UtxoZNoneZ ret = (self.list_confirmed_utxos)(self.this_arg); return ret; } -inline LDK::CResult_TransactionNoneZ CoinSelectionSource::sign_psbt(struct LDKCVec_u8Z psbt) { - LDK::CResult_TransactionNoneZ ret = (self.sign_psbt)(self.this_arg, psbt); +inline LDK::CResult_CVec_u8ZNoneZ WalletSourceSync::get_change_script() { + LDK::CResult_CVec_u8ZNoneZ ret = (self.get_change_script)(self.this_arg); return ret; } -inline LDK::CResult_CVec_UtxoZNoneZ WalletSource::list_confirmed_utxos() { - LDK::CResult_CVec_UtxoZNoneZ ret = (self.list_confirmed_utxos)(self.this_arg); +inline LDK::CResult_TransactionNoneZ WalletSourceSync::sign_psbt(struct LDKCVec_u8Z psbt) { + LDK::CResult_TransactionNoneZ ret = (self.sign_psbt)(self.this_arg, psbt); return ret; } -inline LDK::CResult_CVec_u8ZNoneZ WalletSource::get_change_script() { - LDK::CResult_CVec_u8ZNoneZ ret = (self.get_change_script)(self.this_arg); +inline LDK::CResult_CoinSelectionNoneZ CoinSelectionSourceSync::select_confirmed_utxos(struct LDKThirtyTwoBytes claim_id, struct LDKCVec_InputZ must_spend, struct LDKCVec_TxOutZ must_pay_to, uint32_t target_feerate_sat_per_1000_weight, uint64_t max_tx_weight) { + LDK::CResult_CoinSelectionNoneZ ret = (self.select_confirmed_utxos)(self.this_arg, claim_id, must_spend, must_pay_to, target_feerate_sat_per_1000_weight, max_tx_weight); return ret; } -inline LDK::CResult_TransactionNoneZ WalletSource::sign_psbt(struct LDKCVec_u8Z psbt) { +inline LDK::CResult_TransactionNoneZ CoinSelectionSourceSync::sign_psbt(struct LDKCVec_u8Z psbt) { LDK::CResult_TransactionNoneZ ret = (self.sign_psbt)(self.this_arg, psbt); return ret; } @@ -15434,44 +16281,44 @@ inline LDK::CResult_NoneNoneZ Verification::verify_for_offer_payment(struct LDKT LDK::CResult_NoneNoneZ ret = (self.verify_for_offer_payment)(self.this_arg, hmac, nonce, expanded_key); return ret; } -inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner::sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) { - LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_counterparty_commitment)(self.this_arg, commitment_tx, inbound_htlc_preimages, outbound_htlc_preimages); +inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ BaseEcdsaChannelSigner::sign_counterparty_commitment(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) { + LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_counterparty_commitment)(self.this_arg, channel_parameters, commitment_tx, inbound_htlc_preimages, outbound_htlc_preimages); return ret; } -inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) { - LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_commitment)(self.this_arg, commitment_tx); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_holder_commitment(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_commitment)(self.this_arg, channel_parameters, commitment_tx); return ret; } -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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_justice_revoked_output(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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, channel_parameters, justice_tx, input, amount, per_commitment_key); return ret; } -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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_justice_revoked_htlc(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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, channel_parameters, justice_tx, input, amount, per_commitment_key, htlc); return ret; } -inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor) { +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::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_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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_counterparty_htlc_transaction(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, 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, channel_parameters, htlc_tx, input, amount, per_commitment_point, htlc); return ret; } -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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_closing_transaction(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKClosingTransaction *NONNULL_PTR closing_tx) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_closing_transaction)(self.this_arg, channel_parameters, closing_tx); return ret; } -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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_holder_keyed_anchor_input(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction anchor_tx, uintptr_t input) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_holder_keyed_anchor_input)(self.this_arg, channel_parameters, anchor_tx, input); return ret; } -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); +inline LDK::CResult_ECDSASignatureNoneZ BaseEcdsaChannelSigner::sign_channel_announcement_with_funding_key(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, channel_parameters, msg); return ret; } -inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_splicing_funding_input(struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value) { - LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_splicing_funding_input)(self.this_arg, tx, input_index, input_value); +inline LDK::ECDSASignature BaseEcdsaChannelSigner::sign_splice_shared_input(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters, struct LDKTransaction tx, uintptr_t input_index) { + LDK::ECDSASignature ret = (self.sign_splice_shared_input)(self.this_arg, channel_parameters, tx, input_index); return ret; } inline LDK::CResult_NoneLightningErrorZ CustomMessageHandler::handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id) { @@ -15497,8 +16344,8 @@ inline LDK::InitFeatures CustomMessageHandler::provided_init_features(struct LDK LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); return ret; } -inline uintptr_t SocketDescriptor::send_data(struct LDKu8slice data, bool resume_read) { - uintptr_t ret = (self.send_data)(self.this_arg, data, resume_read); +inline uintptr_t SocketDescriptor::send_data(struct LDKu8slice data, bool continue_read) { + uintptr_t ret = (self.send_data)(self.this_arg, data, continue_read); return ret; } inline void SocketDescriptor::disconnect_socket() { @@ -15512,19 +16359,23 @@ inline uint64_t SocketDescriptor::hash() { uint64_t ret = (self.hash)(self.this_arg); return ret; } -inline LDK::CResult_CVec_u8ZIOErrorZ KVStore::read(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key) { +inline LDK::CResult_SchnorrSignatureNoneZ SignInvoiceRequestFn::sign_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message) { + LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_invoice_request)(self.this_arg, message); + return ret; +} +inline LDK::CResult_CVec_u8ZIOErrorZ KVStoreSync::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) { +inline LDK::CResult_NoneIOErrorZ KVStoreSync::write(struct LDKStr primary_namespace, struct LDKStr secondary_namespace, struct LDKStr key, struct LDKCVec_u8Z 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) { +inline LDK::CResult_NoneIOErrorZ KVStoreSync::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) { +inline LDK::CResult_CVec_StrZIOErrorZ KVStoreSync::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; } @@ -15532,20 +16383,23 @@ inline LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ MigratableKVStore::list_all LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ ret = (self.list_all_keys)(self.this_arg); 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); +inline LDK::CVec_MessageSendEventZ BaseMessageHandler::get_and_clear_pending_msg_events() { + LDK::CVec_MessageSendEventZ ret = (self.get_and_clear_pending_msg_events)(self.this_arg); return ret; } -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); +inline void BaseMessageHandler::peer_disconnected(struct LDKPublicKey their_node_id) { + (self.peer_disconnected)(self.this_arg, their_node_id); +} +inline LDK::NodeFeatures BaseMessageHandler::provided_node_features() { + LDK::NodeFeatures ret = (self.provided_node_features)(self.this_arg); return ret; } -inline LDK::CResult_NoneIOErrorZ Persister::persist_scorer(const struct LDKWriteableScore *NONNULL_PTR scorer) { - LDK::CResult_NoneIOErrorZ ret = (self.persist_scorer)(self.this_arg, scorer); +inline LDK::InitFeatures BaseMessageHandler::provided_init_features(struct LDKPublicKey their_node_id) { + LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); return ret; } -inline LDK::CResult_SchnorrSignatureNoneZ SignInvoiceRequestFn::sign_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR message) { - LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_invoice_request)(self.this_arg, message); +inline LDK::CResult_NoneNoneZ BaseMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound) { + LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, msg, inbound); return ret; } inline void ChannelMessageHandler::handle_open_channel(struct LDKPublicKey their_node_id, const struct LDKOpenChannel *NONNULL_PTR msg) { @@ -15569,6 +16423,12 @@ inline void ChannelMessageHandler::handle_funding_signed(struct LDKPublicKey the inline void ChannelMessageHandler::handle_channel_ready(struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg) { (self.handle_channel_ready)(self.this_arg, their_node_id, msg); } +inline void ChannelMessageHandler::handle_peer_storage(struct LDKPublicKey their_node_id, struct LDKPeerStorage msg) { + (self.handle_peer_storage)(self.this_arg, their_node_id, msg); +} +inline void ChannelMessageHandler::handle_peer_storage_retrieval(struct LDKPublicKey their_node_id, struct LDKPeerStorageRetrieval msg) { + (self.handle_peer_storage_retrieval)(self.this_arg, their_node_id, msg); +} inline void ChannelMessageHandler::handle_shutdown(struct LDKPublicKey their_node_id, const struct LDKShutdown *NONNULL_PTR msg) { (self.handle_shutdown)(self.this_arg, their_node_id, msg); } @@ -15578,6 +16438,15 @@ inline void ChannelMessageHandler::handle_closing_signed(struct LDKPublicKey the inline void ChannelMessageHandler::handle_stfu(struct LDKPublicKey their_node_id, const struct LDKStfu *NONNULL_PTR msg) { (self.handle_stfu)(self.this_arg, their_node_id, msg); } +inline void ChannelMessageHandler::handle_splice_init(struct LDKPublicKey their_node_id, const struct LDKSpliceInit *NONNULL_PTR msg) { + (self.handle_splice_init)(self.this_arg, their_node_id, msg); +} +inline void ChannelMessageHandler::handle_splice_ack(struct LDKPublicKey their_node_id, const struct LDKSpliceAck *NONNULL_PTR msg) { + (self.handle_splice_ack)(self.this_arg, their_node_id, msg); +} +inline void ChannelMessageHandler::handle_splice_locked(struct LDKPublicKey their_node_id, const struct LDKSpliceLocked *NONNULL_PTR msg) { + (self.handle_splice_locked)(self.this_arg, their_node_id, msg); +} inline void ChannelMessageHandler::handle_tx_add_input(struct LDKPublicKey their_node_id, const struct LDKTxAddInput *NONNULL_PTR msg) { (self.handle_tx_add_input)(self.this_arg, their_node_id, msg); } @@ -15608,7 +16477,7 @@ inline void ChannelMessageHandler::handle_tx_abort(struct LDKPublicKey their_nod inline void ChannelMessageHandler::handle_update_add_htlc(struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg) { (self.handle_update_add_htlc)(self.this_arg, their_node_id, msg); } -inline void ChannelMessageHandler::handle_update_fulfill_htlc(struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg) { +inline void ChannelMessageHandler::handle_update_fulfill_htlc(struct LDKPublicKey their_node_id, struct LDKUpdateFulfillHTLC msg) { (self.handle_update_fulfill_htlc)(self.this_arg, their_node_id, msg); } inline void ChannelMessageHandler::handle_update_fail_htlc(struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg) { @@ -15620,6 +16489,9 @@ inline void ChannelMessageHandler::handle_update_fail_malformed_htlc(struct LDKP inline void ChannelMessageHandler::handle_commitment_signed(struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg) { (self.handle_commitment_signed)(self.this_arg, their_node_id, msg); } +inline void ChannelMessageHandler::handle_commitment_signed_batch(struct LDKPublicKey their_node_id, struct LDKChannelId channel_id, struct LDKCVec_CommitmentSignedZ batch) { + (self.handle_commitment_signed_batch)(self.this_arg, their_node_id, channel_id, batch); +} inline void ChannelMessageHandler::handle_revoke_and_ack(struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg) { (self.handle_revoke_and_ack)(self.this_arg, their_node_id, msg); } @@ -15629,13 +16501,6 @@ inline void ChannelMessageHandler::handle_update_fee(struct LDKPublicKey their_n inline void ChannelMessageHandler::handle_announcement_signatures(struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg) { (self.handle_announcement_signatures)(self.this_arg, their_node_id, msg); } -inline void ChannelMessageHandler::peer_disconnected(struct LDKPublicKey their_node_id) { - (self.peer_disconnected)(self.this_arg, their_node_id); -} -inline LDK::CResult_NoneNoneZ ChannelMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg, bool inbound) { - LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, msg, inbound); - return ret; -} inline void ChannelMessageHandler::handle_channel_reestablish(struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg) { (self.handle_channel_reestablish)(self.this_arg, their_node_id, msg); } @@ -15645,14 +16510,6 @@ inline void ChannelMessageHandler::handle_channel_update(struct LDKPublicKey the inline void ChannelMessageHandler::handle_error(struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg) { (self.handle_error)(self.this_arg, their_node_id, msg); } -inline LDK::NodeFeatures ChannelMessageHandler::provided_node_features() { - LDK::NodeFeatures ret = (self.provided_node_features)(self.this_arg); - return ret; -} -inline LDK::InitFeatures ChannelMessageHandler::provided_init_features(struct LDKPublicKey their_node_id) { - LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); - return ret; -} inline LDK::COption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler::get_chain_hashes() { LDK::COption_CVec_ThirtyTwoBytesZZ ret = (self.get_chain_hashes)(self.this_arg); return ret; @@ -15680,10 +16537,6 @@ inline LDK::NodeAnnouncement RoutingMessageHandler::get_next_node_announcement(s LDK::NodeAnnouncement ret = (self.get_next_node_announcement)(self.this_arg, starting_point); return ret; } -inline LDK::CResult_NoneNoneZ RoutingMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound) { - LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, init, inbound); - return ret; -} inline LDK::CResult_NoneLightningErrorZ RoutingMessageHandler::handle_reply_channel_range(struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg) { LDK::CResult_NoneLightningErrorZ ret = (self.handle_reply_channel_range)(self.this_arg, their_node_id, msg); return ret; @@ -15704,14 +16557,6 @@ inline bool RoutingMessageHandler::processing_queue_high() { bool ret = (self.processing_queue_high)(self.this_arg); return ret; } -inline LDK::NodeFeatures RoutingMessageHandler::provided_node_features() { - LDK::NodeFeatures ret = (self.provided_node_features)(self.this_arg); - return ret; -} -inline LDK::InitFeatures RoutingMessageHandler::provided_init_features(struct LDKPublicKey their_node_id) { - LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); - return ret; -} inline void OnionMessageHandler::handle_onion_message(struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg) { (self.handle_onion_message)(self.this_arg, peer_node_id, msg); } @@ -15719,32 +16564,31 @@ inline LDK::OnionMessage OnionMessageHandler::next_onion_message_for_peer(struct LDK::OnionMessage ret = (self.next_onion_message_for_peer)(self.this_arg, peer_node_id); return ret; } -inline LDK::CResult_NoneNoneZ OnionMessageHandler::peer_connected(struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init, bool inbound) { - LDK::CResult_NoneNoneZ ret = (self.peer_connected)(self.this_arg, their_node_id, init, inbound); - return ret; -} -inline void OnionMessageHandler::peer_disconnected(struct LDKPublicKey their_node_id) { - (self.peer_disconnected)(self.this_arg, their_node_id); -} inline void OnionMessageHandler::timer_tick_occurred() { (self.timer_tick_occurred)(self.this_arg); } -inline LDK::NodeFeatures OnionMessageHandler::provided_node_features() { - LDK::NodeFeatures ret = (self.provided_node_features)(self.this_arg); - return ret; -} -inline LDK::InitFeatures OnionMessageHandler::provided_init_features(struct LDKPublicKey their_node_id) { - LDK::InitFeatures ret = (self.provided_init_features)(self.this_arg, their_node_id); - return ret; -} inline void Logger::log(struct LDKRecord record) { (self.log)(self.this_arg, record); } inline void FutureCallback::call() { (self.call)(self.this_arg); } -inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ AsyncPaymentsMessageHandler::handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder) { - LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ ret = (self.handle_held_htlc_available)(self.this_arg, message, responder); +inline LDK::COption_C2Tuple_OfferPathsResponseInstructionZZ AsyncPaymentsMessageHandler::handle_offer_paths_request(struct LDKOfferPathsRequest message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder) { + LDK::COption_C2Tuple_OfferPathsResponseInstructionZZ ret = (self.handle_offer_paths_request)(self.this_arg, message, context, responder); + return ret; +} +inline LDK::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ AsyncPaymentsMessageHandler::handle_offer_paths(struct LDKOfferPaths message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder) { + LDK::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ ret = (self.handle_offer_paths)(self.this_arg, message, context, responder); + return ret; +} +inline void AsyncPaymentsMessageHandler::handle_serve_static_invoice(struct LDKServeStaticInvoice message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder) { + (self.handle_serve_static_invoice)(self.this_arg, message, context, responder); +} +inline void AsyncPaymentsMessageHandler::handle_static_invoice_persisted(struct LDKStaticInvoicePersisted message, struct LDKAsyncPaymentsContext context) { + (self.handle_static_invoice_persisted)(self.this_arg, message, context); +} +inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ AsyncPaymentsMessageHandler::handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKAsyncPaymentsContext context, struct LDKResponder responder) { + LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ ret = (self.handle_held_htlc_available)(self.this_arg, message, context, responder); return ret; } inline void AsyncPaymentsMessageHandler::handle_release_held_htlc(struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context) { @@ -15754,6 +16598,10 @@ inline LDK::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ AsyncPaym LDK::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ ret = (self.release_pending_messages)(self.this_arg); return ret; } +inline LDK::CResult_SchnorrSignatureNoneZ SignStaticInvoiceFn::sign_invoice(const struct LDKUnsignedStaticInvoice *NONNULL_PTR message) { + LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, message); + return ret; +} inline LDK::COption_C2Tuple_OffersMessageResponseInstructionZZ OffersMessageHandler::handle_message(struct LDKOffersMessage message, struct LDKCOption_OffersContextZ context, struct LDKResponder responder) { LDK::COption_C2Tuple_OffersMessageResponseInstructionZZ ret = (self.handle_message)(self.this_arg, message, context, responder); return ret; @@ -15769,6 +16617,13 @@ inline uint32_t FeeEstimator::get_est_sat_per_1000_weight(enum LDKConfirmationTa uint32_t ret = (self.get_est_sat_per_1000_weight)(self.this_arg, confirmation_target); return ret; } +inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) { + (self.process_pending_events)(self.this_arg, handler); +} +inline LDK::CResult_NoneReplayEventZ EventHandler::handle_event(struct LDKEvent event) { + LDK::CResult_NoneReplayEventZ ret = (self.handle_event)(self.this_arg, event); + return ret; +} inline uint64_t OnionMessageContents::tlv_type() { uint64_t ret = (self.tlv_type)(self.this_arg); return ret; @@ -15781,17 +16636,6 @@ inline LDK::Str OnionMessageContents::debug_str() { LDK::Str ret = (self.debug_str)(self.this_arg); return ret; } -inline LDK::CVec_MessageSendEventZ MessageSendEventsProvider::get_and_clear_pending_msg_events() { - LDK::CVec_MessageSendEventZ ret = (self.get_and_clear_pending_msg_events)(self.this_arg); - return ret; -} -inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) { - (self.process_pending_events)(self.this_arg, handler); -} -inline LDK::CResult_NoneReplayEventZ EventHandler::handle_event(struct LDKEvent event) { - LDK::CResult_NoneReplayEventZ ret = (self.handle_event)(self.this_arg, event); - return ret; -} inline LDK::CResult_COption_TypeZDecodeErrorZ CustomMessageReader::read(uint16_t message_type, struct LDKu8slice buffer) { LDK::CResult_COption_TypeZDecodeErrorZ ret = (self.read)(self.this_arg, message_type, buffer); return ret; @@ -15804,20 +16648,12 @@ inline LDK::Str Type::debug_str() { LDK::Str ret = (self.debug_str)(self.this_arg); return ret; } -inline LDK::UtxoResult UtxoLookup::get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id) { - LDK::UtxoResult ret = (self.get_utxo)(self.this_arg, chain_hash, short_channel_id); - return ret; -} inline LDK::CResult_OnionMessagePathNoneZ MessageRouter::find_path(struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination) { LDK::CResult_OnionMessagePathNoneZ ret = (self.find_path)(self.this_arg, sender, peers, destination); return ret; } -inline LDK::CResult_CVec_BlindedMessagePathZNoneZ MessageRouter::create_blinded_paths(struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers) { - LDK::CResult_CVec_BlindedMessagePathZNoneZ ret = (self.create_blinded_paths)(self.this_arg, recipient, context, peers); - return ret; -} -inline LDK::CResult_CVec_BlindedMessagePathZNoneZ MessageRouter::create_compact_blinded_paths(struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers) { - LDK::CResult_CVec_BlindedMessagePathZNoneZ ret = (self.create_compact_blinded_paths)(self.this_arg, recipient, context, peers); +inline LDK::CResult_CVec_BlindedMessagePathZNoneZ MessageRouter::create_blinded_paths(struct LDKPublicKey recipient, struct LDKReceiveAuthKey local_node_receive_key, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers) { + LDK::CResult_CVec_BlindedMessagePathZNoneZ ret = (self.create_blinded_paths)(self.this_arg, recipient, local_node_receive_key, context, peers); return ret; } inline LDK::COption_C2Tuple_OnionMessageContentsResponseInstructionZZ CustomOnionMessageHandler::handle_custom_message(struct LDKOnionMessageContents message, struct LDKCOption_CVec_u8ZZ context, struct LDKResponder responder) { @@ -15832,22 +16668,27 @@ inline LDK::CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ CustomOni LDK::CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ ret = (self.release_pending_custom_messages)(self.this_arg); return ret; } +inline LDK::UtxoResult UtxoLookup::get_utxo(const uint8_t (*chain_hash)[32], uint64_t short_channel_id) { + LDK::UtxoResult ret = (self.get_utxo)(self.this_arg, chain_hash, short_channel_id); + return ret; +} inline LDKPublicKey NodeIdLookUp::next_node_id(uint64_t short_channel_id) { LDKPublicKey ret = (self.next_node_id)(self.this_arg, short_channel_id); return ret; } -inline void ProcessMessagesCallback::call() { - (self.call)(self.this_arg); -} -inline LDK::ChannelMonitorUpdateStatus Persist::persist_new_channel(struct LDKOutPoint channel_funding_outpoint, const struct LDKChannelMonitor *NONNULL_PTR monitor) { - LDK::ChannelMonitorUpdateStatus ret = (self.persist_new_channel)(self.this_arg, channel_funding_outpoint, monitor); +inline LDK::ChannelMonitorUpdateStatus Persist::persist_new_channel(struct LDKMonitorName monitor_name, const struct LDKChannelMonitor *NONNULL_PTR monitor) { + LDK::ChannelMonitorUpdateStatus ret = (self.persist_new_channel)(self.this_arg, monitor_name, monitor); return ret; } -inline LDK::ChannelMonitorUpdateStatus Persist::update_persisted_channel(struct LDKOutPoint channel_funding_outpoint, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor) { - LDK::ChannelMonitorUpdateStatus ret = (self.update_persisted_channel)(self.this_arg, channel_funding_outpoint, monitor_update, monitor); +inline LDK::ChannelMonitorUpdateStatus Persist::update_persisted_channel(struct LDKMonitorName monitor_name, struct LDKChannelMonitorUpdate monitor_update, const struct LDKChannelMonitor *NONNULL_PTR monitor) { + LDK::ChannelMonitorUpdateStatus ret = (self.update_persisted_channel)(self.this_arg, monitor_name, monitor_update, monitor); return ret; } -inline void Persist::archive_persisted_channel(struct LDKOutPoint channel_funding_outpoint) { - (self.archive_persisted_channel)(self.this_arg, channel_funding_outpoint); +inline void Persist::archive_persisted_channel(struct LDKMonitorName monitor_name) { + (self.archive_persisted_channel)(self.this_arg, monitor_name); +} +inline LDK::CVec_C2Tuple_ChannelIdu64ZZ Persist::get_and_clear_completed_updates() { + LDK::CVec_C2Tuple_ChannelIdu64ZZ ret = (self.get_and_clear_completed_updates)(self.this_arg); + return ret; } } diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index 106a029c..008edbdf 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -21,13 +21,13 @@ pub struct CVec_u8Z { impl CVec_u8Z { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u8] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_u8Z { @@ -43,14 +43,14 @@ pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { } impl Drop for CVec_u8Z { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_u8Z { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -296,13 +296,13 @@ pub struct CVec_BlindedMessagePathZ { impl CVec_BlindedMessagePathZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::message::BlindedMessagePath] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_BlindedMessagePathZ { @@ -318,14 +318,14 @@ pub extern "C" fn CVec_BlindedMessagePathZ_free(_res: CVec_BlindedMessagePathZ) impl Drop for CVec_BlindedMessagePathZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_BlindedMessagePathZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -842,13 +842,13 @@ pub struct CVec_C2Tuple_u64CVec_u8ZZZ { 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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C2Tuple_u64CVec_u8ZZZ { @@ -864,14 +864,14 @@ pub extern "C" fn CVec_C2Tuple_u64CVec_u8ZZZ_free(_res: CVec_C2Tuple_u64CVec_u8Z 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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -1101,13 +1101,13 @@ pub struct CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { impl CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_DNSResolverMessageMessageSendInstructionsZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { @@ -1123,14 +1123,14 @@ pub extern "C" fn CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free( impl Drop for CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -1607,13 +1607,13 @@ pub struct CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { impl CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_HumanReadableNameThirtyTwoBytesZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { @@ -1629,14 +1629,14 @@ pub extern "C" fn CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(_res: CVec impl Drop for CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -2095,13 +2095,13 @@ pub struct CVec_BlindedPaymentPathZ { impl CVec_BlindedPaymentPathZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::payment::BlindedPaymentPath] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_BlindedPaymentPathZ { @@ -2117,14 +2117,14 @@ pub extern "C" fn CVec_BlindedPaymentPathZ_free(_res: CVec_BlindedPaymentPathZ) impl Drop for CVec_BlindedPaymentPathZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_BlindedPaymentPathZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -2141,13 +2141,13 @@ pub struct CVec_AddressZ { 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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::Address] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_AddressZ { @@ -2163,7 +2163,7 @@ 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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } #[repr(C)] @@ -2179,13 +2179,13 @@ pub struct CVec_ThirtyTwoBytesZ { 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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_ThirtyTwoBytesZ { @@ -2201,14 +2201,14 @@ 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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -2812,13 +2812,13 @@ pub struct CVec_SpendableOutputDescriptorZ { impl CVec_SpendableOutputDescriptorZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::sign::SpendableOutputDescriptor] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_SpendableOutputDescriptorZ { @@ -2834,14 +2834,14 @@ pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutpu impl Drop for CVec_SpendableOutputDescriptorZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_SpendableOutputDescriptorZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -2858,13 +2858,13 @@ pub struct CVec_TxOutZ { impl CVec_TxOutZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::TxOut] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_TxOutZ { @@ -2880,14 +2880,14 @@ pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { } impl Drop for CVec_TxOutZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_TxOutZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -3748,40 +3748,40 @@ impl Clone for CResult_ECDSASignatureNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionNoneZ -pub union CResult_TransactionNoneZPtr { +/// The contents of CResult_StrNoneZ +pub union CResult_StrNoneZPtr { /// 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, + pub result: *mut crate::c_types::Str, /// 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. +/// A CResult_StrNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::Str 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 +pub struct CResult_StrNoneZ { + /// The contents of this CResult_StrNoneZ, 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 contents: CResult_StrNoneZPtr, + /// Whether this CResult_StrNoneZ 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 { +/// Creates a new CResult_StrNoneZ in the success state. +pub extern "C" fn CResult_StrNoneZ_ok(o: crate::c_types::Str) -> CResult_StrNoneZ { + CResult_StrNoneZ { + contents: CResult_StrNoneZPtr { 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 { +/// Creates a new CResult_StrNoneZ in the error state. +pub extern "C" fn CResult_StrNoneZ_err() -> CResult_StrNoneZ { + CResult_StrNoneZ { + contents: CResult_StrNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -3789,13 +3789,13 @@ pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { } /// 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 { +pub extern "C" fn CResult_StrNoneZ_is_ok(o: &CResult_StrNoneZ) -> 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 { +/// Frees any resources used by the CResult_StrNoneZ. +pub extern "C" fn CResult_StrNoneZ_free(_res: CResult_StrNoneZ) { } +impl Drop for CResult_StrNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -3805,16 +3805,16 @@ impl Drop for CResult_TransactionNoneZ { } } } -impl From> for CResult_TransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StrNoneZ { + 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_StrNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_TransactionNoneZPtr { err: core::ptr::null_mut() } + CResult_StrNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3822,95 +3822,91 @@ impl From> for CRe } } } -impl Clone for CResult_TransactionNoneZ { +impl Clone for CResult_StrNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StrNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TransactionNoneZPtr { + Self { result_ok: false, contents: CResult_StrNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_TransactionNoneZ which has the same data as `orig` +/// Creates a new CResult_StrNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StrNoneZ_clone(orig: &CResult_StrNoneZ) -> CResult_StrNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_EcdsaChannelSignerDecodeErrorZ -pub union CResult_EcdsaChannelSignerDecodeErrorZPtr { +/// 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::lightning::sign::ecdsa::EcdsaChannelSigner, - /// 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::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_EcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::ecdsa::EcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError 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_EcdsaChannelSignerDecodeErrorZ { - /// The contents of this CResult_EcdsaChannelSignerDecodeErrorZ, 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_EcdsaChannelSignerDecodeErrorZPtr, - /// Whether this CResult_EcdsaChannelSignerDecodeErrorZ 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_EcdsaChannelSignerDecodeErrorZ in the success state. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::EcdsaChannelSigner) -> CResult_EcdsaChannelSignerDecodeErrorZ { - CResult_EcdsaChannelSignerDecodeErrorZ { - contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { +/// 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_EcdsaChannelSignerDecodeErrorZ in the error state. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_EcdsaChannelSignerDecodeErrorZ { - CResult_EcdsaChannelSignerDecodeErrorZ { - contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// 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_EcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_EcdsaChannelSignerDecodeErrorZ) -> 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_EcdsaChannelSignerDecodeErrorZ. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_free(_res: CResult_EcdsaChannelSignerDecodeErrorZ) { } -impl Drop for CResult_EcdsaChannelSignerDecodeErrorZ { +/// 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 { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } } } } -impl From> for CResult_EcdsaChannelSignerDecodeErrorZ { - 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_EcdsaChannelSignerDecodeErrorZPtr { result } + CResult_TransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_EcdsaChannelSignerDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3918,23 +3914,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TransactionNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_TransactionNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TransactionNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_EcdsaChannelSignerDecodeErrorZ) -> CResult_EcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_CVec_u8ZNoneZ pub union CResult_CVec_u8ZNoneZPtr { @@ -4120,80 +4116,6 @@ 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)] /// The contents of CResult_WitnessNoneZ pub union CResult_WitnessNoneZPtr { /// A pointer to the contents in the success state. @@ -4298,13 +4220,13 @@ pub struct CVec_ECDSASignatureZ { 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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::ECDSASignature] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_ECDSASignatureZ { @@ -4320,14 +4242,14 @@ 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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_ECDSASignatureZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -4466,101 +4388,51 @@ impl Clone for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. 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_InMemorySignerDecodeErrorZ -pub union CResult_InMemorySignerDecodeErrorZPtr { - /// 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::InMemorySigner, - /// 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_InMemorySignerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::InMemorySigner 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_InMemorySignerDecodeErrorZ { - /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InMemorySignerDecodeErrorZPtr, - /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. - pub result_ok: bool, +/// 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 { + /// 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::CVec_u8Z, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ { - CResult_InMemorySignerDecodeErrorZ { - contents: CResult_InMemorySignerDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl CVec_CVec_u8ZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -#[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ { - CResult_InMemorySignerDecodeErrorZ { - contents: CResult_InMemorySignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::CVec_u8Z] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool { - o.result_ok +impl From> for CVec_CVec_u8ZZ { + 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 any resources used by the CResult_InMemorySignerDecodeErrorZ. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { } -impl Drop for CResult_InMemorySignerDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { } +impl Drop for CVec_CVec_u8ZZ { 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_InMemorySignerDecodeErrorZ { - 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_InMemorySignerDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InMemorySignerDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_InMemorySignerDecodeErrorZ { +impl Clone for CVec_CVec_u8ZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` -/// 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)] /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not pub enum COption_WriteableScoreZ { @@ -4686,170 +4558,32 @@ impl Clone for CResult_NoneIOErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields, - /// The element at position 2 - pub c: crate::lightning::routing::router::RouteParameters, +/// A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ChannelDetailsZ { + /// 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::channel_state::ChannelDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } +impl CVec_ChannelDetailsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::channel_state::ChannelDetails] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) { - (self.a, self.b, self.c) - } -} -impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } - } -} -#[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 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. -pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { } -#[repr(C)] -/// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ -pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - /// 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::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, - /// 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr, - /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { } -impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - err: core::ptr::null_mut() - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::ChannelDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChannelDetailsZ { - /// 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::channel_state::ChannelDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChannelDetailsZ { - #[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::channel_state::ChannelDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ChannelDetailsZ { - 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() } } +impl From> for CVec_ChannelDetailsZ { + 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] @@ -4858,53 +4592,53 @@ pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { } impl Drop for CVec_ChannelDetailsZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_ChannelDetailsZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_RouteLightningErrorZ -pub union CResult_RouteLightningErrorZPtr { +/// The contents of CResult_RouteStrZ +pub union CResult_RouteStrZPtr { /// 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::routing::router::Route, /// 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::LightningError, + pub err: *mut crate::c_types::Str, } #[repr(C)] -/// A CResult_RouteLightningErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. +/// A CResult_RouteStrZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::Route on success and a crate::c_types::Str on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_RouteLightningErrorZ { - /// The contents of this CResult_RouteLightningErrorZ, accessible via either +pub struct CResult_RouteStrZ { + /// The contents of this CResult_RouteStrZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteLightningErrorZPtr, - /// Whether this CResult_RouteLightningErrorZ represents a success state. + pub contents: CResult_RouteStrZPtr, + /// Whether this CResult_RouteStrZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ in the success state. -pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ { - CResult_RouteLightningErrorZ { - contents: CResult_RouteLightningErrorZPtr { +/// Creates a new CResult_RouteStrZ in the success state. +pub extern "C" fn CResult_RouteStrZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteStrZ { + CResult_RouteStrZ { + contents: CResult_RouteStrZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ in the error state. -pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ { - CResult_RouteLightningErrorZ { - contents: CResult_RouteLightningErrorZPtr { +/// Creates a new CResult_RouteStrZ in the error state. +pub extern "C" fn CResult_RouteStrZ_err(e: crate::c_types::Str) -> CResult_RouteStrZ { + CResult_RouteStrZ { + contents: CResult_RouteStrZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -4912,13 +4646,13 @@ pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool { +pub extern "C" fn CResult_RouteStrZ_is_ok(o: &CResult_RouteStrZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteLightningErrorZ. -pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { } -impl Drop for CResult_RouteLightningErrorZ { +/// Frees any resources used by the CResult_RouteStrZ. +pub extern "C" fn CResult_RouteStrZ_free(_res: CResult_RouteStrZ) { } +impl Drop for CResult_RouteStrZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -4931,16 +4665,16 @@ impl Drop for CResult_RouteLightningErrorZ { } } } -impl From> for CResult_RouteLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteStrZ { + 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_RouteLightningErrorZPtr { result } + CResult_RouteStrZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteLightningErrorZPtr { err } + CResult_RouteStrZPtr { err } }; Self { contents, @@ -4948,23 +4682,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr { + Self { result_ok: true, contents: CResult_RouteStrZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_RouteStrZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` +/// Creates a new CResult_RouteStrZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RouteStrZ_clone(orig: &CResult_RouteStrZ) -> CResult_RouteStrZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_CVec_BlindedPaymentPathZNoneZ pub union CResult_CVec_BlindedPaymentPathZNoneZPtr { @@ -5250,6 +4984,148 @@ impl Clone for CResult_RouteHopDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_TrampolineHopDecodeErrorZ +pub union CResult_TrampolineHopDecodeErrorZPtr { + /// 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::routing::router::TrampolineHop, + /// 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_TrampolineHopDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::TrampolineHop 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_TrampolineHopDecodeErrorZ { + /// The contents of this CResult_TrampolineHopDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_TrampolineHopDecodeErrorZPtr, + /// Whether this CResult_TrampolineHopDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_TrampolineHopDecodeErrorZ in the success state. +pub extern "C" fn CResult_TrampolineHopDecodeErrorZ_ok(o: crate::lightning::routing::router::TrampolineHop) -> CResult_TrampolineHopDecodeErrorZ { + CResult_TrampolineHopDecodeErrorZ { + contents: CResult_TrampolineHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_TrampolineHopDecodeErrorZ in the error state. +pub extern "C" fn CResult_TrampolineHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrampolineHopDecodeErrorZ { + CResult_TrampolineHopDecodeErrorZ { + contents: CResult_TrampolineHopDecodeErrorZPtr { + 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_TrampolineHopDecodeErrorZ_is_ok(o: &CResult_TrampolineHopDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_TrampolineHopDecodeErrorZ. +pub extern "C" fn CResult_TrampolineHopDecodeErrorZ_free(_res: CResult_TrampolineHopDecodeErrorZ) { } +impl Drop for CResult_TrampolineHopDecodeErrorZ { + 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_TrampolineHopDecodeErrorZ { + 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_TrampolineHopDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_TrampolineHopDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_TrampolineHopDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TrampolineHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TrampolineHopDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TrampolineHopDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TrampolineHopDecodeErrorZ_clone(orig: &CResult_TrampolineHopDecodeErrorZ) -> CResult_TrampolineHopDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::routing::router::TrampolineHops of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TrampolineHopZ { + /// 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::routing::router::TrampolineHop, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TrampolineHopZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::routing::router::TrampolineHop] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TrampolineHopZ { + 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_TrampolineHopZ_free(_res: CVec_TrampolineHopZ) { } +impl Drop for CVec_TrampolineHopZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_TrampolineHopZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] /// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_BlindedHopZ { @@ -5262,13 +5138,13 @@ pub struct CVec_BlindedHopZ { impl CVec_BlindedHopZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::BlindedHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_BlindedHopZ { @@ -5284,14 +5160,14 @@ pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { } impl Drop for CVec_BlindedHopZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_BlindedHopZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -5404,13 +5280,13 @@ pub struct CVec_RouteHopZ { impl CVec_RouteHopZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::routing::router::RouteHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_RouteHopZ { @@ -5426,14 +5302,14 @@ pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { } impl Drop for CVec_RouteHopZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_RouteHopZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -5450,13 +5326,13 @@ pub struct CVec_PathZ { impl CVec_PathZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::routing::router::Path] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_PathZ { @@ -5472,14 +5348,14 @@ pub extern "C" fn CVec_PathZ_free(_res: CVec_PathZ) { } impl Drop for CVec_PathZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_PathZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -5688,13 +5564,13 @@ pub struct CVec_u64Z { impl CVec_u64Z { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u64] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_u64Z { @@ -5710,14 +5586,14 @@ pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { } impl Drop for CVec_u64Z { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_u64Z { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -5818,85 +5694,181 @@ impl Clone for CResult_PaymentParametersDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_RouteHintZ { - /// 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_types::routing::RouteHint, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_RouteHintZ { - #[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_types::routing::RouteHint] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_RouteHintZ { - 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_RouteHintZ_free(_res: CVec_RouteHintZ) { } -impl Drop for CVec_RouteHintZ { - 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_RouteHintZ { - 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_RouteHintDecodeErrorZ -pub union CResult_RouteHintDecodeErrorZPtr { +/// The contents of CResult_RouteParametersConfigDecodeErrorZ +pub union CResult_RouteParametersConfigDecodeErrorZPtr { /// 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_types::routing::RouteHint, + pub result: *mut crate::lightning::routing::router::RouteParametersConfig, /// 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_RouteHintDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::routing::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RouteParametersConfigDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::RouteParametersConfig 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_RouteHintDecodeErrorZ { - /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either +pub struct CResult_RouteParametersConfigDecodeErrorZ { + /// The contents of this CResult_RouteParametersConfigDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteHintDecodeErrorZPtr, - /// Whether this CResult_RouteHintDecodeErrorZ represents a success state. + pub contents: CResult_RouteParametersConfigDecodeErrorZPtr, + /// Whether this CResult_RouteParametersConfigDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteHintDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHint) -> CResult_RouteHintDecodeErrorZ { - CResult_RouteHintDecodeErrorZ { - contents: CResult_RouteHintDecodeErrorZPtr { +/// Creates a new CResult_RouteParametersConfigDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteParametersConfigDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParametersConfig) -> CResult_RouteParametersConfigDecodeErrorZ { + CResult_RouteParametersConfigDecodeErrorZ { + contents: CResult_RouteParametersConfigDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RouteHintDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ { +/// Creates a new CResult_RouteParametersConfigDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteParametersConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersConfigDecodeErrorZ { + CResult_RouteParametersConfigDecodeErrorZ { + contents: CResult_RouteParametersConfigDecodeErrorZPtr { + 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_RouteParametersConfigDecodeErrorZ_is_ok(o: &CResult_RouteParametersConfigDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_RouteParametersConfigDecodeErrorZ. +pub extern "C" fn CResult_RouteParametersConfigDecodeErrorZ_free(_res: CResult_RouteParametersConfigDecodeErrorZ) { } +impl Drop for CResult_RouteParametersConfigDecodeErrorZ { + 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_RouteParametersConfigDecodeErrorZ { + 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_RouteParametersConfigDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_RouteParametersConfigDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_RouteParametersConfigDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_RouteParametersConfigDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RouteParametersConfigDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_RouteParametersConfigDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_RouteParametersConfigDecodeErrorZ_clone(orig: &CResult_RouteParametersConfigDecodeErrorZ) -> CResult_RouteParametersConfigDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_RouteHintZ { + /// 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_types::routing::RouteHint, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_RouteHintZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_types::routing::RouteHint] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_RouteHintZ { + 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_RouteHintZ_free(_res: CVec_RouteHintZ) { } +impl Drop for CVec_RouteHintZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_RouteHintZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_RouteHintDecodeErrorZ +pub union CResult_RouteHintDecodeErrorZPtr { + /// 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_types::routing::RouteHint, + /// 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_RouteHintDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::routing::RouteHint 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_RouteHintDecodeErrorZ { + /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_RouteHintDecodeErrorZPtr, + /// Whether this CResult_RouteHintDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_RouteHintDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHint) -> CResult_RouteHintDecodeErrorZ { + CResult_RouteHintDecodeErrorZ { + contents: CResult_RouteHintDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_RouteHintDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ { CResult_RouteHintDecodeErrorZ { contents: CResult_RouteHintDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), @@ -6068,13 +6040,13 @@ pub struct CVec_PublicKeyZ { impl CVec_PublicKeyZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::PublicKey] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_PublicKeyZ { @@ -6090,60 +6062,14 @@ pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { } impl Drop for CVec_PublicKeyZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_PublicKeyZ { 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 u16s of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_u16Z { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut u16, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_u16Z { - #[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) -> &[u16] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_u16Z { - 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_u16Z_free(_res: CVec_u16Z) { } -impl Drop for CVec_u16Z { - 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_u16Z { - 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -6244,6 +6170,102 @@ impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] +/// The contents of CResult_ChannelLiquiditiesDecodeErrorZ +pub union CResult_ChannelLiquiditiesDecodeErrorZPtr { + /// 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::routing::scoring::ChannelLiquidities, + /// 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_ChannelLiquiditiesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::scoring::ChannelLiquidities 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_ChannelLiquiditiesDecodeErrorZ { + /// The contents of this CResult_ChannelLiquiditiesDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelLiquiditiesDecodeErrorZPtr, + /// Whether this CResult_ChannelLiquiditiesDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ChannelLiquiditiesDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelLiquiditiesDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ChannelLiquidities) -> CResult_ChannelLiquiditiesDecodeErrorZ { + CResult_ChannelLiquiditiesDecodeErrorZ { + contents: CResult_ChannelLiquiditiesDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ChannelLiquiditiesDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelLiquiditiesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelLiquiditiesDecodeErrorZ { + CResult_ChannelLiquiditiesDecodeErrorZ { + contents: CResult_ChannelLiquiditiesDecodeErrorZPtr { + 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_ChannelLiquiditiesDecodeErrorZ_is_ok(o: &CResult_ChannelLiquiditiesDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ChannelLiquiditiesDecodeErrorZ. +pub extern "C" fn CResult_ChannelLiquiditiesDecodeErrorZ_free(_res: CResult_ChannelLiquiditiesDecodeErrorZ) { } +impl Drop for CResult_ChannelLiquiditiesDecodeErrorZ { + 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_ChannelLiquiditiesDecodeErrorZ { + 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_ChannelLiquiditiesDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelLiquiditiesDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelLiquiditiesDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelLiquiditiesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelLiquiditiesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelLiquiditiesDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelLiquiditiesDecodeErrorZ_clone(orig: &CResult_ChannelLiquiditiesDecodeErrorZ) -> CResult_ChannelLiquiditiesDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_NodeIdZ { @@ -6256,13 +6278,13 @@ pub struct CVec_NodeIdZ { impl CVec_NodeIdZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::routing::gossip::NodeId] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_NodeIdZ { @@ -6278,14 +6300,14 @@ pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { } impl Drop for CVec_NodeIdZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_NodeIdZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -6727,13 +6749,13 @@ pub struct CVec_C2Tuple_usizeTransactionZZ { impl CVec_C2Tuple_usizeTransactionZZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_usizeTransactionZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C2Tuple_usizeTransactionZZ { @@ -6749,14 +6771,14 @@ pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeT impl Drop for CVec_C2Tuple_usizeTransactionZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C2Tuple_usizeTransactionZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -6819,13 +6841,13 @@ pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { impl CVec_C3Tuple_ThirtyTwoBytesu32COption_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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { @@ -6841,14 +6863,14 @@ pub extern "C" fn CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_ impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -6957,13 +6979,13 @@ pub struct CVec_MonitorEventZ { impl CVec_MonitorEventZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::channelmonitor::MonitorEvent] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_MonitorEventZ { @@ -6979,14 +7001,14 @@ pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { } impl Drop for CVec_MonitorEventZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_MonitorEventZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -7053,13 +7075,13 @@ pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { @@ -7075,248 +7097,37 @@ pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_fr impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// An enum which can either contain a crate::c_types::Address or not -pub enum COption_AddressZ { - /// When we're in this state, this COption_AddressZ contains a crate::c_types::Address - Some(crate::c_types::Address), - /// When we're in this state, this COption_AddressZ contains nothing - None +/// The contents of CResult_OfferIdDecodeErrorZ +pub union CResult_OfferIdDecodeErrorZPtr { + /// 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::OfferId, + /// 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_AddressZ { - #[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::Address { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_AddressZ containing a crate::c_types::Address -pub extern "C" fn COption_AddressZ_some(o: crate::c_types::Address) -> COption_AddressZ { - COption_AddressZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_AddressZ containing nothing -pub extern "C" fn COption_AddressZ_none() -> COption_AddressZ { - COption_AddressZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::Address, if we are in the Some state -pub extern "C" fn COption_AddressZ_free(_res: COption_AddressZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::Str or not -pub enum COption_StrZ { - /// When we're in this state, this COption_StrZ contains a crate::c_types::Str - Some(crate::c_types::Str), - /// When we're in this state, this COption_StrZ contains nothing - None -} -impl COption_StrZ { - #[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::Str { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_StrZ containing a crate::c_types::Str -pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ { - COption_StrZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_StrZ containing nothing -pub extern "C" fn COption_StrZ_none() -> COption_StrZ { - COption_StrZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::Str, if we are in the Some state -pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { } -#[no_mangle] -/// Creates a new COption_StrZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_LSPSRequestIdAPIErrorZ -pub union CResult_LSPSRequestIdAPIErrorZPtr { - /// 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_liquidity::lsps0::ser::LSPSRequestId, - /// 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, -} -#[repr(C)] -/// A CResult_LSPSRequestIdAPIErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_liquidity::lsps0::ser::LSPSRequestId 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_LSPSRequestIdAPIErrorZ { - /// The contents of this CResult_LSPSRequestIdAPIErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_LSPSRequestIdAPIErrorZPtr, - /// Whether this CResult_LSPSRequestIdAPIErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_LSPSRequestIdAPIErrorZ in the success state. -pub extern "C" fn CResult_LSPSRequestIdAPIErrorZ_ok(o: crate::lightning_liquidity::lsps0::ser::LSPSRequestId) -> CResult_LSPSRequestIdAPIErrorZ { - CResult_LSPSRequestIdAPIErrorZ { - contents: CResult_LSPSRequestIdAPIErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_LSPSRequestIdAPIErrorZ in the error state. -pub extern "C" fn CResult_LSPSRequestIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_LSPSRequestIdAPIErrorZ { - CResult_LSPSRequestIdAPIErrorZ { - contents: CResult_LSPSRequestIdAPIErrorZPtr { - 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_LSPSRequestIdAPIErrorZ_is_ok(o: &CResult_LSPSRequestIdAPIErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_LSPSRequestIdAPIErrorZ. -pub extern "C" fn CResult_LSPSRequestIdAPIErrorZ_free(_res: CResult_LSPSRequestIdAPIErrorZ) { } -impl Drop for CResult_LSPSRequestIdAPIErrorZ { - 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_LSPSRequestIdAPIErrorZ { - 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_LSPSRequestIdAPIErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_LSPSRequestIdAPIErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_LSPSRequestIdAPIErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_LSPSRequestIdAPIErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_LSPSRequestIdAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_LSPSRequestIdAPIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_LSPSRequestIdAPIErrorZ_clone(orig: &CResult_LSPSRequestIdAPIErrorZ) -> CResult_LSPSRequestIdAPIErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParamss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_LSPS2OpeningFeeParamsZ { - /// 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_liquidity::lsps2::msgs::LSPS2OpeningFeeParams, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_LSPS2OpeningFeeParamsZ { - #[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_liquidity::lsps2::msgs::LSPS2OpeningFeeParams] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_LSPS2OpeningFeeParamsZ { - 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_LSPS2OpeningFeeParamsZ_free(_res: CVec_LSPS2OpeningFeeParamsZ) { } -impl Drop for CVec_LSPS2OpeningFeeParamsZ { - 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_LSPS2OpeningFeeParamsZ { - 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_OfferIdDecodeErrorZ -pub union CResult_OfferIdDecodeErrorZPtr { - /// 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::OfferId, - /// 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_OfferIdDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::OfferId 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_OfferIdDecodeErrorZ { - /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferIdDecodeErrorZPtr, - /// Whether this CResult_OfferIdDecodeErrorZ represents a success state. - pub result_ok: bool, +#[repr(C)] +/// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::OfferId 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_OfferIdDecodeErrorZ { + /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_OfferIdDecodeErrorZPtr, + /// Whether this CResult_OfferIdDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] /// Creates a new CResult_OfferIdDecodeErrorZ in the success state. @@ -7757,41 +7568,41 @@ impl Clone for CResult_OfferDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_OfferDecodeErrorZ_clone(orig: &CResult_OfferDecodeErrorZ) -> CResult_OfferDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OfferBolt12ParseErrorZ -pub union CResult_OfferBolt12ParseErrorZPtr { +/// The contents of CResult_CurrencyCodeCurrencyCodeErrorZ +pub union CResult_CurrencyCodeCurrencyCodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::offers::offer::CurrencyCode, /// 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, + pub err: *mut crate::lightning::offers::offer::CurrencyCodeError, } #[repr(C)] -/// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. +/// A CResult_CurrencyCodeCurrencyCodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::CurrencyCode on success and a crate::lightning::offers::offer::CurrencyCodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferBolt12ParseErrorZ { - /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either +pub struct CResult_CurrencyCodeCurrencyCodeErrorZ { + /// The contents of this CResult_CurrencyCodeCurrencyCodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferBolt12ParseErrorZPtr, - /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state. + pub contents: CResult_CurrencyCodeCurrencyCodeErrorZPtr, + /// Whether this CResult_CurrencyCodeCurrencyCodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ in the success state. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ { - CResult_OfferBolt12ParseErrorZ { - contents: CResult_OfferBolt12ParseErrorZPtr { +/// Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ in the success state. +pub extern "C" fn CResult_CurrencyCodeCurrencyCodeErrorZ_ok(o: crate::lightning::offers::offer::CurrencyCode) -> CResult_CurrencyCodeCurrencyCodeErrorZ { + CResult_CurrencyCodeCurrencyCodeErrorZ { + contents: CResult_CurrencyCodeCurrencyCodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ in the error state. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ { - CResult_OfferBolt12ParseErrorZ { - contents: CResult_OfferBolt12ParseErrorZPtr { +/// Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ in the error state. +pub extern "C" fn CResult_CurrencyCodeCurrencyCodeErrorZ_err(e: crate::lightning::offers::offer::CurrencyCodeError) -> CResult_CurrencyCodeCurrencyCodeErrorZ { + CResult_CurrencyCodeCurrencyCodeErrorZ { + contents: CResult_CurrencyCodeCurrencyCodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7799,13 +7610,13 @@ pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool { +pub extern "C" fn CResult_CurrencyCodeCurrencyCodeErrorZ_is_ok(o: &CResult_CurrencyCodeCurrencyCodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OfferBolt12ParseErrorZ. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { } -impl Drop for CResult_OfferBolt12ParseErrorZ { +/// Frees any resources used by the CResult_CurrencyCodeCurrencyCodeErrorZ. +pub extern "C" fn CResult_CurrencyCodeCurrencyCodeErrorZ_free(_res: CResult_CurrencyCodeCurrencyCodeErrorZ) { } +impl Drop for CResult_CurrencyCodeCurrencyCodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7818,16 +7629,16 @@ impl Drop for CResult_OfferBolt12ParseErrorZ { } } } -impl From> for CResult_OfferBolt12ParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CurrencyCodeCurrencyCodeErrorZ { + 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_OfferBolt12ParseErrorZPtr { result } + CResult_CurrencyCodeCurrencyCodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferBolt12ParseErrorZPtr { err } + CResult_CurrencyCodeCurrencyCodeErrorZPtr { err } }; Self { contents, @@ -7835,59 +7646,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CurrencyCodeCurrencyCodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CurrencyCodeCurrencyCodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` +/// Creates a new CResult_CurrencyCodeCurrencyCodeErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_CurrencyCodeCurrencyCodeErrorZ_clone(orig: &CResult_CurrencyCodeCurrencyCodeErrorZ) -> CResult_CurrencyCodeCurrencyCodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeIdDecodeErrorZ -pub union CResult_NodeIdDecodeErrorZPtr { +/// 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::routing::gossip::NodeId, + 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::ln::msgs::DecodeError, + pub err: *mut crate::lightning::offers::parse::Bolt12ParseError, } #[repr(C)] -/// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeIdDecodeErrorZ { - /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either +pub struct CResult_OfferBolt12ParseErrorZ { + /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeIdDecodeErrorZPtr, - /// Whether this CResult_NodeIdDecodeErrorZ represents a success state. + pub contents: CResult_OfferBolt12ParseErrorZPtr, + /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ { - CResult_NodeIdDecodeErrorZ { - contents: CResult_NodeIdDecodeErrorZPtr { +/// Creates a new CResult_OfferBolt12ParseErrorZ in the success state. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ { + CResult_OfferBolt12ParseErrorZ { + contents: CResult_OfferBolt12ParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ { - CResult_NodeIdDecodeErrorZ { - contents: CResult_NodeIdDecodeErrorZPtr { +/// Creates a new CResult_OfferBolt12ParseErrorZ in the error state. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ { + CResult_OfferBolt12ParseErrorZ { + contents: CResult_OfferBolt12ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7895,13 +7706,13 @@ pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeIdDecodeErrorZ. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { } -impl Drop for CResult_NodeIdDecodeErrorZ { +/// Frees any resources used by the CResult_OfferBolt12ParseErrorZ. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { } +impl Drop for CResult_OfferBolt12ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7914,16 +7725,16 @@ impl Drop for CResult_NodeIdDecodeErrorZ { } } } -impl From> for CResult_NodeIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferBolt12ParseErrorZ { + 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_NodeIdDecodeErrorZPtr { result } + CResult_OfferBolt12ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeIdDecodeErrorZPtr { err } + CResult_OfferBolt12ParseErrorZPtr { err } }; Self { contents, @@ -7931,59 +7742,151 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PublicKeySecp256k1ErrorZ -pub union CResult_PublicKeySecp256k1ErrorZPtr { +/// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_HTLCOutputInCommitmentZ { + /// 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::chan_utils::HTLCOutputInCommitment, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_HTLCOutputInCommitmentZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chan_utils::HTLCOutputInCommitment] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_HTLCOutputInCommitmentZ { + 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_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { } +impl Drop for CVec_HTLCOutputInCommitmentZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_HTLCOutputInCommitmentZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_HTLCDescriptorZ { + /// 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::sign::HTLCDescriptor, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_HTLCDescriptorZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::sign::HTLCDescriptor] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_HTLCDescriptorZ { + 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_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { } +impl Drop for CVec_HTLCDescriptorZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_HTLCDescriptorZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_UtxoDecodeErrorZ +pub union CResult_UtxoDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::events::bump_transaction::Utxo, /// 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::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_UtxoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::bump_transaction::Utxo 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_PublicKeySecp256k1ErrorZ { - /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either +pub struct CResult_UtxoDecodeErrorZ { + /// The contents of this CResult_UtxoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PublicKeySecp256k1ErrorZPtr, - /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. + pub contents: CResult_UtxoDecodeErrorZPtr, + /// Whether this CResult_UtxoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_UtxoDecodeErrorZ in the success state. +pub extern "C" fn CResult_UtxoDecodeErrorZ_ok(o: crate::lightning::events::bump_transaction::Utxo) -> CResult_UtxoDecodeErrorZ { + CResult_UtxoDecodeErrorZ { + contents: CResult_UtxoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_UtxoDecodeErrorZ in the error state. +pub extern "C" fn CResult_UtxoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UtxoDecodeErrorZ { + CResult_UtxoDecodeErrorZ { + contents: CResult_UtxoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7991,13 +7894,13 @@ pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp25 } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool { +pub extern "C" fn CResult_UtxoDecodeErrorZ_is_ok(o: &CResult_UtxoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { } -impl Drop for CResult_PublicKeySecp256k1ErrorZ { +/// Frees any resources used by the CResult_UtxoDecodeErrorZ. +pub extern "C" fn CResult_UtxoDecodeErrorZ_free(_res: CResult_UtxoDecodeErrorZ) { } +impl Drop for CResult_UtxoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8010,16 +7913,16 @@ impl Drop for CResult_PublicKeySecp256k1ErrorZ { } } } -impl From> for CResult_PublicKeySecp256k1ErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UtxoDecodeErrorZ { + 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_PublicKeySecp256k1ErrorZPtr { result } + CResult_UtxoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PublicKeySecp256k1ErrorZPtr { err } + CResult_UtxoDecodeErrorZPtr { err } }; Self { contents, @@ -8027,96 +7930,142 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UtxoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_UtxoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` +/// Creates a new CResult_UtxoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UtxoDecodeErrorZ_clone(orig: &CResult_UtxoDecodeErrorZ) -> CResult_UtxoDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::events::bump_transaction::Utxos of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UtxoZ { + /// 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::bump_transaction::Utxo, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UtxoZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::events::bump_transaction::Utxo] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UtxoZ { + 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_UtxoZ_free(_res: CVec_UtxoZ) { } +impl Drop for CVec_UtxoZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_UtxoZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not -pub enum COption_NetworkUpdateZ { - /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate - Some(crate::lightning::routing::gossip::NetworkUpdate), - /// When we're in this state, this COption_NetworkUpdateZ contains nothing +/// An enum which can either contain a crate::c_types::TxOut or not +pub enum COption_TxOutZ { + /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut + Some(crate::c_types::TxOut), + /// When we're in this state, this COption_TxOutZ contains nothing None } -impl COption_NetworkUpdateZ { +impl COption_TxOutZ { #[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::routing::gossip::NetworkUpdate { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate -pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ { - COption_NetworkUpdateZ::Some(o) +/// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut +pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ { + COption_TxOutZ::Some(o) } #[no_mangle] -/// Constructs a new COption_NetworkUpdateZ containing nothing -pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ { - COption_NetworkUpdateZ::None +/// Constructs a new COption_TxOutZ containing nothing +pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ { + COption_TxOutZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state -pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { } +/// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state +pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { } #[no_mangle] -/// Creates a new COption_NetworkUpdateZ which has the same data as `orig` +/// Creates a new COption_TxOutZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) } +pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ -pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// The contents of CResult_u64ShortChannelIdErrorZ +pub union CResult_u64ShortChannelIdErrorZPtr { /// 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_NetworkUpdateZ, + pub result: *mut u64, /// 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::util::scid_utils::ShortChannelIdError, } #[repr(C)] -/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, +/// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_NetworkUpdateZDecodeErrorZ { - /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either +pub struct CResult_u64ShortChannelIdErrorZ { + /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr, - /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + pub contents: CResult_u64ShortChannelIdErrorZPtr, + /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { - CResult_COption_NetworkUpdateZDecodeErrorZ { - contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// Creates a new CResult_u64ShortChannelIdErrorZ in the success state. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ { + CResult_u64ShortChannelIdErrorZ { + contents: CResult_u64ShortChannelIdErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ { - CResult_COption_NetworkUpdateZDecodeErrorZ { - contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// Creates a new CResult_u64ShortChannelIdErrorZ in the error state. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ { + CResult_u64ShortChannelIdErrorZ { + contents: CResult_u64ShortChannelIdErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8124,13 +8073,13 @@ pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { } -impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { +/// Frees any resources used by the CResult_u64ShortChannelIdErrorZ. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { } +impl Drop for CResult_u64ShortChannelIdErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8143,16 +8092,16 @@ impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { } } } -impl From> for CResult_COption_NetworkUpdateZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_u64ShortChannelIdErrorZ { + 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_NetworkUpdateZDecodeErrorZPtr { result } + CResult_u64ShortChannelIdErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_NetworkUpdateZDecodeErrorZPtr { err } + CResult_u64ShortChannelIdErrorZPtr { err } }; Self { contents, @@ -8160,90 +8109,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not -pub enum COption_UtxoLookupZ { - /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup - Some(crate::lightning::routing::utxo::UtxoLookup), - /// When we're in this state, this COption_UtxoLookupZ contains nothing - None -} -impl COption_UtxoLookupZ { - #[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::routing::utxo::UtxoLookup { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup -pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ { - COption_UtxoLookupZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_UtxoLookupZ containing nothing -pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ { - COption_UtxoLookupZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state -pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { } #[repr(C)] -/// The contents of CResult_NoneLightningErrorZ -pub union CResult_NoneLightningErrorZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, +/// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ +pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr { + /// 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::channelmanager::PendingHTLCInfo, /// 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::LightningError, + pub err: *mut crate::lightning::ln::onion_payment::InboundHTLCErr, } #[repr(C)] -/// A CResult_NoneLightningErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. +/// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneLightningErrorZ { - /// The contents of this CResult_NoneLightningErrorZ, accessible via either +pub struct CResult_PendingHTLCInfoInboundHTLCErrZ { + /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneLightningErrorZPtr, - /// Whether this CResult_NoneLightningErrorZ represents a success state. + pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr, + /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ in the success state. -pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ { - CResult_NoneLightningErrorZ { - contents: CResult_NoneLightningErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ { + CResult_PendingHTLCInfoInboundHTLCErrZ { + contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ in the error state. -pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ { - CResult_NoneLightningErrorZ { - contents: CResult_NoneLightningErrorZPtr { +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ { + CResult_PendingHTLCInfoInboundHTLCErrZ { + contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8251,15 +8152,18 @@ pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool { +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneLightningErrorZ. -pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { } -impl Drop for CResult_NoneLightningErrorZ { +/// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { } +impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ { 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) }; @@ -8267,16 +8171,16 @@ impl Drop for CResult_NoneLightningErrorZ { } } } -impl From> for CResult_NoneLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self { +impl From> for CResult_PendingHTLCInfoInboundHTLCErrZ { + 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_NoneLightningErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_PendingHTLCInfoInboundHTLCErrZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneLightningErrorZPtr { err } + CResult_PendingHTLCInfoInboundHTLCErrZPtr { err } }; Self { contents, @@ -8284,95 +8188,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_boolLightningErrorZ -pub union CResult_boolLightningErrorZPtr { +/// The contents of CResult_CVec_UtxoZNoneZ +pub union CResult_CVec_UtxoZNoneZPtr { /// 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::msgs::LightningError, + pub result: *mut crate::c_types::derived::CVec_UtxoZ, + /// 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_boolLightningErrorZ represents the result of a fallible operation, -/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. +/// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_boolLightningErrorZ { - /// The contents of this CResult_boolLightningErrorZ, accessible via either +pub struct CResult_CVec_UtxoZNoneZ { + /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_boolLightningErrorZPtr, - /// Whether this CResult_boolLightningErrorZ represents a success state. + pub contents: CResult_CVec_UtxoZNoneZPtr, + /// Whether this CResult_CVec_UtxoZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ in the success state. -pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ { - CResult_boolLightningErrorZ { - contents: CResult_boolLightningErrorZPtr { +/// Creates a new CResult_CVec_UtxoZNoneZ in the success state. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ { + CResult_CVec_UtxoZNoneZ { + contents: CResult_CVec_UtxoZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ in the error state. -pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ { - CResult_boolLightningErrorZ { - contents: CResult_boolLightningErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_CVec_UtxoZNoneZ in the error state. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ { + CResult_CVec_UtxoZNoneZ { + contents: CResult_CVec_UtxoZNoneZPtr { + 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_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool { +pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_boolLightningErrorZ. -pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { } -impl Drop for CResult_boolLightningErrorZ { +/// Frees any resources used by the CResult_CVec_UtxoZNoneZ. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { } +impl Drop for CResult_CVec_UtxoZNoneZ { 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_boolLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_UtxoZNoneZ { + 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_boolLightningErrorZPtr { result } + CResult_CVec_UtxoZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolLightningErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -8380,224 +8280,137 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_boolLightningErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_boolLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - /// The element at position 0 - pub a: crate::lightning::ln::msgs::ChannelAnnouncement, - /// The element at position 1 - pub b: crate::lightning::ln::msgs::ChannelUpdate, - /// The element at position 2 - pub c: crate::lightning::ln::msgs::ChannelUpdate, +/// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_InputZ { + /// 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::bump_transaction::Input, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } +impl CVec_InputZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) { - (self.a, self.b, self.c) + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::bump_transaction::Input] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } - } -} -#[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 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. -pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not -pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ - Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), - /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing - None -} -impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - #[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::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { } -#[no_mangle] -/// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_MessageSendEventZ { - /// 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::MessageSendEvent, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_MessageSendEventZ { - #[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::events::MessageSendEvent] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_MessageSendEventZ { - 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() } } +impl From> for CVec_InputZ { + 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_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { } -impl Drop for CVec_MessageSendEventZ { +pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { } +impl Drop for CVec_InputZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_MessageSendEventZ { +impl Clone for CVec_InputZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_ChannelUpdateInfoDecodeErrorZ -pub union CResult_ChannelUpdateInfoDecodeErrorZPtr { +/// The contents of CResult_CoinSelectionNoneZ +pub union CResult_CoinSelectionNoneZPtr { /// 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::routing::gossip::ChannelUpdateInfo, - /// 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::events::bump_transaction::CoinSelection, + /// 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_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CoinSelectionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelUpdateInfoDecodeErrorZ { - /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either +pub struct CResult_CoinSelectionNoneZ { + /// The contents of this CResult_CoinSelectionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr, - /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. + pub contents: CResult_CoinSelectionNoneZPtr, + /// Whether this CResult_CoinSelectionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ { - CResult_ChannelUpdateInfoDecodeErrorZ { - contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { +/// Creates a new CResult_CoinSelectionNoneZ in the success state. +pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ { + CResult_CoinSelectionNoneZ { + contents: CResult_CoinSelectionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ { - CResult_ChannelUpdateInfoDecodeErrorZ { - contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_CoinSelectionNoneZ in the error state. +pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ { + CResult_CoinSelectionNoneZ { + contents: CResult_CoinSelectionNoneZPtr { + 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_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { } -impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ { +/// Frees any resources used by the CResult_CoinSelectionNoneZ. +pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { } +impl Drop for CResult_CoinSelectionNoneZ { 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_ChannelUpdateInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CoinSelectionNoneZ { + 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_ChannelUpdateInfoDecodeErrorZPtr { result } + CResult_CoinSelectionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelUpdateInfoDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -8605,59 +8418,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelInfoDecodeErrorZ -pub union CResult_ChannelInfoDecodeErrorZPtr { +/// The contents of CResult_NodeIdDecodeErrorZ +pub union CResult_NodeIdDecodeErrorZPtr { /// 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::routing::gossip::ChannelInfo, + pub result: *mut crate::lightning::routing::gossip::NodeId, /// 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_ChannelInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeId 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_ChannelInfoDecodeErrorZ { - /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either +pub struct CResult_NodeIdDecodeErrorZ { + /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelInfoDecodeErrorZPtr, - /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + pub contents: CResult_NodeIdDecodeErrorZPtr, + /// Whether this CResult_NodeIdDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ { - CResult_ChannelInfoDecodeErrorZ { - contents: CResult_ChannelInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeIdDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ { + CResult_NodeIdDecodeErrorZ { + contents: CResult_NodeIdDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ { - CResult_ChannelInfoDecodeErrorZ { - contents: CResult_ChannelInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeIdDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ { + CResult_NodeIdDecodeErrorZ { + contents: CResult_NodeIdDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8665,13 +8478,13 @@ pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { } -impl Drop for CResult_ChannelInfoDecodeErrorZ { +/// Frees any resources used by the CResult_NodeIdDecodeErrorZ. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { } +impl Drop for CResult_NodeIdDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8684,16 +8497,16 @@ impl Drop for CResult_ChannelInfoDecodeErrorZ { } } } -impl From> for CResult_ChannelInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeIdDecodeErrorZ { + 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_ChannelInfoDecodeErrorZPtr { result } + CResult_NodeIdDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelInfoDecodeErrorZPtr { err } + CResult_NodeIdDecodeErrorZPtr { err } }; Self { contents, @@ -8701,59 +8514,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RoutingFeesDecodeErrorZ -pub union CResult_RoutingFeesDecodeErrorZPtr { +/// 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::lightning_types::routing::RoutingFees, + pub result: *mut crate::c_types::PublicKey, /// 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::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::routing::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_RoutingFeesDecodeErrorZ { - /// The contents of this CResult_RoutingFeesDecodeErrorZ, 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_RoutingFeesDecodeErrorZPtr, - /// Whether this CResult_RoutingFeesDecodeErrorZ 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_RoutingFeesDecodeErrorZ in the success state. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning_types::routing::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ { - CResult_RoutingFeesDecodeErrorZ { - contents: CResult_RoutingFeesDecodeErrorZPtr { +/// 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_RoutingFeesDecodeErrorZ in the error state. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ { - CResult_RoutingFeesDecodeErrorZ { - contents: CResult_RoutingFeesDecodeErrorZPtr { +/// 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, @@ -8761,13 +8574,13 @@ pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> 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_RoutingFeesDecodeErrorZ. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { } -impl Drop for CResult_RoutingFeesDecodeErrorZ { +/// 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() } { @@ -8780,16 +8593,16 @@ impl Drop for CResult_RoutingFeesDecodeErrorZ { } } } -impl From> for CResult_RoutingFeesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { +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_RoutingFeesDecodeErrorZPtr { result } + CResult_PublicKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RoutingFeesDecodeErrorZPtr { err } + CResult_PublicKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -8797,105 +8610,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_RoutingFeesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RoutingFeesDecodeErrorZ 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_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. -/// This corresponds to std::vector in C++ -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::SocketAddress, - /// The number of elements pointed to by `data`. - pub datalen: usize +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not +pub enum COption_NetworkUpdateZ { + /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate + Some(crate::lightning::routing::gossip::NetworkUpdate), + /// When we're in this state, this COption_NetworkUpdateZ contains nothing + None } -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 +impl COption_NetworkUpdateZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -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() } } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NetworkUpdate { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -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)) }; - } +/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate +pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ { + COption_NetworkUpdateZ::Some(o) } -impl Clone for CVec_SocketAddressZ { - 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] +/// Constructs a new COption_NetworkUpdateZ containing nothing +pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ { + COption_NetworkUpdateZ::None } +#[no_mangle] +/// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state +pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { } +#[no_mangle] +/// Creates a new COption_NetworkUpdateZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ -pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ +pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr { /// 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::routing::gossip::NodeAnnouncementInfo, + pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ, /// 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_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_NetworkUpdateZ 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_NodeAnnouncementInfoDecodeErrorZ { - /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either +pub struct CResult_COption_NetworkUpdateZDecodeErrorZ { + /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr, - /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. + pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr, + /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ { - CResult_NodeAnnouncementInfoDecodeErrorZ { - contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ { - CResult_NodeAnnouncementInfoDecodeErrorZ { - contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8903,13 +8707,13 @@ pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { } -impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { +/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { } +impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8922,16 +8726,16 @@ impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { } } } -impl From> for CResult_NodeAnnouncementInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_NetworkUpdateZDecodeErrorZ { + 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_NodeAnnouncementInfoDecodeErrorZPtr { result } + CResult_COption_NetworkUpdateZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAnnouncementInfoDecodeErrorZPtr { err } + CResult_COption_NetworkUpdateZDecodeErrorZPtr { err } }; Self { contents, @@ -8939,59 +8743,90 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAliasDecodeErrorZ -pub union CResult_NodeAliasDecodeErrorZPtr { - /// 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::routing::gossip::NodeAlias, +/// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not +pub enum COption_UtxoLookupZ { + /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup + Some(crate::lightning::routing::utxo::UtxoLookup), + /// When we're in this state, this COption_UtxoLookupZ contains nothing + None +} +impl COption_UtxoLookupZ { + #[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::routing::utxo::UtxoLookup { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup +pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ { + COption_UtxoLookupZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_UtxoLookupZ containing nothing +pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ { + COption_UtxoLookupZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state +pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { } +#[repr(C)] +/// The contents of CResult_NoneLightningErrorZ +pub union CResult_NoneLightningErrorZPtr { + /// 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. /// 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::LightningError, } #[repr(C)] -/// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NoneLightningErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeAliasDecodeErrorZ { - /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either +pub struct CResult_NoneLightningErrorZ { + /// The contents of this CResult_NoneLightningErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAliasDecodeErrorZPtr, - /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state. + pub contents: CResult_NoneLightningErrorZPtr, + /// Whether this CResult_NoneLightningErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ { - CResult_NodeAliasDecodeErrorZ { - contents: CResult_NodeAliasDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneLightningErrorZ in the success state. +pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ { + CResult_NoneLightningErrorZ { + contents: CResult_NoneLightningErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ { - CResult_NodeAliasDecodeErrorZ { - contents: CResult_NodeAliasDecodeErrorZPtr { +/// Creates a new CResult_NoneLightningErrorZ in the error state. +pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ { + CResult_NoneLightningErrorZ { + contents: CResult_NoneLightningErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8999,18 +8834,15 @@ pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAliasDecodeErrorZ. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { } -impl Drop for CResult_NodeAliasDecodeErrorZ { +/// Frees any resources used by the CResult_NoneLightningErrorZ. +pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { } +impl Drop for CResult_NoneLightningErrorZ { 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) }; @@ -9018,16 +8850,16 @@ impl Drop for CResult_NodeAliasDecodeErrorZ { } } } -impl From> for CResult_NodeAliasDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneLightningErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_NodeAliasDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAliasDecodeErrorZPtr { err } + CResult_NoneLightningErrorZPtr { err } }; Self { contents, @@ -9035,96 +8867,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::routing::gossip::NodeAnnouncementInfo or not -pub enum COption_NodeAnnouncementInfoZ { - /// When we're in this state, this COption_NodeAnnouncementInfoZ contains a crate::lightning::routing::gossip::NodeAnnouncementInfo - Some(crate::lightning::routing::gossip::NodeAnnouncementInfo), - /// When we're in this state, this COption_NodeAnnouncementInfoZ contains nothing - None -} -impl COption_NodeAnnouncementInfoZ { - #[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::routing::gossip::NodeAnnouncementInfo { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo -pub extern "C" fn COption_NodeAnnouncementInfoZ_some(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> COption_NodeAnnouncementInfoZ { - COption_NodeAnnouncementInfoZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_NodeAnnouncementInfoZ containing nothing -pub extern "C" fn COption_NodeAnnouncementInfoZ_none() -> COption_NodeAnnouncementInfoZ { - COption_NodeAnnouncementInfoZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state -pub extern "C" fn COption_NodeAnnouncementInfoZ_free(_res: COption_NodeAnnouncementInfoZ) { } -#[no_mangle] -/// Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NodeAnnouncementInfoZ_clone(orig: &COption_NodeAnnouncementInfoZ) -> COption_NodeAnnouncementInfoZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_NodeInfoDecodeErrorZ -pub union CResult_NodeInfoDecodeErrorZPtr { +/// The contents of CResult_boolLightningErrorZ +pub union CResult_boolLightningErrorZPtr { /// 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::routing::gossip::NodeInfo, + 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::msgs::DecodeError, + pub err: *mut crate::lightning::ln::msgs::LightningError, } #[repr(C)] -/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_boolLightningErrorZ represents the result of a fallible operation, +/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeInfoDecodeErrorZ { - /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either +pub struct CResult_boolLightningErrorZ { + /// The contents of this CResult_boolLightningErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeInfoDecodeErrorZPtr, - /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state. + pub contents: CResult_boolLightningErrorZPtr, + /// Whether this CResult_boolLightningErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ { - CResult_NodeInfoDecodeErrorZ { - contents: CResult_NodeInfoDecodeErrorZPtr { +/// Creates a new CResult_boolLightningErrorZ in the success state. +pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ { + CResult_boolLightningErrorZ { + contents: CResult_boolLightningErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ { - CResult_NodeInfoDecodeErrorZ { - contents: CResult_NodeInfoDecodeErrorZPtr { +/// Creates a new CResult_boolLightningErrorZ in the error state. +pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ { + CResult_boolLightningErrorZ { + contents: CResult_boolLightningErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9132,13 +8927,13 @@ pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { } -impl Drop for CResult_NodeInfoDecodeErrorZ { +/// Frees any resources used by the CResult_boolLightningErrorZ. +pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { } +impl Drop for CResult_boolLightningErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9151,16 +8946,16 @@ impl Drop for CResult_NodeInfoDecodeErrorZ { } } } -impl From> for CResult_NodeInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_boolLightningErrorZ { + 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_NodeInfoDecodeErrorZPtr { result } + CResult_boolLightningErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeInfoDecodeErrorZPtr { err } + CResult_boolLightningErrorZPtr { err } }; Self { contents, @@ -9168,175 +8963,188 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_boolLightningErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_boolLightningErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_NetworkGraphDecodeErrorZ -pub union CResult_NetworkGraphDecodeErrorZPtr { - /// 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::routing::gossip::NetworkGraph, - /// 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_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NetworkGraph 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_NetworkGraphDecodeErrorZ { - /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NetworkGraphDecodeErrorZPtr, - /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ { - CResult_NetworkGraphDecodeErrorZ { - contents: CResult_NetworkGraphDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + /// The element at position 0 + pub a: crate::lightning::ln::msgs::ChannelAnnouncement, + /// The element at position 1 + pub b: crate::lightning::ln::msgs::ChannelUpdate, + /// The element at position 2 + pub c: crate::lightning::ln::msgs::ChannelUpdate, } -#[no_mangle] -/// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ { - CResult_NetworkGraphDecodeErrorZ { - contents: CResult_NetworkGraphDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { } -impl Drop for CResult_NetworkGraphDecodeErrorZ { - 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 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) { + (self.a, self.b, self.c) } } -impl From> for CResult_NetworkGraphDecodeErrorZ { - 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_NetworkGraphDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NetworkGraphDecodeErrorZPtr { err } - }; +impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + fn clone(&self) -> Self { Self { - contents, - result_ok: o.result_ok, + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), } } } +#[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 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, } +} + +#[no_mangle] +/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. +pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not -pub enum COption_CVec_SocketAddressZZ { - /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ - Some(crate::c_types::derived::CVec_SocketAddressZ), - /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing +/// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not +pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), + /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing None } -impl COption_CVec_SocketAddressZZ { +impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { #[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_SocketAddressZ { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// 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) +/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o) } #[no_mangle] -/// Constructs a new COption_CVec_SocketAddressZZ containing nothing -pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ { - COption_CVec_SocketAddressZZ::None +/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None } #[no_mangle] -/// 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) { } +/// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { } #[no_mangle] -/// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` +/// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) } +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_u64ShortChannelIdErrorZ -pub union CResult_u64ShortChannelIdErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut u64, - /// 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::scid_utils::ShortChannelIdError, +/// A dynamically-allocated array of crate::lightning::ln::msgs::MessageSendEvents of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MessageSendEventZ { + /// 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::MessageSendEvent, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[repr(C)] -/// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, -/// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. +impl CVec_MessageSendEventZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::MessageSendEvent] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MessageSendEventZ { + 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_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { } +impl Drop for CVec_MessageSendEventZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_MessageSendEventZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_ChannelUpdateInfoDecodeErrorZ +pub union CResult_ChannelUpdateInfoDecodeErrorZPtr { + /// 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::routing::gossip::ChannelUpdateInfo, + /// 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_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::ChannelUpdateInfo 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_u64ShortChannelIdErrorZ { - /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either +pub struct CResult_ChannelUpdateInfoDecodeErrorZ { + /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_u64ShortChannelIdErrorZPtr, - /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state. + pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr, + /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_u64ShortChannelIdErrorZ in the success state. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ { - CResult_u64ShortChannelIdErrorZ { - contents: CResult_u64ShortChannelIdErrorZPtr { +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ { + CResult_ChannelUpdateInfoDecodeErrorZ { + contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_u64ShortChannelIdErrorZ in the error state. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ { - CResult_u64ShortChannelIdErrorZ { - contents: CResult_u64ShortChannelIdErrorZPtr { +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ { + CResult_ChannelUpdateInfoDecodeErrorZ { + contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9344,13 +9152,13 @@ pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool { +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_u64ShortChannelIdErrorZ. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { } -impl Drop for CResult_u64ShortChannelIdErrorZ { +/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { } +impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9363,16 +9171,16 @@ impl Drop for CResult_u64ShortChannelIdErrorZ { } } } -impl From> for CResult_u64ShortChannelIdErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelUpdateInfoDecodeErrorZ { + 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_u64ShortChannelIdErrorZPtr { result } + CResult_ChannelUpdateInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_u64ShortChannelIdErrorZPtr { err } + CResult_ChannelUpdateInfoDecodeErrorZPtr { err } }; Self { contents, @@ -9380,42 +9188,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ -pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr { +/// The contents of CResult_ChannelInfoDecodeErrorZ +pub union CResult_ChannelInfoDecodeErrorZPtr { /// 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::channelmanager::PendingHTLCInfo, + pub result: *mut crate::lightning::routing::gossip::ChannelInfo, /// 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::onion_payment::InboundHTLCErr, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. +/// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::ChannelInfo 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_PendingHTLCInfoInboundHTLCErrZ { - /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either +pub struct CResult_ChannelInfoDecodeErrorZ { + /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr, - /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. + pub contents: CResult_ChannelInfoDecodeErrorZPtr, + /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ { - CResult_PendingHTLCInfoInboundHTLCErrZ { - contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { +/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ { + CResult_ChannelInfoDecodeErrorZ { + contents: CResult_ChannelInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ { - CResult_PendingHTLCInfoInboundHTLCErrZ { - contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { +/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ { + CResult_ChannelInfoDecodeErrorZ { + contents: CResult_ChannelInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9423,13 +9248,13 @@ pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool { +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { } -impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ { +/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { } +impl Drop for CResult_ChannelInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9442,16 +9267,16 @@ impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ { } } } -impl From> for CResult_PendingHTLCInfoInboundHTLCErrZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelInfoDecodeErrorZ { + 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_PendingHTLCInfoInboundHTLCErrZPtr { result } + CResult_ChannelInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCInfoInboundHTLCErrZPtr { err } + CResult_ChannelInfoDecodeErrorZPtr { err } }; Self { contents, @@ -9459,222 +9284,143 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` +/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { 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++ -pub struct CVec_HTLCOutputInCommitmentZ { - /// 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::chan_utils::HTLCOutputInCommitment, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_RoutingFeesDecodeErrorZ +pub union CResult_RoutingFeesDecodeErrorZPtr { + /// 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_types::routing::RoutingFees, + /// 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 CVec_HTLCOutputInCommitmentZ { - #[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::chan_utils::HTLCOutputInCommitment] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +#[repr(C)] +/// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::routing::RoutingFees 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_RoutingFeesDecodeErrorZ { + /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_RoutingFeesDecodeErrorZPtr, + /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. + pub result_ok: bool, } -impl From> for CVec_HTLCOutputInCommitmentZ { - 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] +/// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning_types::routing::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ { + CResult_RoutingFeesDecodeErrorZ { + contents: CResult_RoutingFeesDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { } -impl Drop for CVec_HTLCOutputInCommitmentZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; +/// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ { + CResult_RoutingFeesDecodeErrorZ { + contents: CResult_RoutingFeesDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } -impl Clone for CVec_HTLCOutputInCommitmentZ { - 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) +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { } +impl Drop for CResult_RoutingFeesDecodeErrorZ { + 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) }; + } + } } } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::sign::HTLCDescriptors of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_HTLCDescriptorZ { - /// 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::sign::HTLCDescriptor, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_HTLCDescriptorZ { - #[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::sign::HTLCDescriptor] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_HTLCDescriptorZ { - 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_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { } -impl Drop for CVec_HTLCDescriptorZ { - 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_HTLCDescriptorZ { - 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::lightning::events::bump_transaction::Utxos of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UtxoZ { - /// 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::bump_transaction::Utxo, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UtxoZ { - #[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::events::bump_transaction::Utxo] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UtxoZ { - 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_UtxoZ_free(_res: CVec_UtxoZ) { } -impl Drop for CVec_UtxoZ { - 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 From> for CResult_RoutingFeesDecodeErrorZ { + 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_RoutingFeesDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_RoutingFeesDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for CVec_UtxoZ { +impl Clone for CResult_RoutingFeesDecodeErrorZ { 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::TxOut or not -pub enum COption_TxOutZ { - /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut - Some(crate::c_types::TxOut), - /// When we're in this state, this COption_TxOutZ contains nothing - None -} -impl COption_TxOutZ { - #[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::TxOut { - if let Self::Some(v) = self { v } else { unreachable!() } + if self.result_ok { + Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } #[no_mangle] -/// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut -pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ { - COption_TxOutZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_TxOutZ containing nothing -pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ { - COption_TxOutZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state -pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { } -#[no_mangle] -/// Creates a new COption_TxOutZ which has the same data as `orig` +/// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs 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_InputZ { +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::events::bump_transaction::Input, + pub data: *mut crate::lightning::ln::msgs::SocketAddress, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_InputZ { - #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::events::bump_transaction::Input] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_InputZ { - 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() } } @@ -9682,89 +9428,93 @@ impl From> for CVec_Input } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { } -impl Drop for CVec_InputZ { +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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_InputZ { +impl Clone for CVec_SocketAddressZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_CoinSelectionNoneZ -pub union CResult_CoinSelectionNoneZPtr { +/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ +pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr { /// 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::CoinSelection, - /// 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::lightning::routing::gossip::NodeAnnouncementInfo, + /// 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_CoinSelectionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. +/// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo 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_CoinSelectionNoneZ { - /// The contents of this CResult_CoinSelectionNoneZ, accessible via either +pub struct CResult_NodeAnnouncementInfoDecodeErrorZ { + /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CoinSelectionNoneZPtr, - /// Whether this CResult_CoinSelectionNoneZ represents a success state. + pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr, + /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ in the success state. -pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ { - CResult_CoinSelectionNoneZ { - contents: CResult_CoinSelectionNoneZPtr { +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ { + CResult_NodeAnnouncementInfoDecodeErrorZ { + contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ in the error state. -pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ { - CResult_CoinSelectionNoneZ { - contents: CResult_CoinSelectionNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ { + CResult_NodeAnnouncementInfoDecodeErrorZ { + contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { + 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_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool { +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CoinSelectionNoneZ. -pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { } -impl Drop for CResult_CoinSelectionNoneZ { +/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { } +impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { 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_CoinSelectionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAnnouncementInfoDecodeErrorZ { + 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_CoinSelectionNoneZPtr { result } + CResult_NodeAnnouncementInfoDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NodeAnnouncementInfoDecodeErrorZPtr { err } }; Self { contents, @@ -9772,91 +9522,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_UtxoZNoneZ -pub union CResult_CVec_UtxoZNoneZPtr { +/// The contents of CResult_NodeAliasDecodeErrorZ +pub union CResult_NodeAliasDecodeErrorZPtr { /// 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_UtxoZ, - /// 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::lightning::routing::gossip::NodeAlias, + /// 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_CVec_UtxoZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. +/// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeAlias 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_CVec_UtxoZNoneZ { - /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either +pub struct CResult_NodeAliasDecodeErrorZ { + /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_UtxoZNoneZPtr, - /// Whether this CResult_CVec_UtxoZNoneZ represents a success state. - pub result_ok: bool, + pub contents: CResult_NodeAliasDecodeErrorZPtr, + /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ in the success state. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ { - CResult_CVec_UtxoZNoneZ { - contents: CResult_CVec_UtxoZNoneZPtr { +/// Creates a new CResult_NodeAliasDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ { + CResult_NodeAliasDecodeErrorZ { + contents: CResult_NodeAliasDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ in the error state. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ { - CResult_CVec_UtxoZNoneZ { - contents: CResult_CVec_UtxoZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_NodeAliasDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ { + CResult_NodeAliasDecodeErrorZ { + contents: CResult_NodeAliasDecodeErrorZPtr { + 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_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool { +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_UtxoZNoneZ. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { } -impl Drop for CResult_CVec_UtxoZNoneZ { +/// Frees any resources used by the CResult_NodeAliasDecodeErrorZ. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { } +impl Drop for CResult_NodeAliasDecodeErrorZ { 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_UtxoZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAliasDecodeErrorZ { + 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_UtxoZNoneZPtr { result } + CResult_NodeAliasDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NodeAliasDecodeErrorZPtr { err } }; Self { contents, @@ -9864,175 +9618,96 @@ impl From> } } } -impl Clone for CResult_CVec_UtxoZNoneZ { +impl Clone for CResult_NodeAliasDecodeErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` -/// 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)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not -pub enum COption_PaymentContextZ { - /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext - Some(crate::lightning::blinded_path::payment::PaymentContext), - /// When we're in this state, this COption_PaymentContextZ contains nothing - None -} -impl COption_PaymentContextZ { - #[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::blinded_path::payment::PaymentContext { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext -pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ { - COption_PaymentContextZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_PaymentContextZ containing nothing -pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ { - COption_PaymentContextZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state -pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { } -#[no_mangle] -/// Creates a new COption_PaymentContextZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { 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` +/// Creates a new CResult_NodeAliasDecodeErrorZ 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) { } +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// 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 +/// An enum which can either contain a crate::lightning::routing::gossip::NodeAnnouncementInfo or not +pub enum COption_NodeAnnouncementInfoZ { + /// When we're in this state, this COption_NodeAnnouncementInfoZ contains a crate::lightning::routing::gossip::NodeAnnouncementInfo + Some(crate::lightning::routing::gossip::NodeAnnouncementInfo), + /// When we're in this state, this COption_NodeAnnouncementInfoZ contains nothing None } -impl COption_C2Tuple_u64u16ZZ { +impl COption_NodeAnnouncementInfoZ { #[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_u64u16Z { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::gossip::NodeAnnouncementInfo { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// 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) +/// Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo +pub extern "C" fn COption_NodeAnnouncementInfoZ_some(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> COption_NodeAnnouncementInfoZ { + COption_NodeAnnouncementInfoZ::Some(o) } #[no_mangle] -/// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing -pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ { - COption_C2Tuple_u64u16ZZ::None +/// Constructs a new COption_NodeAnnouncementInfoZ containing nothing +pub extern "C" fn COption_NodeAnnouncementInfoZ_none() -> COption_NodeAnnouncementInfoZ { + COption_NodeAnnouncementInfoZ::None } #[no_mangle] -/// 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) { } +/// Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state +pub extern "C" fn COption_NodeAnnouncementInfoZ_free(_res: COption_NodeAnnouncementInfoZ) { } #[no_mangle] -/// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` +/// Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) } +pub extern "C" fn COption_NodeAnnouncementInfoZ_clone(orig: &COption_NodeAnnouncementInfoZ) -> COption_NodeAnnouncementInfoZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelIdAPIErrorZ -pub union CResult_ChannelIdAPIErrorZPtr { +/// The contents of CResult_NodeInfoDecodeErrorZ +pub union CResult_NodeInfoDecodeErrorZPtr { /// 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::types::ChannelId, + pub result: *mut crate::lightning::routing::gossip::NodeInfo, /// 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 err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure. +/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeInfo 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_ChannelIdAPIErrorZ { - /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either +pub struct CResult_NodeInfoDecodeErrorZ { + /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelIdAPIErrorZPtr, - /// Whether this CResult_ChannelIdAPIErrorZ represents a success state. + pub contents: CResult_NodeInfoDecodeErrorZPtr, + /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ in the success state. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ { - CResult_ChannelIdAPIErrorZ { - contents: CResult_ChannelIdAPIErrorZPtr { +/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ { + CResult_NodeInfoDecodeErrorZ { + contents: CResult_NodeInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ in the error state. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ { - CResult_ChannelIdAPIErrorZ { - contents: CResult_ChannelIdAPIErrorZPtr { +/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ { + CResult_NodeInfoDecodeErrorZ { + contents: CResult_NodeInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10040,13 +9715,13 @@ pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::erro } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool { +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelIdAPIErrorZ. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { } -impl Drop for CResult_ChannelIdAPIErrorZ { +/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { } +impl Drop for CResult_NodeInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10059,16 +9734,16 @@ impl Drop for CResult_ChannelIdAPIErrorZ { } } } -impl From> for CResult_ChannelIdAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeInfoDecodeErrorZ { + 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_ChannelIdAPIErrorZPtr { result } + CResult_NodeInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelIdAPIErrorZPtr { err } + CResult_NodeInfoDecodeErrorZPtr { err } }; Self { contents, @@ -10076,96 +9751,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { 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++ -pub struct CVec_RecentPaymentDetailsZ { - /// 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::channelmanager::RecentPaymentDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_RecentPaymentDetailsZ { - #[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::channelmanager::RecentPaymentDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_RecentPaymentDetailsZ { - 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_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { } -impl Drop for CVec_RecentPaymentDetailsZ { - 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_NoneAPIErrorZ -pub union CResult_NoneAPIErrorZPtr { - /// 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. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::util::errors::APIError, +/// The contents of CResult_NetworkGraphDecodeErrorZ +pub union CResult_NetworkGraphDecodeErrorZPtr { + /// 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::routing::gossip::NetworkGraph, + /// 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_NoneAPIErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::util::errors::APIError on failure. +/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NetworkGraph 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_NoneAPIErrorZ { - /// The contents of this CResult_NoneAPIErrorZ, accessible via either +pub struct CResult_NetworkGraphDecodeErrorZ { + /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneAPIErrorZPtr, - /// Whether this CResult_NoneAPIErrorZ represents a success state. + pub contents: CResult_NetworkGraphDecodeErrorZPtr, + /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ in the success state. -pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ { - CResult_NoneAPIErrorZ { - contents: CResult_NoneAPIErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ { + CResult_NetworkGraphDecodeErrorZ { + contents: CResult_NetworkGraphDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ in the error state. -pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ { - CResult_NoneAPIErrorZ { - contents: CResult_NoneAPIErrorZPtr { +/// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ { + CResult_NetworkGraphDecodeErrorZ { + contents: CResult_NetworkGraphDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10173,15 +9811,18 @@ pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::A } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool { +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneAPIErrorZ. -pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { } -impl Drop for CResult_NoneAPIErrorZ { +/// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { } +impl Drop for CResult_NetworkGraphDecodeErrorZ { 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) }; @@ -10189,16 +9830,16 @@ impl Drop for CResult_NoneAPIErrorZ { } } } -impl From> for CResult_NoneAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self { +impl From> for CResult_NetworkGraphDecodeErrorZ { + 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_NoneAPIErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_NetworkGraphDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneAPIErrorZPtr { err } + CResult_NetworkGraphDecodeErrorZPtr { err } }; Self { contents, @@ -10206,280 +9847,266 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_NoneRetryableSendFailureZ -pub union CResult_NoneRetryableSendFailureZPtr { - /// 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. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure, -} #[repr(C)] -/// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation, -/// containing a () 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_NoneRetryableSendFailureZ { - /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneRetryableSendFailureZPtr, - /// Whether this CResult_NoneRetryableSendFailureZ represents a success state. - pub result_ok: bool, +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not +pub enum COption_CVec_SocketAddressZZ { + /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ + Some(crate::c_types::derived::CVec_SocketAddressZ), + /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing + None } -#[no_mangle] -/// Creates a new CResult_NoneRetryableSendFailureZ in the success state. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ { - CResult_NoneRetryableSendFailureZ { - contents: CResult_NoneRetryableSendFailureZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, +impl COption_CVec_SocketAddressZZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -#[no_mangle] -/// Creates a new CResult_NoneRetryableSendFailureZ in the error state. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ { - CResult_NoneRetryableSendFailureZ { - contents: CResult_NoneRetryableSendFailureZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[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_SocketAddressZ { + 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_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool { - o.result_ok +/// 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] -/// Frees any resources used by the CResult_NoneRetryableSendFailureZ. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { } -impl Drop for CResult_NoneRetryableSendFailureZ { - 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_NoneRetryableSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self { - let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneRetryableSendFailureZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_NoneRetryableSendFailureZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } +/// 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] -/// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` +/// 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_SocketAddressZZ which has the same data as `orig` /// 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) } +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::lightning::blinded_path::message::OffersContext or not -pub enum COption_OffersContextZ { - /// When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext - Some(crate::lightning::blinded_path::message::OffersContext), - /// When we're in this state, this COption_OffersContextZ contains nothing +/// An enum which can either contain a or not +pub enum COption_NoneZ { + /// When we're in this state, this COption_NoneZ contains a + Some, + /// When we're in this state, this COption_NoneZ contains nothing None } -impl COption_OffersContextZ { +impl COption_NoneZ { #[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::blinded_path::message::OffersContext { - if let Self::Some(v) = self { v } else { unreachable!() } - } } #[no_mangle] -/// Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext -pub extern "C" fn COption_OffersContextZ_some(o: crate::lightning::blinded_path::message::OffersContext) -> COption_OffersContextZ { - COption_OffersContextZ::Some(o) +/// Constructs a new COption_NoneZ containing a +pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ { + COption_NoneZ::Some } #[no_mangle] -/// Constructs a new COption_OffersContextZ containing nothing -pub extern "C" fn COption_OffersContextZ_none() -> COption_OffersContextZ { - COption_OffersContextZ::None +/// Constructs a new COption_NoneZ containing nothing +pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ { + COption_NoneZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state -pub extern "C" fn COption_OffersContextZ_free(_res: COption_OffersContextZ) { } +/// Frees any resources associated with the , if we are in the Some state +pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { } #[no_mangle] -/// Creates a new COption_OffersContextZ which has the same data as `orig` +/// Creates a new COption_NoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OffersContextZ_clone(orig: &COption_OffersContextZ) -> COption_OffersContextZ { Clone::clone(&orig) } +pub extern "C" fn COption_NoneZ_clone(orig: &COption_NoneZ) -> COption_NoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneBolt12PaymentErrorZ -pub union CResult_NoneBolt12PaymentErrorZPtr { - /// 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. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::outbound_payment::Bolt12PaymentError, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not +pub enum COption_PaymentContextZ { + /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext + Some(crate::lightning::blinded_path::payment::PaymentContext), + /// When we're in this state, this COption_PaymentContextZ contains nothing + None } -#[repr(C)] -/// A CResult_NoneBolt12PaymentErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::ln::outbound_payment::Bolt12PaymentError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneBolt12PaymentErrorZ { - /// The contents of this CResult_NoneBolt12PaymentErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneBolt12PaymentErrorZPtr, - /// Whether this CResult_NoneBolt12PaymentErrorZ represents a success state. - pub result_ok: bool, +impl COption_PaymentContextZ { + #[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::blinded_path::payment::PaymentContext { + if let Self::Some(v) = self { v } else { unreachable!() } + } } #[no_mangle] -/// Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. -pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_ok() -> CResult_NoneBolt12PaymentErrorZ { - CResult_NoneBolt12PaymentErrorZ { - contents: CResult_NoneBolt12PaymentErrorZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, - } +/// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext +pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ { + COption_PaymentContextZ::Some(o) } #[no_mangle] -/// Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. -pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_err(e: crate::lightning::ln::outbound_payment::Bolt12PaymentError) -> CResult_NoneBolt12PaymentErrorZ { - CResult_NoneBolt12PaymentErrorZ { - contents: CResult_NoneBolt12PaymentErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +/// Constructs a new COption_PaymentContextZ containing nothing +pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ { + COption_PaymentContextZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state +pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { } +#[no_mangle] +/// Creates a new COption_PaymentContextZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::Str or not +pub enum COption_StrZ { + /// When we're in this state, this COption_StrZ contains a crate::c_types::Str + Some(crate::c_types::Str), + /// When we're in this state, this COption_StrZ contains nothing + None +} +impl COption_StrZ { + #[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::Str { + 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_NoneBolt12PaymentErrorZ_is_ok(o: &CResult_NoneBolt12PaymentErrorZ) -> bool { - o.result_ok +/// Constructs a new COption_StrZ containing a crate::c_types::Str +pub extern "C" fn COption_StrZ_some(o: crate::c_types::Str) -> COption_StrZ { + COption_StrZ::Some(o) } #[no_mangle] -/// Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. -pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_free(_res: CResult_NoneBolt12PaymentErrorZ) { } -impl Drop for CResult_NoneBolt12PaymentErrorZ { - 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) }; - } - } - } +/// Constructs a new COption_StrZ containing nothing +pub extern "C" fn COption_StrZ_none() -> COption_StrZ { + COption_StrZ::None } -impl From> for CResult_NoneBolt12PaymentErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::Bolt12PaymentError>) -> Self { - let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneBolt12PaymentErrorZPtr { result: core::ptr::null_mut() } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneBolt12PaymentErrorZPtr { err } - }; +#[no_mangle] +/// Frees any resources associated with the crate::c_types::Str, if we are in the Some state +pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { } +#[no_mangle] +/// Creates a new COption_StrZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { 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 { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, } } } -impl Clone for CResult_NoneBolt12PaymentErrorZ { +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 { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneBolt12PaymentErrorZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneBolt12PaymentErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), } } } #[no_mangle] -/// Creates a new CResult_NoneBolt12PaymentErrorZ 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. -pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_clone(orig: &CResult_NoneBolt12PaymentErrorZ) -> CResult_NoneBolt12PaymentErrorZ { Clone::clone(&orig) } +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)] -/// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ -pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr { +#[derive(Clone)] +/// 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_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) -> crate::c_types::derived::C2Tuple_u64u16Z { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// 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_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 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_C2Tuple_u64u16ZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ChannelIdAPIErrorZ +pub union CResult_ChannelIdAPIErrorZPtr { /// 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, + pub result: *mut crate::lightning::ln::types::ChannelId, /// 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::RetryableSendFailure, + pub err: *mut crate::lightning::util::errors::APIError, } #[repr(C)] -/// 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. +/// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::types::ChannelId 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_ThirtyTwoBytesRetryableSendFailureZ { - /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either +pub struct CResult_ChannelIdAPIErrorZ { + /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr, - /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. + pub contents: CResult_ChannelIdAPIErrorZPtr, + /// Whether this CResult_ChannelIdAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_ChannelIdAPIErrorZ in the success state. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ { + CResult_ChannelIdAPIErrorZ { + contents: CResult_ChannelIdAPIErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_ChannelIdAPIErrorZ in the error state. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ { + CResult_ChannelIdAPIErrorZ { + contents: CResult_ChannelIdAPIErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10487,13 +10114,13 @@ pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool { +pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { } -impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { +/// Frees any resources used by the CResult_ChannelIdAPIErrorZ. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { } +impl Drop for CResult_ChannelIdAPIErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10506,16 +10133,16 @@ impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { } } } -impl From> for CResult_ThirtyTwoBytesRetryableSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelIdAPIErrorZ { + 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_ThirtyTwoBytesRetryableSendFailureZPtr { result } + CResult_ChannelIdAPIErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err } + CResult_ChannelIdAPIErrorZPtr { err } }; Self { contents, @@ -10523,101 +10150,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` +/// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -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, +/// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_RecentPaymentDetailsZ { + /// 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::channelmanager::RecentPaymentDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize } -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, - b: tup.1, - } +impl CVec_RecentPaymentDetailsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { - (self.a, self.b) + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } +impl From> for CVec_RecentPaymentDetailsZ { + 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] -/// 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_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_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, } +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { } +impl Drop for CVec_RecentPaymentDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } } - -#[no_mangle] -/// 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_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ -pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { - /// 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_ThirtyTwoBytesThirtyTwoBytesZ, +/// 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 + pub result: *mut core::ffi::c_void, /// 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, + pub err: *mut crate::lightning::util::errors::APIError, } #[repr(C)] -/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. +/// A CResult_NoneAPIErrorZ represents the result of a fallible operation, +/// containing a () 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ, accessible via either +pub struct CResult_NoneAPIErrorZ { + /// The contents of this CResult_NoneAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents a success state. + pub contents: CResult_NoneAPIErrorZPtr, + /// Whether this CResult_NoneAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneAPIErrorZ in the success state. +pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ { + CResult_NoneAPIErrorZ { + contents: CResult_NoneAPIErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { +/// Creates a new CResult_NoneAPIErrorZ in the error state. +pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ { + CResult_NoneAPIErrorZ { + contents: CResult_NoneAPIErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10625,18 +10247,15 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> bool { +pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) { } -impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { +/// Frees any resources used by the CResult_NoneAPIErrorZ. +pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { } +impl Drop for CResult_NoneAPIErrorZ { 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) }; @@ -10644,16 +10263,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneAPIErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { err } + CResult_NoneAPIErrorZPtr { err } }; Self { contents, @@ -10661,105 +10280,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ which has the same data as `orig` +/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. -/// This corresponds to std::vector in C++ -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::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -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::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -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() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { - 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_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// 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::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, +/// The contents of CResult_NoneRetryableSendFailureZ +pub union CResult_NoneRetryableSendFailureZPtr { + /// 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. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure, + pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure, } #[repr(C)] -/// 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. +/// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation, +/// containing a () 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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either +pub struct CResult_NoneRetryableSendFailureZ { + /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr, - /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. + pub contents: CResult_NoneRetryableSendFailureZPtr, + /// Whether this CResult_NoneRetryableSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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)), +/// Creates a new CResult_NoneRetryableSendFailureZ in the success state. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ { + CResult_NoneRetryableSendFailureZ { + contents: CResult_NoneRetryableSendFailureZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_NoneRetryableSendFailureZ in the error state. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ { + CResult_NoneRetryableSendFailureZ { + contents: CResult_NoneRetryableSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10767,18 +10339,15 @@ pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFa } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool { +pub extern "C" fn CResult_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_NoneRetryableSendFailureZ. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { } +impl Drop for CResult_NoneRetryableSendFailureZ { 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) }; @@ -10786,16 +10355,16 @@ impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailur } } } -impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneRetryableSendFailureZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err } + CResult_NoneRetryableSendFailureZPtr { err } }; Self { contents, @@ -10803,45 +10372,4735 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` +/// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ChannelIdPublicKeyZ { - /// The element at position 0 +/// The contents of CResult_NoneBolt11PaymentErrorZ +pub union CResult_NoneBolt11PaymentErrorZPtr { + /// 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. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::outbound_payment::Bolt11PaymentError, +} +#[repr(C)] +/// A CResult_NoneBolt11PaymentErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::outbound_payment::Bolt11PaymentError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_NoneBolt11PaymentErrorZ { + /// The contents of this CResult_NoneBolt11PaymentErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneBolt11PaymentErrorZPtr, + /// Whether this CResult_NoneBolt11PaymentErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NoneBolt11PaymentErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt11PaymentErrorZ_ok() -> CResult_NoneBolt11PaymentErrorZ { + CResult_NoneBolt11PaymentErrorZ { + contents: CResult_NoneBolt11PaymentErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NoneBolt11PaymentErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt11PaymentErrorZ_err(e: crate::lightning::ln::outbound_payment::Bolt11PaymentError) -> CResult_NoneBolt11PaymentErrorZ { + CResult_NoneBolt11PaymentErrorZ { + contents: CResult_NoneBolt11PaymentErrorZPtr { + 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_NoneBolt11PaymentErrorZ_is_ok(o: &CResult_NoneBolt11PaymentErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneBolt11PaymentErrorZ. +pub extern "C" fn CResult_NoneBolt11PaymentErrorZ_free(_res: CResult_NoneBolt11PaymentErrorZ) { } +impl Drop for CResult_NoneBolt11PaymentErrorZ { + 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_NoneBolt11PaymentErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::Bolt11PaymentError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt11PaymentErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneBolt11PaymentErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not +pub enum COption_OffersContextZ { + /// When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext + Some(crate::lightning::blinded_path::message::OffersContext), + /// When we're in this state, this COption_OffersContextZ contains nothing + None +} +impl COption_OffersContextZ { + #[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::blinded_path::message::OffersContext { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext +pub extern "C" fn COption_OffersContextZ_some(o: crate::lightning::blinded_path::message::OffersContext) -> COption_OffersContextZ { + COption_OffersContextZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_OffersContextZ containing nothing +pub extern "C" fn COption_OffersContextZ_none() -> COption_OffersContextZ { + COption_OffersContextZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state +pub extern "C" fn COption_OffersContextZ_free(_res: COption_OffersContextZ) { } +#[no_mangle] +/// Creates a new COption_OffersContextZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_OffersContextZ_clone(orig: &COption_OffersContextZ) -> COption_OffersContextZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_NoneBolt12PaymentErrorZ +pub union CResult_NoneBolt12PaymentErrorZPtr { + /// 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. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::outbound_payment::Bolt12PaymentError, +} +#[repr(C)] +/// A CResult_NoneBolt12PaymentErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::outbound_payment::Bolt12PaymentError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_NoneBolt12PaymentErrorZ { + /// The contents of this CResult_NoneBolt12PaymentErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneBolt12PaymentErrorZPtr, + /// Whether this CResult_NoneBolt12PaymentErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_ok() -> CResult_NoneBolt12PaymentErrorZ { + CResult_NoneBolt12PaymentErrorZ { + contents: CResult_NoneBolt12PaymentErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_err(e: crate::lightning::ln::outbound_payment::Bolt12PaymentError) -> CResult_NoneBolt12PaymentErrorZ { + CResult_NoneBolt12PaymentErrorZ { + contents: CResult_NoneBolt12PaymentErrorZPtr { + 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_NoneBolt12PaymentErrorZ_is_ok(o: &CResult_NoneBolt12PaymentErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_free(_res: CResult_NoneBolt12PaymentErrorZ) { } +impl Drop for CResult_NoneBolt12PaymentErrorZ { + 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_NoneBolt12PaymentErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::Bolt12PaymentError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt12PaymentErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneBolt12PaymentErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NoneBolt12PaymentErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NoneBolt12PaymentErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NoneBolt12PaymentErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NoneBolt12PaymentErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_clone(orig: &CResult_NoneBolt12PaymentErrorZ) -> CResult_NoneBolt12PaymentErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// 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, + /// 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::RetryableSendFailure, +} +#[repr(C)] +/// 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_ThirtyTwoBytesRetryableSendFailureZ { + /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr, + /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// 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_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, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool { + o.result_ok +} +#[no_mangle] +/// 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() } { + 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_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_ThirtyTwoBytesRetryableSendFailureZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ThirtyTwoBytesRetryableSendFailureZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_ThirtyTwoBytesRetryableSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// 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_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_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_ThirtyTwoBytesThirtyTwoBytesZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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_ThirtyTwoBytesThirtyTwoBytesZ { + 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_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_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_ThirtyTwoBytesThirtyTwoBytesZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ +pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + /// 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_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::ProbeSendFailure, +} +#[repr(C)] +/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ 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_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + 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_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + 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_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + 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_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. +/// This corresponds to std::vector in C++ +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::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +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(crate::c_types::from_raw_parts_safer_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_ThirtyTwoBytesThirtyTwoBytesZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +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() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +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(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// 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::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_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_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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// 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_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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool { + o.result_ok +} +#[no_mangle] +/// 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_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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// 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_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ChannelIdPublicKeyZ { + /// The element at position 0 pub a: crate::lightning::ln::types::ChannelId, /// The element at position 1 - pub b: crate::c_types::PublicKey, + pub b: crate::c_types::PublicKey, +} +impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ { + fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ChannelIdPublicKeyZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ChannelIdPublicKeyZ { + 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_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ { + C2Tuple_ChannelIdPublicKeyZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. +pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ { + /// 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_ChannelIdPublicKeyZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ChannelIdPublicKeyZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_ChannelIdPublicKeyZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_ChannelIdPublicKeyZZ { + 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_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { } +impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ChannelIdZ { + /// 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::types::ChannelId, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ChannelIdZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::types::ChannelId] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ChannelIdZ { + 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_ChannelIdZ_free(_res: CVec_ChannelIdZ) { } +impl Drop for CVec_ChannelIdZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_ChannelIdZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_PublicKeyChannelIdZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::types::ChannelId, +} +impl From<(crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)> for C2Tuple_PublicKeyChannelIdZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_PublicKeyChannelIdZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_PublicKeyChannelIdZ { + 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_PublicKeyChannelIdZ_clone(orig: &C2Tuple_PublicKeyChannelIdZ) -> C2Tuple_PublicKeyChannelIdZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_PublicKeyChannelIdZ { + C2Tuple_PublicKeyChannelIdZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. +pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_free(_res: C2Tuple_PublicKeyChannelIdZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ or not +pub enum COption_C2Tuple_PublicKeyChannelIdZZ { + /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ + Some(crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ), + /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains nothing + None +} +impl COption_C2Tuple_PublicKeyChannelIdZZ { + #[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_PublicKeyChannelIdZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_some(o: crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { + COption_C2Tuple_PublicKeyChannelIdZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_none() -> COption_C2Tuple_PublicKeyChannelIdZZ { + COption_C2Tuple_PublicKeyChannelIdZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_free(_res: COption_C2Tuple_PublicKeyChannelIdZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_PublicKeyChannelIdZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_clone(orig: &COption_C2Tuple_PublicKeyChannelIdZZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ +pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + /// 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::Bolt11Invoice, + /// 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::SignOrCreationError, +} +#[repr(C)] +/// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ { + /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr, + /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { + CResult_Bolt11InvoiceSignOrCreationErrorZ { + contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { + CResult_Bolt11InvoiceSignOrCreationErrorZ { + contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + 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_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { } +impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { + 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_Bolt11InvoiceSignOrCreationErrorZ { + 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_Bolt11InvoiceSignOrCreationErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { 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)] +/// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ +pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + /// 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::OfferWithDerivedMetadataBuilder, + /// 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::Bolt12SemanticError, +} +#[repr(C)] +/// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_OfferNoneZ +pub union CResult_OfferNoneZPtr { + /// 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, + /// 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_OfferNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::Offer on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_OfferNoneZ { + /// The contents of this CResult_OfferNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_OfferNoneZPtr, + /// Whether this CResult_OfferNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_OfferNoneZ in the success state. +pub extern "C" fn CResult_OfferNoneZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferNoneZ { + CResult_OfferNoneZ { + contents: CResult_OfferNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_OfferNoneZ in the error state. +pub extern "C" fn CResult_OfferNoneZ_err() -> CResult_OfferNoneZ { + CResult_OfferNoneZ { + contents: CResult_OfferNoneZPtr { + 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_OfferNoneZ_is_ok(o: &CResult_OfferNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_OfferNoneZ. +pub extern "C" fn CResult_OfferNoneZ_free(_res: CResult_OfferNoneZ) { } +impl Drop for CResult_OfferNoneZ { + 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_OfferNoneZ { + 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_OfferNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_OfferNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_OfferNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_OfferNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_OfferNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_OfferNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_OfferNoneZ_clone(orig: &CResult_OfferNoneZ) -> CResult_OfferNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::onion_message::messenger::Destinations of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_DestinationZ { + /// 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::onion_message::messenger::Destination, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_DestinationZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::onion_message::messenger::Destination] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_DestinationZ { + 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_DestinationZ_free(_res: CVec_DestinationZ) { } +impl Drop for CVec_DestinationZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_DestinationZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// 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::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_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_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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// 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_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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// 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 { + } + } +} +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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result } + } else { + 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, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// 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 CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// 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, + /// 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, +} +#[repr(C)] +/// 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_ThirtyTwoBytesAPIErrorZ { + /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr, + /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// 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_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, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// 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() } { + 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_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_ThirtyTwoBytesAPIErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ThirtyTwoBytesAPIErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ThirtyTwoBytesAPIErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_ThirtyTwoBytesAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// 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_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_CVec_BlindedMessagePathZNoneZ +pub union CResult_CVec_BlindedMessagePathZNoneZPtr { + /// 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_BlindedMessagePathZ, + /// 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_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_BlindedMessagePathZNoneZ { + /// The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_BlindedMessagePathZNoneZPtr, + /// Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedMessagePathZ) -> CResult_CVec_BlindedMessagePathZNoneZ { + CResult_CVec_BlindedMessagePathZNoneZ { + contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_err() -> CResult_CVec_BlindedMessagePathZNoneZ { + CResult_CVec_BlindedMessagePathZNoneZ { + contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + 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_CVec_BlindedMessagePathZNoneZ_is_ok(o: &CResult_CVec_BlindedMessagePathZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_free(_res: CResult_CVec_BlindedMessagePathZNoneZ) { } +impl Drop for CResult_CVec_BlindedMessagePathZNoneZ { + 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_CVec_BlindedMessagePathZNoneZ { + 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_BlindedMessagePathZNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_BlindedMessagePathZNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_BlindedMessagePathZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_clone(orig: &CResult_CVec_BlindedMessagePathZNoneZ) -> CResult_CVec_BlindedMessagePathZNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::msgs::CommitmentSigneds of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_CommitmentSignedZ { + /// 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::CommitmentSigned, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_CommitmentSignedZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::CommitmentSigned] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_CommitmentSignedZ { + 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_CommitmentSignedZ_free(_res: CVec_CommitmentSignedZ) { } +impl Drop for CVec_CommitmentSignedZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_CommitmentSignedZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_OffersMessageResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::offers::OffersMessage, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OffersMessageResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OffersMessageResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OffersMessageResponseInstructionZ { + 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_OffersMessageResponseInstructionZ_clone(orig: &C2Tuple_OffersMessageResponseInstructionZ) -> C2Tuple_OffersMessageResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OffersMessageResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OffersMessageResponseInstructionZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OffersMessageResponseInstructionZ { + C2Tuple_OffersMessageResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OffersMessageResponseInstructionZ. +pub extern "C" fn C2Tuple_OffersMessageResponseInstructionZ_free(_res: C2Tuple_OffersMessageResponseInstructionZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ or not +pub enum COption_C2Tuple_OffersMessageResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_OffersMessageResponseInstructionZZ { + #[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_OffersMessageResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ +pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ) -> COption_C2Tuple_OffersMessageResponseInstructionZZ { + COption_C2Tuple_OffersMessageResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_none() -> COption_C2Tuple_OffersMessageResponseInstructionZZ { + COption_C2Tuple_OffersMessageResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_free(_res: COption_C2Tuple_OffersMessageResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_OffersMessageResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_clone(orig: &COption_C2Tuple_OffersMessageResponseInstructionZZ) -> COption_C2Tuple_OffersMessageResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OffersMessageMessageSendInstructionsZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::offers::OffersMessage, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, +} +impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OffersMessageMessageSendInstructionsZ { + fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OffersMessageMessageSendInstructionsZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OffersMessageMessageSendInstructionsZ { + 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_OffersMessageMessageSendInstructionsZ_clone(orig: &C2Tuple_OffersMessageMessageSendInstructionsZ) -> C2Tuple_OffersMessageMessageSendInstructionsZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OffersMessageMessageSendInstructionsZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OffersMessageMessageSendInstructionsZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OffersMessageMessageSendInstructionsZ { + C2Tuple_OffersMessageMessageSendInstructionsZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OffersMessageMessageSendInstructionsZ. +pub extern "C" fn C2Tuple_OffersMessageMessageSendInstructionsZ_free(_res: C2Tuple_OffersMessageMessageSendInstructionsZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OffersMessageMessageSendInstructionsZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + /// 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_OffersMessageMessageSendInstructionsZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_OffersMessageMessageSendInstructionsZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + 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_OffersMessageMessageSendInstructionsZZ_free(_res: CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ) { } +impl Drop for CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_OfferPathsResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::OfferPaths, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OfferPathsResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OfferPathsResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OfferPathsResponseInstructionZ { + 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_OfferPathsResponseInstructionZ_clone(orig: &C2Tuple_OfferPathsResponseInstructionZ) -> C2Tuple_OfferPathsResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OfferPathsResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OfferPathsResponseInstructionZ_new(a: crate::lightning::onion_message::async_payments::OfferPaths, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OfferPathsResponseInstructionZ { + C2Tuple_OfferPathsResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OfferPathsResponseInstructionZ. +pub extern "C" fn C2Tuple_OfferPathsResponseInstructionZ_free(_res: C2Tuple_OfferPathsResponseInstructionZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ or not +pub enum COption_C2Tuple_OfferPathsResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_OfferPathsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_OfferPathsResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_OfferPathsResponseInstructionZZ { + #[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_OfferPathsResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OfferPathsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ +pub extern "C" fn COption_C2Tuple_OfferPathsResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ) -> COption_C2Tuple_OfferPathsResponseInstructionZZ { + COption_C2Tuple_OfferPathsResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OfferPathsResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_OfferPathsResponseInstructionZZ_none() -> COption_C2Tuple_OfferPathsResponseInstructionZZ { + COption_C2Tuple_OfferPathsResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OfferPathsResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_OfferPathsResponseInstructionZZ_free(_res: COption_C2Tuple_OfferPathsResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_OfferPathsResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_OfferPathsResponseInstructionZZ_clone(orig: &COption_C2Tuple_OfferPathsResponseInstructionZZ) -> COption_C2Tuple_OfferPathsResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ServeStaticInvoiceResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::ServeStaticInvoice, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_ServeStaticInvoiceResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ServeStaticInvoiceResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ServeStaticInvoiceResponseInstructionZ { + 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_ServeStaticInvoiceResponseInstructionZ_clone(orig: &C2Tuple_ServeStaticInvoiceResponseInstructionZ) -> C2Tuple_ServeStaticInvoiceResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ServeStaticInvoiceResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ServeStaticInvoiceResponseInstructionZ_new(a: crate::lightning::onion_message::async_payments::ServeStaticInvoice, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_ServeStaticInvoiceResponseInstructionZ { + C2Tuple_ServeStaticInvoiceResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ServeStaticInvoiceResponseInstructionZ. +pub extern "C" fn C2Tuple_ServeStaticInvoiceResponseInstructionZ_free(_res: C2Tuple_ServeStaticInvoiceResponseInstructionZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ or not +pub enum COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { + #[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_ServeStaticInvoiceResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ) -> COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_none() -> COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { + COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_ServeStaticInvoiceResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_free(_res: COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ_clone(orig: &COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ) -> COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ReleaseHeldHtlcResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_ReleaseHeldHtlcResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ReleaseHeldHtlcResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ReleaseHeldHtlcResponseInstructionZ { + 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_ReleaseHeldHtlcResponseInstructionZ_clone(orig: &C2Tuple_ReleaseHeldHtlcResponseInstructionZ) -> C2Tuple_ReleaseHeldHtlcResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ReleaseHeldHtlcResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ReleaseHeldHtlcResponseInstructionZ_new(a: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_ReleaseHeldHtlcResponseInstructionZ { + C2Tuple_ReleaseHeldHtlcResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ReleaseHeldHtlcResponseInstructionZ. +pub extern "C" fn C2Tuple_ReleaseHeldHtlcResponseInstructionZ_free(_res: C2Tuple_ReleaseHeldHtlcResponseInstructionZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ or not +pub enum COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + #[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_ReleaseHeldHtlcResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ +pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ) -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_none() -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(_res: COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_clone(orig: &COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ) -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, +} +impl From<(crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + fn from (tup: (crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + 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_AsyncPaymentsMessageMessageSendInstructionsZ_clone(orig: &C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ) -> C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_new(a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { + C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ. +pub extern "C" fn C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(_res: C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + /// 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_AsyncPaymentsMessageMessageSendInstructionsZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_AsyncPaymentsMessageMessageSendInstructionsZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + 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_AsyncPaymentsMessageMessageSendInstructionsZZ_free(_res: CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ) { } +impl Drop for CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_PhantomRouteHintsDecodeErrorZ +pub union CResult_PhantomRouteHintsDecodeErrorZPtr { + /// 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::channelmanager::PhantomRouteHints, + /// 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_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_PhantomRouteHintsDecodeErrorZ { + /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr, + /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ { + CResult_PhantomRouteHintsDecodeErrorZ { + contents: CResult_PhantomRouteHintsDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ { + CResult_PhantomRouteHintsDecodeErrorZ { + contents: CResult_PhantomRouteHintsDecodeErrorZPtr { + 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_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { } +impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { + 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_PhantomRouteHintsDecodeErrorZ { + 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_PhantomRouteHintsDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PhantomRouteHintsDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_PhantomRouteHintsDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_BlindedForwardDecodeErrorZ +pub union CResult_BlindedForwardDecodeErrorZPtr { + /// 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::channelmanager::BlindedForward, + /// 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_BlindedForwardDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::BlindedForward 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_BlindedForwardDecodeErrorZ { + /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_BlindedForwardDecodeErrorZPtr, + /// Whether this CResult_BlindedForwardDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_BlindedForwardDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ { + CResult_BlindedForwardDecodeErrorZ { + contents: CResult_BlindedForwardDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_BlindedForwardDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ { + CResult_BlindedForwardDecodeErrorZ { + contents: CResult_BlindedForwardDecodeErrorZPtr { + 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_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { } +impl Drop for CResult_BlindedForwardDecodeErrorZ { + 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_BlindedForwardDecodeErrorZ { + 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_BlindedForwardDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_BlindedForwardDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_BlindedForwardDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_PendingHTLCRoutingDecodeErrorZ +pub union CResult_PendingHTLCRoutingDecodeErrorZPtr { + /// 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::channelmanager::PendingHTLCRouting, + /// 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_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting 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_PendingHTLCRoutingDecodeErrorZ { + /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_PendingHTLCRoutingDecodeErrorZPtr, + /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ { + CResult_PendingHTLCRoutingDecodeErrorZ { + contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the error state. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ { + CResult_PendingHTLCRoutingDecodeErrorZ { + contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { + 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_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { } +impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { + 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_PendingHTLCRoutingDecodeErrorZ { + 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_PendingHTLCRoutingDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PendingHTLCRoutingDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_PendingHTLCRoutingDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_PendingHTLCInfoDecodeErrorZ +pub union CResult_PendingHTLCInfoDecodeErrorZPtr { + /// 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::channelmanager::PendingHTLCInfo, + /// 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_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo 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_PendingHTLCInfoDecodeErrorZ { + /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr, + /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ { + CResult_PendingHTLCInfoDecodeErrorZ { + contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ { + CResult_PendingHTLCInfoDecodeErrorZ { + contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + 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_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { } +impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { + 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_PendingHTLCInfoDecodeErrorZ { + 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_PendingHTLCInfoDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PendingHTLCInfoDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_PendingHTLCInfoDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_BlindedFailureDecodeErrorZ +pub union CResult_BlindedFailureDecodeErrorZPtr { + /// 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::channelmanager::BlindedFailure, + /// 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_BlindedFailureDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::BlindedFailure 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_BlindedFailureDecodeErrorZ { + /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_BlindedFailureDecodeErrorZPtr, + /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ { + CResult_BlindedFailureDecodeErrorZ { + contents: CResult_BlindedFailureDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ { + CResult_BlindedFailureDecodeErrorZ { + contents: CResult_BlindedFailureDecodeErrorZPtr { + 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_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { } +impl Drop for CResult_BlindedFailureDecodeErrorZ { + 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_BlindedFailureDecodeErrorZ { + 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_BlindedFailureDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_BlindedFailureDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_BlindedFailureDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ChannelMonitorZ { + /// 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::chain::channelmonitor::ChannelMonitor, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ChannelMonitorZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::channelmonitor::ChannelMonitor] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ChannelMonitorZ { + 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_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { } +impl Drop for CVec_ChannelMonitorZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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 { crate::c_types::from_raw_parts_safer_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_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_ThirtyTwoBytesChannelManagerZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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_ThirtyTwoBytesChannelManagerZ from the contained elements. +#[no_mangle] +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_ThirtyTwoBytesChannelManagerZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { } +#[repr(C)] +/// 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_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_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_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_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// 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_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, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +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_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() } { + 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_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_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +/// The contents of CResult_NoneSecp256k1ErrorZ +pub union CResult_NoneSecp256k1ErrorZPtr { + /// 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. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::c_types::Secp256k1Error, +} +#[repr(C)] +/// A CResult_NoneSecp256k1ErrorZ represents the result of a fallible operation, +/// containing a () 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_NoneSecp256k1ErrorZ { + /// The contents of this CResult_NoneSecp256k1ErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneSecp256k1ErrorZPtr, + /// Whether this CResult_NoneSecp256k1ErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NoneSecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_NoneSecp256k1ErrorZ_ok() -> CResult_NoneSecp256k1ErrorZ { + CResult_NoneSecp256k1ErrorZ { + contents: CResult_NoneSecp256k1ErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NoneSecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_NoneSecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_NoneSecp256k1ErrorZ { + CResult_NoneSecp256k1ErrorZ { + contents: CResult_NoneSecp256k1ErrorZPtr { + 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_NoneSecp256k1ErrorZ_is_ok(o: &CResult_NoneSecp256k1ErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneSecp256k1ErrorZ. +pub extern "C" fn CResult_NoneSecp256k1ErrorZ_free(_res: CResult_NoneSecp256k1ErrorZ) { } +impl Drop for CResult_NoneSecp256k1ErrorZ { + 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_NoneSecp256k1ErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::Secp256k1Error>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneSecp256k1ErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneSecp256k1ErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NoneSecp256k1ErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NoneSecp256k1ErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NoneSecp256k1ErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NoneSecp256k1ErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NoneSecp256k1ErrorZ_clone(orig: &CResult_NoneSecp256k1ErrorZ) -> CResult_NoneSecp256k1ErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_MaxDustHTLCExposureDecodeErrorZ +pub union CResult_MaxDustHTLCExposureDecodeErrorZPtr { + /// 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::config::MaxDustHTLCExposure, + /// 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_MaxDustHTLCExposureDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::config::MaxDustHTLCExposure 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_MaxDustHTLCExposureDecodeErrorZ { + /// The contents of this CResult_MaxDustHTLCExposureDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr, + /// Whether this CResult_MaxDustHTLCExposureDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the success state. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_ok(o: crate::lightning::util::config::MaxDustHTLCExposure) -> CResult_MaxDustHTLCExposureDecodeErrorZ { + CResult_MaxDustHTLCExposureDecodeErrorZ { + contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ in the error state. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ { + CResult_MaxDustHTLCExposureDecodeErrorZ { + contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + 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_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_MaxDustHTLCExposureDecodeErrorZ. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { } +impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ { + 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_MaxDustHTLCExposureDecodeErrorZ { + 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_MaxDustHTLCExposureDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_MaxDustHTLCExposureDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_MaxDustHTLCExposureDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ChannelConfigDecodeErrorZ +pub union CResult_ChannelConfigDecodeErrorZPtr { + /// 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::config::ChannelConfig, + /// 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_ChannelConfigDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::config::ChannelConfig 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_ChannelConfigDecodeErrorZ { + /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelConfigDecodeErrorZPtr, + /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ { + CResult_ChannelConfigDecodeErrorZ { + contents: CResult_ChannelConfigDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ { + CResult_ChannelConfigDecodeErrorZ { + contents: CResult_ChannelConfigDecodeErrorZPtr { + 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_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { } +impl Drop for CResult_ChannelConfigDecodeErrorZ { + 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_ChannelConfigDecodeErrorZ { + 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_ChannelConfigDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelConfigDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelConfigDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not +pub enum COption_MaxDustHTLCExposureZ { + /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure + Some(crate::lightning::util::config::MaxDustHTLCExposure), + /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing + None +} +impl COption_MaxDustHTLCExposureZ { + #[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::util::config::MaxDustHTLCExposure { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure +pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ { + COption_MaxDustHTLCExposureZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_MaxDustHTLCExposureZ containing nothing +pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ { + COption_MaxDustHTLCExposureZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state +pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { } +#[no_mangle] +/// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { 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)] +#[derive(Clone)] +/// An enum which can either contain a u8 or not +pub enum COption_u8Z { + /// When we're in this state, this COption_u8Z contains a u8 + Some(u8), + /// When we're in this state, this COption_u8Z contains nothing + None +} +impl COption_u8Z { + #[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) -> u8 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_u8Z containing a u8 +pub extern "C" fn COption_u8Z_some(o: u8) -> COption_u8Z { + COption_u8Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_u8Z containing nothing +pub extern "C" fn COption_u8Z_none() -> COption_u8Z { + COption_u8Z::None +} +#[no_mangle] +/// Frees any resources associated with the u8, if we are in the Some state +pub extern "C" fn COption_u8Z_free(_res: COption_u8Z) { } +#[no_mangle] +/// Creates a new COption_u8Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u8Z_clone(orig: &COption_u8Z) -> COption_u8Z { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::util::errors::APIError or not +pub enum COption_APIErrorZ { + /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError + Some(crate::lightning::util::errors::APIError), + /// When we're in this state, this COption_APIErrorZ contains nothing + None +} +impl COption_APIErrorZ { + #[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::util::errors::APIError { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError +pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ { + COption_APIErrorZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_APIErrorZ containing nothing +pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ { + COption_APIErrorZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state +pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { } +#[no_mangle] +/// Creates a new COption_APIErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_APIErrorZDecodeErrorZ +pub union CResult_COption_APIErrorZDecodeErrorZPtr { + /// 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_APIErrorZ, + /// 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_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_APIErrorZ 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_COption_APIErrorZDecodeErrorZ { + /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_APIErrorZDecodeErrorZPtr, + /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { + CResult_COption_APIErrorZDecodeErrorZ { + contents: CResult_COption_APIErrorZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ { + CResult_COption_APIErrorZDecodeErrorZ { + contents: CResult_COption_APIErrorZDecodeErrorZPtr { + 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_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { } +impl Drop for CResult_COption_APIErrorZDecodeErrorZ { + 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_COption_APIErrorZDecodeErrorZ { + 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_APIErrorZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_APIErrorZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_APIErrorZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_EncryptedOurPeerStorageNoneZ +pub union CResult_EncryptedOurPeerStorageNoneZPtr { + /// 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::our_peer_storage::EncryptedOurPeerStorage, + /// 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_EncryptedOurPeerStorageNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_EncryptedOurPeerStorageNoneZ { + /// The contents of this CResult_EncryptedOurPeerStorageNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_EncryptedOurPeerStorageNoneZPtr, + /// Whether this CResult_EncryptedOurPeerStorageNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_EncryptedOurPeerStorageNoneZ in the success state. +pub extern "C" fn CResult_EncryptedOurPeerStorageNoneZ_ok(o: crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage) -> CResult_EncryptedOurPeerStorageNoneZ { + CResult_EncryptedOurPeerStorageNoneZ { + contents: CResult_EncryptedOurPeerStorageNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_EncryptedOurPeerStorageNoneZ in the error state. +pub extern "C" fn CResult_EncryptedOurPeerStorageNoneZ_err() -> CResult_EncryptedOurPeerStorageNoneZ { + CResult_EncryptedOurPeerStorageNoneZ { + contents: CResult_EncryptedOurPeerStorageNoneZPtr { + 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_EncryptedOurPeerStorageNoneZ_is_ok(o: &CResult_EncryptedOurPeerStorageNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_EncryptedOurPeerStorageNoneZ. +pub extern "C" fn CResult_EncryptedOurPeerStorageNoneZ_free(_res: CResult_EncryptedOurPeerStorageNoneZ) { } +impl Drop for CResult_EncryptedOurPeerStorageNoneZ { + 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_EncryptedOurPeerStorageNoneZ { + 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_EncryptedOurPeerStorageNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_EncryptedOurPeerStorageNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +/// The contents of CResult_DecryptedOurPeerStorageNoneZ +pub union CResult_DecryptedOurPeerStorageNoneZPtr { + /// 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::our_peer_storage::DecryptedOurPeerStorage, + /// 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_DecryptedOurPeerStorageNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_DecryptedOurPeerStorageNoneZ { + /// The contents of this CResult_DecryptedOurPeerStorageNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_DecryptedOurPeerStorageNoneZPtr, + /// Whether this CResult_DecryptedOurPeerStorageNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_DecryptedOurPeerStorageNoneZ in the success state. +pub extern "C" fn CResult_DecryptedOurPeerStorageNoneZ_ok(o: crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage) -> CResult_DecryptedOurPeerStorageNoneZ { + CResult_DecryptedOurPeerStorageNoneZ { + contents: CResult_DecryptedOurPeerStorageNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_DecryptedOurPeerStorageNoneZ in the error state. +pub extern "C" fn CResult_DecryptedOurPeerStorageNoneZ_err() -> CResult_DecryptedOurPeerStorageNoneZ { + CResult_DecryptedOurPeerStorageNoneZ { + contents: CResult_DecryptedOurPeerStorageNoneZPtr { + 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_DecryptedOurPeerStorageNoneZ_is_ok(o: &CResult_DecryptedOurPeerStorageNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_DecryptedOurPeerStorageNoneZ. +pub extern "C" fn CResult_DecryptedOurPeerStorageNoneZ_free(_res: CResult_DecryptedOurPeerStorageNoneZ) { } +impl Drop for CResult_DecryptedOurPeerStorageNoneZ { + 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_DecryptedOurPeerStorageNoneZ { + 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_DecryptedOurPeerStorageNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_DecryptedOurPeerStorageNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MessageForwardNodeZ { + /// 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::blinded_path::message::MessageForwardNode, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_MessageForwardNodeZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::message::MessageForwardNode] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MessageForwardNodeZ { + 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_MessageForwardNodeZ_free(_res: CVec_MessageForwardNodeZ) { } +impl Drop for CVec_MessageForwardNodeZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_MessageForwardNodeZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_InvreqResponseInstructionsNoneZ +pub union CResult_InvreqResponseInstructionsNoneZPtr { + /// 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::flow::InvreqResponseInstructions, + /// 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_InvreqResponseInstructionsNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::flow::InvreqResponseInstructions on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_InvreqResponseInstructionsNoneZ { + /// The contents of this CResult_InvreqResponseInstructionsNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_InvreqResponseInstructionsNoneZPtr, + /// Whether this CResult_InvreqResponseInstructionsNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_InvreqResponseInstructionsNoneZ in the success state. +pub extern "C" fn CResult_InvreqResponseInstructionsNoneZ_ok(o: crate::lightning::offers::flow::InvreqResponseInstructions) -> CResult_InvreqResponseInstructionsNoneZ { + CResult_InvreqResponseInstructionsNoneZ { + contents: CResult_InvreqResponseInstructionsNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_InvreqResponseInstructionsNoneZ in the error state. +pub extern "C" fn CResult_InvreqResponseInstructionsNoneZ_err() -> CResult_InvreqResponseInstructionsNoneZ { + CResult_InvreqResponseInstructionsNoneZ { + contents: CResult_InvreqResponseInstructionsNoneZPtr { + 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_InvreqResponseInstructionsNoneZ_is_ok(o: &CResult_InvreqResponseInstructionsNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_InvreqResponseInstructionsNoneZ. +pub extern "C" fn CResult_InvreqResponseInstructionsNoneZ_free(_res: CResult_InvreqResponseInstructionsNoneZ) { } +impl Drop for CResult_InvreqResponseInstructionsNoneZ { + 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_InvreqResponseInstructionsNoneZ { + 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_InvreqResponseInstructionsNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_InvreqResponseInstructionsNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not +pub enum COption_MessageContextZ { + /// When we're in this state, this COption_MessageContextZ contains a crate::lightning::blinded_path::message::MessageContext + Some(crate::lightning::blinded_path::message::MessageContext), + /// When we're in this state, this COption_MessageContextZ contains nothing + None +} +impl COption_MessageContextZ { + #[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::blinded_path::message::MessageContext { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext +pub extern "C" fn COption_MessageContextZ_some(o: crate::lightning::blinded_path::message::MessageContext) -> COption_MessageContextZ { + COption_MessageContextZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_MessageContextZ containing nothing +pub extern "C" fn COption_MessageContextZ_none() -> COption_MessageContextZ { + COption_MessageContextZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::blinded_path::message::MessageContext, if we are in the Some state +pub extern "C" fn COption_MessageContextZ_free(_res: COption_MessageContextZ) { } +#[no_mangle] +/// Creates a new COption_MessageContextZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MessageContextZ_clone(orig: &COption_MessageContextZ) -> COption_MessageContextZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OffersMessageCOption_MessageContextZZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::offers::OffersMessage, + /// The element at position 1 + pub b: crate::c_types::derived::COption_MessageContextZ, +} +impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::c_types::derived::COption_MessageContextZ)> for C2Tuple_OffersMessageCOption_MessageContextZZ { + fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::c_types::derived::COption_MessageContextZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OffersMessageCOption_MessageContextZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::c_types::derived::COption_MessageContextZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OffersMessageCOption_MessageContextZZ { + 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_OffersMessageCOption_MessageContextZZ_clone(orig: &C2Tuple_OffersMessageCOption_MessageContextZZ) -> C2Tuple_OffersMessageCOption_MessageContextZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OffersMessageCOption_MessageContextZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OffersMessageCOption_MessageContextZZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::c_types::derived::COption_MessageContextZ) -> C2Tuple_OffersMessageCOption_MessageContextZZ { + C2Tuple_OffersMessageCOption_MessageContextZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OffersMessageCOption_MessageContextZZ. +pub extern "C" fn C2Tuple_OffersMessageCOption_MessageContextZZ_free(_res: C2Tuple_OffersMessageCOption_MessageContextZZ) { } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OfferboolZ { + /// The element at position 0 + pub a: crate::lightning::offers::offer::Offer, + /// The element at position 1 + pub b: bool, +} +impl From<(crate::lightning::offers::offer::Offer, bool)> for C2Tuple_OfferboolZ { + fn from (tup: (crate::lightning::offers::offer::Offer, bool)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OfferboolZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::offers::offer::Offer, bool) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OfferboolZ { + 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_OfferboolZ_clone(orig: &C2Tuple_OfferboolZ) -> C2Tuple_OfferboolZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OfferboolZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OfferboolZ_new(a: crate::lightning::offers::offer::Offer, b: bool) -> C2Tuple_OfferboolZ { + C2Tuple_OfferboolZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OfferboolZ. +pub extern "C" fn C2Tuple_OfferboolZ_free(_res: C2Tuple_OfferboolZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_OfferboolZNoneZ +pub union CResult_C2Tuple_OfferboolZNoneZPtr { + /// 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_OfferboolZ, + /// 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_OfferboolZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_OfferboolZ on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_C2Tuple_OfferboolZNoneZ { + /// The contents of this CResult_C2Tuple_OfferboolZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_OfferboolZNoneZPtr, + /// Whether this CResult_C2Tuple_OfferboolZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_OfferboolZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_OfferboolZNoneZ_ok(o: crate::c_types::derived::C2Tuple_OfferboolZ) -> CResult_C2Tuple_OfferboolZNoneZ { + CResult_C2Tuple_OfferboolZNoneZ { + contents: CResult_C2Tuple_OfferboolZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_OfferboolZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_OfferboolZNoneZ_err() -> CResult_C2Tuple_OfferboolZNoneZ { + CResult_C2Tuple_OfferboolZNoneZ { + contents: CResult_C2Tuple_OfferboolZNoneZPtr { + 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_OfferboolZNoneZ_is_ok(o: &CResult_C2Tuple_OfferboolZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_OfferboolZNoneZ. +pub extern "C" fn CResult_C2Tuple_OfferboolZNoneZ_free(_res: CResult_C2Tuple_OfferboolZNoneZ) { } +impl Drop for CResult_C2Tuple_OfferboolZNoneZ { + 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_OfferboolZNoneZ { + 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_OfferboolZNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_C2Tuple_OfferboolZNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_OfferboolZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_OfferboolZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_OfferboolZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_OfferboolZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_OfferboolZNoneZ_clone(orig: &CResult_C2Tuple_OfferboolZNoneZ) -> CResult_C2Tuple_OfferboolZNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OfferPathsMessageContextZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::OfferPaths, + /// The element at position 1 + pub b: crate::lightning::blinded_path::message::MessageContext, +} +impl From<(crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::blinded_path::message::MessageContext)> for C2Tuple_OfferPathsMessageContextZ { + fn from (tup: (crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::blinded_path::message::MessageContext)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OfferPathsMessageContextZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::OfferPaths, crate::lightning::blinded_path::message::MessageContext) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OfferPathsMessageContextZ { + 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_OfferPathsMessageContextZ_clone(orig: &C2Tuple_OfferPathsMessageContextZ) -> C2Tuple_OfferPathsMessageContextZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OfferPathsMessageContextZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OfferPathsMessageContextZ_new(a: crate::lightning::onion_message::async_payments::OfferPaths, b: crate::lightning::blinded_path::message::MessageContext) -> C2Tuple_OfferPathsMessageContextZ { + C2Tuple_OfferPathsMessageContextZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OfferPathsMessageContextZ. +pub extern "C" fn C2Tuple_OfferPathsMessageContextZ_free(_res: C2Tuple_OfferPathsMessageContextZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ or not +pub enum COption_C2Tuple_OfferPathsMessageContextZZ { + /// When we're in this state, this COption_C2Tuple_OfferPathsMessageContextZZ contains a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ + Some(crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ), + /// When we're in this state, this COption_C2Tuple_OfferPathsMessageContextZZ contains nothing + None +} +impl COption_C2Tuple_OfferPathsMessageContextZZ { + #[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_OfferPathsMessageContextZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OfferPathsMessageContextZZ containing a crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ +pub extern "C" fn COption_C2Tuple_OfferPathsMessageContextZZ_some(o: crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ) -> COption_C2Tuple_OfferPathsMessageContextZZ { + COption_C2Tuple_OfferPathsMessageContextZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OfferPathsMessageContextZZ containing nothing +pub extern "C" fn COption_C2Tuple_OfferPathsMessageContextZZ_none() -> COption_C2Tuple_OfferPathsMessageContextZZ { + COption_C2Tuple_OfferPathsMessageContextZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OfferPathsMessageContextZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_OfferPathsMessageContextZZ_free(_res: COption_C2Tuple_OfferPathsMessageContextZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_OfferPathsMessageContextZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_OfferPathsMessageContextZZ_clone(orig: &COption_C2Tuple_OfferPathsMessageContextZZ) -> COption_C2Tuple_OfferPathsMessageContextZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ServeStaticInvoiceMessageContextZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::async_payments::ServeStaticInvoice, + /// The element at position 1 + pub b: crate::lightning::blinded_path::message::MessageContext, +} +impl From<(crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::blinded_path::message::MessageContext)> for C2Tuple_ServeStaticInvoiceMessageContextZ { + fn from (tup: (crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::blinded_path::message::MessageContext)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ServeStaticInvoiceMessageContextZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::ServeStaticInvoice, crate::lightning::blinded_path::message::MessageContext) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ServeStaticInvoiceMessageContextZ { + 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_ServeStaticInvoiceMessageContextZ_clone(orig: &C2Tuple_ServeStaticInvoiceMessageContextZ) -> C2Tuple_ServeStaticInvoiceMessageContextZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ServeStaticInvoiceMessageContextZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ServeStaticInvoiceMessageContextZ_new(a: crate::lightning::onion_message::async_payments::ServeStaticInvoice, b: crate::lightning::blinded_path::message::MessageContext) -> C2Tuple_ServeStaticInvoiceMessageContextZ { + C2Tuple_ServeStaticInvoiceMessageContextZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ServeStaticInvoiceMessageContextZ. +pub extern "C" fn C2Tuple_ServeStaticInvoiceMessageContextZ_free(_res: C2Tuple_ServeStaticInvoiceMessageContextZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ or not +pub enum COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + /// When we're in this state, this COption_C2Tuple_ServeStaticInvoiceMessageContextZZ contains a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ + Some(crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ), + /// When we're in this state, this COption_C2Tuple_ServeStaticInvoiceMessageContextZZ contains nothing + None +} +impl COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + #[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_ServeStaticInvoiceMessageContextZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ containing a crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_some(o: crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ) -> COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ containing nothing +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_none() -> COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + COption_C2Tuple_ServeStaticInvoiceMessageContextZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_ServeStaticInvoiceMessageContextZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_free(_res: COption_C2Tuple_ServeStaticInvoiceMessageContextZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_ServeStaticInvoiceMessageContextZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_ServeStaticInvoiceMessageContextZZ_clone(orig: &COption_C2Tuple_ServeStaticInvoiceMessageContextZZ) -> COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_CVec_u8Zu16Z { + /// The element at position 0 + pub a: crate::c_types::derived::CVec_u8Z, + /// The element at position 1 + pub b: u16, +} +impl From<(crate::c_types::derived::CVec_u8Z, u16)> for C2Tuple_CVec_u8Zu16Z { + fn from (tup: (crate::c_types::derived::CVec_u8Z, u16)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_CVec_u8Zu16Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u16) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_CVec_u8Zu16Z { + 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_CVec_u8Zu16Z_clone(orig: &C2Tuple_CVec_u8Zu16Z) -> C2Tuple_CVec_u8Zu16Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_CVec_u8Zu16Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_CVec_u8Zu16Z_new(a: crate::c_types::derived::CVec_u8Z, b: u16) -> C2Tuple_CVec_u8Zu16Z { + C2Tuple_CVec_u8Zu16Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_CVec_u8Zu16Z. +pub extern "C" fn C2Tuple_CVec_u8Zu16Z_free(_res: C2Tuple_CVec_u8Zu16Z) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_CVec_u8Zu16ZNoneZ +pub union CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + /// 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_CVec_u8Zu16Z, + /// 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_CVec_u8Zu16ZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu16Z on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + /// The contents of this CResult_C2Tuple_CVec_u8Zu16ZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr, + /// Whether this CResult_C2Tuple_CVec_u8Zu16ZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu16ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu16Z) -> CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + contents: CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu16ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + contents: CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + 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_CVec_u8Zu16ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu16ZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu16ZNoneZ. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu16ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu16ZNoneZ) { } +impl Drop for CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + 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_CVec_u8Zu16ZNoneZ { + 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_CVec_u8Zu16ZNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu16ZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_CVec_u8Zu16ZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu16ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu16ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu16ZNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +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_OutPointCVec_u8ZZ { + fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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_OutPointCVec_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_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_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_OutPointCVec_u8ZZ. +pub extern "C" fn C2Tuple_OutPointCVec_u8ZZ_free(_res: C2Tuple_OutPointCVec_u8ZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_u8ZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_OutPointCVec_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_OutPointCVec_u8ZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_OutPointCVec_u8ZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_OutPointCVec_u8ZZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_OutPointCVec_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_OutPointCVec_u8ZZZ_free(_res: CVec_C2Tuple_OutPointCVec_u8ZZZ) { } +impl Drop for CVec_C2Tuple_OutPointCVec_u8ZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_OutPointCVec_u8ZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ +pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { + /// 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::channelmonitor::ChannelMonitorUpdate, + /// 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_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate 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_ChannelMonitorUpdateDecodeErrorZ { + /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, + /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + 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_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } +impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { + 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_ChannelMonitorUpdateDecodeErrorZ { + 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_ChannelMonitorUpdateDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelMonitorUpdateDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not +pub enum COption_MonitorEventZ { + /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + Some(crate::lightning::chain::channelmonitor::MonitorEvent), + /// When we're in this state, this COption_MonitorEventZ contains nothing + None +} +impl COption_MonitorEventZ { + #[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::chain::channelmonitor::MonitorEvent { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent +pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { + COption_MonitorEventZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_MonitorEventZ containing nothing +pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { + COption_MonitorEventZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state +pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } +#[no_mangle] +/// Creates a new COption_MonitorEventZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_MonitorEventZDecodeErrorZ +pub union CResult_COption_MonitorEventZDecodeErrorZPtr { + /// 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_MonitorEventZ, + /// 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_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_MonitorEventZ 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_COption_MonitorEventZDecodeErrorZ { + /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr, + /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + 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_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } +impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { + 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_COption_MonitorEventZDecodeErrorZ { + 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_MonitorEventZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_MonitorEventZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_MonitorEventZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_HTLCUpdateDecodeErrorZ +pub union CResult_HTLCUpdateDecodeErrorZPtr { + /// 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::channelmonitor::HTLCUpdate, + /// 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_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate 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_HTLCUpdateDecodeErrorZ { + /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_HTLCUpdateDecodeErrorZPtr, + /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { + 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_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } +impl Drop for CResult_HTLCUpdateDecodeErrorZ { + 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_HTLCUpdateDecodeErrorZ { + 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_HTLCUpdateDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HTLCUpdateDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_HTLCUpdateDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::HolderCommitmentTransactionBalances of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_HolderCommitmentTransactionBalanceZ { + /// 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::chain::channelmonitor::HolderCommitmentTransactionBalance, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_HolderCommitmentTransactionBalanceZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::channelmonitor::HolderCommitmentTransactionBalance] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_HolderCommitmentTransactionBalanceZ { + 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_HolderCommitmentTransactionBalanceZ_free(_res: CVec_HolderCommitmentTransactionBalanceZ) { } +impl Drop for CVec_HolderCommitmentTransactionBalanceZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_HolderCommitmentTransactionBalanceZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_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_u32CVec_u8ZZ { + fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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_u32CVec_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_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_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_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_u32CVec_u8ZZs of arbitrary size. +/// This corresponds to std::vector in C++ +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_u32CVec_u8ZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +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(crate::c_types::from_raw_parts_safer_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_u32CVec_u8ZZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +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() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +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(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_u32CVec_u8ZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_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_u32CVec_u8ZZZ, +} +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_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_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { + 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_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_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_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(crate::c_types::from_raw_parts_safer_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 { crate::c_types::from_raw_parts_safer_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(crate::c_types::from_raw_parts_safer_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 { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_NoneReplayEventZ +pub union CResult_NoneReplayEventZPtr { + /// 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. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::events::ReplayEvent, +} +#[repr(C)] +/// A CResult_NoneReplayEventZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::events::ReplayEvent on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_NoneReplayEventZ { + /// The contents of this CResult_NoneReplayEventZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneReplayEventZPtr, + /// Whether this CResult_NoneReplayEventZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NoneReplayEventZ in the success state. +pub extern "C" fn CResult_NoneReplayEventZ_ok() -> CResult_NoneReplayEventZ { + CResult_NoneReplayEventZ { + contents: CResult_NoneReplayEventZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NoneReplayEventZ in the error state. +pub extern "C" fn CResult_NoneReplayEventZ_err(e: crate::lightning::events::ReplayEvent) -> CResult_NoneReplayEventZ { + CResult_NoneReplayEventZ { + contents: CResult_NoneReplayEventZPtr { + 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_NoneReplayEventZ_is_ok(o: &CResult_NoneReplayEventZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneReplayEventZ. +pub extern "C" fn CResult_NoneReplayEventZ_free(_res: CResult_NoneReplayEventZ) { } +impl Drop for CResult_NoneReplayEventZ { + 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_NoneReplayEventZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::events::ReplayEvent>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneReplayEventZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneReplayEventZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NoneReplayEventZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NoneReplayEventZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NoneReplayEventZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NoneReplayEventZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NoneReplayEventZ_clone(orig: &CResult_NoneReplayEventZ) -> CResult_NoneReplayEventZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. +/// This corresponds to std::vector in C++ +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::lightning::ln::chan_utils::CommitmentTransaction, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +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(crate::c_types::from_raw_parts_safer_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::chan_utils::CommitmentTransaction] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +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() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +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(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_CommitmentTransactionZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_u32TxOutZ { + /// The element at position 0 + pub a: u32, + /// The element at position 1 + pub b: crate::c_types::TxOut, } -impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ { - fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self { +impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { + fn from (tup: (u32, crate::c_types::TxOut)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_ChannelIdPublicKeyZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) { +impl C2Tuple_u32TxOutZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { (self.a, self.b) } } -impl Clone for C2Tuple_ChannelIdPublicKeyZ { +impl Clone for C2Tuple_u32TxOutZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10852,40 +15111,40 @@ impl Clone for C2Tuple_ChannelIdPublicKeyZ { #[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_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. +pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32TxOutZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ { - C2Tuple_ChannelIdPublicKeyZ { a, b, } +pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { + C2Tuple_u32TxOutZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. -pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { } +/// Frees any resources used by the C2Tuple_u32TxOutZ. +pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ { +pub struct CVec_C2Tuple_u32TxOutZZ { /// 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_ChannelIdPublicKeyZ, + pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_ChannelIdPublicKeyZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_u32TxOutZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_ChannelIdPublicKeyZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_ChannelIdPublicKeyZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_u32TxOutZZ { + 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() } } @@ -10893,45 +15152,87 @@ impl From> for CVec_C2 } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { } -impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ { +pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } +impl Drop for CVec_C2Tuple_u32TxOutZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ { +impl Clone for CVec_C2Tuple_u32TxOutZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size. +/// A tuple of 2 elements. See the individual fields for the types contained. +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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { + 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_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_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_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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_ChannelIdZ { +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::lightning::ln::types::ChannelId, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_ChannelIdZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_TransactionOutputsZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::types::ChannelId] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_ChannelIdZ { - 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() } } @@ -10939,43 +15240,43 @@ impl From> for CVec_ChannelIdZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { } -impl Drop for CVec_ChannelIdZ { +pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } +impl Drop for CVec_TransactionOutputsZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_ChannelIdZ { +impl Clone for CVec_TransactionOutputsZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_PublicKeyChannelIdZ { +pub struct C2Tuple_boolboolZ { /// The element at position 0 - pub a: crate::c_types::PublicKey, + pub a: bool, /// The element at position 1 - pub b: crate::lightning::ln::types::ChannelId, + pub b: bool, } -impl From<(crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)> for C2Tuple_PublicKeyChannelIdZ { - fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)) -> Self { +impl From<(bool, bool)> for C2Tuple_boolboolZ { + fn from (tup: (bool, bool)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_PublicKeyChannelIdZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId) { +impl C2Tuple_boolboolZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (bool, bool) { (self.a, self.b) } } -impl Clone for C2Tuple_PublicKeyChannelIdZ { +impl Clone for C2Tuple_boolboolZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10986,89 +15287,140 @@ impl Clone for C2Tuple_PublicKeyChannelIdZ { #[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_PublicKeyChannelIdZ_clone(orig: &C2Tuple_PublicKeyChannelIdZ) -> C2Tuple_PublicKeyChannelIdZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. +pub extern "C" fn C2Tuple_boolboolZ_clone(orig: &C2Tuple_boolboolZ) -> C2Tuple_boolboolZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_boolboolZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_PublicKeyChannelIdZ { - C2Tuple_PublicKeyChannelIdZ { a, b, } +pub extern "C" fn C2Tuple_boolboolZ_new(a: bool, b: bool) -> C2Tuple_boolboolZ { + C2Tuple_boolboolZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. -pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_free(_res: C2Tuple_PublicKeyChannelIdZ) { } +/// Frees any resources used by the C2Tuple_boolboolZ. +pub extern "C" fn C2Tuple_boolboolZ_free(_res: C2Tuple_boolboolZ) { } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ or not -pub enum COption_C2Tuple_PublicKeyChannelIdZZ { - /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ - Some(crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ), - /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains nothing - None +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_BalanceZ { + /// 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::chain::channelmonitor::Balance, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_C2Tuple_PublicKeyChannelIdZZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_BalanceZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::channelmonitor::Balance] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_BalanceZ { + 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_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ -pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_some(o: crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { - COption_C2Tuple_PublicKeyChannelIdZZ::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } +impl Drop for CVec_BalanceZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } } -#[no_mangle] -/// Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing -pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_none() -> COption_C2Tuple_PublicKeyChannelIdZZ { - COption_C2Tuple_PublicKeyChannelIdZZ::None +impl Clone for CVec_BalanceZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_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_ThirtyTwoBytesChannelMonitorZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +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) + } +} +impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state -pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_free(_res: COption_C2Tuple_PublicKeyChannelIdZZ) { } -#[no_mangle] -/// Creates a new COption_C2Tuple_PublicKeyChannelIdZZ 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. -pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_clone(orig: &COption_C2Tuple_PublicKeyChannelIdZZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { Clone::clone(&orig) } +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_ThirtyTwoBytesChannelMonitorZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ -pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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::lightning_invoice::Bolt11Invoice, + 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_invoice::SignOrCreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError 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_Bolt11InvoiceSignOrCreationErrorZ { - /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, 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_Bolt11InvoiceSignOrCreationErrorZPtr, - /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ 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_Bolt11InvoiceSignOrCreationErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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_Bolt11InvoiceSignOrCreationErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { +/// 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, @@ -11076,13 +15428,13 @@ pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> 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_Bolt11InvoiceSignOrCreationErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { } -impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { +/// 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() } { @@ -11095,16 +15447,16 @@ impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { } } } -impl From> for CResult_Bolt11InvoiceSignOrCreationErrorZ { - 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_Bolt11InvoiceSignOrCreationErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } }; Self { contents, @@ -11112,143 +15464,89 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_Bolt11InvoiceSignOrCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + 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_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` +/// 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_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ -pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - /// 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::OfferWithDerivedMetadataBuilder, - /// 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::Bolt12SemanticError, -} +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> bool { - o.result_ok +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_PublicKeyTypeZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::wire::Type, } -#[no_mangle] -/// Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(_res: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - 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<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self { + Self { + a: tup.0, + b: tup.1, } } } -impl From> for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl C2Tuple_PublicKeyTypeZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) { + (self.a, self.b) } } -impl Clone for CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { +impl Clone for C2Tuple_PublicKeyTypeZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), } } } #[no_mangle] -/// Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ 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. -pub extern "C" fn CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(orig: &CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ) -> CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { Clone::clone(&orig) } +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 { + C2Tuple_PublicKeyTypeZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_PublicKeyTypeZ. +pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::onion_message::messenger::Destinations of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_DestinationZ { +pub struct CVec_C2Tuple_PublicKeyTypeZZ { /// 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::onion_message::messenger::Destination, + pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_DestinationZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_PublicKeyTypeZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::onion_message::messenger::Destination] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_DestinationZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_PublicKeyTypeZZ { + 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() } } @@ -11256,149 +15554,173 @@ impl From> for CVec } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_DestinationZ_free(_res: CVec_DestinationZ) { } -impl Drop for CVec_DestinationZ { +pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { } +impl Drop for CVec_C2Tuple_PublicKeyTypeZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_DestinationZ { +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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// 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::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, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OnionMessageContentsResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::packet::OnionMessageContents, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OnionMessageContentsResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OnionMessageContentsResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OnionMessageContentsResponseInstructionZ { + 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_OnionMessageContentsResponseInstructionZ_clone(orig: &C2Tuple_OnionMessageContentsResponseInstructionZ) -> C2Tuple_OnionMessageContentsResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OnionMessageContentsResponseInstructionZ { + C2Tuple_OnionMessageContentsResponseInstructionZ { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. +pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_free(_res: C2Tuple_OnionMessageContentsResponseInstructionZ) { } #[repr(C)] -/// 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_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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ represents a success state. - pub result_ok: bool, +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ or not +pub enum COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains nothing + None } -#[no_mangle] -/// 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, +impl COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + #[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_OnionMessageContentsResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// 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, - } +/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::Some(o) } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> bool { - o.result_ok +/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none() -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::None } #[no_mangle] -/// 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 { - } - } +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(_res: COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(orig: &COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not +pub enum COption_OnionMessageContentsZ { + /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents + Some(crate::lightning::onion_message::packet::OnionMessageContents), + /// When we're in this state, this COption_OnionMessageContentsZ contains nothing + None } -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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { result } - } else { - 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, - result_ok: o.result_ok, - } +impl COption_OnionMessageContentsZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { - err: core::ptr::null_mut() - } } - } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::OnionMessageContents { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` +/// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents +pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ { + COption_OnionMessageContentsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_OnionMessageContentsZ containing nothing +pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ { + COption_OnionMessageContentsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state +pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { } +#[no_mangle] +/// Creates a new COption_OnionMessageContentsZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { Clone::clone(&orig) } +pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ThirtyTwoBytesAPIErrorZ -pub union CResult_ThirtyTwoBytesAPIErrorZPtr { +/// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ +pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr { /// 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, + pub result: *mut crate::c_types::derived::COption_OnionMessageContentsZ, /// 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 err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_OnionMessageContentsZ 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_ThirtyTwoBytesAPIErrorZ { - /// The contents of this CResult_ThirtyTwoBytesAPIErrorZ, accessible via either +pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ { + /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ThirtyTwoBytesAPIErrorZPtr, - /// Whether this CResult_ThirtyTwoBytesAPIErrorZ represents a success state. + pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr, + /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { + CResult_COption_OnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { + CResult_COption_OnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11406,13 +15728,13 @@ pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_err(e: crate::lightning::util: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_is_ok(o: &CResult_ThirtyTwoBytesAPIErrorZ) -> bool { +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. -pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_free(_res: CResult_ThirtyTwoBytesAPIErrorZ) { } -impl Drop for CResult_ThirtyTwoBytesAPIErrorZ { +/// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { } +impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11425,141 +15747,62 @@ impl Drop for CResult_ThirtyTwoBytesAPIErrorZ { } } } -impl From> for CResult_ThirtyTwoBytesAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_OnionMessageContentsZDecodeErrorZ { + 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_ThirtyTwoBytesAPIErrorZPtr { result } + CResult_COption_OnionMessageContentsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ThirtyTwoBytesAPIErrorZPtr { err } + CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err } }; Self { contents, result_ok: o.result_ok, - } - } -} -impl Clone for CResult_ThirtyTwoBytesAPIErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - 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_ThirtyTwoBytesAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// 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_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OffersMessageResponseInstructionZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::offers::OffersMessage, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::ResponseInstruction, -} -impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OffersMessageResponseInstructionZ { - fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OffersMessageResponseInstructionZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::ResponseInstruction) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OffersMessageResponseInstructionZ { - 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_OffersMessageResponseInstructionZ_clone(orig: &C2Tuple_OffersMessageResponseInstructionZ) -> C2Tuple_OffersMessageResponseInstructionZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OffersMessageResponseInstructionZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OffersMessageResponseInstructionZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OffersMessageResponseInstructionZ { - C2Tuple_OffersMessageResponseInstructionZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OffersMessageResponseInstructionZ. -pub extern "C" fn C2Tuple_OffersMessageResponseInstructionZ_free(_res: C2Tuple_OffersMessageResponseInstructionZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ or not -pub enum COption_C2Tuple_OffersMessageResponseInstructionZZ { - /// When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ - Some(crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ), - /// When we're in this state, this COption_C2Tuple_OffersMessageResponseInstructionZZ contains nothing - None -} -impl COption_C2Tuple_OffersMessageResponseInstructionZZ { - #[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_OffersMessageResponseInstructionZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ -pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ) -> COption_C2Tuple_OffersMessageResponseInstructionZZ { - COption_C2Tuple_OffersMessageResponseInstructionZZ::Some(o) + } + } } -#[no_mangle] -/// Constructs a new COption_C2Tuple_OffersMessageResponseInstructionZZ containing nothing -pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_none() -> COption_C2Tuple_OffersMessageResponseInstructionZZ { - COption_C2Tuple_OffersMessageResponseInstructionZZ::None +impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OffersMessageResponseInstructionZ, if we are in the Some state -pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_free(_res: COption_C2Tuple_OffersMessageResponseInstructionZZ) { } -#[no_mangle] -/// Creates a new COption_C2Tuple_OffersMessageResponseInstructionZZ which has the same data as `orig` +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_OffersMessageResponseInstructionZZ_clone(orig: &COption_C2Tuple_OffersMessageResponseInstructionZZ) -> COption_C2Tuple_OffersMessageResponseInstructionZZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OffersMessageMessageSendInstructionsZ { +pub struct C2Tuple_OnionMessageContentsMessageSendInstructionsZ { /// The element at position 0 - pub a: crate::lightning::onion_message::offers::OffersMessage, + pub a: crate::lightning::onion_message::packet::OnionMessageContents, /// The element at position 1 pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, } -impl From<(crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OffersMessageMessageSendInstructionsZ { - fn from (tup: (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { +impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_OffersMessageMessageSendInstructionsZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::offers::OffersMessage, crate::lightning::onion_message::messenger::MessageSendInstructions) { +impl C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions) { (self.a, self.b) } } -impl Clone for C2Tuple_OffersMessageMessageSendInstructionsZ { +impl Clone for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -11570,40 +15813,40 @@ impl Clone for C2Tuple_OffersMessageMessageSendInstructionsZ { #[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_OffersMessageMessageSendInstructionsZ_clone(orig: &C2Tuple_OffersMessageMessageSendInstructionsZ) -> C2Tuple_OffersMessageMessageSendInstructionsZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OffersMessageMessageSendInstructionsZ from the contained elements. +pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_clone(orig: &C2Tuple_OnionMessageContentsMessageSendInstructionsZ) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_OffersMessageMessageSendInstructionsZ_new(a: crate::lightning::onion_message::offers::OffersMessage, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OffersMessageMessageSendInstructionsZ { - C2Tuple_OffersMessageMessageSendInstructionsZ { a, b, } +pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + C2Tuple_OnionMessageContentsMessageSendInstructionsZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_OffersMessageMessageSendInstructionsZ. -pub extern "C" fn C2Tuple_OffersMessageMessageSendInstructionsZ_free(_res: C2Tuple_OffersMessageMessageSendInstructionsZ) { } +/// Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. +pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(_res: C2Tuple_OnionMessageContentsMessageSendInstructionsZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OffersMessageMessageSendInstructionsZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { +pub struct CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { /// 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_OffersMessageMessageSendInstructionsZ, + pub data: *mut crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_OffersMessageMessageSendInstructionsZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + 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() } } @@ -11611,166 +15854,215 @@ impl From 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_ReleaseHeldHtlcResponseInstructionZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::ResponseInstruction, -} -impl From<(crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_ReleaseHeldHtlcResponseInstructionZ { - fn from (tup: (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_ReleaseHeldHtlcResponseInstructionZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, crate::lightning::onion_message::messenger::ResponseInstruction) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_ReleaseHeldHtlcResponseInstructionZ { - 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_ReleaseHeldHtlcResponseInstructionZ_clone(orig: &C2Tuple_ReleaseHeldHtlcResponseInstructionZ) -> C2Tuple_ReleaseHeldHtlcResponseInstructionZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ReleaseHeldHtlcResponseInstructionZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_ReleaseHeldHtlcResponseInstructionZ_new(a: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_ReleaseHeldHtlcResponseInstructionZ { - C2Tuple_ReleaseHeldHtlcResponseInstructionZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_ReleaseHeldHtlcResponseInstructionZ. -pub extern "C" fn C2Tuple_ReleaseHeldHtlcResponseInstructionZ_free(_res: C2Tuple_ReleaseHeldHtlcResponseInstructionZ) { } -#[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ or not -pub enum COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { - /// When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ - Some(crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ), - /// When we're in this state, this COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ contains nothing +/// 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 + Some(crate::lightning::ln::wire::Type), + /// When we're in this state, this COption_TypeZ contains nothing None } -impl COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +impl COption_TypeZ { #[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_ReleaseHeldHtlcResponseInstructionZ { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::wire::Type { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ -pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ) -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some(o) +/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type +pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ { + COption_TypeZ::Some(o) } #[no_mangle] -/// Constructs a new COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ containing nothing -pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_none() -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None +/// Constructs a new COption_TypeZ containing nothing +pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { + COption_TypeZ::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_ReleaseHeldHtlcResponseInstructionZ, if we are in the Some state -pub extern "C" fn COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(_res: COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ) { } +/// 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_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ which has the same data as `orig` +/// 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_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_clone(orig: &COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ) -> COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { Clone::clone(&orig) } +pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, +/// The contents of CResult_COption_TypeZDecodeErrorZ +pub union CResult_COption_TypeZDecodeErrorZPtr { + /// 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_TypeZ, + /// 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 From<(crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { - fn from (tup: (crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { +#[repr(C)] +/// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_TypeZ 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_COption_TypeZDecodeErrorZ { + /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_TypeZDecodeErrorZPtr, + /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ { + CResult_COption_TypeZDecodeErrorZ { + contents: CResult_COption_TypeZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ { + CResult_COption_TypeZDecodeErrorZ { + contents: CResult_COption_TypeZDecodeErrorZPtr { + 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_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { } +impl Drop for CResult_COption_TypeZDecodeErrorZ { + 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_COption_TypeZDecodeErrorZ { + 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_TypeZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_TypeZDecodeErrorZPtr { err } + }; Self { - a: tup.0, - b: tup.1, + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_TypeZDecodeErrorZ { + fn clone(&self) -> 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 }))) + } } } } } -impl C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, crate::lightning::onion_message::messenger::MessageSendInstructions) { - (self.a, self.b) +#[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::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_SocketAddressZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl Clone for C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::SocketAddress { + 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_AsyncPaymentsMessageMessageSendInstructionsZ_clone(orig: &C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ) -> C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ from the contained elements. +/// 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] -pub extern "C" fn C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_new(a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { - C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { a, b, } +/// Constructs a new COption_SocketAddressZ containing nothing +pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ { + COption_SocketAddressZ::None } - #[no_mangle] -/// Frees any resources used by the C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ. -pub extern "C" fn C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(_res: C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ) { } +/// 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_SocketAddressZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { +pub struct CVec_PeerDetailsZ { /// 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_AsyncPaymentsMessageMessageSendInstructionsZ, + pub data: *mut crate::lightning::ln::peer_handler::PeerDetails, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_PeerDetailsZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_AsyncPaymentsMessageMessageSendInstructionsZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::peer_handler::PeerDetails] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_PeerDetailsZ { + 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() } } @@ -11778,57 +16070,49 @@ impl From 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) + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } #[repr(C)] -/// The contents of CResult_PhantomRouteHintsDecodeErrorZ -pub union CResult_PhantomRouteHintsDecodeErrorZPtr { +/// The contents of CResult_CVec_u8ZPeerHandleErrorZ +pub union CResult_CVec_u8ZPeerHandleErrorZPtr { /// 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::channelmanager::PhantomRouteHints, + 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::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, } #[repr(C)] -/// A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_u8Z 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_PhantomRouteHintsDecodeErrorZ { - /// The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either +pub struct CResult_CVec_u8ZPeerHandleErrorZ { + /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PhantomRouteHintsDecodeErrorZPtr, - /// Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. + pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr, + /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PhantomRouteHints) -> CResult_PhantomRouteHintsDecodeErrorZ { - CResult_PhantomRouteHintsDecodeErrorZ { - contents: CResult_PhantomRouteHintsDecodeErrorZPtr { +/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ { + CResult_CVec_u8ZPeerHandleErrorZ { + contents: CResult_CVec_u8ZPeerHandleErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PhantomRouteHintsDecodeErrorZ { - CResult_PhantomRouteHintsDecodeErrorZ { - contents: CResult_PhantomRouteHintsDecodeErrorZPtr { +/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ { + CResult_CVec_u8ZPeerHandleErrorZ { + contents: CResult_CVec_u8ZPeerHandleErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11836,13 +16120,13 @@ pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_is_ok(o: &CResult_PhantomRouteHintsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_free(_res: CResult_PhantomRouteHintsDecodeErrorZ) { } -impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { } +impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11855,16 +16139,16 @@ impl Drop for CResult_PhantomRouteHintsDecodeErrorZ { } } } -impl From> for CResult_PhantomRouteHintsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_u8ZPeerHandleErrorZ { + 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_PhantomRouteHintsDecodeErrorZPtr { result } + CResult_CVec_u8ZPeerHandleErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PhantomRouteHintsDecodeErrorZPtr { err } + CResult_CVec_u8ZPeerHandleErrorZPtr { err } }; Self { contents, @@ -11872,59 +16156,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PhantomRouteHintsDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PhantomRouteHintsDecodeErrorZ_clone(orig: &CResult_PhantomRouteHintsDecodeErrorZ) -> CResult_PhantomRouteHintsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedForwardDecodeErrorZ -pub union CResult_BlindedForwardDecodeErrorZPtr { - /// 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::channelmanager::BlindedForward, +/// The contents of CResult_NonePeerHandleErrorZ +pub union CResult_NonePeerHandleErrorZPtr { + /// 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. /// 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::peer_handler::PeerHandleError, } #[repr(C)] -/// A CResult_BlindedForwardDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::BlindedForward on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, +/// containing a () 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_BlindedForwardDecodeErrorZ { - /// The contents of this CResult_BlindedForwardDecodeErrorZ, accessible via either +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_BlindedForwardDecodeErrorZPtr, - /// Whether this CResult_BlindedForwardDecodeErrorZ 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_BlindedForwardDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedForward) -> CResult_BlindedForwardDecodeErrorZ { - CResult_BlindedForwardDecodeErrorZ { - contents: CResult_BlindedForwardDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// 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_BlindedForwardDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedForwardDecodeErrorZ { - CResult_BlindedForwardDecodeErrorZ { - contents: CResult_BlindedForwardDecodeErrorZPtr { +/// 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, @@ -11932,18 +16215,15 @@ pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_is_ok(o: &CResult_BlindedForwardDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedForwardDecodeErrorZ. -pub extern "C" fn CResult_BlindedForwardDecodeErrorZ_free(_res: CResult_BlindedForwardDecodeErrorZ) { } -impl Drop for CResult_BlindedForwardDecodeErrorZ { +/// 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 { - 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) }; @@ -11951,16 +16231,16 @@ impl Drop for CResult_BlindedForwardDecodeErrorZ { } } } -impl From> for CResult_BlindedForwardDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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 result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedForwardDecodeErrorZPtr { result } + 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_BlindedForwardDecodeErrorZPtr { err } + CResult_NonePeerHandleErrorZPtr { err } }; Self { contents, @@ -11968,59 +16248,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedForwardDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_BlindedForwardDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedForwardDecodeErrorZ which has the same data as `orig` +/// 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_BlindedForwardDecodeErrorZ_clone(orig: &CResult_BlindedForwardDecodeErrorZ) -> CResult_BlindedForwardDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCRoutingDecodeErrorZ -pub union CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// 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 crate::lightning::ln::channelmanager::PendingHTLCRouting, + 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::ln::msgs::DecodeError, + pub err: *mut crate::lightning_rapid_gossip_sync::GraphSyncError, } #[repr(C)] -/// A CResult_PendingHTLCRoutingDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCRouting on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, +/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PendingHTLCRoutingDecodeErrorZ { - /// The contents of this CResult_PendingHTLCRoutingDecodeErrorZ, accessible via either +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_PendingHTLCRoutingDecodeErrorZPtr, - /// Whether this CResult_PendingHTLCRoutingDecodeErrorZ represents a success state. + pub contents: CResult_u32GraphSyncErrorZPtr, + /// Whether this CResult_u32GraphSyncErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ in the success state. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCRouting) -> CResult_PendingHTLCRoutingDecodeErrorZ { - CResult_PendingHTLCRoutingDecodeErrorZ { - contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// 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_PendingHTLCRoutingDecodeErrorZ in the error state. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCRoutingDecodeErrorZ { - CResult_PendingHTLCRoutingDecodeErrorZ { - contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { +/// Creates a new CResult_u32GraphSyncErrorZ in the error state. +pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ { + CResult_u32GraphSyncErrorZ { + contents: CResult_u32GraphSyncErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12028,13 +16308,13 @@ pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_is_ok(o: &CResult_PendingHTLCRoutingDecodeErrorZ) -> bool { +pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCRoutingDecodeErrorZ. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_free(_res: CResult_PendingHTLCRoutingDecodeErrorZ) { } -impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { +/// 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() } { @@ -12047,16 +16327,16 @@ impl Drop for CResult_PendingHTLCRoutingDecodeErrorZ { } } } -impl From> for CResult_PendingHTLCRoutingDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_PendingHTLCRoutingDecodeErrorZPtr { result } + CResult_u32GraphSyncErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCRoutingDecodeErrorZPtr { err } + CResult_u32GraphSyncErrorZPtr { err } }; Self { contents, @@ -12064,59 +16344,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PendingHTLCRoutingDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PendingHTLCRoutingDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCRoutingDecodeErrorZ_clone(orig: &CResult_PendingHTLCRoutingDecodeErrorZ) -> CResult_PendingHTLCRoutingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCInfoDecodeErrorZ -pub union CResult_PendingHTLCInfoDecodeErrorZPtr { +/// The contents of CResult_AsyncReceiveOfferCacheDecodeErrorZ +pub union CResult_AsyncReceiveOfferCacheDecodeErrorZPtr { /// 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::channelmanager::PendingHTLCInfo, + pub result: *mut crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache, /// 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_PendingHTLCInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AsyncReceiveOfferCacheDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache 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_PendingHTLCInfoDecodeErrorZ { - /// The contents of this CResult_PendingHTLCInfoDecodeErrorZ, accessible via either +pub struct CResult_AsyncReceiveOfferCacheDecodeErrorZ { + /// The contents of this CResult_AsyncReceiveOfferCacheDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PendingHTLCInfoDecodeErrorZPtr, - /// Whether this CResult_PendingHTLCInfoDecodeErrorZ represents a success state. + pub contents: CResult_AsyncReceiveOfferCacheDecodeErrorZPtr, + /// Whether this CResult_AsyncReceiveOfferCacheDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoDecodeErrorZ { - CResult_PendingHTLCInfoDecodeErrorZ { - contents: CResult_PendingHTLCInfoDecodeErrorZPtr { +/// Creates a new CResult_AsyncReceiveOfferCacheDecodeErrorZ in the success state. +pub extern "C" fn CResult_AsyncReceiveOfferCacheDecodeErrorZ_ok(o: crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache) -> CResult_AsyncReceiveOfferCacheDecodeErrorZ { + CResult_AsyncReceiveOfferCacheDecodeErrorZ { + contents: CResult_AsyncReceiveOfferCacheDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PendingHTLCInfoDecodeErrorZ { - CResult_PendingHTLCInfoDecodeErrorZ { - contents: CResult_PendingHTLCInfoDecodeErrorZPtr { +/// Creates a new CResult_AsyncReceiveOfferCacheDecodeErrorZ in the error state. +pub extern "C" fn CResult_AsyncReceiveOfferCacheDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncReceiveOfferCacheDecodeErrorZ { + CResult_AsyncReceiveOfferCacheDecodeErrorZ { + contents: CResult_AsyncReceiveOfferCacheDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12124,13 +16387,13 @@ pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_is_ok(o: &CResult_PendingHTLCInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AsyncReceiveOfferCacheDecodeErrorZ_is_ok(o: &CResult_AsyncReceiveOfferCacheDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCInfoDecodeErrorZ. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_free(_res: CResult_PendingHTLCInfoDecodeErrorZ) { } -impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { +/// Frees any resources used by the CResult_AsyncReceiveOfferCacheDecodeErrorZ. +pub extern "C" fn CResult_AsyncReceiveOfferCacheDecodeErrorZ_free(_res: CResult_AsyncReceiveOfferCacheDecodeErrorZ) { } +impl Drop for CResult_AsyncReceiveOfferCacheDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12143,16 +16406,16 @@ impl Drop for CResult_PendingHTLCInfoDecodeErrorZ { } } } -impl From> for CResult_PendingHTLCInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AsyncReceiveOfferCacheDecodeErrorZ { + 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_PendingHTLCInfoDecodeErrorZPtr { result } + CResult_AsyncReceiveOfferCacheDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCInfoDecodeErrorZPtr { err } + CResult_AsyncReceiveOfferCacheDecodeErrorZPtr { err } }; Self { contents, @@ -12160,59 +16423,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PendingHTLCInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PendingHTLCInfoDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCInfoDecodeErrorZ_clone(orig: &CResult_PendingHTLCInfoDecodeErrorZ) -> CResult_PendingHTLCInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedFailureDecodeErrorZ -pub union CResult_BlindedFailureDecodeErrorZPtr { +/// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ +pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr { /// 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::channelmanager::BlindedFailure, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_BlindedFailureDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::BlindedFailure on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedFailureDecodeErrorZ { - /// The contents of this CResult_BlindedFailureDecodeErrorZ, accessible via either +pub struct CResult_InvoiceRequestBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedFailureDecodeErrorZPtr, - /// Whether this CResult_BlindedFailureDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_ok(o: crate::lightning::ln::channelmanager::BlindedFailure) -> CResult_BlindedFailureDecodeErrorZ { - CResult_BlindedFailureDecodeErrorZ { - contents: CResult_BlindedFailureDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ { + CResult_InvoiceRequestBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedFailureDecodeErrorZ { - CResult_BlindedFailureDecodeErrorZ { - contents: CResult_BlindedFailureDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ { + CResult_InvoiceRequestBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12220,13 +16466,13 @@ pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_is_ok(o: &CResult_BlindedFailureDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedFailureDecodeErrorZ. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_free(_res: CResult_BlindedFailureDecodeErrorZ) { } -impl Drop for CResult_BlindedFailureDecodeErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12239,16 +16485,16 @@ impl Drop for CResult_BlindedFailureDecodeErrorZ { } } } -impl From> for CResult_BlindedFailureDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestBolt12SemanticErrorZ { + 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_BlindedFailureDecodeErrorZPtr { result } + CResult_InvoiceRequestBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedFailureDecodeErrorZPtr { err } + CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -12256,135 +16502,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedFailureDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedFailureDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedFailureDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedFailureDecodeErrorZ_clone(orig: &CResult_BlindedFailureDecodeErrorZ) -> CResult_BlindedFailureDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChannelMonitorZ { - /// 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::chain::channelmonitor::ChannelMonitor, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChannelMonitorZ { - #[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::chain::channelmonitor::ChannelMonitor] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ChannelMonitorZ { - 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_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { } -impl Drop for CVec_ChannelMonitorZ { - 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_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_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_ThirtyTwoBytesChannelManagerZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::channelmanager::ChannelManager)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -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_ThirtyTwoBytesChannelManagerZ from the contained elements. -#[no_mangle] -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_ThirtyTwoBytesChannelManagerZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_free(_res: C2Tuple_ThirtyTwoBytesChannelManagerZ) { } +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { +/// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ +pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { /// 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_ThirtyTwoBytesChannelManagerZ, + pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// 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. +/// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ, accessible via either +pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12392,13 +16562,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_err( } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12411,16 +16581,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { result } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZPtr { err } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -12429,77 +16599,73 @@ impl From CResult_MaxDustHTLCExposureDecodeErrorZ { - CResult_MaxDustHTLCExposureDecodeErrorZ { - contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { +/// 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_MaxDustHTLCExposureDecodeErrorZ in the error state. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_MaxDustHTLCExposureDecodeErrorZ { - CResult_MaxDustHTLCExposureDecodeErrorZ { - contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// 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, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_is_ok(o: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> 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_MaxDustHTLCExposureDecodeErrorZ. -pub extern "C" fn CResult_MaxDustHTLCExposureDecodeErrorZ_free(_res: CResult_MaxDustHTLCExposureDecodeErrorZ) { } -impl Drop for CResult_MaxDustHTLCExposureDecodeErrorZ { +/// 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() } { 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_MaxDustHTLCExposureDecodeErrorZ { - 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_MaxDustHTLCExposureDecodeErrorZPtr { result } + CResult_VerifiedInvoiceRequestNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_MaxDustHTLCExposureDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -12507,59 +16673,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_MaxDustHTLCExposureDecodeErrorZPtr { - 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_MaxDustHTLCExposureDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_MaxDustHTLCExposureDecodeErrorZ 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 CResult_MaxDustHTLCExposureDecodeErrorZ_clone(orig: &CResult_MaxDustHTLCExposureDecodeErrorZ) -> CResult_MaxDustHTLCExposureDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelConfigDecodeErrorZ -pub union CResult_ChannelConfigDecodeErrorZPtr { +/// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ +pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { /// 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::config::ChannelConfig, + pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelConfigDecodeErrorZ { - /// The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either +pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelConfigDecodeErrorZPtr, - /// Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_ok(o: crate::lightning::util::config::ChannelConfig) -> CResult_ChannelConfigDecodeErrorZ { - CResult_ChannelConfigDecodeErrorZ { - contents: CResult_ChannelConfigDecodeErrorZPtr { +/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelConfigDecodeErrorZ { - CResult_ChannelConfigDecodeErrorZ { - contents: CResult_ChannelConfigDecodeErrorZPtr { +/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12567,13 +16733,13 @@ pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_is_ok(o: &CResult_ChannelConfigDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_free(_res: CResult_ChannelConfigDecodeErrorZ) { } -impl Drop for CResult_ChannelConfigDecodeErrorZ { +/// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12586,16 +16752,16 @@ impl Drop for CResult_ChannelConfigDecodeErrorZ { } } } -impl From> for CResult_ChannelConfigDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_ChannelConfigDecodeErrorZPtr { result } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelConfigDecodeErrorZPtr { err } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -12603,133 +16769,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelConfigDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ChannelConfigDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelConfigDecodeErrorZ_clone(orig: &CResult_ChannelConfigDecodeErrorZ) -> CResult_ChannelConfigDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::util::config::MaxDustHTLCExposure or not -pub enum COption_MaxDustHTLCExposureZ { - /// When we're in this state, this COption_MaxDustHTLCExposureZ contains a crate::lightning::util::config::MaxDustHTLCExposure - Some(crate::lightning::util::config::MaxDustHTLCExposure), - /// When we're in this state, this COption_MaxDustHTLCExposureZ contains nothing - None -} -impl COption_MaxDustHTLCExposureZ { - #[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::util::config::MaxDustHTLCExposure { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_MaxDustHTLCExposureZ containing a crate::lightning::util::config::MaxDustHTLCExposure -pub extern "C" fn COption_MaxDustHTLCExposureZ_some(o: crate::lightning::util::config::MaxDustHTLCExposure) -> COption_MaxDustHTLCExposureZ { - COption_MaxDustHTLCExposureZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_MaxDustHTLCExposureZ containing nothing -pub extern "C" fn COption_MaxDustHTLCExposureZ_none() -> COption_MaxDustHTLCExposureZ { - COption_MaxDustHTLCExposureZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::util::config::MaxDustHTLCExposure, if we are in the Some state -pub extern "C" fn COption_MaxDustHTLCExposureZ_free(_res: COption_MaxDustHTLCExposureZ) { } -#[no_mangle] -/// Creates a new COption_MaxDustHTLCExposureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_MaxDustHTLCExposureZ_clone(orig: &COption_MaxDustHTLCExposureZ) -> COption_MaxDustHTLCExposureZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::util::errors::APIError or not -pub enum COption_APIErrorZ { - /// When we're in this state, this COption_APIErrorZ contains a crate::lightning::util::errors::APIError - Some(crate::lightning::util::errors::APIError), - /// When we're in this state, this COption_APIErrorZ contains nothing - None -} -impl COption_APIErrorZ { - #[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::util::errors::APIError { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_APIErrorZ containing a crate::lightning::util::errors::APIError -pub extern "C" fn COption_APIErrorZ_some(o: crate::lightning::util::errors::APIError) -> COption_APIErrorZ { - COption_APIErrorZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_APIErrorZ containing nothing -pub extern "C" fn COption_APIErrorZ_none() -> COption_APIErrorZ { - COption_APIErrorZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::util::errors::APIError, if we are in the Some state -pub extern "C" fn COption_APIErrorZ_free(_res: COption_APIErrorZ) { } -#[no_mangle] -/// Creates a new COption_APIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_APIErrorZ_clone(orig: &COption_APIErrorZ) -> COption_APIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_APIErrorZDecodeErrorZ -pub union CResult_COption_APIErrorZDecodeErrorZPtr { +/// The contents of CResult_InvoiceRequestDecodeErrorZ +pub union CResult_InvoiceRequestDecodeErrorZPtr { /// 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_APIErrorZ, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest, /// 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_COption_APIErrorZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_APIErrorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequest 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_COption_APIErrorZDecodeErrorZ { - /// The contents of this CResult_COption_APIErrorZDecodeErrorZ, accessible via either +pub struct CResult_InvoiceRequestDecodeErrorZ { + /// The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_APIErrorZDecodeErrorZPtr, - /// Whether this CResult_COption_APIErrorZDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceRequestDecodeErrorZPtr, + /// Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_ok(o: crate::c_types::derived::COption_APIErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { - CResult_COption_APIErrorZDecodeErrorZ { - contents: CResult_COption_APIErrorZDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestDecodeErrorZ { + CResult_InvoiceRequestDecodeErrorZ { + contents: CResult_InvoiceRequestDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_APIErrorZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_APIErrorZDecodeErrorZ { - CResult_COption_APIErrorZDecodeErrorZ { - contents: CResult_COption_APIErrorZDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestDecodeErrorZ { + CResult_InvoiceRequestDecodeErrorZ { + contents: CResult_InvoiceRequestDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12737,13 +16812,13 @@ pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_is_ok(o: &CResult_COption_APIErrorZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_APIErrorZDecodeErrorZ. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_free(_res: CResult_COption_APIErrorZDecodeErrorZ) { } -impl Drop for CResult_COption_APIErrorZDecodeErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_free(_res: CResult_InvoiceRequestDecodeErrorZ) { } +impl Drop for CResult_InvoiceRequestDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12756,16 +16831,16 @@ impl Drop for CResult_COption_APIErrorZDecodeErrorZ { } } } -impl From> for CResult_COption_APIErrorZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestDecodeErrorZ { + 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_APIErrorZDecodeErrorZPtr { result } + CResult_InvoiceRequestDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_APIErrorZDecodeErrorZPtr { err } + CResult_InvoiceRequestDecodeErrorZPtr { err } }; Self { contents, @@ -12773,97 +16848,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_APIErrorZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InvoiceRequestDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_APIErrorZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InvoiceRequestDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_APIErrorZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_APIErrorZDecodeErrorZ_clone(orig: &CResult_COption_APIErrorZDecodeErrorZ) -> CResult_COption_APIErrorZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning_liquidity::lsps2::msgs::LSPS2RawOpeningFeeParamss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_LSPS2RawOpeningFeeParamsZ { - /// 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_liquidity::lsps2::msgs::LSPS2RawOpeningFeeParams, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_LSPS2RawOpeningFeeParamsZ { - #[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_liquidity::lsps2::msgs::LSPS2RawOpeningFeeParams] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_LSPS2RawOpeningFeeParamsZ { - 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_LSPS2RawOpeningFeeParamsZ_free(_res: CVec_LSPS2RawOpeningFeeParamsZ) { } -impl Drop for CVec_LSPS2RawOpeningFeeParamsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_clone(orig: &CResult_InvoiceRequestDecodeErrorZ) -> CResult_InvoiceRequestDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ -pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ +pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr { /// 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::channelmonitor::ChannelMonitorUpdate, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields, /// 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_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields 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_ChannelMonitorUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either +pub struct CResult_InvoiceRequestFieldsDecodeErrorZ { + /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr, + /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ { + CResult_InvoiceRequestFieldsDecodeErrorZ { + contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ { + CResult_InvoiceRequestFieldsDecodeErrorZ { + contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12871,13 +16908,13 @@ pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } -impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { } +impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12890,16 +16927,16 @@ impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { } } } -impl From> for CResult_ChannelMonitorUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestFieldsDecodeErrorZ { + 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_ChannelMonitorUpdateDecodeErrorZPtr { result } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } }; Self { contents, @@ -12907,96 +16944,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not -pub enum COption_MonitorEventZ { - /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent - Some(crate::lightning::chain::channelmonitor::MonitorEvent), - /// When we're in this state, this COption_MonitorEventZ contains nothing - None -} -impl COption_MonitorEventZ { - #[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::chain::channelmonitor::MonitorEvent { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent -pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { - COption_MonitorEventZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_MonitorEventZ containing nothing -pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { - COption_MonitorEventZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state -pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } -#[no_mangle] -/// Creates a new COption_MonitorEventZ which has the same data as `orig` +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_MonitorEventZDecodeErrorZ -pub union CResult_COption_MonitorEventZDecodeErrorZPtr { +/// 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::COption_MonitorEventZ, + 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::lightning::ln::msgs::DecodeError, + pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_COption_MonitorEventZDecodeErrorZ { - /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either +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_COption_MonitorEventZDecodeErrorZPtr, - /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + pub contents: CResult_CVec_u8ZIOErrorZPtr, + /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { +/// 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_COption_MonitorEventZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { +/// 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, @@ -13004,13 +17004,13 @@ pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { +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_COption_MonitorEventZDecodeErrorZ. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } -impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { +/// 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() } { @@ -13023,16 +17023,16 @@ impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { } } } -impl From> for CResult_COption_MonitorEventZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_COption_MonitorEventZDecodeErrorZPtr { result } + CResult_CVec_u8ZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_MonitorEventZDecodeErrorZPtr { err } + CResult_CVec_u8ZIOErrorZPtr { err } }; Self { contents, @@ -13040,59 +17040,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_COption_MonitorEventZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + 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_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } +#[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(crate::c_types::from_raw_parts_safer_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 { crate::c_types::from_raw_parts_safer_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(crate::c_types::from_raw_parts_safer_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 { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] -/// The contents of CResult_HTLCUpdateDecodeErrorZ -pub union CResult_HTLCUpdateDecodeErrorZPtr { +/// 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::lightning::chain::channelmonitor::HTLCUpdate, + 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::lightning::ln::msgs::DecodeError, + pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_HTLCUpdateDecodeErrorZ { - /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either +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_HTLCUpdateDecodeErrorZPtr, - /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + pub contents: CResult_CVec_StrZIOErrorZPtr, + /// Whether this CResult_CVec_StrZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// 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_HTLCUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// 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, @@ -13100,13 +17146,13 @@ pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> 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_HTLCUpdateDecodeErrorZ. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } -impl Drop for CResult_HTLCUpdateDecodeErrorZ { +/// 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() } { @@ -13119,16 +17165,16 @@ impl Drop for CResult_HTLCUpdateDecodeErrorZ { } } } -impl From> for CResult_HTLCUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_StrZIOErrorZ { + 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_HTLCUpdateDecodeErrorZPtr { result } + CResult_CVec_StrZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCUpdateDecodeErrorZPtr { err } + CResult_CVec_StrZIOErrorZPtr { err } }; Self { contents, @@ -13136,276 +17182,151 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_HTLCUpdateDecodeErrorZPtr { - 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_HTLCUpdateDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -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_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_OutPointCVec_u8ZZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -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_OutPointCVec_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_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_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_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_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_u32CVec_u8ZZ { - fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -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_u32CVec_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` +/// 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 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_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_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_u32CVec_u8ZZs of arbitrary size. -/// This corresponds to std::vector in C++ -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_u32CVec_u8ZZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -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_u32CVec_u8ZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -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() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -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_u32CVec_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) - } -} +pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_StrStrStrZ { /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, + pub a: crate::c_types::Str, /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32CVec_u8ZZZ, + pub b: crate::c_types::Str, + /// The element at position 2 + pub c: crate::c_types::Str, } -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 { +impl From<(crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)> for C3Tuple_StrStrStrZ { + fn from (tup: (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)) -> Self { Self { a: tup.0, b: tup.1, + c: tup.2, } } } -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 C3Tuple_StrStrStrZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str) { + (self.a, self.b, self.c) } } -impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ { +impl Clone for C3Tuple_StrStrStrZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), b: Clone::clone(&self.b), + c: Clone::clone(&self.c), } } } #[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_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. +pub extern "C" fn C3Tuple_StrStrStrZ_clone(orig: &C3Tuple_StrStrStrZ) -> C3Tuple_StrStrStrZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_StrStrStrZ from the contained elements. #[no_mangle] -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, } +pub extern "C" fn C3Tuple_StrStrStrZ_new(a: crate::c_types::Str, b: crate::c_types::Str, c: crate::c_types::Str) -> C3Tuple_StrStrStrZ { + C3Tuple_StrStrStrZ { a, b, c, } } #[no_mangle] -/// 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) { } +/// Frees any resources used by the C3Tuple_StrStrStrZ. +pub extern "C" fn C3Tuple_StrStrStrZ_free(_res: C3Tuple_StrStrStrZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_StrStrStrZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { +pub struct CVec_C3Tuple_StrStrStrZZ { /// 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, + pub data: *mut crate::c_types::derived::C3Tuple_StrStrStrZ, /// 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 { +impl CVec_C3Tuple_StrStrStrZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C3Tuple_StrStrStrZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C3Tuple_StrStrStrZZ { + 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 { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C3Tuple_StrStrStrZZ_free(_res: CVec_C3Tuple_StrStrStrZZ) { } +impl Drop for CVec_C3Tuple_StrStrStrZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZZ { +impl Clone for CVec_C3Tuple_StrStrStrZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_NoneReplayEventZ -pub union CResult_NoneReplayEventZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, +/// The contents of CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ +pub union CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + /// 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_C3Tuple_StrStrStrZZ, /// 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::events::ReplayEvent, + pub err: *mut crate::c_types::IOError, } #[repr(C)] -/// A CResult_NoneReplayEventZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::events::ReplayEvent on failure. +/// A CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ 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_NoneReplayEventZ { - /// The contents of this CResult_NoneReplayEventZ, accessible via either +pub struct CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + /// The contents of this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneReplayEventZPtr, - /// Whether this CResult_NoneReplayEventZ represents a success state. + pub contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr, + /// Whether this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneReplayEventZ in the success state. -pub extern "C" fn CResult_NoneReplayEventZ_ok() -> CResult_NoneReplayEventZ { - CResult_NoneReplayEventZ { - contents: CResult_NoneReplayEventZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneReplayEventZ in the error state. -pub extern "C" fn CResult_NoneReplayEventZ_err(e: crate::lightning::events::ReplayEvent) -> CResult_NoneReplayEventZ { - CResult_NoneReplayEventZ { - contents: CResult_NoneReplayEventZPtr { +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -13413,15 +17334,18 @@ pub extern "C" fn CResult_NoneReplayEventZ_err(e: crate::lightning::events::Repl } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneReplayEventZ_is_ok(o: &CResult_NoneReplayEventZ) -> bool { +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(o: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneReplayEventZ. -pub extern "C" fn CResult_NoneReplayEventZ_free(_res: CResult_NoneReplayEventZ) { } -impl Drop for CResult_NoneReplayEventZ { +/// Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(_res: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) { } +impl Drop for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { 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) }; @@ -13429,16 +17353,16 @@ impl Drop for CResult_NoneReplayEventZ { } } } -impl From> for CResult_NoneReplayEventZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::events::ReplayEvent>) -> Self { +impl From> for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + 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_NoneReplayEventZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneReplayEventZPtr { err } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { err } }; Self { contents, @@ -13446,47 +17370,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneReplayEventZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneReplayEventZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneReplayEventZ which has the same data as `orig` +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneReplayEventZ_clone(orig: &CResult_NoneReplayEventZ) -> CResult_NoneReplayEventZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(orig: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::chan_utils::CommitmentTransactions of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_CommitmentTransactionZ { +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::lightning::ln::chan_utils::CommitmentTransaction, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_CommitmentTransactionZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chan_utils::CommitmentTransaction] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_CommitmentTransactionZ { - fn from(v: Vec) -> Self { +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() } } @@ -13494,219 +17418,235 @@ impl From> for CVec } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_CommitmentTransactionZ_free(_res: CVec_CommitmentTransactionZ) { } -impl Drop for CVec_CommitmentTransactionZ { +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)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_CommitmentTransactionZ { +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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_u32TxOutZ { - /// The element at position 0 - pub a: u32, - /// The element at position 1 - pub b: crate::c_types::TxOut, -} -impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { - fn from (tup: (u32, crate::c_types::TxOut)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_u32TxOutZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { - (self.a, self.b) - } +/// 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 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::c_types::IOError, } -impl Clone for C2Tuple_u32TxOutZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } - } +#[repr(C)] +/// 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_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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. + pub result_ok: bool, } #[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_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32TxOutZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { - C2Tuple_u32TxOutZ { a, b, } +/// 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] -/// Frees any resources used by the C2Tuple_u32TxOutZ. -pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_u32TxOutZZ { - /// 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_u32TxOutZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_u32TxOutZZ { - #[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_u32TxOutZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +/// 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, } } -impl From> for CVec_C2Tuple_u32TxOutZZ { - 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() } } - } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } -impl Drop for CVec_C2Tuple_u32TxOutZZ { +/// 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.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_C2Tuple_u32TxOutZZ { - 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_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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { - Self { - a: tup.0, - b: tup.1, + 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 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 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ { +impl Clone for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } #[no_mangle] -/// Creates a new tuple 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 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_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, } +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_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 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::c_types::IOError, } - -#[no_mangle] -/// 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_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_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// 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_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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. + pub result_ok: bool, } -impl CVec_TransactionOutputsZ { - #[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_u32TxOutZZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// 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, } } -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() } } +#[no_mangle] +/// 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, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } -impl Drop for CVec_TransactionOutputsZ { +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_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.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + 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 Clone for CVec_TransactionOutputsZ { +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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { 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) + 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)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_boolboolZ { +pub struct C2Tuple_ChannelIdu64Z { /// The element at position 0 - pub a: bool, + pub a: crate::lightning::ln::types::ChannelId, /// The element at position 1 - pub b: bool, + pub b: u64, } -impl From<(bool, bool)> for C2Tuple_boolboolZ { - fn from (tup: (bool, bool)) -> Self { +impl From<(crate::lightning::ln::types::ChannelId, u64)> for C2Tuple_ChannelIdu64Z { + fn from (tup: (crate::lightning::ln::types::ChannelId, u64)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_boolboolZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (bool, bool) { +impl C2Tuple_ChannelIdu64Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, u64) { (self.a, self.b) } } -impl Clone for C2Tuple_boolboolZ { +impl Clone for C2Tuple_ChannelIdu64Z { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -13717,40 +17657,40 @@ impl Clone for C2Tuple_boolboolZ { #[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_boolboolZ_clone(orig: &C2Tuple_boolboolZ) -> C2Tuple_boolboolZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_boolboolZ from the contained elements. +pub extern "C" fn C2Tuple_ChannelIdu64Z_clone(orig: &C2Tuple_ChannelIdu64Z) -> C2Tuple_ChannelIdu64Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_ChannelIdu64Z from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_boolboolZ_new(a: bool, b: bool) -> C2Tuple_boolboolZ { - C2Tuple_boolboolZ { a, b, } +pub extern "C" fn C2Tuple_ChannelIdu64Z_new(a: crate::lightning::ln::types::ChannelId, b: u64) -> C2Tuple_ChannelIdu64Z { + C2Tuple_ChannelIdu64Z { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_boolboolZ. -pub extern "C" fn C2Tuple_boolboolZ_free(_res: C2Tuple_boolboolZ) { } +/// Frees any resources used by the C2Tuple_ChannelIdu64Z. +pub extern "C" fn C2Tuple_ChannelIdu64Z_free(_res: C2Tuple_ChannelIdu64Z) { } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdu64Zs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_BalanceZ { +pub struct CVec_C2Tuple_ChannelIdu64ZZ { /// 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::chain::channelmonitor::Balance, + pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdu64Z, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_BalanceZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_ChannelIdu64ZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::channelmonitor::Balance] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdu64Z] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_BalanceZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_ChannelIdu64ZZ { + 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() } } @@ -13758,99 +17698,57 @@ impl From> for CVec_Balanc } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } -impl Drop for CVec_BalanceZ { +pub extern "C" fn CVec_C2Tuple_ChannelIdu64ZZ_free(_res: CVec_C2Tuple_ChannelIdu64ZZ) { } +impl Drop for CVec_C2Tuple_ChannelIdu64ZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_BalanceZ { +impl Clone for CVec_C2Tuple_ChannelIdu64ZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_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_ThirtyTwoBytesChannelMonitorZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::chain::channelmonitor::ChannelMonitor)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -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) - } -} -impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ { - 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_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_ThirtyTwoBytesChannelMonitorZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { } -#[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { +/// The contents of CResult_UpdateNameIOErrorZ +pub union CResult_UpdateNameIOErrorZPtr { /// 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_ThirtyTwoBytesChannelMonitorZ, + pub result: *mut crate::lightning::util::persist::UpdateName, /// 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::c_types::IOError, } #[repr(C)] -/// 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. +/// A CResult_UpdateNameIOErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::persist::UpdateName 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either +pub struct CResult_UpdateNameIOErrorZ { + /// The contents of this CResult_UpdateNameIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. + pub contents: CResult_UpdateNameIOErrorZPtr, + /// Whether this CResult_UpdateNameIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_UpdateNameIOErrorZ in the success state. +pub extern "C" fn CResult_UpdateNameIOErrorZ_ok(o: crate::lightning::util::persist::UpdateName) -> CResult_UpdateNameIOErrorZ { + CResult_UpdateNameIOErrorZ { + contents: CResult_UpdateNameIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_UpdateNameIOErrorZ in the error state. +pub extern "C" fn CResult_UpdateNameIOErrorZ_err(e: crate::c_types::IOError) -> CResult_UpdateNameIOErrorZ { + CResult_UpdateNameIOErrorZ { + contents: CResult_UpdateNameIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -13858,13 +17756,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err( } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateNameIOErrorZ_is_ok(o: &CResult_UpdateNameIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_UpdateNameIOErrorZ. +pub extern "C" fn CResult_UpdateNameIOErrorZ_free(_res: CResult_UpdateNameIOErrorZ) { } +impl Drop for CResult_UpdateNameIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -13877,16 +17775,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateNameIOErrorZ { + 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_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } + CResult_UpdateNameIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } + CResult_UpdateNameIOErrorZPtr { err } }; Self { contents, @@ -13894,89 +17792,67 @@ 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 { - /// The element at position 0 - pub a: crate::c_types::PublicKey, - /// The element at position 1 - pub b: crate::lightning::ln::wire::Type, +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::Transaction or not +pub enum COption_TransactionZ { + /// When we're in this state, this COption_TransactionZ contains a crate::c_types::Transaction + Some(crate::c_types::Transaction), + /// When we're in this state, this COption_TransactionZ contains nothing + None } -impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ { - fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self { - Self { - a: tup.0, - b: tup.1, - } +impl COption_TransactionZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl C2Tuple_PublicKeyTypeZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) { - (self.a, self.b) + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl Clone for C2Tuple_PublicKeyTypeZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Transaction { + 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_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. +/// Constructs a new COption_TransactionZ containing a crate::c_types::Transaction +pub extern "C" fn COption_TransactionZ_some(o: crate::c_types::Transaction) -> COption_TransactionZ { + COption_TransactionZ::Some(o) +} #[no_mangle] -pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ { - C2Tuple_PublicKeyTypeZ { a, b, } +/// Constructs a new COption_TransactionZ containing nothing +pub extern "C" fn COption_TransactionZ_none() -> COption_TransactionZ { + COption_TransactionZ::None } - #[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyTypeZ. -pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { } +/// Frees any resources associated with the crate::c_types::Transaction, if we are in the Some state +pub extern "C" fn COption_TransactionZ_free(_res: COption_TransactionZ) { } +#[no_mangle] +/// Creates a new COption_TransactionZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_TransactionZ_clone(orig: &COption_TransactionZ) -> COption_TransactionZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_PublicKeyTypeZZ { +pub struct CVec_WitnessZ { /// 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_PublicKeyTypeZ, + pub data: *mut crate::c_types::Witness, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_PublicKeyTypeZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_WitnessZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_PublicKeyTypeZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Witness] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_PublicKeyTypeZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_WitnessZ { + 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() } } @@ -13984,255 +17860,117 @@ impl From> for CVec_C2Tuple } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { } -impl Drop for CVec_C2Tuple_PublicKeyTypeZZ { +pub extern "C" fn CVec_WitnessZ_free(_res: CVec_WitnessZ) { } +impl Drop for CVec_WitnessZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { +impl Clone for CVec_WitnessZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_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_OnionMessageContentsResponseInstructionZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::packet::OnionMessageContents, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::ResponseInstruction, -} -impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OnionMessageContentsResponseInstructionZ { - fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OnionMessageContentsResponseInstructionZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OnionMessageContentsResponseInstructionZ { - 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_OnionMessageContentsResponseInstructionZ_clone(orig: &C2Tuple_OnionMessageContentsResponseInstructionZ) -> C2Tuple_OnionMessageContentsResponseInstructionZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OnionMessageContentsResponseInstructionZ { - C2Tuple_OnionMessageContentsResponseInstructionZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. -pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_free(_res: C2Tuple_OnionMessageContentsResponseInstructionZ) { } -#[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ or not -pub enum COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ - Some(crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ), - /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains nothing +/// An enum which can either contain a crate::c_types::ECDSASignature or not +pub enum COption_ECDSASignatureZ { + /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature + Some(crate::c_types::ECDSASignature), + /// When we're in this state, this COption_ECDSASignatureZ contains nothing None } -impl COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { +impl COption_ECDSASignatureZ { #[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_OnionMessageContentsResponseInstructionZ { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::ECDSASignature { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::Some(o) +/// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature +pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ { + COption_ECDSASignatureZ::Some(o) } #[no_mangle] -/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none() -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::None +/// Constructs a new COption_ECDSASignatureZ containing nothing +pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ { + COption_ECDSASignatureZ::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(_res: COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) { } +/// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state +pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { } #[no_mangle] -/// Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` +/// Creates a new COption_ECDSASignatureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(orig: &COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { Clone::clone(&orig) } +pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not -pub enum COption_OnionMessageContentsZ { - /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents - Some(crate::lightning::onion_message::packet::OnionMessageContents), - /// When we're in this state, this COption_OnionMessageContentsZ contains nothing - None -} -impl COption_OnionMessageContentsZ { - #[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::onion_message::packet::OnionMessageContents { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents -pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ { - COption_OnionMessageContentsZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_OnionMessageContentsZ containing nothing -pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ { - COption_OnionMessageContentsZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state -pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { } -#[no_mangle] -/// Creates a new COption_OnionMessageContentsZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ -pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - /// 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_OnionMessageContentsZ, - /// 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_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_OnionMessageContentsZ 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_COption_OnionMessageContentsZDecodeErrorZ { - /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr, - /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { - CResult_COption_OnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { - CResult_COption_OnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - 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_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { } -impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ { - 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) }; - } - } - } +/// An enum which can either contain a i64 or not +pub enum COption_i64Z { + /// When we're in this state, this COption_i64Z contains a i64 + Some(i64), + /// When we're in this state, this COption_i64Z contains nothing + None } -impl From> for CResult_COption_OnionMessageContentsZDecodeErrorZ { - 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_OnionMessageContentsZDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl COption_i64Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> i64 { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` +/// Constructs a new COption_i64Z containing a i64 +pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z { + COption_i64Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_i64Z containing nothing +pub extern "C" fn COption_i64Z_none() -> COption_i64Z { + COption_i64Z::None +} +#[no_mangle] +/// Frees any resources associated with the i64, if we are in the Some state +pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { } +#[no_mangle] +/// Creates a new COption_i64Z which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OnionMessageContentsMessageSendInstructionsZ { +pub struct C2Tuple_u64BlindedMessagePathZ { /// The element at position 0 - pub a: crate::lightning::onion_message::packet::OnionMessageContents, + pub a: u64, /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, + pub b: crate::lightning::blinded_path::message::BlindedMessagePath, } -impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { +impl From<(u64, crate::lightning::blinded_path::message::BlindedMessagePath)> for C2Tuple_u64BlindedMessagePathZ { + fn from (tup: (u64, crate::lightning::blinded_path::message::BlindedMessagePath)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions) { +impl C2Tuple_u64BlindedMessagePathZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, crate::lightning::blinded_path::message::BlindedMessagePath) { (self.a, self.b) } } -impl Clone for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { +impl Clone for C2Tuple_u64BlindedMessagePathZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -14243,40 +17981,40 @@ impl Clone for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { #[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_OnionMessageContentsMessageSendInstructionsZ_clone(orig: &C2Tuple_OnionMessageContentsMessageSendInstructionsZ) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. +pub extern "C" fn C2Tuple_u64BlindedMessagePathZ_clone(orig: &C2Tuple_u64BlindedMessagePathZ) -> C2Tuple_u64BlindedMessagePathZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u64BlindedMessagePathZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - C2Tuple_OnionMessageContentsMessageSendInstructionsZ { a, b, } +pub extern "C" fn C2Tuple_u64BlindedMessagePathZ_new(a: u64, b: crate::lightning::blinded_path::message::BlindedMessagePath) -> C2Tuple_u64BlindedMessagePathZ { + C2Tuple_u64BlindedMessagePathZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. -pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(_res: C2Tuple_OnionMessageContentsMessageSendInstructionsZ) { } +/// Frees any resources used by the C2Tuple_u64BlindedMessagePathZ. +pub extern "C" fn C2Tuple_u64BlindedMessagePathZ_free(_res: C2Tuple_u64BlindedMessagePathZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u64BlindedMessagePathZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { +pub struct CVec_C2Tuple_u64BlindedMessagePathZZ { /// 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_OnionMessageContentsMessageSendInstructionsZ, + pub data: *mut crate::c_types::derived::C2Tuple_u64BlindedMessagePathZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_u64BlindedMessagePathZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_OnionMessageContentsMessageSendInstructionsZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u64BlindedMessagePathZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_u64BlindedMessagePathZZ { + 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() } } @@ -14284,94 +18022,57 @@ impl From 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[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 - Some(crate::lightning::ln::wire::Type), - /// When we're in this state, this COption_TypeZ contains nothing - None -} -impl COption_TypeZ { - #[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::wire::Type { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type -pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ { - COption_TypeZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_TypeZ containing nothing -pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { - COption_TypeZ::None -} -#[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 { +/// 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::c_types::derived::COption_TypeZ, + 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, } #[repr(C)] -/// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_COption_TypeZDecodeErrorZ { - /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either +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_COption_TypeZDecodeErrorZPtr, - /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + pub contents: CResult_SocketAddressDecodeErrorZPtr, + /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ { - CResult_COption_TypeZDecodeErrorZ { - contents: CResult_COption_TypeZDecodeErrorZPtr { +/// 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] -/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ { - CResult_COption_TypeZDecodeErrorZ { - contents: CResult_COption_TypeZDecodeErrorZPtr { +/// 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, @@ -14379,13 +18080,13 @@ pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { } -impl Drop for CResult_COption_TypeZDecodeErrorZ { +/// 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() } { @@ -14398,16 +18099,16 @@ impl Drop for CResult_COption_TypeZDecodeErrorZ { } } } -impl From> for CResult_COption_TypeZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_COption_TypeZDecodeErrorZPtr { result } + CResult_SocketAddressDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_TypeZDecodeErrorZPtr { err } + CResult_SocketAddressDecodeErrorZPtr { err } }; Self { contents, @@ -14415,134 +18116,59 @@ 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 }))) + 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_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::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_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::SocketAddress { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// 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_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::SocketAddress, if we are in the Some state -pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { } -#[no_mangle] -/// 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_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PeerDetailsZ { - /// 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::peer_handler::PeerDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PeerDetailsZ { - #[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::peer_handler::PeerDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PeerDetailsZ { - 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_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { } -impl Drop for CVec_PeerDetailsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// 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 CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_u8ZPeerHandleErrorZ -pub union CResult_CVec_u8ZPeerHandleErrorZPtr { +/// 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::c_types::derived::CVec_u8Z, + 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::peer_handler::PeerHandleError, + pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError, } #[repr(C)] -/// A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError 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_CVec_u8ZPeerHandleErrorZ { - /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, 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_CVec_u8ZPeerHandleErrorZPtr, - /// Whether this CResult_CVec_u8ZPeerHandleErrorZ 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_CVec_u8ZPeerHandleErrorZ in the success state. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ { - CResult_CVec_u8ZPeerHandleErrorZ { - contents: CResult_CVec_u8ZPeerHandleErrorZPtr { +/// 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_CVec_u8ZPeerHandleErrorZ in the error state. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ { - CResult_CVec_u8ZPeerHandleErrorZ { - contents: CResult_CVec_u8ZPeerHandleErrorZPtr { +/// 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, @@ -14550,13 +18176,13 @@ pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> 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_CVec_u8ZPeerHandleErrorZ. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { } -impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { +/// 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() } { @@ -14569,16 +18195,16 @@ impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { } } } -impl From> for CResult_CVec_u8ZPeerHandleErrorZ { - 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_CVec_u8ZPeerHandleErrorZPtr { result } + CResult_SocketAddressSocketAddressParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZPeerHandleErrorZPtr { err } + CResult_SocketAddressSocketAddressParseErrorZPtr { err } }; Self { contents, @@ -14586,151 +18212,243 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { - 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_CVec_u8ZPeerHandleErrorZPtr { - 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_CVec_u8ZPeerHandleErrorZ 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_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NonePeerHandleErrorZ -pub union CResult_NonePeerHandleErrorZPtr { - /// 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. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateAddHTLCZ { + /// 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::UpdateAddHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[repr(C)] -/// A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, -/// containing a () 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_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 result_ok: bool, +impl CVec_UpdateAddHTLCZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::UpdateAddHTLC] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } } -#[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, +impl From> for CVec_UpdateAddHTLCZ { + 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] -/// 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, +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { } +impl Drop for CVec_UpdateAddHTLCZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_UpdateAddHTLCZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFulfillHTLCZ { + /// 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::UpdateFulfillHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFulfillHTLCZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::UpdateFulfillHTLC] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFulfillHTLCZ { + 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() } } } } -/// 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 +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { } +impl Drop for CVec_UpdateFulfillHTLCZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_UpdateFulfillHTLCZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFailHTLCZ { + /// 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::UpdateFailHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFailHTLCZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::UpdateFailHTLC] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFailHTLCZ { + 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 any resources used by the CResult_NonePeerHandleErrorZ. -pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { } -impl Drop for CResult_NonePeerHandleErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { } +impl Drop for CVec_UpdateFailHTLCZ { 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) }; - } - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_UpdateFailHTLCZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFailMalformedHTLCZ { + /// 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::UpdateFailMalformedHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFailMalformedHTLCZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::UpdateFailMalformedHTLC] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFailMalformedHTLCZ { + 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() } } } } -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, - } +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { } +impl Drop for CVec_UpdateFailMalformedHTLCZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_NonePeerHandleErrorZ { +impl Clone for CVec_UpdateFailMalformedHTLCZ { 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 }))) - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[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 { +/// The contents of CResult_TrampolineOnionPacketDecodeErrorZ +pub union CResult_TrampolineOnionPacketDecodeErrorZPtr { /// 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::lightning::ln::msgs::TrampolineOnionPacket, /// 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::lightning::ln::msgs::DecodeError, } #[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_TrampolineOnionPacketDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TrampolineOnionPacket 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_boolPeerHandleErrorZ { - /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either +pub struct CResult_TrampolineOnionPacketDecodeErrorZ { + /// The contents of this CResult_TrampolineOnionPacketDecodeErrorZ, 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_TrampolineOnionPacketDecodeErrorZPtr, + /// Whether this CResult_TrampolineOnionPacketDecodeErrorZ 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_TrampolineOnionPacketDecodeErrorZ in the success state. +pub extern "C" fn CResult_TrampolineOnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TrampolineOnionPacket) -> CResult_TrampolineOnionPacketDecodeErrorZ { + CResult_TrampolineOnionPacketDecodeErrorZ { + contents: CResult_TrampolineOnionPacketDecodeErrorZPtr { 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_TrampolineOnionPacketDecodeErrorZ in the error state. +pub extern "C" fn CResult_TrampolineOnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TrampolineOnionPacketDecodeErrorZ { + CResult_TrampolineOnionPacketDecodeErrorZ { + contents: CResult_TrampolineOnionPacketDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14738,13 +18456,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_TrampolineOnionPacketDecodeErrorZ_is_ok(o: &CResult_TrampolineOnionPacketDecodeErrorZ) -> 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_TrampolineOnionPacketDecodeErrorZ. +pub extern "C" fn CResult_TrampolineOnionPacketDecodeErrorZ_free(_res: CResult_TrampolineOnionPacketDecodeErrorZ) { } +impl Drop for CResult_TrampolineOnionPacketDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14757,16 +18475,16 @@ impl Drop for CResult_boolPeerHandleErrorZ { } } } -impl From> for CResult_boolPeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TrampolineOnionPacketDecodeErrorZ { + 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_TrampolineOnionPacketDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolPeerHandleErrorZPtr { err } + CResult_TrampolineOnionPacketDecodeErrorZPtr { err } }; Self { contents, @@ -14774,59 +18492,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_TrampolineOnionPacketDecodeErrorZPtr { + 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_TrampolineOnionPacketDecodeErrorZPtr { + 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_TrampolineOnionPacketDecodeErrorZ 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_TrampolineOnionPacketDecodeErrorZ_clone(orig: &CResult_TrampolineOnionPacketDecodeErrorZ) -> CResult_TrampolineOnionPacketDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_u32GraphSyncErrorZ -pub union CResult_u32GraphSyncErrorZPtr { +/// The contents of CResult_AcceptChannelDecodeErrorZ +pub union CResult_AcceptChannelDecodeErrorZPtr { /// 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::lightning::ln::msgs::AcceptChannel, /// 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::GraphSyncError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, -/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. +/// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AcceptChannel 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_u32GraphSyncErrorZ { - /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either +pub struct CResult_AcceptChannelDecodeErrorZ { + /// The contents of this CResult_AcceptChannelDecodeErrorZ, 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_AcceptChannelDecodeErrorZPtr, + /// Whether this CResult_AcceptChannelDecodeErrorZ 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_AcceptChannelDecodeErrorZ in the success state. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ { + CResult_AcceptChannelDecodeErrorZ { + contents: CResult_AcceptChannelDecodeErrorZPtr { 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::GraphSyncError) -> CResult_u32GraphSyncErrorZ { - CResult_u32GraphSyncErrorZ { - contents: CResult_u32GraphSyncErrorZPtr { +/// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ { + CResult_AcceptChannelDecodeErrorZ { + contents: CResult_AcceptChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14834,13 +18552,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_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> 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_AcceptChannelDecodeErrorZ. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { } +impl Drop for CResult_AcceptChannelDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14853,16 +18571,16 @@ impl Drop for CResult_u32GraphSyncErrorZ { } } } -impl From> for CResult_u32GraphSyncErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AcceptChannelDecodeErrorZ { + 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_AcceptChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_u32GraphSyncErrorZPtr { err } + CResult_AcceptChannelDecodeErrorZPtr { err } }; Self { contents, @@ -14870,42 +18588,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_u8ZIOErrorZ -pub union CResult_CVec_u8ZIOErrorZPtr { +/// The contents of CResult_AcceptChannelV2DecodeErrorZ +pub union CResult_AcceptChannelV2DecodeErrorZPtr { /// 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::lightning::ln::msgs::AcceptChannelV2, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[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. +/// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AcceptChannelV2 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_CVec_u8ZIOErrorZ { - /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either +pub struct CResult_AcceptChannelV2DecodeErrorZ { + /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, 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 contents: CResult_AcceptChannelV2DecodeErrorZPtr, + /// Whether this CResult_AcceptChannelV2DecodeErrorZ 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 { +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ { + CResult_AcceptChannelV2DecodeErrorZ { + contents: CResult_AcceptChannelV2DecodeErrorZPtr { 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 { +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ { + CResult_AcceptChannelV2DecodeErrorZ { + contents: CResult_AcceptChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14913,13 +18648,13 @@ pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CR } /// 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 { +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> 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 { +/// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { } +impl Drop for CResult_AcceptChannelV2DecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14932,16 +18667,16 @@ impl Drop for CResult_CVec_u8ZIOErrorZ { } } } -impl From> for CResult_CVec_u8ZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AcceptChannelV2DecodeErrorZ { + 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 } + CResult_AcceptChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZIOErrorZPtr { err } + CResult_AcceptChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -14949,105 +18684,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + 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` +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ 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) - } -} +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_StrZIOErrorZ -pub union CResult_CVec_StrZIOErrorZPtr { +/// The contents of CResult_StfuDecodeErrorZ +pub union CResult_StfuDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::ln::msgs::Stfu, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[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. +/// A CResult_StfuDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Stfu 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_CVec_StrZIOErrorZ { - /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either +pub struct CResult_StfuDecodeErrorZ { + /// The contents of this CResult_StfuDecodeErrorZ, 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 contents: CResult_StfuDecodeErrorZPtr, + /// Whether this CResult_StfuDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_StfuDecodeErrorZ in the success state. +pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ { + CResult_StfuDecodeErrorZ { + contents: CResult_StfuDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_StfuDecodeErrorZ in the error state. +pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ { + CResult_StfuDecodeErrorZ { + contents: CResult_StfuDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15055,13 +18744,13 @@ pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> C } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool { +pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_StfuDecodeErrorZ. +pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { } +impl Drop for CResult_StfuDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15074,16 +18763,16 @@ impl Drop for CResult_CVec_StrZIOErrorZ { } } } -impl From> for CResult_CVec_StrZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StfuDecodeErrorZ { + 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_StrZIOErrorZPtr { result } + CResult_StfuDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_StrZIOErrorZPtr { err } + CResult_StfuDecodeErrorZPtr { err } }; Self { contents, @@ -15091,151 +18780,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// 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_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_StrStrStrZ { - /// The element at position 0 - pub a: crate::c_types::Str, - /// The element at position 1 - pub b: crate::c_types::Str, - /// The element at position 2 - pub c: crate::c_types::Str, -} -impl From<(crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)> for C3Tuple_StrStrStrZ { - fn from (tup: (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } - } -} -impl C3Tuple_StrStrStrZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str) { - (self.a, self.b, self.c) - } -} -impl Clone for C3Tuple_StrStrStrZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } - } -} -#[no_mangle] -/// Creates a new tuple which has the same data as `orig` +/// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C3Tuple_StrStrStrZ_clone(orig: &C3Tuple_StrStrStrZ) -> C3Tuple_StrStrStrZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_StrStrStrZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_StrStrStrZ_new(a: crate::c_types::Str, b: crate::c_types::Str, c: crate::c_types::Str) -> C3Tuple_StrStrStrZ { - C3Tuple_StrStrStrZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_StrStrStrZ. -pub extern "C" fn C3Tuple_StrStrStrZ_free(_res: C3Tuple_StrStrStrZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_StrStrStrZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C3Tuple_StrStrStrZZ { - /// 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::C3Tuple_StrStrStrZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C3Tuple_StrStrStrZZ { - #[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::C3Tuple_StrStrStrZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C3Tuple_StrStrStrZZ { - 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_C3Tuple_StrStrStrZZ_free(_res: CVec_C3Tuple_StrStrStrZZ) { } -impl Drop for CVec_C3Tuple_StrStrStrZZ { - 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_C3Tuple_StrStrStrZZ { - 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_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ -pub union CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { +/// The contents of CResult_SpliceInitDecodeErrorZ +pub union CResult_SpliceInitDecodeErrorZPtr { /// 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_C3Tuple_StrStrStrZZ, + pub result: *mut crate::lightning::ln::msgs::SpliceInit, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ on success and a crate::c_types::IOError on failure. +/// A CResult_SpliceInitDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceInit 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_CVec_C3Tuple_StrStrStrZZIOErrorZ { - /// The contents of this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, accessible via either +pub struct CResult_SpliceInitDecodeErrorZ { + /// The contents of this CResult_SpliceInitDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr, - /// Whether this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents a success state. + pub contents: CResult_SpliceInitDecodeErrorZPtr, + /// Whether this CResult_SpliceInitDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. -pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { - contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { +/// Creates a new CResult_SpliceInitDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceInit) -> CResult_SpliceInitDecodeErrorZ { + CResult_SpliceInitDecodeErrorZ { + contents: CResult_SpliceInitDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. -pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { - contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { +/// Creates a new CResult_SpliceInitDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceInitDecodeErrorZ { + CResult_SpliceInitDecodeErrorZ { + contents: CResult_SpliceInitDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15243,13 +18840,13 @@ pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(e: crate::c_types } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(o: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> bool { +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_is_ok(o: &CResult_SpliceInitDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. -pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(_res: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) { } -impl Drop for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { +/// Frees any resources used by the CResult_SpliceInitDecodeErrorZ. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_free(_res: CResult_SpliceInitDecodeErrorZ) { } +impl Drop for CResult_SpliceInitDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15262,16 +18859,16 @@ impl Drop for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { } } } -impl From> for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceInitDecodeErrorZ { + 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_C3Tuple_StrStrStrZZIOErrorZPtr { result } + CResult_SpliceInitDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { err } + CResult_SpliceInitDecodeErrorZPtr { err } }; Self { contents, @@ -15279,105 +18876,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SpliceInitDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SpliceInitDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` +/// Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(orig: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// 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) - } -} +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_clone(orig: &CResult_SpliceInitDecodeErrorZ) -> CResult_SpliceInitDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ -pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { +/// The contents of CResult_SpliceAckDecodeErrorZ +pub union CResult_SpliceAckDecodeErrorZPtr { /// 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_ThirtyTwoBytesChannelMonitorZZ, + pub result: *mut crate::lightning::ln::msgs::SpliceAck, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceAck 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either +pub struct CResult_SpliceAckDecodeErrorZ { + /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - 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_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 { + pub contents: CResult_SpliceAckDecodeErrorZPtr, + /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_SpliceAckDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ { + CResult_SpliceAckDecodeErrorZ { + contents: CResult_SpliceAckDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_SpliceAckDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ { + CResult_SpliceAckDecodeErrorZ { + contents: CResult_SpliceAckDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15385,13 +18936,13 @@ pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_er } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_SpliceAckDecodeErrorZ. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { } +impl Drop for CResult_SpliceAckDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15404,16 +18955,16 @@ impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { } } } -impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceAckDecodeErrorZ { + 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_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } + CResult_SpliceAckDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } + CResult_SpliceAckDecodeErrorZPtr { err } }; Self { contents, @@ -15421,59 +18972,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` +/// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { +/// The contents of CResult_SpliceLockedDecodeErrorZ +pub union CResult_SpliceLockedDecodeErrorZPtr { /// 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_ThirtyTwoBytesChannelMonitorZ, + pub result: *mut crate::lightning::ln::msgs::SpliceLocked, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceLocked 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_ThirtyTwoBytesChannelMonitorZIOErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either +pub struct CResult_SpliceLockedDecodeErrorZ { + /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. + pub contents: CResult_SpliceLockedDecodeErrorZPtr, + /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ { + CResult_SpliceLockedDecodeErrorZ { + contents: CResult_SpliceLockedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ { + CResult_SpliceLockedDecodeErrorZ { + contents: CResult_SpliceLockedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15481,13 +19032,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: c } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool { +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { } +impl Drop for CResult_SpliceLockedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15500,16 +19051,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceLockedDecodeErrorZ { + 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_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } + CResult_SpliceLockedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } + CResult_SpliceLockedDecodeErrorZPtr { err } }; Self { contents, @@ -15517,59 +19068,59 @@ 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 }))) + Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr { + 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` +/// Creates a new CResult_SpliceLockedDecodeErrorZ 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) } +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_MonitorNameIOErrorZ -pub union CResult_MonitorNameIOErrorZPtr { +/// The contents of CResult_TxAddInputDecodeErrorZ +pub union CResult_TxAddInputDecodeErrorZPtr { /// 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::persist::MonitorName, + pub result: *mut crate::lightning::ln::msgs::TxAddInput, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_MonitorNameIOErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::persist::MonitorName on success and a crate::c_types::IOError on failure. +/// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAddInput 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_MonitorNameIOErrorZ { - /// The contents of this CResult_MonitorNameIOErrorZ, accessible via either +pub struct CResult_TxAddInputDecodeErrorZ { + /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_MonitorNameIOErrorZPtr, - /// Whether this CResult_MonitorNameIOErrorZ represents a success state. + pub contents: CResult_TxAddInputDecodeErrorZPtr, + /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_MonitorNameIOErrorZ in the success state. -pub extern "C" fn CResult_MonitorNameIOErrorZ_ok(o: crate::lightning::util::persist::MonitorName) -> CResult_MonitorNameIOErrorZ { - CResult_MonitorNameIOErrorZ { - contents: CResult_MonitorNameIOErrorZPtr { +/// Creates a new CResult_TxAddInputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ { + CResult_TxAddInputDecodeErrorZ { + contents: CResult_TxAddInputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_MonitorNameIOErrorZ in the error state. -pub extern "C" fn CResult_MonitorNameIOErrorZ_err(e: crate::c_types::IOError) -> CResult_MonitorNameIOErrorZ { - CResult_MonitorNameIOErrorZ { - contents: CResult_MonitorNameIOErrorZPtr { +/// Creates a new CResult_TxAddInputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ { + CResult_TxAddInputDecodeErrorZ { + contents: CResult_TxAddInputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15577,13 +19128,13 @@ pub extern "C" fn CResult_MonitorNameIOErrorZ_err(e: crate::c_types::IOError) -> } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_MonitorNameIOErrorZ_is_ok(o: &CResult_MonitorNameIOErrorZ) -> bool { +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_MonitorNameIOErrorZ. -pub extern "C" fn CResult_MonitorNameIOErrorZ_free(_res: CResult_MonitorNameIOErrorZ) { } -impl Drop for CResult_MonitorNameIOErrorZ { +/// Frees any resources used by the CResult_TxAddInputDecodeErrorZ. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { } +impl Drop for CResult_TxAddInputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15596,16 +19147,16 @@ impl Drop for CResult_MonitorNameIOErrorZ { } } } -impl From> for CResult_MonitorNameIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAddInputDecodeErrorZ { + 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_MonitorNameIOErrorZPtr { result } + CResult_TxAddInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_MonitorNameIOErrorZPtr { err } + CResult_TxAddInputDecodeErrorZPtr { err } }; Self { contents, @@ -15613,42 +19164,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateNameIOErrorZ -pub union CResult_UpdateNameIOErrorZPtr { +/// The contents of CResult_TxAddOutputDecodeErrorZ +pub union CResult_TxAddOutputDecodeErrorZPtr { /// 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::persist::UpdateName, + pub result: *mut crate::lightning::ln::msgs::TxAddOutput, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_UpdateNameIOErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::persist::UpdateName on success and a crate::c_types::IOError on failure. +/// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAddOutput 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_UpdateNameIOErrorZ { - /// The contents of this CResult_UpdateNameIOErrorZ, accessible via either +pub struct CResult_TxAddOutputDecodeErrorZ { + /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateNameIOErrorZPtr, - /// Whether this CResult_UpdateNameIOErrorZ represents a success state. + pub contents: CResult_TxAddOutputDecodeErrorZPtr, + /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateNameIOErrorZ in the success state. -pub extern "C" fn CResult_UpdateNameIOErrorZ_ok(o: crate::lightning::util::persist::UpdateName) -> CResult_UpdateNameIOErrorZ { - CResult_UpdateNameIOErrorZ { - contents: CResult_UpdateNameIOErrorZPtr { +/// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ { + CResult_TxAddOutputDecodeErrorZ { + contents: CResult_TxAddOutputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateNameIOErrorZ in the error state. -pub extern "C" fn CResult_UpdateNameIOErrorZ_err(e: crate::c_types::IOError) -> CResult_UpdateNameIOErrorZ { - CResult_UpdateNameIOErrorZ { - contents: CResult_UpdateNameIOErrorZPtr { +/// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ { + CResult_TxAddOutputDecodeErrorZ { + contents: CResult_TxAddOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15656,13 +19224,13 @@ pub extern "C" fn CResult_UpdateNameIOErrorZ_err(e: crate::c_types::IOError) -> } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateNameIOErrorZ_is_ok(o: &CResult_UpdateNameIOErrorZ) -> bool { +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateNameIOErrorZ. -pub extern "C" fn CResult_UpdateNameIOErrorZ_free(_res: CResult_UpdateNameIOErrorZ) { } -impl Drop for CResult_UpdateNameIOErrorZ { +/// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { } +impl Drop for CResult_TxAddOutputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15675,16 +19243,16 @@ impl Drop for CResult_UpdateNameIOErrorZ { } } } -impl From> for CResult_UpdateNameIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAddOutputDecodeErrorZ { + 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_UpdateNameIOErrorZPtr { result } + CResult_TxAddOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateNameIOErrorZPtr { err } + CResult_TxAddOutputDecodeErrorZPtr { err } }; Self { contents, @@ -15692,42 +19260,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ -pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// The contents of CResult_TxRemoveInputDecodeErrorZ +pub union CResult_TxRemoveInputDecodeErrorZPtr { /// 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_request::InvoiceRequest, + pub result: *mut crate::lightning::ln::msgs::TxRemoveInput, /// 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::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxRemoveInput 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_InvoiceRequestBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either +pub struct CResult_TxRemoveInputDecodeErrorZ { + /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. + pub contents: CResult_TxRemoveInputDecodeErrorZPtr, + /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ { - CResult_InvoiceRequestBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ { + CResult_TxRemoveInputDecodeErrorZ { + contents: CResult_TxRemoveInputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ { - CResult_InvoiceRequestBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ { + CResult_TxRemoveInputDecodeErrorZ { + contents: CResult_TxRemoveInputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15735,13 +19320,13 @@ pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { } +impl Drop for CResult_TxRemoveInputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15754,16 +19339,16 @@ impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { } } } -impl From> for CResult_InvoiceRequestBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxRemoveInputDecodeErrorZ { + 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_InvoiceRequestBolt12SemanticErrorZPtr { result } + CResult_TxRemoveInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } + CResult_TxRemoveInputDecodeErrorZPtr { err } }; Self { contents, @@ -15771,59 +19356,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_TxRemoveOutputDecodeErrorZ +pub union CResult_TxRemoveOutputDecodeErrorZPtr { /// 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::InvoiceWithExplicitSigningPubkeyBuilder, + pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput, /// 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::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxRemoveOutput 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either +pub struct CResult_TxRemoveOutputDecodeErrorZ { + /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_TxRemoveOutputDecodeErrorZPtr, + /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ { + CResult_TxRemoveOutputDecodeErrorZ { + contents: CResult_TxRemoveOutputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ { + CResult_TxRemoveOutputDecodeErrorZ { + contents: CResult_TxRemoveOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15831,13 +19416,13 @@ pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticE } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { } +impl Drop for CResult_TxRemoveOutputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15850,16 +19435,16 @@ impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticError } } } -impl From> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxRemoveOutputDecodeErrorZ { + 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } + CResult_TxRemoveOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } + CResult_TxRemoveOutputDecodeErrorZPtr { err } }; Self { contents, @@ -15867,74 +19452,95 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_VerifiedInvoiceRequestNoneZ -pub union CResult_VerifiedInvoiceRequestNoneZPtr { +/// The contents of CResult_TxCompleteDecodeErrorZ +pub union CResult_TxCompleteDecodeErrorZPtr { /// 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_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, + pub result: *mut crate::lightning::ln::msgs::TxComplete, + /// 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_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure. +/// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxComplete 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_VerifiedInvoiceRequestNoneZ { - /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either +pub struct CResult_TxCompleteDecodeErrorZ { + /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_VerifiedInvoiceRequestNoneZPtr, - /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state. + pub contents: CResult_TxCompleteDecodeErrorZPtr, + /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_TxCompleteDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ { + CResult_TxCompleteDecodeErrorZ { + contents: CResult_TxCompleteDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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(), +/// Creates a new CResult_TxCompleteDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ { + CResult_TxCompleteDecodeErrorZ { + contents: CResult_TxCompleteDecodeErrorZPtr { + 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_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool { +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { } -impl Drop for CResult_VerifiedInvoiceRequestNoneZ { +/// Frees any resources used by the CResult_TxCompleteDecodeErrorZ. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { } +impl Drop for CResult_TxCompleteDecodeErrorZ { 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_VerifiedInvoiceRequestNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxCompleteDecodeErrorZ { + 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_VerifiedInvoiceRequestNoneZPtr { result } + CResult_TxCompleteDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_TxCompleteDecodeErrorZPtr { err } }; Self { contents, @@ -15942,59 +19548,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` +/// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_TxSignaturesDecodeErrorZ +pub union CResult_TxSignaturesDecodeErrorZPtr { /// 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::InvoiceWithDerivedSigningPubkeyBuilder, + pub result: *mut crate::lightning::ln::msgs::TxSignatures, /// 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::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxSignatures 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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either +pub struct CResult_TxSignaturesDecodeErrorZ { + /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_TxSignaturesDecodeErrorZPtr, + /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ { + CResult_TxSignaturesDecodeErrorZ { + contents: CResult_TxSignaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ { + CResult_TxSignaturesDecodeErrorZ { + contents: CResult_TxSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16002,13 +19608,13 @@ pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticEr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { } +impl Drop for CResult_TxSignaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16021,16 +19627,16 @@ impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ } } } -impl From> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxSignaturesDecodeErrorZ { + 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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } + CResult_TxSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } + CResult_TxSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -16038,42 +19644,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestDecodeErrorZ -pub union CResult_InvoiceRequestDecodeErrorZPtr { +/// The contents of CResult_TxInitRbfDecodeErrorZ +pub union CResult_TxInitRbfDecodeErrorZPtr { /// 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_request::InvoiceRequest, + pub result: *mut crate::lightning::ln::msgs::TxInitRbf, /// 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_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxInitRbf 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_InvoiceRequestDecodeErrorZ { - /// The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either +pub struct CResult_TxInitRbfDecodeErrorZ { + /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestDecodeErrorZPtr, - /// Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. + pub contents: CResult_TxInitRbfDecodeErrorZPtr, + /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestDecodeErrorZ { - CResult_InvoiceRequestDecodeErrorZ { - contents: CResult_InvoiceRequestDecodeErrorZPtr { +/// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ { + CResult_TxInitRbfDecodeErrorZ { + contents: CResult_TxInitRbfDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestDecodeErrorZ { - CResult_InvoiceRequestDecodeErrorZ { - contents: CResult_InvoiceRequestDecodeErrorZPtr { +/// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ { + CResult_TxInitRbfDecodeErrorZ { + contents: CResult_TxInitRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16081,13 +19704,13 @@ pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. -pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_free(_res: CResult_InvoiceRequestDecodeErrorZ) { } -impl Drop for CResult_InvoiceRequestDecodeErrorZ { +/// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { } +impl Drop for CResult_TxInitRbfDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16100,16 +19723,16 @@ impl Drop for CResult_InvoiceRequestDecodeErrorZ { } } } -impl From> for CResult_InvoiceRequestDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxInitRbfDecodeErrorZ { + 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_InvoiceRequestDecodeErrorZPtr { result } + CResult_TxInitRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestDecodeErrorZPtr { err } + CResult_TxInitRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16117,59 +19740,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InvoiceRequestDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_clone(orig: &CResult_InvoiceRequestDecodeErrorZ) -> CResult_InvoiceRequestDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ -pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// The contents of CResult_TxAckRbfDecodeErrorZ +pub union CResult_TxAckRbfDecodeErrorZPtr { /// 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_request::InvoiceRequestFields, + pub result: *mut crate::lightning::ln::msgs::TxAckRbf, /// 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_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAckRbf 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_InvoiceRequestFieldsDecodeErrorZ { - /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either +pub struct CResult_TxAckRbfDecodeErrorZ { + /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr, - /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. + pub contents: CResult_TxAckRbfDecodeErrorZPtr, + /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ { - CResult_InvoiceRequestFieldsDecodeErrorZ { - contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ { + CResult_TxAckRbfDecodeErrorZ { + contents: CResult_TxAckRbfDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ { - CResult_InvoiceRequestFieldsDecodeErrorZ { - contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ { + CResult_TxAckRbfDecodeErrorZ { + contents: CResult_TxAckRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16177,13 +19800,13 @@ pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { } -impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { +/// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { } +impl Drop for CResult_TxAckRbfDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16196,16 +19819,16 @@ impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { } } } -impl From> for CResult_InvoiceRequestFieldsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAckRbfDecodeErrorZ { + 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_InvoiceRequestFieldsDecodeErrorZPtr { result } + CResult_TxAckRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } + CResult_TxAckRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16213,208 +19836,59 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// An enum which can either contain a or not -pub enum COption_NoneZ { - /// When we're in this state, this COption_NoneZ contains a - Some, - /// When we're in this state, this COption_NoneZ contains nothing - None -} -impl COption_NoneZ { - #[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() - } -} -#[no_mangle] -/// Constructs a new COption_NoneZ containing a -pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ { - COption_NoneZ::Some -} -#[no_mangle] -/// Constructs a new COption_NoneZ containing nothing -pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ { - COption_NoneZ::None -} -#[no_mangle] -/// Frees any resources associated with the , if we are in the Some state -pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_WitnessZ { - /// 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::Witness, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_WitnessZ { - #[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::Witness] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_WitnessZ { - 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_WitnessZ_free(_res: CVec_WitnessZ) { } -impl Drop for CVec_WitnessZ { - 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_WitnessZ { - 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::ECDSASignature or not -pub enum COption_ECDSASignatureZ { - /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature - Some(crate::c_types::ECDSASignature), - /// When we're in this state, this COption_ECDSASignatureZ contains nothing - None -} -impl COption_ECDSASignatureZ { - #[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::ECDSASignature { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature -pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ { - COption_ECDSASignatureZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_ECDSASignatureZ containing nothing -pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ { - COption_ECDSASignatureZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state -pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { } -#[no_mangle] -/// Creates a new COption_ECDSASignatureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a i64 or not -pub enum COption_i64Z { - /// When we're in this state, this COption_i64Z contains a i64 - Some(i64), - /// When we're in this state, this COption_i64Z contains nothing - None -} -impl COption_i64Z { - #[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) -> i64 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_i64Z containing a i64 -pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z { - COption_i64Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_i64Z containing nothing -pub extern "C" fn COption_i64Z_none() -> COption_i64Z { - COption_i64Z::None +impl Clone for CResult_TxAckRbfDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } } #[no_mangle] -/// Frees any resources associated with the i64, if we are in the Some state -pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { } -#[no_mangle] -/// Creates a new COption_i64Z which has the same data as `orig` +/// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressDecodeErrorZ -pub union CResult_SocketAddressDecodeErrorZPtr { +/// The contents of CResult_TxAbortDecodeErrorZ +pub union CResult_TxAbortDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::ln::msgs::TxAbort, /// 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_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. +/// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAbort 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 +pub struct CResult_TxAbortDecodeErrorZ { + /// The contents of this CResult_TxAbortDecodeErrorZ, 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 contents: CResult_TxAbortDecodeErrorZPtr, + /// Whether this CResult_TxAbortDecodeErrorZ 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 { +/// Creates a new CResult_TxAbortDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ { + CResult_TxAbortDecodeErrorZ { + contents: CResult_TxAbortDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_TxAbortDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ { + CResult_TxAbortDecodeErrorZ { + contents: CResult_TxAbortDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16422,13 +19896,13 @@ pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SocketAddressDecodeErrorZ. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { } -impl Drop for CResult_SocketAddressDecodeErrorZ { +/// Frees any resources used by the CResult_TxAbortDecodeErrorZ. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { } +impl Drop for CResult_TxAbortDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16441,16 +19915,16 @@ impl Drop for CResult_SocketAddressDecodeErrorZ { } } } -impl From> for CResult_SocketAddressDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAbortDecodeErrorZ { + 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 } + CResult_TxAbortDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressDecodeErrorZPtr { err } + CResult_TxAbortDecodeErrorZPtr { err } }; Self { contents, @@ -16458,59 +19932,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressSocketAddressParseErrorZ -pub union CResult_SocketAddressSocketAddressParseErrorZPtr { +/// The contents of CResult_AnnouncementSignaturesDecodeErrorZ +pub union CResult_AnnouncementSignaturesDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures, /// 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::SocketAddressParseError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_SocketAddressSocketAddressParseErrorZ { - /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either +pub struct CResult_AnnouncementSignaturesDecodeErrorZ { + /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr, - /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. + pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr, + /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ { + CResult_AnnouncementSignaturesDecodeErrorZ { + contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ { + CResult_AnnouncementSignaturesDecodeErrorZ { + contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16518,13 +19992,13 @@ pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::li } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool { +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { } -impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { +/// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { } +impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16537,16 +20011,16 @@ impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { } } } -impl From> for CResult_SocketAddressSocketAddressParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AnnouncementSignaturesDecodeErrorZ { + 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_SocketAddressSocketAddressParseErrorZPtr { result } + CResult_AnnouncementSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressSocketAddressParseErrorZPtr { err } + CResult_AnnouncementSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -16554,243 +20028,251 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -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++ -pub struct CVec_UpdateAddHTLCZ { - /// 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::UpdateAddHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateAddHTLCZ { - #[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::UpdateAddHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UpdateAddHTLCZ { - 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_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { } -impl Drop for CVec_UpdateAddHTLCZ { - 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_UpdateAddHTLCZ { - 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_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFulfillHTLCZ { - /// 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::UpdateFulfillHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateFulfillHTLCZ { - #[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::UpdateFulfillHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UpdateFulfillHTLCZ { - 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_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { } -impl Drop for CVec_UpdateFulfillHTLCZ { - 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_UpdateFulfillHTLCZ { - 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) - } +/// The contents of CResult_ChannelReestablishDecodeErrorZ +pub union CResult_ChannelReestablishDecodeErrorZPtr { + /// 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::ChannelReestablish, + /// 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 dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFailHTLCZ { - /// 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::UpdateFailHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ { + /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_ChannelReestablishDecodeErrorZPtr, + /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. + pub result_ok: bool, } -impl CVec_UpdateFailHTLCZ { - #[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::UpdateFailHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ { + CResult_ChannelReestablishDecodeErrorZ { + contents: CResult_ChannelReestablishDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_UpdateFailHTLCZ { - 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] +/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ { + CResult_ChannelReestablishDecodeErrorZ { + contents: CResult_ChannelReestablishDecodeErrorZPtr { + 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_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool { + o.result_ok +} #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { } -impl Drop for CVec_UpdateFailHTLCZ { +/// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { } +impl Drop for CResult_ChannelReestablishDecodeErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + 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 Clone for CVec_UpdateFailHTLCZ { +impl From> for CResult_ChannelReestablishDecodeErrorZ { + 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_ChannelReestablishDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelReestablishDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_ChannelReestablishDecodeErrorZ { 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) + if self.result_ok { + Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFailMalformedHTLCZ { - /// 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::UpdateFailMalformedHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_NextFundingDecodeErrorZ +pub union CResult_NextFundingDecodeErrorZPtr { + /// 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::NextFunding, + /// 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 CVec_UpdateFailMalformedHTLCZ { - #[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::UpdateFailMalformedHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[repr(C)] +/// A CResult_NextFundingDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::NextFunding 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_NextFundingDecodeErrorZ { + /// The contents of this CResult_NextFundingDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NextFundingDecodeErrorZPtr, + /// Whether this CResult_NextFundingDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NextFundingDecodeErrorZ in the success state. +pub extern "C" fn CResult_NextFundingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NextFunding) -> CResult_NextFundingDecodeErrorZ { + CResult_NextFundingDecodeErrorZ { + contents: CResult_NextFundingDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_UpdateFailMalformedHTLCZ { - 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] +/// Creates a new CResult_NextFundingDecodeErrorZ in the error state. +pub extern "C" fn CResult_NextFundingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NextFundingDecodeErrorZ { + CResult_NextFundingDecodeErrorZ { + contents: CResult_NextFundingDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { } -impl Drop for CVec_UpdateFailMalformedHTLCZ { +pub extern "C" fn CResult_NextFundingDecodeErrorZ_is_ok(o: &CResult_NextFundingDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NextFundingDecodeErrorZ. +pub extern "C" fn CResult_NextFundingDecodeErrorZ_free(_res: CResult_NextFundingDecodeErrorZ) { } +impl Drop for CResult_NextFundingDecodeErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + 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 Clone for CVec_UpdateFailMalformedHTLCZ { +impl From> for CResult_NextFundingDecodeErrorZ { + 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_NextFundingDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NextFundingDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NextFundingDecodeErrorZ { 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) + if self.result_ok { + Self { result_ok: true, contents: CResult_NextFundingDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_NextFundingDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_NextFundingDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NextFundingDecodeErrorZ_clone(orig: &CResult_NextFundingDecodeErrorZ) -> CResult_NextFundingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelDecodeErrorZ -pub union CResult_AcceptChannelDecodeErrorZPtr { +/// The contents of CResult_FundingLockedDecodeErrorZ +pub union CResult_FundingLockedDecodeErrorZPtr { /// 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::AcceptChannel, + pub result: *mut crate::lightning::ln::msgs::FundingLocked, /// 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_AcceptChannelDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FundingLocked 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_AcceptChannelDecodeErrorZ { - /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either +pub struct CResult_FundingLockedDecodeErrorZ { + /// The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AcceptChannelDecodeErrorZPtr, - /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state. + pub contents: CResult_FundingLockedDecodeErrorZPtr, + /// Whether this CResult_FundingLockedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ { - CResult_AcceptChannelDecodeErrorZ { - contents: CResult_AcceptChannelDecodeErrorZPtr { +/// Creates a new CResult_FundingLockedDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingLocked) -> CResult_FundingLockedDecodeErrorZ { + CResult_FundingLockedDecodeErrorZ { + contents: CResult_FundingLockedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ { - CResult_AcceptChannelDecodeErrorZ { - contents: CResult_AcceptChannelDecodeErrorZPtr { +/// Creates a new CResult_FundingLockedDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingLockedDecodeErrorZ { + CResult_FundingLockedDecodeErrorZ { + contents: CResult_FundingLockedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16798,13 +20280,13 @@ pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_is_ok(o: &CResult_FundingLockedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { } -impl Drop for CResult_AcceptChannelDecodeErrorZ { +/// Frees any resources used by the CResult_FundingLockedDecodeErrorZ. +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_free(_res: CResult_FundingLockedDecodeErrorZ) { } +impl Drop for CResult_FundingLockedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16817,16 +20299,16 @@ impl Drop for CResult_AcceptChannelDecodeErrorZ { } } } -impl From> for CResult_AcceptChannelDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingLockedDecodeErrorZ { + 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_AcceptChannelDecodeErrorZPtr { result } + CResult_FundingLockedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelDecodeErrorZPtr { err } + CResult_FundingLockedDecodeErrorZPtr { err } }; Self { contents, @@ -16834,59 +20316,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingLockedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingLockedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingLockedDecodeErrorZ_clone(orig: &CResult_FundingLockedDecodeErrorZ) -> CResult_FundingLockedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelV2DecodeErrorZ -pub union CResult_AcceptChannelV2DecodeErrorZPtr { +/// The contents of CResult_ClosingSignedDecodeErrorZ +pub union CResult_ClosingSignedDecodeErrorZPtr { /// 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::AcceptChannelV2, + pub result: *mut crate::lightning::ln::msgs::ClosingSigned, /// 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_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingSigned 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_AcceptChannelV2DecodeErrorZ { - /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either +pub struct CResult_ClosingSignedDecodeErrorZ { + /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AcceptChannelV2DecodeErrorZPtr, - /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state. + pub contents: CResult_ClosingSignedDecodeErrorZPtr, + /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ { - CResult_AcceptChannelV2DecodeErrorZ { - contents: CResult_AcceptChannelV2DecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ { + CResult_ClosingSignedDecodeErrorZ { + contents: CResult_ClosingSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ { - CResult_AcceptChannelV2DecodeErrorZ { - contents: CResult_AcceptChannelV2DecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ { + CResult_ClosingSignedDecodeErrorZ { + contents: CResult_ClosingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16894,13 +20376,13 @@ pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { } -impl Drop for CResult_AcceptChannelV2DecodeErrorZ { +/// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { } +impl Drop for CResult_ClosingSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16913,16 +20395,16 @@ impl Drop for CResult_AcceptChannelV2DecodeErrorZ { } } } -impl From> for CResult_AcceptChannelV2DecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingSignedDecodeErrorZ { + 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_AcceptChannelV2DecodeErrorZPtr { result } + CResult_ClosingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelV2DecodeErrorZPtr { err } + CResult_ClosingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -16930,59 +20412,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_StfuDecodeErrorZ -pub union CResult_StfuDecodeErrorZPtr { +/// The contents of CResult_ClosingCompleteDecodeErrorZ +pub union CResult_ClosingCompleteDecodeErrorZPtr { /// 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::Stfu, + pub result: *mut crate::lightning::ln::msgs::ClosingComplete, /// 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_StfuDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingCompleteDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingComplete 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_StfuDecodeErrorZ { - /// The contents of this CResult_StfuDecodeErrorZ, accessible via either +pub struct CResult_ClosingCompleteDecodeErrorZ { + /// The contents of this CResult_ClosingCompleteDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_StfuDecodeErrorZPtr, - /// Whether this CResult_StfuDecodeErrorZ represents a success state. + pub contents: CResult_ClosingCompleteDecodeErrorZPtr, + /// Whether this CResult_ClosingCompleteDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ in the success state. -pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ { - CResult_StfuDecodeErrorZ { - contents: CResult_StfuDecodeErrorZPtr { +/// Creates a new CResult_ClosingCompleteDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingComplete) -> CResult_ClosingCompleteDecodeErrorZ { + CResult_ClosingCompleteDecodeErrorZ { + contents: CResult_ClosingCompleteDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ in the error state. -pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ { - CResult_StfuDecodeErrorZ { - contents: CResult_StfuDecodeErrorZPtr { +/// Creates a new CResult_ClosingCompleteDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingCompleteDecodeErrorZ { + CResult_ClosingCompleteDecodeErrorZ { + contents: CResult_ClosingCompleteDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16990,13 +20472,13 @@ pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingCompleteDecodeErrorZ_is_ok(o: &CResult_ClosingCompleteDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_StfuDecodeErrorZ. -pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { } -impl Drop for CResult_StfuDecodeErrorZ { +/// Frees any resources used by the CResult_ClosingCompleteDecodeErrorZ. +pub extern "C" fn CResult_ClosingCompleteDecodeErrorZ_free(_res: CResult_ClosingCompleteDecodeErrorZ) { } +impl Drop for CResult_ClosingCompleteDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17009,16 +20491,16 @@ impl Drop for CResult_StfuDecodeErrorZ { } } } -impl From> for CResult_StfuDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingCompleteDecodeErrorZ { + 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_StfuDecodeErrorZPtr { result } + CResult_ClosingCompleteDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StfuDecodeErrorZPtr { err } + CResult_ClosingCompleteDecodeErrorZPtr { err } }; Self { contents, @@ -17026,59 +20508,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingCompleteDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingCompleteDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingCompleteDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingCompleteDecodeErrorZ_clone(orig: &CResult_ClosingCompleteDecodeErrorZ) -> CResult_ClosingCompleteDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceInitDecodeErrorZ -pub union CResult_SpliceInitDecodeErrorZPtr { +/// The contents of CResult_ClosingSigDecodeErrorZ +pub union CResult_ClosingSigDecodeErrorZPtr { /// 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::SpliceInit, + pub result: *mut crate::lightning::ln::msgs::ClosingSig, /// 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_SpliceInitDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceInit on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingSigDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingSig 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_SpliceInitDecodeErrorZ { - /// The contents of this CResult_SpliceInitDecodeErrorZ, accessible via either +pub struct CResult_ClosingSigDecodeErrorZ { + /// The contents of this CResult_ClosingSigDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceInitDecodeErrorZPtr, - /// Whether this CResult_SpliceInitDecodeErrorZ represents a success state. + pub contents: CResult_ClosingSigDecodeErrorZPtr, + /// Whether this CResult_ClosingSigDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceInit) -> CResult_SpliceInitDecodeErrorZ { - CResult_SpliceInitDecodeErrorZ { - contents: CResult_SpliceInitDecodeErrorZPtr { +/// Creates a new CResult_ClosingSigDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingSigDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSig) -> CResult_ClosingSigDecodeErrorZ { + CResult_ClosingSigDecodeErrorZ { + contents: CResult_ClosingSigDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceInitDecodeErrorZ { - CResult_SpliceInitDecodeErrorZ { - contents: CResult_SpliceInitDecodeErrorZPtr { +/// Creates a new CResult_ClosingSigDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingSigDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSigDecodeErrorZ { + CResult_ClosingSigDecodeErrorZ { + contents: CResult_ClosingSigDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17086,13 +20568,13 @@ pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_is_ok(o: &CResult_SpliceInitDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingSigDecodeErrorZ_is_ok(o: &CResult_ClosingSigDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceInitDecodeErrorZ. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_free(_res: CResult_SpliceInitDecodeErrorZ) { } -impl Drop for CResult_SpliceInitDecodeErrorZ { +/// Frees any resources used by the CResult_ClosingSigDecodeErrorZ. +pub extern "C" fn CResult_ClosingSigDecodeErrorZ_free(_res: CResult_ClosingSigDecodeErrorZ) { } +impl Drop for CResult_ClosingSigDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17105,16 +20587,16 @@ impl Drop for CResult_SpliceInitDecodeErrorZ { } } } -impl From> for CResult_SpliceInitDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingSigDecodeErrorZ { + 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_SpliceInitDecodeErrorZPtr { result } + CResult_ClosingSigDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceInitDecodeErrorZPtr { err } + CResult_ClosingSigDecodeErrorZPtr { err } }; Self { contents, @@ -17122,59 +20604,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceInitDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingSigDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceInitDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingSigDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingSigDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_clone(orig: &CResult_SpliceInitDecodeErrorZ) -> CResult_SpliceInitDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingSigDecodeErrorZ_clone(orig: &CResult_ClosingSigDecodeErrorZ) -> CResult_ClosingSigDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceAckDecodeErrorZ -pub union CResult_SpliceAckDecodeErrorZPtr { +/// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ +pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr { /// 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::SpliceAck, + pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange, /// 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_SpliceAckDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange 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_SpliceAckDecodeErrorZ { - /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either +pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ { + /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceAckDecodeErrorZPtr, - /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state. + pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr, + /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ { - CResult_SpliceAckDecodeErrorZ { - contents: CResult_SpliceAckDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { + CResult_ClosingSignedFeeRangeDecodeErrorZ { + contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ { - CResult_SpliceAckDecodeErrorZ { - contents: CResult_SpliceAckDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { + CResult_ClosingSignedFeeRangeDecodeErrorZ { + contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17182,13 +20664,13 @@ pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceAckDecodeErrorZ. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { } -impl Drop for CResult_SpliceAckDecodeErrorZ { +/// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } +impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17201,16 +20683,16 @@ impl Drop for CResult_SpliceAckDecodeErrorZ { } } } -impl From> for CResult_SpliceAckDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingSignedFeeRangeDecodeErrorZ { + 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_SpliceAckDecodeErrorZPtr { result } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceAckDecodeErrorZPtr { err } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } }; Self { contents, @@ -17218,59 +20700,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceLockedDecodeErrorZ -pub union CResult_SpliceLockedDecodeErrorZPtr { +/// The contents of CResult_CommitmentSignedDecodeErrorZ +pub union CResult_CommitmentSignedDecodeErrorZPtr { /// 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::SpliceLocked, + pub result: *mut crate::lightning::ln::msgs::CommitmentSigned, /// 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_SpliceLockedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::CommitmentSigned 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_SpliceLockedDecodeErrorZ { - /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either +pub struct CResult_CommitmentSignedDecodeErrorZ { + /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceLockedDecodeErrorZPtr, - /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. + pub contents: CResult_CommitmentSignedDecodeErrorZPtr, + /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ { - CResult_SpliceLockedDecodeErrorZ { - contents: CResult_SpliceLockedDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ { + CResult_CommitmentSignedDecodeErrorZ { + contents: CResult_CommitmentSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ { - CResult_SpliceLockedDecodeErrorZ { - contents: CResult_SpliceLockedDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ { + CResult_CommitmentSignedDecodeErrorZ { + contents: CResult_CommitmentSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17278,13 +20760,13 @@ pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { } -impl Drop for CResult_SpliceLockedDecodeErrorZ { +/// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { } +impl Drop for CResult_CommitmentSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17297,16 +20779,16 @@ impl Drop for CResult_SpliceLockedDecodeErrorZ { } } } -impl From> for CResult_SpliceLockedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CommitmentSignedDecodeErrorZ { + 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_SpliceLockedDecodeErrorZPtr { result } + CResult_CommitmentSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceLockedDecodeErrorZPtr { err } + CResult_CommitmentSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17314,59 +20796,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAddInputDecodeErrorZ -pub union CResult_TxAddInputDecodeErrorZPtr { +/// The contents of CResult_FundingCreatedDecodeErrorZ +pub union CResult_FundingCreatedDecodeErrorZPtr { /// 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::TxAddInput, + pub result: *mut crate::lightning::ln::msgs::FundingCreated, /// 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_TxAddInputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FundingCreated 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_TxAddInputDecodeErrorZ { - /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either +pub struct CResult_FundingCreatedDecodeErrorZ { + /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAddInputDecodeErrorZPtr, - /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state. + pub contents: CResult_FundingCreatedDecodeErrorZPtr, + /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ { - CResult_TxAddInputDecodeErrorZ { - contents: CResult_TxAddInputDecodeErrorZPtr { +/// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ { + CResult_FundingCreatedDecodeErrorZ { + contents: CResult_FundingCreatedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ { - CResult_TxAddInputDecodeErrorZ { - contents: CResult_TxAddInputDecodeErrorZPtr { +/// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ { + CResult_FundingCreatedDecodeErrorZ { + contents: CResult_FundingCreatedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17374,13 +20856,13 @@ pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAddInputDecodeErrorZ. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { } -impl Drop for CResult_TxAddInputDecodeErrorZ { +/// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { } +impl Drop for CResult_FundingCreatedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17393,16 +20875,16 @@ impl Drop for CResult_TxAddInputDecodeErrorZ { } } } -impl From> for CResult_TxAddInputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingCreatedDecodeErrorZ { + 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_TxAddInputDecodeErrorZPtr { result } + CResult_FundingCreatedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddInputDecodeErrorZPtr { err } + CResult_FundingCreatedDecodeErrorZPtr { err } }; Self { contents, @@ -17410,59 +20892,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_TxAddOutputDecodeErrorZ -pub union CResult_TxAddOutputDecodeErrorZPtr { +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_FundingSignedDecodeErrorZ +pub union CResult_FundingSignedDecodeErrorZPtr { /// 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::TxAddOutput, + pub result: *mut crate::lightning::ln::msgs::FundingSigned, /// 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_TxAddOutputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FundingSigned 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_TxAddOutputDecodeErrorZ { - /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either +pub struct CResult_FundingSignedDecodeErrorZ { + /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAddOutputDecodeErrorZPtr, - /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state. + pub contents: CResult_FundingSignedDecodeErrorZPtr, + /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ { - CResult_TxAddOutputDecodeErrorZ { - contents: CResult_TxAddOutputDecodeErrorZPtr { +/// Creates a new CResult_FundingSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ { + CResult_FundingSignedDecodeErrorZ { + contents: CResult_FundingSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ { - CResult_TxAddOutputDecodeErrorZ { - contents: CResult_TxAddOutputDecodeErrorZPtr { +/// Creates a new CResult_FundingSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ { + CResult_FundingSignedDecodeErrorZ { + contents: CResult_FundingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17470,13 +20952,13 @@ pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { } -impl Drop for CResult_TxAddOutputDecodeErrorZ { +/// Frees any resources used by the CResult_FundingSignedDecodeErrorZ. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { } +impl Drop for CResult_FundingSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17489,16 +20971,16 @@ impl Drop for CResult_TxAddOutputDecodeErrorZ { } } } -impl From> for CResult_TxAddOutputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingSignedDecodeErrorZ { + 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_TxAddOutputDecodeErrorZPtr { result } + CResult_FundingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddOutputDecodeErrorZPtr { err } + CResult_FundingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17506,59 +20988,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveInputDecodeErrorZ -pub union CResult_TxRemoveInputDecodeErrorZPtr { +/// The contents of CResult_ChannelReadyDecodeErrorZ +pub union CResult_ChannelReadyDecodeErrorZPtr { /// 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::TxRemoveInput, + pub result: *mut crate::lightning::ln::msgs::ChannelReady, /// 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_TxRemoveInputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelReady 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_TxRemoveInputDecodeErrorZ { - /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either +pub struct CResult_ChannelReadyDecodeErrorZ { + /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxRemoveInputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state. + pub contents: CResult_ChannelReadyDecodeErrorZPtr, + /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ { - CResult_TxRemoveInputDecodeErrorZ { - contents: CResult_TxRemoveInputDecodeErrorZPtr { +/// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ { + CResult_ChannelReadyDecodeErrorZ { + contents: CResult_ChannelReadyDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ { - CResult_TxRemoveInputDecodeErrorZ { - contents: CResult_TxRemoveInputDecodeErrorZPtr { +/// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ { + CResult_ChannelReadyDecodeErrorZ { + contents: CResult_ChannelReadyDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17566,13 +21048,13 @@ pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { } -impl Drop for CResult_TxRemoveInputDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { } +impl Drop for CResult_ChannelReadyDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17585,16 +21067,16 @@ impl Drop for CResult_TxRemoveInputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveInputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelReadyDecodeErrorZ { + 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_TxRemoveInputDecodeErrorZPtr { result } + CResult_ChannelReadyDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveInputDecodeErrorZPtr { err } + CResult_ChannelReadyDecodeErrorZPtr { err } }; Self { contents, @@ -17602,59 +21084,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveOutputDecodeErrorZ -pub union CResult_TxRemoveOutputDecodeErrorZPtr { +/// The contents of CResult_InitDecodeErrorZ +pub union CResult_InitDecodeErrorZPtr { /// 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::TxRemoveOutput, + pub result: *mut crate::lightning::ln::msgs::Init, /// 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_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InitDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Init 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_TxRemoveOutputDecodeErrorZ { - /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either +pub struct CResult_InitDecodeErrorZ { + /// The contents of this CResult_InitDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxRemoveOutputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state. + pub contents: CResult_InitDecodeErrorZPtr, + /// Whether this CResult_InitDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ { - CResult_TxRemoveOutputDecodeErrorZ { - contents: CResult_TxRemoveOutputDecodeErrorZPtr { +/// Creates a new CResult_InitDecodeErrorZ in the success state. +pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ { + CResult_InitDecodeErrorZ { + contents: CResult_InitDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ { - CResult_TxRemoveOutputDecodeErrorZ { - contents: CResult_TxRemoveOutputDecodeErrorZPtr { +/// Creates a new CResult_InitDecodeErrorZ in the error state. +pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ { + CResult_InitDecodeErrorZ { + contents: CResult_InitDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17662,13 +21144,13 @@ pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { } -impl Drop for CResult_TxRemoveOutputDecodeErrorZ { +/// Frees any resources used by the CResult_InitDecodeErrorZ. +pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { } +impl Drop for CResult_InitDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17681,16 +21163,16 @@ impl Drop for CResult_TxRemoveOutputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveOutputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InitDecodeErrorZ { + 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_TxRemoveOutputDecodeErrorZPtr { result } + CResult_InitDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveOutputDecodeErrorZPtr { err } + CResult_InitDecodeErrorZPtr { err } }; Self { contents, @@ -17698,59 +21180,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCompleteDecodeErrorZ -pub union CResult_TxCompleteDecodeErrorZPtr { +/// The contents of CResult_OpenChannelDecodeErrorZ +pub union CResult_OpenChannelDecodeErrorZPtr { /// 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::TxComplete, + pub result: *mut crate::lightning::ln::msgs::OpenChannel, /// 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_TxCompleteDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OpenChannel 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_TxCompleteDecodeErrorZ { - /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either +pub struct CResult_OpenChannelDecodeErrorZ { + /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxCompleteDecodeErrorZPtr, - /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state. + pub contents: CResult_OpenChannelDecodeErrorZPtr, + /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ { - CResult_TxCompleteDecodeErrorZ { - contents: CResult_TxCompleteDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelDecodeErrorZ in the success state. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ { + CResult_OpenChannelDecodeErrorZ { + contents: CResult_OpenChannelDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ { - CResult_TxCompleteDecodeErrorZ { - contents: CResult_TxCompleteDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelDecodeErrorZ in the error state. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ { + CResult_OpenChannelDecodeErrorZ { + contents: CResult_OpenChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17758,13 +21240,13 @@ pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxCompleteDecodeErrorZ. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { } -impl Drop for CResult_TxCompleteDecodeErrorZ { +/// Frees any resources used by the CResult_OpenChannelDecodeErrorZ. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { } +impl Drop for CResult_OpenChannelDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17777,16 +21259,16 @@ impl Drop for CResult_TxCompleteDecodeErrorZ { } } } -impl From> for CResult_TxCompleteDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OpenChannelDecodeErrorZ { + 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_TxCompleteDecodeErrorZPtr { result } + CResult_OpenChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCompleteDecodeErrorZPtr { err } + CResult_OpenChannelDecodeErrorZPtr { err } }; Self { contents, @@ -17794,59 +21276,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxSignaturesDecodeErrorZ -pub union CResult_TxSignaturesDecodeErrorZPtr { +/// The contents of CResult_OpenChannelV2DecodeErrorZ +pub union CResult_OpenChannelV2DecodeErrorZPtr { /// 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::TxSignatures, + pub result: *mut crate::lightning::ln::msgs::OpenChannelV2, /// 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_TxSignaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OpenChannelV2 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_TxSignaturesDecodeErrorZ { - /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either +pub struct CResult_OpenChannelV2DecodeErrorZ { + /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxSignaturesDecodeErrorZPtr, - /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state. + pub contents: CResult_OpenChannelV2DecodeErrorZPtr, + /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ { - CResult_TxSignaturesDecodeErrorZ { - contents: CResult_TxSignaturesDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ { + CResult_OpenChannelV2DecodeErrorZ { + contents: CResult_OpenChannelV2DecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ { - CResult_TxSignaturesDecodeErrorZ { - contents: CResult_TxSignaturesDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ { + CResult_OpenChannelV2DecodeErrorZ { + contents: CResult_OpenChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17854,13 +21336,13 @@ pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { } -impl Drop for CResult_TxSignaturesDecodeErrorZ { +/// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { } +impl Drop for CResult_OpenChannelV2DecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17873,16 +21355,16 @@ impl Drop for CResult_TxSignaturesDecodeErrorZ { } } } -impl From> for CResult_TxSignaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OpenChannelV2DecodeErrorZ { + 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_TxSignaturesDecodeErrorZPtr { result } + CResult_OpenChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxSignaturesDecodeErrorZPtr { err } + CResult_OpenChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -17890,59 +21372,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxInitRbfDecodeErrorZ -pub union CResult_TxInitRbfDecodeErrorZPtr { +/// The contents of CResult_RevokeAndACKDecodeErrorZ +pub union CResult_RevokeAndACKDecodeErrorZPtr { /// 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::TxInitRbf, + pub result: *mut crate::lightning::ln::msgs::RevokeAndACK, /// 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_TxInitRbfDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::RevokeAndACK 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_TxInitRbfDecodeErrorZ { - /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either +pub struct CResult_RevokeAndACKDecodeErrorZ { + /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxInitRbfDecodeErrorZPtr, - /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state. + pub contents: CResult_RevokeAndACKDecodeErrorZPtr, + /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ { - CResult_TxInitRbfDecodeErrorZ { - contents: CResult_TxInitRbfDecodeErrorZPtr { +/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ { + CResult_RevokeAndACKDecodeErrorZ { + contents: CResult_RevokeAndACKDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ { - CResult_TxInitRbfDecodeErrorZ { - contents: CResult_TxInitRbfDecodeErrorZPtr { +/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ { + CResult_RevokeAndACKDecodeErrorZ { + contents: CResult_RevokeAndACKDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17950,13 +21432,13 @@ pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { } -impl Drop for CResult_TxInitRbfDecodeErrorZ { +/// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { } +impl Drop for CResult_RevokeAndACKDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17969,16 +21451,16 @@ impl Drop for CResult_TxInitRbfDecodeErrorZ { } } } -impl From> for CResult_TxInitRbfDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RevokeAndACKDecodeErrorZ { + 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_TxInitRbfDecodeErrorZPtr { result } + CResult_RevokeAndACKDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxInitRbfDecodeErrorZPtr { err } + CResult_RevokeAndACKDecodeErrorZPtr { err } }; Self { contents, @@ -17986,59 +21468,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAckRbfDecodeErrorZ -pub union CResult_TxAckRbfDecodeErrorZPtr { +/// The contents of CResult_ShutdownDecodeErrorZ +pub union CResult_ShutdownDecodeErrorZPtr { /// 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::TxAckRbf, + pub result: *mut crate::lightning::ln::msgs::Shutdown, /// 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_TxAckRbfDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Shutdown 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_TxAckRbfDecodeErrorZ { - /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either +pub struct CResult_ShutdownDecodeErrorZ { + /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAckRbfDecodeErrorZPtr, - /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state. + pub contents: CResult_ShutdownDecodeErrorZPtr, + /// Whether this CResult_ShutdownDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ { - CResult_TxAckRbfDecodeErrorZ { - contents: CResult_TxAckRbfDecodeErrorZPtr { +/// Creates a new CResult_ShutdownDecodeErrorZ in the success state. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ { + CResult_ShutdownDecodeErrorZ { + contents: CResult_ShutdownDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ { - CResult_TxAckRbfDecodeErrorZ { - contents: CResult_TxAckRbfDecodeErrorZPtr { +/// Creates a new CResult_ShutdownDecodeErrorZ in the error state. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ { + CResult_ShutdownDecodeErrorZ { + contents: CResult_ShutdownDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18046,13 +21528,13 @@ pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { } -impl Drop for CResult_TxAckRbfDecodeErrorZ { +/// Frees any resources used by the CResult_ShutdownDecodeErrorZ. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { } +impl Drop for CResult_ShutdownDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18065,16 +21547,16 @@ impl Drop for CResult_TxAckRbfDecodeErrorZ { } } } -impl From> for CResult_TxAckRbfDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownDecodeErrorZ { + 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_TxAckRbfDecodeErrorZPtr { result } + CResult_ShutdownDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAckRbfDecodeErrorZPtr { err } + CResult_ShutdownDecodeErrorZPtr { err } }; Self { contents, @@ -18082,59 +21564,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAbortDecodeErrorZ -pub union CResult_TxAbortDecodeErrorZPtr { +/// The contents of CResult_UpdateFailHTLCDecodeErrorZ +pub union CResult_UpdateFailHTLCDecodeErrorZPtr { /// 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::TxAbort, + pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC, /// 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_TxAbortDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_TxAbortDecodeErrorZ { - /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either +pub struct CResult_UpdateFailHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAbortDecodeErrorZPtr, - /// Whether this CResult_TxAbortDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ { - CResult_TxAbortDecodeErrorZ { - contents: CResult_TxAbortDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ { + CResult_UpdateFailHTLCDecodeErrorZ { + contents: CResult_UpdateFailHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ { - CResult_TxAbortDecodeErrorZ { - contents: CResult_TxAbortDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ { + CResult_UpdateFailHTLCDecodeErrorZ { + contents: CResult_UpdateFailHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18142,13 +21624,13 @@ pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAbortDecodeErrorZ. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { } -impl Drop for CResult_TxAbortDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18161,16 +21643,16 @@ impl Drop for CResult_TxAbortDecodeErrorZ { } } } -impl From> for CResult_TxAbortDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFailHTLCDecodeErrorZ { + 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_TxAbortDecodeErrorZPtr { result } + CResult_UpdateFailHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAbortDecodeErrorZPtr { err } + CResult_UpdateFailHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18178,59 +21660,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AnnouncementSignaturesDecodeErrorZ -pub union CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ +pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { /// 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::AnnouncementSignatures, + pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC, /// 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_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_AnnouncementSignaturesDecodeErrorZ { - /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr, - /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. +pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ { - CResult_AnnouncementSignaturesDecodeErrorZ { - contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { + CResult_UpdateFailMalformedHTLCDecodeErrorZ { + contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ { - CResult_AnnouncementSignaturesDecodeErrorZ { - contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { + CResult_UpdateFailMalformedHTLCDecodeErrorZ { + contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18238,13 +21720,13 @@ pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { } -impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18257,16 +21739,16 @@ impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { } } } -impl From> for CResult_AnnouncementSignaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFailMalformedHTLCDecodeErrorZ { + 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_AnnouncementSignaturesDecodeErrorZPtr { result } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AnnouncementSignaturesDecodeErrorZPtr { err } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18274,59 +21756,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReestablishDecodeErrorZ -pub union CResult_ChannelReestablishDecodeErrorZPtr { +/// The contents of CResult_UpdateFeeDecodeErrorZ +pub union CResult_UpdateFeeDecodeErrorZPtr { /// 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::ChannelReestablish, + pub result: *mut crate::lightning::ln::msgs::UpdateFee, /// 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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFee 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_ChannelReestablishDecodeErrorZ { - /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either +pub struct CResult_UpdateFeeDecodeErrorZ { + /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelReestablishDecodeErrorZPtr, - /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFeeDecodeErrorZPtr, + /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ { - CResult_ChannelReestablishDecodeErrorZ { - contents: CResult_ChannelReestablishDecodeErrorZPtr { +/// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ { + CResult_UpdateFeeDecodeErrorZ { + contents: CResult_UpdateFeeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ { - CResult_ChannelReestablishDecodeErrorZ { - contents: CResult_ChannelReestablishDecodeErrorZPtr { +/// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ { + CResult_UpdateFeeDecodeErrorZ { + contents: CResult_UpdateFeeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18334,13 +21816,13 @@ pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { } -impl Drop for CResult_ChannelReestablishDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { } +impl Drop for CResult_UpdateFeeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18353,16 +21835,16 @@ impl Drop for CResult_ChannelReestablishDecodeErrorZ { } } } -impl From> for CResult_ChannelReestablishDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFeeDecodeErrorZ { + 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_ChannelReestablishDecodeErrorZPtr { result } + CResult_UpdateFeeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReestablishDecodeErrorZPtr { err } + CResult_UpdateFeeDecodeErrorZPtr { err } }; Self { contents, @@ -18370,59 +21852,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedDecodeErrorZ -pub union CResult_ClosingSignedDecodeErrorZPtr { +/// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ +pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr { /// 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::ClosingSigned, + pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC, /// 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_ClosingSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_ClosingSignedDecodeErrorZ { - /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either +pub struct CResult_UpdateFulfillHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ClosingSignedDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ { - CResult_ClosingSignedDecodeErrorZ { - contents: CResult_ClosingSignedDecodeErrorZPtr { +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ { + CResult_UpdateFulfillHTLCDecodeErrorZ { + contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ { - CResult_ClosingSignedDecodeErrorZ { - contents: CResult_ClosingSignedDecodeErrorZPtr { +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ { + CResult_UpdateFulfillHTLCDecodeErrorZ { + contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18430,13 +21912,13 @@ pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { } -impl Drop for CResult_ClosingSignedDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18449,16 +21931,16 @@ impl Drop for CResult_ClosingSignedDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFulfillHTLCDecodeErrorZ { + 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_ClosingSignedDecodeErrorZPtr { result } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedDecodeErrorZPtr { err } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18466,59 +21948,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ -pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// The contents of CResult_PeerStorageDecodeErrorZ +pub union CResult_PeerStorageDecodeErrorZPtr { /// 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::ClosingSignedFeeRange, + pub result: *mut crate::lightning::ln::msgs::PeerStorage, /// 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_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PeerStorageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::PeerStorage 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_ClosingSignedFeeRangeDecodeErrorZ { - /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either +pub struct CResult_PeerStorageDecodeErrorZ { + /// The contents of this CResult_PeerStorageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + pub contents: CResult_PeerStorageDecodeErrorZPtr, + /// Whether this CResult_PeerStorageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { - CResult_ClosingSignedFeeRangeDecodeErrorZ { - contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// Creates a new CResult_PeerStorageDecodeErrorZ in the success state. +pub extern "C" fn CResult_PeerStorageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::PeerStorage) -> CResult_PeerStorageDecodeErrorZ { + CResult_PeerStorageDecodeErrorZ { + contents: CResult_PeerStorageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { - CResult_ClosingSignedFeeRangeDecodeErrorZ { - contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// Creates a new CResult_PeerStorageDecodeErrorZ in the error state. +pub extern "C" fn CResult_PeerStorageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PeerStorageDecodeErrorZ { + CResult_PeerStorageDecodeErrorZ { + contents: CResult_PeerStorageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18526,13 +22008,13 @@ pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PeerStorageDecodeErrorZ_is_ok(o: &CResult_PeerStorageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } -impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { +/// Frees any resources used by the CResult_PeerStorageDecodeErrorZ. +pub extern "C" fn CResult_PeerStorageDecodeErrorZ_free(_res: CResult_PeerStorageDecodeErrorZ) { } +impl Drop for CResult_PeerStorageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18545,16 +22027,16 @@ impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedFeeRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PeerStorageDecodeErrorZ { + 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_ClosingSignedFeeRangeDecodeErrorZPtr { result } + CResult_PeerStorageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } + CResult_PeerStorageDecodeErrorZPtr { err } }; Self { contents, @@ -18562,59 +22044,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PeerStorageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PeerStorageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PeerStorageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PeerStorageDecodeErrorZ_clone(orig: &CResult_PeerStorageDecodeErrorZ) -> CResult_PeerStorageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentSignedBatchDecodeErrorZ -pub union CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// The contents of CResult_PeerStorageRetrievalDecodeErrorZ +pub union CResult_PeerStorageRetrievalDecodeErrorZPtr { /// 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::CommitmentSignedBatch, + pub result: *mut crate::lightning::ln::msgs::PeerStorageRetrieval, /// 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_CommitmentSignedBatchDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::CommitmentSignedBatch on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PeerStorageRetrievalDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::PeerStorageRetrieval 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_CommitmentSignedBatchDecodeErrorZ { - /// The contents of this CResult_CommitmentSignedBatchDecodeErrorZ, accessible via either +pub struct CResult_PeerStorageRetrievalDecodeErrorZ { + /// The contents of this CResult_PeerStorageRetrievalDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentSignedBatchDecodeErrorZPtr, - /// Whether this CResult_CommitmentSignedBatchDecodeErrorZ represents a success state. + pub contents: CResult_PeerStorageRetrievalDecodeErrorZPtr, + /// Whether this CResult_PeerStorageRetrievalDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSignedBatch) -> CResult_CommitmentSignedBatchDecodeErrorZ { - CResult_CommitmentSignedBatchDecodeErrorZ { - contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// Creates a new CResult_PeerStorageRetrievalDecodeErrorZ in the success state. +pub extern "C" fn CResult_PeerStorageRetrievalDecodeErrorZ_ok(o: crate::lightning::ln::msgs::PeerStorageRetrieval) -> CResult_PeerStorageRetrievalDecodeErrorZ { + CResult_PeerStorageRetrievalDecodeErrorZ { + contents: CResult_PeerStorageRetrievalDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedBatchDecodeErrorZ { - CResult_CommitmentSignedBatchDecodeErrorZ { - contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// Creates a new CResult_PeerStorageRetrievalDecodeErrorZ in the error state. +pub extern "C" fn CResult_PeerStorageRetrievalDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PeerStorageRetrievalDecodeErrorZ { + CResult_PeerStorageRetrievalDecodeErrorZ { + contents: CResult_PeerStorageRetrievalDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18622,13 +22104,13 @@ pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedBatchDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PeerStorageRetrievalDecodeErrorZ_is_ok(o: &CResult_PeerStorageRetrievalDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentSignedBatchDecodeErrorZ. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_free(_res: CResult_CommitmentSignedBatchDecodeErrorZ) { } -impl Drop for CResult_CommitmentSignedBatchDecodeErrorZ { +/// Frees any resources used by the CResult_PeerStorageRetrievalDecodeErrorZ. +pub extern "C" fn CResult_PeerStorageRetrievalDecodeErrorZ_free(_res: CResult_PeerStorageRetrievalDecodeErrorZ) { } +impl Drop for CResult_PeerStorageRetrievalDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18641,16 +22123,16 @@ impl Drop for CResult_CommitmentSignedBatchDecodeErrorZ { } } } -impl From> for CResult_CommitmentSignedBatchDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PeerStorageRetrievalDecodeErrorZ { + 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_CommitmentSignedBatchDecodeErrorZPtr { result } + CResult_PeerStorageRetrievalDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentSignedBatchDecodeErrorZPtr { err } + CResult_PeerStorageRetrievalDecodeErrorZPtr { err } }; Self { contents, @@ -18658,59 +22140,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PeerStorageRetrievalDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PeerStorageRetrievalDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PeerStorageRetrievalDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_clone(orig: &CResult_CommitmentSignedBatchDecodeErrorZ) -> CResult_CommitmentSignedBatchDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PeerStorageRetrievalDecodeErrorZ_clone(orig: &CResult_PeerStorageRetrievalDecodeErrorZ) -> CResult_PeerStorageRetrievalDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentSignedDecodeErrorZ -pub union CResult_CommitmentSignedDecodeErrorZPtr { +/// The contents of CResult_StartBatchDecodeErrorZ +pub union CResult_StartBatchDecodeErrorZPtr { /// 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::CommitmentSigned, + pub result: *mut crate::lightning::ln::msgs::StartBatch, /// 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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_StartBatchDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::StartBatch 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_CommitmentSignedDecodeErrorZ { - /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either +pub struct CResult_StartBatchDecodeErrorZ { + /// The contents of this CResult_StartBatchDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentSignedDecodeErrorZPtr, - /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state. + pub contents: CResult_StartBatchDecodeErrorZPtr, + /// Whether this CResult_StartBatchDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ { - CResult_CommitmentSignedDecodeErrorZ { - contents: CResult_CommitmentSignedDecodeErrorZPtr { +/// Creates a new CResult_StartBatchDecodeErrorZ in the success state. +pub extern "C" fn CResult_StartBatchDecodeErrorZ_ok(o: crate::lightning::ln::msgs::StartBatch) -> CResult_StartBatchDecodeErrorZ { + CResult_StartBatchDecodeErrorZ { + contents: CResult_StartBatchDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ { - CResult_CommitmentSignedDecodeErrorZ { - contents: CResult_CommitmentSignedDecodeErrorZPtr { +/// Creates a new CResult_StartBatchDecodeErrorZ in the error state. +pub extern "C" fn CResult_StartBatchDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StartBatchDecodeErrorZ { + CResult_StartBatchDecodeErrorZ { + contents: CResult_StartBatchDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18718,13 +22200,13 @@ pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_StartBatchDecodeErrorZ_is_ok(o: &CResult_StartBatchDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { } -impl Drop for CResult_CommitmentSignedDecodeErrorZ { +/// Frees any resources used by the CResult_StartBatchDecodeErrorZ. +pub extern "C" fn CResult_StartBatchDecodeErrorZ_free(_res: CResult_StartBatchDecodeErrorZ) { } +impl Drop for CResult_StartBatchDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18737,16 +22219,16 @@ impl Drop for CResult_CommitmentSignedDecodeErrorZ { } } } -impl From> for CResult_CommitmentSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StartBatchDecodeErrorZ { + 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_CommitmentSignedDecodeErrorZPtr { result } + CResult_StartBatchDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentSignedDecodeErrorZPtr { err } + CResult_StartBatchDecodeErrorZPtr { err } }; Self { contents, @@ -18754,59 +22236,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StartBatchDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_StartBatchDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_StartBatchDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StartBatchDecodeErrorZ_clone(orig: &CResult_StartBatchDecodeErrorZ) -> CResult_StartBatchDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingCreatedDecodeErrorZ -pub union CResult_FundingCreatedDecodeErrorZPtr { +/// The contents of CResult_OnionPacketDecodeErrorZ +pub union CResult_OnionPacketDecodeErrorZPtr { /// 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::FundingCreated, + pub result: *mut crate::lightning::ln::msgs::OnionPacket, /// 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_FundingCreatedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OnionPacket 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_FundingCreatedDecodeErrorZ { - /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either +pub struct CResult_OnionPacketDecodeErrorZ { + /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingCreatedDecodeErrorZPtr, - /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. + pub contents: CResult_OnionPacketDecodeErrorZPtr, + /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ { - CResult_FundingCreatedDecodeErrorZ { - contents: CResult_FundingCreatedDecodeErrorZPtr { +/// Creates a new CResult_OnionPacketDecodeErrorZ in the success state. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ { + CResult_OnionPacketDecodeErrorZ { + contents: CResult_OnionPacketDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ { - CResult_FundingCreatedDecodeErrorZ { - contents: CResult_FundingCreatedDecodeErrorZPtr { +/// Creates a new CResult_OnionPacketDecodeErrorZ in the error state. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ { + CResult_OnionPacketDecodeErrorZ { + contents: CResult_OnionPacketDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18814,13 +22296,13 @@ pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { } -impl Drop for CResult_FundingCreatedDecodeErrorZ { +/// Frees any resources used by the CResult_OnionPacketDecodeErrorZ. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { } +impl Drop for CResult_OnionPacketDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18833,16 +22315,16 @@ impl Drop for CResult_FundingCreatedDecodeErrorZ { } } } -impl From> for CResult_FundingCreatedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OnionPacketDecodeErrorZ { + 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_FundingCreatedDecodeErrorZPtr { result } + CResult_OnionPacketDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingCreatedDecodeErrorZPtr { err } + CResult_OnionPacketDecodeErrorZPtr { err } }; Self { contents, @@ -18850,59 +22332,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingSignedDecodeErrorZ -pub union CResult_FundingSignedDecodeErrorZPtr { +/// The contents of CResult_UpdateAddHTLCDecodeErrorZ +pub union CResult_UpdateAddHTLCDecodeErrorZPtr { /// 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::FundingSigned, + pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC, /// 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_FundingSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_FundingSignedDecodeErrorZ { - /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either +pub struct CResult_UpdateAddHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingSignedDecodeErrorZPtr, - /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state. + pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ { - CResult_FundingSignedDecodeErrorZ { - contents: CResult_FundingSignedDecodeErrorZPtr { +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ { + CResult_UpdateAddHTLCDecodeErrorZ { + contents: CResult_UpdateAddHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ { - CResult_FundingSignedDecodeErrorZ { - contents: CResult_FundingSignedDecodeErrorZPtr { +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ { + CResult_UpdateAddHTLCDecodeErrorZ { + contents: CResult_UpdateAddHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18910,13 +22392,13 @@ pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FundingSignedDecodeErrorZ. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { } -impl Drop for CResult_FundingSignedDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18929,16 +22411,16 @@ impl Drop for CResult_FundingSignedDecodeErrorZ { } } } -impl From> for CResult_FundingSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateAddHTLCDecodeErrorZ { + 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_FundingSignedDecodeErrorZPtr { result } + CResult_UpdateAddHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingSignedDecodeErrorZPtr { err } + CResult_UpdateAddHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18946,59 +22428,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReadyDecodeErrorZ -pub union CResult_ChannelReadyDecodeErrorZPtr { +/// The contents of CResult_OnionMessageDecodeErrorZ +pub union CResult_OnionMessageDecodeErrorZPtr { /// 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::ChannelReady, + pub result: *mut crate::lightning::ln::msgs::OnionMessage, /// 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_ChannelReadyDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OnionMessage 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_ChannelReadyDecodeErrorZ { - /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either +pub struct CResult_OnionMessageDecodeErrorZ { + /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelReadyDecodeErrorZPtr, - /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state. + pub contents: CResult_OnionMessageDecodeErrorZPtr, + /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ { - CResult_ChannelReadyDecodeErrorZ { - contents: CResult_ChannelReadyDecodeErrorZPtr { +/// Creates a new CResult_OnionMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ { + CResult_OnionMessageDecodeErrorZ { + contents: CResult_OnionMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ { - CResult_ChannelReadyDecodeErrorZ { - contents: CResult_ChannelReadyDecodeErrorZPtr { +/// Creates a new CResult_OnionMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ { + CResult_OnionMessageDecodeErrorZ { + contents: CResult_OnionMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19006,13 +22488,13 @@ pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { } -impl Drop for CResult_ChannelReadyDecodeErrorZ { +/// Frees any resources used by the CResult_OnionMessageDecodeErrorZ. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { } +impl Drop for CResult_OnionMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19025,16 +22507,16 @@ impl Drop for CResult_ChannelReadyDecodeErrorZ { } } } -impl From> for CResult_ChannelReadyDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OnionMessageDecodeErrorZ { + 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_ChannelReadyDecodeErrorZPtr { result } + CResult_OnionMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReadyDecodeErrorZPtr { err } + CResult_OnionMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19042,59 +22524,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InitDecodeErrorZ -pub union CResult_InitDecodeErrorZPtr { +/// The contents of CResult_FinalOnionHopDataDecodeErrorZ +pub union CResult_FinalOnionHopDataDecodeErrorZPtr { /// 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::Init, + pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData, /// 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_InitDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FinalOnionHopData 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_InitDecodeErrorZ { - /// The contents of this CResult_InitDecodeErrorZ, accessible via either +pub struct CResult_FinalOnionHopDataDecodeErrorZ { + /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InitDecodeErrorZPtr, - /// Whether this CResult_InitDecodeErrorZ represents a success state. + pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr, + /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ in the success state. -pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ { - CResult_InitDecodeErrorZ { - contents: CResult_InitDecodeErrorZPtr { +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ { + CResult_FinalOnionHopDataDecodeErrorZ { + contents: CResult_FinalOnionHopDataDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ in the error state. -pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ { - CResult_InitDecodeErrorZ { - contents: CResult_InitDecodeErrorZPtr { +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ { + CResult_FinalOnionHopDataDecodeErrorZ { + contents: CResult_FinalOnionHopDataDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19102,13 +22584,13 @@ pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InitDecodeErrorZ. -pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { } -impl Drop for CResult_InitDecodeErrorZ { +/// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { } +impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19121,16 +22603,16 @@ impl Drop for CResult_InitDecodeErrorZ { } } } -impl From> for CResult_InitDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FinalOnionHopDataDecodeErrorZ { + 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_InitDecodeErrorZPtr { result } + CResult_FinalOnionHopDataDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InitDecodeErrorZPtr { err } + CResult_FinalOnionHopDataDecodeErrorZPtr { err } }; Self { contents, @@ -19138,59 +22620,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelDecodeErrorZ -pub union CResult_OpenChannelDecodeErrorZPtr { +/// The contents of CResult_PingDecodeErrorZ +pub union CResult_PingDecodeErrorZPtr { /// 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::OpenChannel, + pub result: *mut crate::lightning::ln::msgs::Ping, /// 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_OpenChannelDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PingDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Ping 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_OpenChannelDecodeErrorZ { - /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either +pub struct CResult_PingDecodeErrorZ { + /// The contents of this CResult_PingDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OpenChannelDecodeErrorZPtr, - /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state. + pub contents: CResult_PingDecodeErrorZPtr, + /// Whether this CResult_PingDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ in the success state. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ { - CResult_OpenChannelDecodeErrorZ { - contents: CResult_OpenChannelDecodeErrorZPtr { +/// Creates a new CResult_PingDecodeErrorZ in the success state. +pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ { + CResult_PingDecodeErrorZ { + contents: CResult_PingDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ in the error state. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ { - CResult_OpenChannelDecodeErrorZ { - contents: CResult_OpenChannelDecodeErrorZPtr { +/// Creates a new CResult_PingDecodeErrorZ in the error state. +pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ { + CResult_PingDecodeErrorZ { + contents: CResult_PingDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19198,13 +22680,13 @@ pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OpenChannelDecodeErrorZ. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { } -impl Drop for CResult_OpenChannelDecodeErrorZ { +/// Frees any resources used by the CResult_PingDecodeErrorZ. +pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { } +impl Drop for CResult_PingDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19217,16 +22699,16 @@ impl Drop for CResult_OpenChannelDecodeErrorZ { } } } -impl From> for CResult_OpenChannelDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PingDecodeErrorZ { + 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_OpenChannelDecodeErrorZPtr { result } + CResult_PingDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelDecodeErrorZPtr { err } + CResult_PingDecodeErrorZPtr { err } }; Self { contents, @@ -19234,59 +22716,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelV2DecodeErrorZ -pub union CResult_OpenChannelV2DecodeErrorZPtr { +/// The contents of CResult_PongDecodeErrorZ +pub union CResult_PongDecodeErrorZPtr { /// 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::OpenChannelV2, + pub result: *mut crate::lightning::ln::msgs::Pong, /// 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_OpenChannelV2DecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PongDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Pong 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_OpenChannelV2DecodeErrorZ { - /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either +pub struct CResult_PongDecodeErrorZ { + /// The contents of this CResult_PongDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OpenChannelV2DecodeErrorZPtr, - /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state. + pub contents: CResult_PongDecodeErrorZPtr, + /// Whether this CResult_PongDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ { - CResult_OpenChannelV2DecodeErrorZ { - contents: CResult_OpenChannelV2DecodeErrorZPtr { +/// Creates a new CResult_PongDecodeErrorZ in the success state. +pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ { + CResult_PongDecodeErrorZ { + contents: CResult_PongDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ { - CResult_OpenChannelV2DecodeErrorZ { - contents: CResult_OpenChannelV2DecodeErrorZPtr { +/// Creates a new CResult_PongDecodeErrorZ in the error state. +pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ { + CResult_PongDecodeErrorZ { + contents: CResult_PongDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19294,13 +22776,13 @@ pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool { +pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { } -impl Drop for CResult_OpenChannelV2DecodeErrorZ { +/// Frees any resources used by the CResult_PongDecodeErrorZ. +pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { } +impl Drop for CResult_PongDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19313,16 +22795,16 @@ impl Drop for CResult_OpenChannelV2DecodeErrorZ { } } } -impl From> for CResult_OpenChannelV2DecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PongDecodeErrorZ { + 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_OpenChannelV2DecodeErrorZPtr { result } + CResult_PongDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelV2DecodeErrorZPtr { err } + CResult_PongDecodeErrorZPtr { err } }; Self { contents, @@ -19330,59 +22812,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RevokeAndACKDecodeErrorZ -pub union CResult_RevokeAndACKDecodeErrorZPtr { +/// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ +pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { /// 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::RevokeAndACK, + pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement, /// 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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_RevokeAndACKDecodeErrorZ { - /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either +pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ { + /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RevokeAndACKDecodeErrorZPtr, - /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr, + /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ { - CResult_RevokeAndACKDecodeErrorZ { - contents: CResult_RevokeAndACKDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { + CResult_UnsignedChannelAnnouncementDecodeErrorZ { + contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ { - CResult_RevokeAndACKDecodeErrorZ { - contents: CResult_RevokeAndACKDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { + CResult_UnsignedChannelAnnouncementDecodeErrorZ { + contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19390,13 +22872,13 @@ pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { } -impl Drop for CResult_RevokeAndACKDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { } +impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19409,16 +22891,16 @@ impl Drop for CResult_RevokeAndACKDecodeErrorZ { } } } -impl From> for CResult_RevokeAndACKDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedChannelAnnouncementDecodeErrorZ { + 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_RevokeAndACKDecodeErrorZPtr { result } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RevokeAndACKDecodeErrorZPtr { err } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19426,59 +22908,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownDecodeErrorZ -pub union CResult_ShutdownDecodeErrorZPtr { +/// The contents of CResult_ChannelAnnouncementDecodeErrorZ +pub union CResult_ChannelAnnouncementDecodeErrorZPtr { /// 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::Shutdown, + pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement, /// 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_ShutdownDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ShutdownDecodeErrorZ { - /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either +pub struct CResult_ChannelAnnouncementDecodeErrorZ { + /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownDecodeErrorZPtr, - /// Whether this CResult_ShutdownDecodeErrorZ represents a success state. + pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr, + /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ in the success state. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ { - CResult_ShutdownDecodeErrorZ { - contents: CResult_ShutdownDecodeErrorZPtr { +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ { + CResult_ChannelAnnouncementDecodeErrorZ { + contents: CResult_ChannelAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ in the error state. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ { - CResult_ShutdownDecodeErrorZ { - contents: CResult_ShutdownDecodeErrorZPtr { +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ { + CResult_ChannelAnnouncementDecodeErrorZ { + contents: CResult_ChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19486,13 +22968,13 @@ pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownDecodeErrorZ. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { } -impl Drop for CResult_ShutdownDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { } +impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19505,16 +22987,16 @@ impl Drop for CResult_ShutdownDecodeErrorZ { } } } -impl From> for CResult_ShutdownDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelAnnouncementDecodeErrorZ { + 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_ShutdownDecodeErrorZPtr { result } + CResult_ChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownDecodeErrorZPtr { err } + CResult_ChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19522,59 +23004,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailHTLCDecodeErrorZ -pub union CResult_UpdateFailHTLCDecodeErrorZPtr { +/// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ +pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr { /// 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::UpdateFailHTLC, + pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate, /// 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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UpdateFailHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either +pub struct CResult_UnsignedChannelUpdateDecodeErrorZ { + /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr, + /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ { - CResult_UpdateFailHTLCDecodeErrorZ { - contents: CResult_UpdateFailHTLCDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ { + CResult_UnsignedChannelUpdateDecodeErrorZ { + contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ { - CResult_UpdateFailHTLCDecodeErrorZ { - contents: CResult_UpdateFailHTLCDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ { + CResult_UnsignedChannelUpdateDecodeErrorZ { + contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19582,13 +23064,13 @@ pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { } +impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19601,16 +23083,16 @@ impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedChannelUpdateDecodeErrorZ { + 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_UpdateFailHTLCDecodeErrorZPtr { result } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailHTLCDecodeErrorZPtr { err } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19618,59 +23100,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ -pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// The contents of CResult_ChannelUpdateDecodeErrorZ +pub union CResult_ChannelUpdateDecodeErrorZPtr { /// 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::UpdateFailMalformedHTLC, + pub result: *mut crate::lightning::ln::msgs::ChannelUpdate, /// 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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelUpdate 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_UpdateFailMalformedHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either +pub struct CResult_ChannelUpdateDecodeErrorZ { + /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state. + pub contents: CResult_ChannelUpdateDecodeErrorZPtr, + /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { - CResult_UpdateFailMalformedHTLCDecodeErrorZ { - contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ { + CResult_ChannelUpdateDecodeErrorZ { + contents: CResult_ChannelUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { - CResult_UpdateFailMalformedHTLCDecodeErrorZ { - contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ { + CResult_ChannelUpdateDecodeErrorZ { + contents: CResult_ChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19678,13 +23160,13 @@ pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { } +impl Drop for CResult_ChannelUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19697,16 +23179,16 @@ impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailMalformedHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelUpdateDecodeErrorZ { + 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result } + CResult_ChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } + CResult_ChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19714,59 +23196,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFeeDecodeErrorZ -pub union CResult_UpdateFeeDecodeErrorZPtr { +/// The contents of CResult_ErrorMessageDecodeErrorZ +pub union CResult_ErrorMessageDecodeErrorZPtr { /// 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::UpdateFee, + pub result: *mut crate::lightning::ln::msgs::ErrorMessage, /// 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_UpdateFeeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ErrorMessage 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_UpdateFeeDecodeErrorZ { - /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either +pub struct CResult_ErrorMessageDecodeErrorZ { + /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFeeDecodeErrorZPtr, - /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state. + pub contents: CResult_ErrorMessageDecodeErrorZPtr, + /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ { - CResult_UpdateFeeDecodeErrorZ { - contents: CResult_UpdateFeeDecodeErrorZPtr { +/// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ { + CResult_ErrorMessageDecodeErrorZ { + contents: CResult_ErrorMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ { - CResult_UpdateFeeDecodeErrorZ { - contents: CResult_UpdateFeeDecodeErrorZPtr { +/// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ { + CResult_ErrorMessageDecodeErrorZ { + contents: CResult_ErrorMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19774,13 +23256,13 @@ pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { } -impl Drop for CResult_UpdateFeeDecodeErrorZ { +/// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { } +impl Drop for CResult_ErrorMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19793,16 +23275,16 @@ impl Drop for CResult_UpdateFeeDecodeErrorZ { } } } -impl From> for CResult_UpdateFeeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ErrorMessageDecodeErrorZ { + 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_UpdateFeeDecodeErrorZPtr { result } + CResult_ErrorMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFeeDecodeErrorZPtr { err } + CResult_ErrorMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19810,59 +23292,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ -pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// The contents of CResult_WarningMessageDecodeErrorZ +pub union CResult_WarningMessageDecodeErrorZPtr { /// 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::UpdateFulfillHTLC, + pub result: *mut crate::lightning::ln::msgs::WarningMessage, /// 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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::WarningMessage 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_UpdateFulfillHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either +pub struct CResult_WarningMessageDecodeErrorZ { + /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state. + pub contents: CResult_WarningMessageDecodeErrorZPtr, + /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ { - CResult_UpdateFulfillHTLCDecodeErrorZ { - contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// Creates a new CResult_WarningMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ { + CResult_WarningMessageDecodeErrorZ { + contents: CResult_WarningMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ { - CResult_UpdateFulfillHTLCDecodeErrorZ { - contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// Creates a new CResult_WarningMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ { + CResult_WarningMessageDecodeErrorZ { + contents: CResult_WarningMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19870,13 +23352,13 @@ pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_WarningMessageDecodeErrorZ. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { } +impl Drop for CResult_WarningMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19889,16 +23371,16 @@ impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFulfillHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_WarningMessageDecodeErrorZ { + 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_UpdateFulfillHTLCDecodeErrorZPtr { result } + CResult_WarningMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } + CResult_WarningMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19906,59 +23388,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionPacketDecodeErrorZ -pub union CResult_OnionPacketDecodeErrorZPtr { +/// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ +pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { /// 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::OnionPacket, + pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement, /// 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_OnionPacketDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_OnionPacketDecodeErrorZ { - /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either +pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ { + /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionPacketDecodeErrorZPtr, - /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr, + /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ in the success state. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ { - CResult_OnionPacketDecodeErrorZ { - contents: CResult_OnionPacketDecodeErrorZPtr { +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { + CResult_UnsignedNodeAnnouncementDecodeErrorZ { + contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ in the error state. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ { - CResult_OnionPacketDecodeErrorZ { - contents: CResult_OnionPacketDecodeErrorZPtr { +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { + CResult_UnsignedNodeAnnouncementDecodeErrorZ { + contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19966,13 +23448,13 @@ pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionPacketDecodeErrorZ. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { } -impl Drop for CResult_OnionPacketDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { } +impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19985,16 +23467,16 @@ impl Drop for CResult_OnionPacketDecodeErrorZ { } } } -impl From> for CResult_OnionPacketDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedNodeAnnouncementDecodeErrorZ { + 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_OnionPacketDecodeErrorZPtr { result } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionPacketDecodeErrorZPtr { err } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -20002,59 +23484,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateAddHTLCDecodeErrorZ -pub union CResult_UpdateAddHTLCDecodeErrorZPtr { +/// The contents of CResult_NodeAnnouncementDecodeErrorZ +pub union CResult_NodeAnnouncementDecodeErrorZPtr { /// 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::UpdateAddHTLC, + pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement, /// 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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::NodeAnnouncement 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_UpdateAddHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either +pub struct CResult_NodeAnnouncementDecodeErrorZ { + /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state. + pub contents: CResult_NodeAnnouncementDecodeErrorZPtr, + /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ { - CResult_UpdateAddHTLCDecodeErrorZ { - contents: CResult_UpdateAddHTLCDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ { + CResult_NodeAnnouncementDecodeErrorZ { + contents: CResult_NodeAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ { - CResult_UpdateAddHTLCDecodeErrorZ { - contents: CResult_UpdateAddHTLCDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ { + CResult_NodeAnnouncementDecodeErrorZ { + contents: CResult_NodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20062,13 +23544,13 @@ pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { } +impl Drop for CResult_NodeAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20081,16 +23563,16 @@ impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateAddHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAnnouncementDecodeErrorZ { + 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_UpdateAddHTLCDecodeErrorZPtr { result } + CResult_NodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateAddHTLCDecodeErrorZPtr { err } + CResult_NodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -20098,59 +23580,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionMessageDecodeErrorZ -pub union CResult_OnionMessageDecodeErrorZPtr { +/// The contents of CResult_QueryShortChannelIdsDecodeErrorZ +pub union CResult_QueryShortChannelIdsDecodeErrorZPtr { /// 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::OnionMessage, + pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds, /// 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_OnionMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_OnionMessageDecodeErrorZ { - /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either +pub struct CResult_QueryShortChannelIdsDecodeErrorZ { + /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionMessageDecodeErrorZPtr, - /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state. + pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr, + /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ { - CResult_OnionMessageDecodeErrorZ { - contents: CResult_OnionMessageDecodeErrorZPtr { +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ { + CResult_QueryShortChannelIdsDecodeErrorZ { + contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ { - CResult_OnionMessageDecodeErrorZ { - contents: CResult_OnionMessageDecodeErrorZPtr { +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ { + CResult_QueryShortChannelIdsDecodeErrorZ { + contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20158,13 +23640,13 @@ pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionMessageDecodeErrorZ. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { } -impl Drop for CResult_OnionMessageDecodeErrorZ { +/// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { } +impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20177,16 +23659,16 @@ impl Drop for CResult_OnionMessageDecodeErrorZ { } } } -impl From> for CResult_OnionMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_QueryShortChannelIdsDecodeErrorZ { + 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_OnionMessageDecodeErrorZPtr { result } + CResult_QueryShortChannelIdsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionMessageDecodeErrorZPtr { err } + CResult_QueryShortChannelIdsDecodeErrorZPtr { err } }; Self { contents, @@ -20194,59 +23676,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FinalOnionHopDataDecodeErrorZ -pub union CResult_FinalOnionHopDataDecodeErrorZPtr { +/// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ +pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { /// 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::FinalOnionHopData, + pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, /// 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_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd 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_FinalOnionHopDataDecodeErrorZ { - /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either +pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ { + /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr, - /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. + pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr, + /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ { - CResult_FinalOnionHopDataDecodeErrorZ { - contents: CResult_FinalOnionHopDataDecodeErrorZPtr { +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { + CResult_ReplyShortChannelIdsEndDecodeErrorZ { + contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ { - CResult_FinalOnionHopDataDecodeErrorZ { - contents: CResult_FinalOnionHopDataDecodeErrorZPtr { +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { + CResult_ReplyShortChannelIdsEndDecodeErrorZ { + contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20254,13 +23736,13 @@ pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { } -impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { +/// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { } +impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20273,16 +23755,16 @@ impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { } } } -impl From> for CResult_FinalOnionHopDataDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReplyShortChannelIdsEndDecodeErrorZ { + 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_FinalOnionHopDataDecodeErrorZPtr { result } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FinalOnionHopDataDecodeErrorZPtr { err } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err } }; Self { contents, @@ -20290,59 +23772,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PingDecodeErrorZ -pub union CResult_PingDecodeErrorZPtr { +/// The contents of CResult_QueryChannelRangeDecodeErrorZ +pub union CResult_QueryChannelRangeDecodeErrorZPtr { /// 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::Ping, + pub result: *mut crate::lightning::ln::msgs::QueryChannelRange, /// 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_PingDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::QueryChannelRange 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_PingDecodeErrorZ { - /// The contents of this CResult_PingDecodeErrorZ, accessible via either +pub struct CResult_QueryChannelRangeDecodeErrorZ { + /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PingDecodeErrorZPtr, - /// Whether this CResult_PingDecodeErrorZ represents a success state. + pub contents: CResult_QueryChannelRangeDecodeErrorZPtr, + /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ in the success state. -pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ { - CResult_PingDecodeErrorZ { - contents: CResult_PingDecodeErrorZPtr { +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ { + CResult_QueryChannelRangeDecodeErrorZ { + contents: CResult_QueryChannelRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ in the error state. -pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ { - CResult_PingDecodeErrorZ { - contents: CResult_PingDecodeErrorZPtr { +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ { + CResult_QueryChannelRangeDecodeErrorZ { + contents: CResult_QueryChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20350,13 +23832,13 @@ pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool { +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PingDecodeErrorZ. -pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { } -impl Drop for CResult_PingDecodeErrorZ { +/// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { } +impl Drop for CResult_QueryChannelRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20369,16 +23851,16 @@ impl Drop for CResult_PingDecodeErrorZ { } } } -impl From> for CResult_PingDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_QueryChannelRangeDecodeErrorZ { + 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_PingDecodeErrorZPtr { result } + CResult_QueryChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PingDecodeErrorZPtr { err } + CResult_QueryChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -20386,59 +23868,59 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + if self.result_ok { + Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PongDecodeErrorZ -pub union CResult_PongDecodeErrorZPtr { +/// The contents of CResult_ReplyChannelRangeDecodeErrorZ +pub union CResult_ReplyChannelRangeDecodeErrorZPtr { /// 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::Pong, + pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange, /// 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_PongDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ReplyChannelRange 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_PongDecodeErrorZ { - /// The contents of this CResult_PongDecodeErrorZ, accessible via either +pub struct CResult_ReplyChannelRangeDecodeErrorZ { + /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PongDecodeErrorZPtr, - /// Whether this CResult_PongDecodeErrorZ represents a success state. + pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr, + /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ in the success state. -pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ { - CResult_PongDecodeErrorZ { - contents: CResult_PongDecodeErrorZPtr { +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ { + CResult_ReplyChannelRangeDecodeErrorZ { + contents: CResult_ReplyChannelRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ in the error state. -pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ { - CResult_PongDecodeErrorZ { - contents: CResult_PongDecodeErrorZPtr { +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ { + CResult_ReplyChannelRangeDecodeErrorZ { + contents: CResult_ReplyChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20446,13 +23928,13 @@ pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PongDecodeErrorZ. -pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { } -impl Drop for CResult_PongDecodeErrorZ { +/// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { } +impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20465,16 +23947,16 @@ impl Drop for CResult_PongDecodeErrorZ { } } } -impl From> for CResult_PongDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReplyChannelRangeDecodeErrorZ { + 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_PongDecodeErrorZPtr { result } + CResult_ReplyChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PongDecodeErrorZPtr { err } + CResult_ReplyChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -20482,59 +23964,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ -pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// The contents of CResult_GossipTimestampFilterDecodeErrorZ +pub union CResult_GossipTimestampFilterDecodeErrorZPtr { /// 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::UnsignedChannelAnnouncement, + pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter, /// 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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::GossipTimestampFilter 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_UnsignedChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_GossipTimestampFilterDecodeErrorZ { + /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr, + /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { - CResult_UnsignedChannelAnnouncementDecodeErrorZ { - contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ { + CResult_GossipTimestampFilterDecodeErrorZ { + contents: CResult_GossipTimestampFilterDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { - CResult_UnsignedChannelAnnouncementDecodeErrorZ { - contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ { + CResult_GossipTimestampFilterDecodeErrorZ { + contents: CResult_GossipTimestampFilterDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20542,13 +24024,13 @@ pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { } -impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { } +impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20561,16 +24043,16 @@ impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_GossipTimestampFilterDecodeErrorZ { + 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result } + CResult_GossipTimestampFilterDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } + CResult_GossipTimestampFilterDecodeErrorZPtr { err } }; Self { contents, @@ -20578,59 +24060,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelAnnouncementDecodeErrorZ -pub union CResult_ChannelAnnouncementDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not +pub enum COption_InboundHTLCStateDetailsZ { + /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails + Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails), + /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing + None +} +impl COption_InboundHTLCStateDetailsZ { + #[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::channel_state::InboundHTLCStateDetails { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails +pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ { + COption_InboundHTLCStateDetailsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing +pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ { + COption_InboundHTLCStateDetailsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state +pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { } +#[no_mangle] +/// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ +pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { /// 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::ChannelAnnouncement, + pub result: *mut crate::c_types::derived::COption_InboundHTLCStateDetailsZ, /// 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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ 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_ChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr, + /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ { - CResult_ChannelAnnouncementDecodeErrorZ { - contents: CResult_ChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ { - CResult_ChannelAnnouncementDecodeErrorZ { - contents: CResult_ChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20638,13 +24157,13 @@ pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { } -impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { } +impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20657,16 +24176,16 @@ impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_ChannelAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + 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_ChannelAnnouncementDecodeErrorZPtr { result } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelAnnouncementDecodeErrorZPtr { err } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err } }; Self { contents, @@ -20674,59 +24193,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ -pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// The contents of CResult_InboundHTLCDetailsDecodeErrorZ +pub union CResult_InboundHTLCDetailsDecodeErrorZPtr { /// 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::UnsignedChannelUpdate, + pub result: *mut crate::lightning::ln::channel_state::InboundHTLCDetails, /// 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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::InboundHTLCDetails 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_UnsignedChannelUpdateDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either +pub struct CResult_InboundHTLCDetailsDecodeErrorZ { + /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state. + pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr, + /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ { - CResult_UnsignedChannelUpdateDecodeErrorZ { - contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ { + CResult_InboundHTLCDetailsDecodeErrorZ { + contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ { - CResult_UnsignedChannelUpdateDecodeErrorZ { - contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ { + CResult_InboundHTLCDetailsDecodeErrorZ { + contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20734,13 +24253,13 @@ pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { } -impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { } +impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20753,16 +24272,16 @@ impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InboundHTLCDetailsDecodeErrorZ { + 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_UnsignedChannelUpdateDecodeErrorZPtr { result } + CResult_InboundHTLCDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } + CResult_InboundHTLCDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -20770,59 +24289,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelUpdateDecodeErrorZ -pub union CResult_ChannelUpdateDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not +pub enum COption_OutboundHTLCStateDetailsZ { + /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails), + /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing + None +} +impl COption_OutboundHTLCStateDetailsZ { + #[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::channel_state::OutboundHTLCStateDetails { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ { + COption_OutboundHTLCStateDetailsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ { + COption_OutboundHTLCStateDetailsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { } +#[no_mangle] +/// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ +pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { /// 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::ChannelUpdate, + pub result: *mut crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, /// 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_ChannelUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ 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_ChannelUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either +pub struct CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state. + pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr, + /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ { - CResult_ChannelUpdateDecodeErrorZ { - contents: CResult_ChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ { - CResult_ChannelUpdateDecodeErrorZ { - contents: CResult_ChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20830,13 +24386,13 @@ pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { } -impl Drop for CResult_ChannelUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { } +impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20849,16 +24405,16 @@ impl Drop for CResult_ChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_ChannelUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + 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_ChannelUpdateDecodeErrorZPtr { result } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelUpdateDecodeErrorZPtr { err } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err } }; Self { contents, @@ -20866,59 +24422,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ErrorMessageDecodeErrorZ -pub union CResult_ErrorMessageDecodeErrorZPtr { +/// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ +pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr { /// 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::ErrorMessage, + pub result: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails, /// 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_ErrorMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails 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_ErrorMessageDecodeErrorZ { - /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either +pub struct CResult_OutboundHTLCDetailsDecodeErrorZ { + /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ErrorMessageDecodeErrorZPtr, - /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state. + pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr, + /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ { - CResult_ErrorMessageDecodeErrorZ { - contents: CResult_ErrorMessageDecodeErrorZPtr { +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ { + CResult_OutboundHTLCDetailsDecodeErrorZ { + contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ { - CResult_ErrorMessageDecodeErrorZ { - contents: CResult_ErrorMessageDecodeErrorZPtr { +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ { + CResult_OutboundHTLCDetailsDecodeErrorZ { + contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20926,13 +24482,13 @@ pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { } -impl Drop for CResult_ErrorMessageDecodeErrorZ { +/// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { } +impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20945,16 +24501,16 @@ impl Drop for CResult_ErrorMessageDecodeErrorZ { } } } -impl From> for CResult_ErrorMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OutboundHTLCDetailsDecodeErrorZ { + 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_ErrorMessageDecodeErrorZPtr { result } + CResult_OutboundHTLCDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ErrorMessageDecodeErrorZPtr { err } + CResult_OutboundHTLCDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -20962,59 +24518,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_WarningMessageDecodeErrorZ -pub union CResult_WarningMessageDecodeErrorZPtr { +/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ +pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { /// 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::WarningMessage, + pub result: *mut crate::lightning::ln::channel_state::CounterpartyForwardingInfo, /// 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_WarningMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo 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_WarningMessageDecodeErrorZ { - /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either +pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ { + /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_WarningMessageDecodeErrorZPtr, - /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state. + pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr, + /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ { - CResult_WarningMessageDecodeErrorZ { - contents: CResult_WarningMessageDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { + CResult_CounterpartyForwardingInfoDecodeErrorZ { + contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ { - CResult_WarningMessageDecodeErrorZ { - contents: CResult_WarningMessageDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { + CResult_CounterpartyForwardingInfoDecodeErrorZ { + contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21022,13 +24578,13 @@ pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_WarningMessageDecodeErrorZ. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { } -impl Drop for CResult_WarningMessageDecodeErrorZ { +/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { } +impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21041,16 +24597,16 @@ impl Drop for CResult_WarningMessageDecodeErrorZ { } } } -impl From> for CResult_WarningMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CounterpartyForwardingInfoDecodeErrorZ { + 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_WarningMessageDecodeErrorZPtr { result } + CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_WarningMessageDecodeErrorZPtr { err } + CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err } }; Self { contents, @@ -21058,59 +24614,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ -pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// The contents of CResult_ChannelCounterpartyDecodeErrorZ +pub union CResult_ChannelCounterpartyDecodeErrorZPtr { /// 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::UnsignedNodeAnnouncement, + pub result: *mut crate::lightning::ln::channel_state::ChannelCounterparty, /// 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_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelCounterparty 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_UnsignedNodeAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_ChannelCounterpartyDecodeErrorZ { + /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr, + /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { - CResult_UnsignedNodeAnnouncementDecodeErrorZ { - contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ { + CResult_ChannelCounterpartyDecodeErrorZ { + contents: CResult_ChannelCounterpartyDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { - CResult_UnsignedNodeAnnouncementDecodeErrorZ { - contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ { + CResult_ChannelCounterpartyDecodeErrorZ { + contents: CResult_ChannelCounterpartyDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21118,13 +24674,13 @@ pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { } -impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { } +impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21137,16 +24693,16 @@ impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedNodeAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelCounterpartyDecodeErrorZ { + 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result } + CResult_ChannelCounterpartyDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } + CResult_ChannelCounterpartyDecodeErrorZPtr { err } }; Self { contents, @@ -21154,59 +24710,188 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAnnouncementDecodeErrorZ -pub union CResult_NodeAnnouncementDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not +pub enum COption_ChannelShutdownStateZ { + /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState + Some(crate::lightning::ln::channel_state::ChannelShutdownState), + /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing + None +} +impl COption_ChannelShutdownStateZ { + #[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::channel_state::ChannelShutdownState { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState +pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ { + COption_ChannelShutdownStateZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_ChannelShutdownStateZ containing nothing +pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ { + COption_ChannelShutdownStateZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state +pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { } +#[no_mangle] +/// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` +/// 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)] +/// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_InboundHTLCDetailsZ { + /// 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::channel_state::InboundHTLCDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_InboundHTLCDetailsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::channel_state::InboundHTLCDetails] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_InboundHTLCDetailsZ { + 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_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { } +impl Drop for CVec_InboundHTLCDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_InboundHTLCDetailsZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_OutboundHTLCDetailsZ { + /// 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::channel_state::OutboundHTLCDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_OutboundHTLCDetailsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::channel_state::OutboundHTLCDetails] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_OutboundHTLCDetailsZ { + 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_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { } +impl Drop for CVec_OutboundHTLCDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_OutboundHTLCDetailsZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_ChannelDetailsDecodeErrorZ +pub union CResult_ChannelDetailsDecodeErrorZPtr { /// 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::NodeAnnouncement, + pub result: *mut crate::lightning::ln::channel_state::ChannelDetails, /// 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_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelDetails 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_NodeAnnouncementDecodeErrorZ { - /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_ChannelDetailsDecodeErrorZ { + /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAnnouncementDecodeErrorZPtr, - /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_ChannelDetailsDecodeErrorZPtr, + /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ { - CResult_NodeAnnouncementDecodeErrorZ { - contents: CResult_NodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ { + CResult_ChannelDetailsDecodeErrorZ { + contents: CResult_ChannelDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ { - CResult_NodeAnnouncementDecodeErrorZ { - contents: CResult_NodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ { + CResult_ChannelDetailsDecodeErrorZ { + contents: CResult_ChannelDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21214,13 +24899,13 @@ pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { } -impl Drop for CResult_NodeAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { } +impl Drop for CResult_ChannelDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21233,16 +24918,16 @@ impl Drop for CResult_NodeAnnouncementDecodeErrorZ { } } } -impl From> for CResult_NodeAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelDetailsDecodeErrorZ { + 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_NodeAnnouncementDecodeErrorZPtr { result } + CResult_ChannelDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAnnouncementDecodeErrorZPtr { err } + CResult_ChannelDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -21250,59 +24935,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_QueryShortChannelIdsDecodeErrorZ -pub union CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// The contents of CResult_ChannelShutdownStateDecodeErrorZ +pub union CResult_ChannelShutdownStateDecodeErrorZPtr { /// 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::QueryShortChannelIds, + pub result: *mut crate::lightning::ln::channel_state::ChannelShutdownState, /// 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_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelShutdownState 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_QueryShortChannelIdsDecodeErrorZ { - /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either +pub struct CResult_ChannelShutdownStateDecodeErrorZ { + /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr, - /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state. + pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr, + /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ { - CResult_QueryShortChannelIdsDecodeErrorZ { - contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ { + CResult_ChannelShutdownStateDecodeErrorZ { + contents: CResult_ChannelShutdownStateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ { - CResult_QueryShortChannelIdsDecodeErrorZ { - contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ { + CResult_ChannelShutdownStateDecodeErrorZ { + contents: CResult_ChannelShutdownStateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21310,13 +24995,13 @@ pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { } -impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { } +impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21329,16 +25014,16 @@ impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { } } } -impl From> for CResult_QueryShortChannelIdsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelShutdownStateDecodeErrorZ { + 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_QueryShortChannelIdsDecodeErrorZPtr { result } + CResult_ChannelShutdownStateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_QueryShortChannelIdsDecodeErrorZPtr { err } + CResult_ChannelShutdownStateDecodeErrorZPtr { err } }; Self { contents, @@ -21346,59 +25031,97 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ -pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_FutureZ { + /// 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::util::wakers::Future, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_FutureZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::util::wakers::Future] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_FutureZ { + 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_FutureZ_free(_res: CVec_FutureZ) { } +impl Drop for CVec_FutureZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +#[repr(C)] +/// The contents of CResult_OfferPathsRequestDecodeErrorZ +pub union CResult_OfferPathsRequestDecodeErrorZPtr { /// 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::ReplyShortChannelIdsEnd, + pub result: *mut crate::lightning::onion_message::async_payments::OfferPathsRequest, /// 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_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OfferPathsRequestDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::OfferPathsRequest 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_ReplyShortChannelIdsEndDecodeErrorZ { - /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either +pub struct CResult_OfferPathsRequestDecodeErrorZ { + /// The contents of this CResult_OfferPathsRequestDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr, - /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state. + pub contents: CResult_OfferPathsRequestDecodeErrorZPtr, + /// Whether this CResult_OfferPathsRequestDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { - CResult_ReplyShortChannelIdsEndDecodeErrorZ { - contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// Creates a new CResult_OfferPathsRequestDecodeErrorZ in the success state. +pub extern "C" fn CResult_OfferPathsRequestDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::OfferPathsRequest) -> CResult_OfferPathsRequestDecodeErrorZ { + CResult_OfferPathsRequestDecodeErrorZ { + contents: CResult_OfferPathsRequestDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { - CResult_ReplyShortChannelIdsEndDecodeErrorZ { - contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// Creates a new CResult_OfferPathsRequestDecodeErrorZ in the error state. +pub extern "C" fn CResult_OfferPathsRequestDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferPathsRequestDecodeErrorZ { + CResult_OfferPathsRequestDecodeErrorZ { + contents: CResult_OfferPathsRequestDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21406,13 +25129,13 @@ pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferPathsRequestDecodeErrorZ_is_ok(o: &CResult_OfferPathsRequestDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { } -impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { +/// Frees any resources used by the CResult_OfferPathsRequestDecodeErrorZ. +pub extern "C" fn CResult_OfferPathsRequestDecodeErrorZ_free(_res: CResult_OfferPathsRequestDecodeErrorZ) { } +impl Drop for CResult_OfferPathsRequestDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21425,16 +25148,16 @@ impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { } } } -impl From> for CResult_ReplyShortChannelIdsEndDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferPathsRequestDecodeErrorZ { + 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result } + CResult_OfferPathsRequestDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err } + CResult_OfferPathsRequestDecodeErrorZPtr { err } }; Self { contents, @@ -21442,59 +25165,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferPathsRequestDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OfferPathsRequestDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferPathsRequestDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferPathsRequestDecodeErrorZ_clone(orig: &CResult_OfferPathsRequestDecodeErrorZ) -> CResult_OfferPathsRequestDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_QueryChannelRangeDecodeErrorZ -pub union CResult_QueryChannelRangeDecodeErrorZPtr { +/// The contents of CResult_OfferPathsDecodeErrorZ +pub union CResult_OfferPathsDecodeErrorZPtr { /// 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::QueryChannelRange, + pub result: *mut crate::lightning::onion_message::async_payments::OfferPaths, /// 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_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OfferPathsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::OfferPaths 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_QueryChannelRangeDecodeErrorZ { - /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either +pub struct CResult_OfferPathsDecodeErrorZ { + /// The contents of this CResult_OfferPathsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_QueryChannelRangeDecodeErrorZPtr, - /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state. + pub contents: CResult_OfferPathsDecodeErrorZPtr, + /// Whether this CResult_OfferPathsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ { - CResult_QueryChannelRangeDecodeErrorZ { - contents: CResult_QueryChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_OfferPathsDecodeErrorZ in the success state. +pub extern "C" fn CResult_OfferPathsDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::OfferPaths) -> CResult_OfferPathsDecodeErrorZ { + CResult_OfferPathsDecodeErrorZ { + contents: CResult_OfferPathsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ { - CResult_QueryChannelRangeDecodeErrorZ { - contents: CResult_QueryChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_OfferPathsDecodeErrorZ in the error state. +pub extern "C" fn CResult_OfferPathsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferPathsDecodeErrorZ { + CResult_OfferPathsDecodeErrorZ { + contents: CResult_OfferPathsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21502,13 +25225,13 @@ pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferPathsDecodeErrorZ_is_ok(o: &CResult_OfferPathsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { } -impl Drop for CResult_QueryChannelRangeDecodeErrorZ { +/// Frees any resources used by the CResult_OfferPathsDecodeErrorZ. +pub extern "C" fn CResult_OfferPathsDecodeErrorZ_free(_res: CResult_OfferPathsDecodeErrorZ) { } +impl Drop for CResult_OfferPathsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21521,16 +25244,16 @@ impl Drop for CResult_QueryChannelRangeDecodeErrorZ { } } } -impl From> for CResult_QueryChannelRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferPathsDecodeErrorZ { + 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_QueryChannelRangeDecodeErrorZPtr { result } + CResult_OfferPathsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_QueryChannelRangeDecodeErrorZPtr { err } + CResult_OfferPathsDecodeErrorZPtr { err } }; Self { contents, @@ -21538,59 +25261,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferPathsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OfferPathsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferPathsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferPathsDecodeErrorZ_clone(orig: &CResult_OfferPathsDecodeErrorZ) -> CResult_OfferPathsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReplyChannelRangeDecodeErrorZ -pub union CResult_ReplyChannelRangeDecodeErrorZPtr { +/// The contents of CResult_ServeStaticInvoiceDecodeErrorZ +pub union CResult_ServeStaticInvoiceDecodeErrorZPtr { /// 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::ReplyChannelRange, + pub result: *mut crate::lightning::onion_message::async_payments::ServeStaticInvoice, /// 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_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ServeStaticInvoiceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::ServeStaticInvoice 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_ReplyChannelRangeDecodeErrorZ { - /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either +pub struct CResult_ServeStaticInvoiceDecodeErrorZ { + /// The contents of this CResult_ServeStaticInvoiceDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr, - /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state. + pub contents: CResult_ServeStaticInvoiceDecodeErrorZPtr, + /// Whether this CResult_ServeStaticInvoiceDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ { - CResult_ReplyChannelRangeDecodeErrorZ { - contents: CResult_ReplyChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_ServeStaticInvoiceDecodeErrorZ in the success state. +pub extern "C" fn CResult_ServeStaticInvoiceDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::ServeStaticInvoice) -> CResult_ServeStaticInvoiceDecodeErrorZ { + CResult_ServeStaticInvoiceDecodeErrorZ { + contents: CResult_ServeStaticInvoiceDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ { - CResult_ReplyChannelRangeDecodeErrorZ { - contents: CResult_ReplyChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_ServeStaticInvoiceDecodeErrorZ in the error state. +pub extern "C" fn CResult_ServeStaticInvoiceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ServeStaticInvoiceDecodeErrorZ { + CResult_ServeStaticInvoiceDecodeErrorZ { + contents: CResult_ServeStaticInvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21598,13 +25321,13 @@ pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ServeStaticInvoiceDecodeErrorZ_is_ok(o: &CResult_ServeStaticInvoiceDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { } -impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { +/// Frees any resources used by the CResult_ServeStaticInvoiceDecodeErrorZ. +pub extern "C" fn CResult_ServeStaticInvoiceDecodeErrorZ_free(_res: CResult_ServeStaticInvoiceDecodeErrorZ) { } +impl Drop for CResult_ServeStaticInvoiceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21617,16 +25340,16 @@ impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { } } } -impl From> for CResult_ReplyChannelRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ServeStaticInvoiceDecodeErrorZ { + 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_ReplyChannelRangeDecodeErrorZPtr { result } + CResult_ServeStaticInvoiceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReplyChannelRangeDecodeErrorZPtr { err } + CResult_ServeStaticInvoiceDecodeErrorZPtr { err } }; Self { contents, @@ -21634,59 +25357,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ServeStaticInvoiceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ServeStaticInvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ServeStaticInvoiceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ServeStaticInvoiceDecodeErrorZ_clone(orig: &CResult_ServeStaticInvoiceDecodeErrorZ) -> CResult_ServeStaticInvoiceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_GossipTimestampFilterDecodeErrorZ -pub union CResult_GossipTimestampFilterDecodeErrorZPtr { +/// The contents of CResult_StaticInvoicePersistedDecodeErrorZ +pub union CResult_StaticInvoicePersistedDecodeErrorZPtr { /// 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::GossipTimestampFilter, + pub result: *mut crate::lightning::onion_message::async_payments::StaticInvoicePersisted, /// 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_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_StaticInvoicePersistedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::StaticInvoicePersisted 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_GossipTimestampFilterDecodeErrorZ { - /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either +pub struct CResult_StaticInvoicePersistedDecodeErrorZ { + /// The contents of this CResult_StaticInvoicePersistedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr, - /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state. + pub contents: CResult_StaticInvoicePersistedDecodeErrorZPtr, + /// Whether this CResult_StaticInvoicePersistedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ { - CResult_GossipTimestampFilterDecodeErrorZ { - contents: CResult_GossipTimestampFilterDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoicePersistedDecodeErrorZ in the success state. +pub extern "C" fn CResult_StaticInvoicePersistedDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::StaticInvoicePersisted) -> CResult_StaticInvoicePersistedDecodeErrorZ { + CResult_StaticInvoicePersistedDecodeErrorZ { + contents: CResult_StaticInvoicePersistedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ { - CResult_GossipTimestampFilterDecodeErrorZ { - contents: CResult_GossipTimestampFilterDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoicePersistedDecodeErrorZ in the error state. +pub extern "C" fn CResult_StaticInvoicePersistedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticInvoicePersistedDecodeErrorZ { + CResult_StaticInvoicePersistedDecodeErrorZ { + contents: CResult_StaticInvoicePersistedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21694,13 +25417,13 @@ pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool { +pub extern "C" fn CResult_StaticInvoicePersistedDecodeErrorZ_is_ok(o: &CResult_StaticInvoicePersistedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { } -impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { +/// Frees any resources used by the CResult_StaticInvoicePersistedDecodeErrorZ. +pub extern "C" fn CResult_StaticInvoicePersistedDecodeErrorZ_free(_res: CResult_StaticInvoicePersistedDecodeErrorZ) { } +impl Drop for CResult_StaticInvoicePersistedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21713,16 +25436,16 @@ impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { } } } -impl From> for CResult_GossipTimestampFilterDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StaticInvoicePersistedDecodeErrorZ { + 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_GossipTimestampFilterDecodeErrorZPtr { result } + CResult_StaticInvoicePersistedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_GossipTimestampFilterDecodeErrorZPtr { err } + CResult_StaticInvoicePersistedDecodeErrorZPtr { err } }; Self { contents, @@ -21730,96 +25453,59 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not -pub enum COption_InboundHTLCStateDetailsZ { - /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails - Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails), - /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing - None -} -impl COption_InboundHTLCStateDetailsZ { - #[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::channel_state::InboundHTLCStateDetails { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails -pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ { - COption_InboundHTLCStateDetailsZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing -pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ { - COption_InboundHTLCStateDetailsZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state -pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { } +impl Clone for CResult_StaticInvoicePersistedDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_StaticInvoicePersistedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_StaticInvoicePersistedDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} #[no_mangle] -/// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` +/// Creates a new CResult_StaticInvoicePersistedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StaticInvoicePersistedDecodeErrorZ_clone(orig: &CResult_StaticInvoicePersistedDecodeErrorZ) -> CResult_StaticInvoicePersistedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ -pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// The contents of CResult_HeldHtlcAvailableDecodeErrorZ +pub union CResult_HeldHtlcAvailableDecodeErrorZPtr { /// 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_InboundHTLCStateDetailsZ, + pub result: *mut crate::lightning::onion_message::async_payments::HeldHtlcAvailable, /// 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_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HeldHtlcAvailableDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::HeldHtlcAvailable 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_COption_InboundHTLCStateDetailsZDecodeErrorZ { - /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either +pub struct CResult_HeldHtlcAvailableDecodeErrorZ { + /// The contents of this CResult_HeldHtlcAvailableDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr, - /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. + pub contents: CResult_HeldHtlcAvailableDecodeErrorZPtr, + /// Whether this CResult_HeldHtlcAvailableDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> CResult_HeldHtlcAvailableDecodeErrorZ { + CResult_HeldHtlcAvailableDecodeErrorZ { + contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HeldHtlcAvailableDecodeErrorZ { + CResult_HeldHtlcAvailableDecodeErrorZ { + contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21827,13 +25513,13 @@ pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: cr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(o: &CResult_HeldHtlcAvailableDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { } -impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { +/// Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_free(_res: CResult_HeldHtlcAvailableDecodeErrorZ) { } +impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21846,16 +25532,16 @@ impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { } } } -impl From> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HeldHtlcAvailableDecodeErrorZ { + 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_InboundHTLCStateDetailsZDecodeErrorZPtr { result } + CResult_HeldHtlcAvailableDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err } + CResult_HeldHtlcAvailableDecodeErrorZPtr { err } }; Self { contents, @@ -21863,59 +25549,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_clone(orig: &CResult_HeldHtlcAvailableDecodeErrorZ) -> CResult_HeldHtlcAvailableDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InboundHTLCDetailsDecodeErrorZ -pub union CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// The contents of CResult_ReleaseHeldHtlcDecodeErrorZ +pub union CResult_ReleaseHeldHtlcDecodeErrorZPtr { /// 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::channel_state::InboundHTLCDetails, + pub result: *mut crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, /// 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_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::InboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReleaseHeldHtlcDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::ReleaseHeldHtlc 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_InboundHTLCDetailsDecodeErrorZ { - /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either +pub struct CResult_ReleaseHeldHtlcDecodeErrorZ { + /// The contents of this CResult_ReleaseHeldHtlcDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr, - /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. + pub contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr, + /// Whether this CResult_ReleaseHeldHtlcDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ { - CResult_InboundHTLCDetailsDecodeErrorZ { - contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) -> CResult_ReleaseHeldHtlcDecodeErrorZ { + CResult_ReleaseHeldHtlcDecodeErrorZ { + contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ { - CResult_InboundHTLCDetailsDecodeErrorZ { - contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReleaseHeldHtlcDecodeErrorZ { + CResult_ReleaseHeldHtlcDecodeErrorZ { + contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21923,13 +25609,13 @@ pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(o: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { } -impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { +/// Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_free(_res: CResult_ReleaseHeldHtlcDecodeErrorZ) { } +impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21942,16 +25628,16 @@ impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { } } } -impl From> for CResult_InboundHTLCDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReleaseHeldHtlcDecodeErrorZ { + 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_InboundHTLCDetailsDecodeErrorZPtr { result } + CResult_ReleaseHeldHtlcDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InboundHTLCDetailsDecodeErrorZPtr { err } + CResult_ReleaseHeldHtlcDecodeErrorZPtr { err } }; Self { contents, @@ -21959,96 +25645,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not -pub enum COption_OutboundHTLCStateDetailsZ { - /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails - Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails), - /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing - None -} -impl COption_OutboundHTLCStateDetailsZ { - #[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::channel_state::OutboundHTLCStateDetails { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ { - COption_OutboundHTLCStateDetailsZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ { - COption_OutboundHTLCStateDetailsZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { } -#[no_mangle] -/// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_clone(orig: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> CResult_ReleaseHeldHtlcDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ -pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// The contents of CResult_AsyncPaymentsMessageDecodeErrorZ +pub union CResult_AsyncPaymentsMessageDecodeErrorZPtr { /// 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_OutboundHTLCStateDetailsZ, + pub result: *mut crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, /// 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_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AsyncPaymentsMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::AsyncPaymentsMessage 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_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either +pub struct CResult_AsyncPaymentsMessageDecodeErrorZ { + /// The contents of this CResult_AsyncPaymentsMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr, - /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. + pub contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr, + /// Whether this CResult_AsyncPaymentsMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage) -> CResult_AsyncPaymentsMessageDecodeErrorZ { + CResult_AsyncPaymentsMessageDecodeErrorZ { + contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncPaymentsMessageDecodeErrorZ { + CResult_AsyncPaymentsMessageDecodeErrorZ { + contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22056,13 +25705,13 @@ pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: c } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(o: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { } -impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { +/// Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_free(_res: CResult_AsyncPaymentsMessageDecodeErrorZ) { } +impl Drop for CResult_AsyncPaymentsMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22075,16 +25724,16 @@ impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { } } } -impl From> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AsyncPaymentsMessageDecodeErrorZ { + 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_OutboundHTLCStateDetailsZDecodeErrorZPtr { result } + CResult_AsyncPaymentsMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err } + CResult_AsyncPaymentsMessageDecodeErrorZPtr { err } }; Self { contents, @@ -22092,59 +25741,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_clone(orig: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> CResult_AsyncPaymentsMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ -pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// The contents of CResult_StaticInvoiceSignErrorZ +pub union CResult_StaticInvoiceSignErrorZPtr { /// 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::channel_state::OutboundHTLCDetails, + pub result: *mut crate::lightning::offers::static_invoice::StaticInvoice, /// 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::offers::merkle::SignError, } #[repr(C)] -/// A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_StaticInvoiceSignErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::static_invoice::StaticInvoice on success and a crate::lightning::offers::merkle::SignError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OutboundHTLCDetailsDecodeErrorZ { - /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either +pub struct CResult_StaticInvoiceSignErrorZ { + /// The contents of this CResult_StaticInvoiceSignErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr, - /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. + pub contents: CResult_StaticInvoiceSignErrorZPtr, + /// Whether this CResult_StaticInvoiceSignErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ { - CResult_OutboundHTLCDetailsDecodeErrorZ { - contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoiceSignErrorZ in the success state. +pub extern "C" fn CResult_StaticInvoiceSignErrorZ_ok(o: crate::lightning::offers::static_invoice::StaticInvoice) -> CResult_StaticInvoiceSignErrorZ { + CResult_StaticInvoiceSignErrorZ { + contents: CResult_StaticInvoiceSignErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ { - CResult_OutboundHTLCDetailsDecodeErrorZ { - contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoiceSignErrorZ in the error state. +pub extern "C" fn CResult_StaticInvoiceSignErrorZ_err(e: crate::lightning::offers::merkle::SignError) -> CResult_StaticInvoiceSignErrorZ { + CResult_StaticInvoiceSignErrorZ { + contents: CResult_StaticInvoiceSignErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22152,13 +25801,13 @@ pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_StaticInvoiceSignErrorZ_is_ok(o: &CResult_StaticInvoiceSignErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { } -impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { +/// Frees any resources used by the CResult_StaticInvoiceSignErrorZ. +pub extern "C" fn CResult_StaticInvoiceSignErrorZ_free(_res: CResult_StaticInvoiceSignErrorZ) { } +impl Drop for CResult_StaticInvoiceSignErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22171,16 +25820,16 @@ impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { } } } -impl From> for CResult_OutboundHTLCDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StaticInvoiceSignErrorZ { + 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_OutboundHTLCDetailsDecodeErrorZPtr { result } + CResult_StaticInvoiceSignErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OutboundHTLCDetailsDecodeErrorZPtr { err } + CResult_StaticInvoiceSignErrorZPtr { err } }; Self { contents, @@ -22188,59 +25837,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ -pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// The contents of CResult_StaticInvoiceDecodeErrorZ +pub union CResult_StaticInvoiceDecodeErrorZPtr { /// 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::channel_state::CounterpartyForwardingInfo, + pub result: *mut crate::lightning::offers::static_invoice::StaticInvoice, /// 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_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_StaticInvoiceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::static_invoice::StaticInvoice 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_CounterpartyForwardingInfoDecodeErrorZ { - /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either +pub struct CResult_StaticInvoiceDecodeErrorZ { + /// The contents of this CResult_StaticInvoiceDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr, - /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. + pub contents: CResult_StaticInvoiceDecodeErrorZPtr, + /// Whether this CResult_StaticInvoiceDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { - CResult_CounterpartyForwardingInfoDecodeErrorZ { - contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoiceDecodeErrorZ in the success state. +pub extern "C" fn CResult_StaticInvoiceDecodeErrorZ_ok(o: crate::lightning::offers::static_invoice::StaticInvoice) -> CResult_StaticInvoiceDecodeErrorZ { + CResult_StaticInvoiceDecodeErrorZ { + contents: CResult_StaticInvoiceDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { - CResult_CounterpartyForwardingInfoDecodeErrorZ { - contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// Creates a new CResult_StaticInvoiceDecodeErrorZ in the error state. +pub extern "C" fn CResult_StaticInvoiceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticInvoiceDecodeErrorZ { + CResult_StaticInvoiceDecodeErrorZ { + contents: CResult_StaticInvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22248,13 +25880,13 @@ pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_StaticInvoiceDecodeErrorZ_is_ok(o: &CResult_StaticInvoiceDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { } -impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { +/// Frees any resources used by the CResult_StaticInvoiceDecodeErrorZ. +pub extern "C" fn CResult_StaticInvoiceDecodeErrorZ_free(_res: CResult_StaticInvoiceDecodeErrorZ) { } +impl Drop for CResult_StaticInvoiceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22267,16 +25899,16 @@ impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { } } } -impl From> for CResult_CounterpartyForwardingInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StaticInvoiceDecodeErrorZ { + 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_CounterpartyForwardingInfoDecodeErrorZPtr { result } + CResult_StaticInvoiceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err } + CResult_StaticInvoiceDecodeErrorZPtr { err } }; Self { contents, @@ -22284,59 +25916,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StaticInvoiceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_StaticInvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_StaticInvoiceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StaticInvoiceDecodeErrorZ_clone(orig: &CResult_StaticInvoiceDecodeErrorZ) -> CResult_StaticInvoiceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelCounterpartyDecodeErrorZ -pub union CResult_ChannelCounterpartyDecodeErrorZPtr { +/// The contents of CResult_OffersMessageDecodeErrorZ +pub union CResult_OffersMessageDecodeErrorZPtr { /// 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::channel_state::ChannelCounterparty, + pub result: *mut crate::lightning::onion_message::offers::OffersMessage, /// 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_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::offers::OffersMessage 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_ChannelCounterpartyDecodeErrorZ { - /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either +pub struct CResult_OffersMessageDecodeErrorZ { + /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr, - /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + pub contents: CResult_OffersMessageDecodeErrorZPtr, + /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ { - CResult_ChannelCounterpartyDecodeErrorZ { - contents: CResult_ChannelCounterpartyDecodeErrorZPtr { +/// Creates a new CResult_OffersMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ { + CResult_OffersMessageDecodeErrorZ { + contents: CResult_OffersMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ { - CResult_ChannelCounterpartyDecodeErrorZ { - contents: CResult_ChannelCounterpartyDecodeErrorZPtr { +/// Creates a new CResult_OffersMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ { + CResult_OffersMessageDecodeErrorZ { + contents: CResult_OffersMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22344,13 +25976,13 @@ pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { } -impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { +/// Frees any resources used by the CResult_OffersMessageDecodeErrorZ. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { } +impl Drop for CResult_OffersMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22363,16 +25995,16 @@ impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { } } } -impl From> for CResult_ChannelCounterpartyDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OffersMessageDecodeErrorZ { + 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_ChannelCounterpartyDecodeErrorZPtr { result } + CResult_OffersMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelCounterpartyDecodeErrorZPtr { err } + CResult_OffersMessageDecodeErrorZPtr { err } }; Self { contents, @@ -22380,188 +26012,187 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not -pub enum COption_ChannelShutdownStateZ { - /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState - Some(crate::lightning::ln::channel_state::ChannelShutdownState), - /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing +/// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not +pub enum COption_HTLCClaimZ { + /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim + Some(crate::lightning::ln::chan_utils::HTLCClaim), + /// When we're in this state, this COption_HTLCClaimZ contains nothing None } -impl COption_ChannelShutdownStateZ { +impl COption_HTLCClaimZ { #[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::channel_state::ChannelShutdownState { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState -pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ { - COption_ChannelShutdownStateZ::Some(o) +/// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim +pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ { + COption_HTLCClaimZ::Some(o) } #[no_mangle] -/// Constructs a new COption_ChannelShutdownStateZ containing nothing -pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ { - COption_ChannelShutdownStateZ::None +/// Constructs a new COption_HTLCClaimZ containing nothing +pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ { + COption_HTLCClaimZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state -pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { } -#[no_mangle] -/// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` -/// 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) } +/// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state +pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_InboundHTLCDetailsZ { - /// 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::channel_state::InboundHTLCDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_InboundHTLCDetailsZ { - #[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::channel_state::InboundHTLCDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +/// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ +pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + /// 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::chan_utils::CounterpartyCommitmentSecrets, + /// 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 From> for CVec_InboundHTLCDetailsZ { - 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() } } - } +#[repr(C)] +/// A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets 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_CounterpartyCommitmentSecretsDecodeErrorZ { + /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr, + /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { } -impl Drop for CVec_InboundHTLCDetailsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl Clone for CVec_InboundHTLCDetailsZ { - 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] +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_OutboundHTLCDetailsZ { - /// 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::channel_state::OutboundHTLCDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_OutboundHTLCDetailsZ { - #[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::channel_state::OutboundHTLCDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool { + o.result_ok } -impl From> for CVec_OutboundHTLCDetailsZ { - 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 any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { } +impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + 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) }; + } + } } } -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { } -impl Drop for CVec_OutboundHTLCDetailsZ { - 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 From> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + 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_CounterpartyCommitmentSecretsDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for CVec_OutboundHTLCDetailsZ { +impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { 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) + if self.result_ok { + Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelDetailsDecodeErrorZ -pub union CResult_ChannelDetailsDecodeErrorZPtr { +/// The contents of CResult_TxCreationKeysDecodeErrorZ +pub union CResult_TxCreationKeysDecodeErrorZPtr { /// 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::channel_state::ChannelDetails, + pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys, /// 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_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TxCreationKeys 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_ChannelDetailsDecodeErrorZ { - /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either +pub struct CResult_TxCreationKeysDecodeErrorZ { + /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelDetailsDecodeErrorZPtr, - /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. + pub contents: CResult_TxCreationKeysDecodeErrorZPtr, + /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ { - CResult_ChannelDetailsDecodeErrorZ { - contents: CResult_ChannelDetailsDecodeErrorZPtr { +/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ { + CResult_TxCreationKeysDecodeErrorZ { + contents: CResult_TxCreationKeysDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ { - CResult_ChannelDetailsDecodeErrorZ { - contents: CResult_ChannelDetailsDecodeErrorZPtr { +/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ { + CResult_TxCreationKeysDecodeErrorZ { + contents: CResult_TxCreationKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22569,13 +26200,13 @@ pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { } -impl Drop for CResult_ChannelDetailsDecodeErrorZ { +/// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } +impl Drop for CResult_TxCreationKeysDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22588,16 +26219,16 @@ impl Drop for CResult_ChannelDetailsDecodeErrorZ { } } } -impl From> for CResult_ChannelDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxCreationKeysDecodeErrorZ { + 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_ChannelDetailsDecodeErrorZPtr { result } + CResult_TxCreationKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelDetailsDecodeErrorZPtr { err } + CResult_TxCreationKeysDecodeErrorZPtr { err } }; Self { contents, @@ -22605,59 +26236,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelShutdownStateDecodeErrorZ -pub union CResult_ChannelShutdownStateDecodeErrorZPtr { +/// The contents of CResult_ChannelPublicKeysDecodeErrorZ +pub union CResult_ChannelPublicKeysDecodeErrorZPtr { /// 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::channel_state::ChannelShutdownState, + pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys, /// 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_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelShutdownState on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys 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_ChannelShutdownStateDecodeErrorZ { - /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either +pub struct CResult_ChannelPublicKeysDecodeErrorZ { + /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr, - /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. + pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr, + /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ { - CResult_ChannelShutdownStateDecodeErrorZ { - contents: CResult_ChannelShutdownStateDecodeErrorZPtr { +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ { + CResult_ChannelPublicKeysDecodeErrorZ { + contents: CResult_ChannelPublicKeysDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ { - CResult_ChannelShutdownStateDecodeErrorZ { - contents: CResult_ChannelShutdownStateDecodeErrorZPtr { +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ { + CResult_ChannelPublicKeysDecodeErrorZ { + contents: CResult_ChannelPublicKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22665,13 +26296,13 @@ pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { } -impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { } +impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22684,16 +26315,16 @@ impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { } } } -impl From> for CResult_ChannelShutdownStateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelPublicKeysDecodeErrorZ { + 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_ChannelShutdownStateDecodeErrorZPtr { result } + CResult_ChannelPublicKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelShutdownStateDecodeErrorZPtr { err } + CResult_ChannelPublicKeysDecodeErrorZPtr { err } }; Self { contents, @@ -22701,97 +26332,155 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_FutureZ { - /// 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::util::wakers::Future, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ +pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + /// 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::chan_utils::HTLCOutputInCommitment, + /// 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 CVec_FutureZ { - #[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 +#[repr(C)] +/// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment 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_HTLCOutputInCommitmentDecodeErrorZ { + /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr, + /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { + CResult_HTLCOutputInCommitmentDecodeErrorZ { + contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +} +#[no_mangle] +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { + CResult_HTLCOutputInCommitmentDecodeErrorZ { + contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + 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_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } +impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { + 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_HTLCOutputInCommitmentDecodeErrorZ { + 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_HTLCOutputInCommitmentDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl From> for CVec_FutureZ { - 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() } } +impl Clone for CResult_HTLCOutputInCommitmentDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { } -impl Drop for CVec_FutureZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RawLSPSMessageDecodeErrorZ -pub union CResult_RawLSPSMessageDecodeErrorZPtr { +/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ +pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { /// 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_liquidity::lsps0::ser::RawLSPSMessage, + pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, /// 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_RawLSPSMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_liquidity::lsps0::ser::RawLSPSMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters 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_RawLSPSMessageDecodeErrorZ { - /// The contents of this CResult_RawLSPSMessageDecodeErrorZ, accessible via either +pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RawLSPSMessageDecodeErrorZPtr, - /// Whether this CResult_RawLSPSMessageDecodeErrorZ represents a success state. + pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr, + /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RawLSPSMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_ok(o: crate::lightning_liquidity::lsps0::ser::RawLSPSMessage) -> CResult_RawLSPSMessageDecodeErrorZ { - CResult_RawLSPSMessageDecodeErrorZ { - contents: CResult_RawLSPSMessageDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RawLSPSMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RawLSPSMessageDecodeErrorZ { - CResult_RawLSPSMessageDecodeErrorZ { - contents: CResult_RawLSPSMessageDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22799,13 +26488,13 @@ pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_is_ok(o: &CResult_RawLSPSMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RawLSPSMessageDecodeErrorZ. -pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_free(_res: CResult_RawLSPSMessageDecodeErrorZ) { } -impl Drop for CResult_RawLSPSMessageDecodeErrorZ { +/// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { } +impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -22818,16 +26507,16 @@ impl Drop for CResult_RawLSPSMessageDecodeErrorZ { } } } -impl From> for CResult_RawLSPSMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + 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_RawLSPSMessageDecodeErrorZPtr { result } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RawLSPSMessageDecodeErrorZPtr { err } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -22835,91 +26524,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RawLSPSMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RawLSPSMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RawLSPSMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RawLSPSMessageDecodeErrorZ_clone(orig: &CResult_RawLSPSMessageDecodeErrorZ) -> CResult_RawLSPSMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_LSPSDateTimeNoneZ -pub union CResult_LSPSDateTimeNoneZPtr { +/// The contents of CResult_ChannelTransactionParametersDecodeErrorZ +pub union CResult_ChannelTransactionParametersDecodeErrorZPtr { /// 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_liquidity::lsps0::ser::LSPSDateTime, - /// 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::lightning::ln::chan_utils::ChannelTransactionParameters, + /// 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_LSPSDateTimeNoneZ represents the result of a fallible operation, -/// containing a crate::lightning_liquidity::lsps0::ser::LSPSDateTime on success and a () on failure. +/// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters 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_LSPSDateTimeNoneZ { - /// The contents of this CResult_LSPSDateTimeNoneZ, accessible via either +pub struct CResult_ChannelTransactionParametersDecodeErrorZ { + /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_LSPSDateTimeNoneZPtr, - /// Whether this CResult_LSPSDateTimeNoneZ represents a success state. + pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr, + /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_LSPSDateTimeNoneZ in the success state. -pub extern "C" fn CResult_LSPSDateTimeNoneZ_ok(o: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) -> CResult_LSPSDateTimeNoneZ { - CResult_LSPSDateTimeNoneZ { - contents: CResult_LSPSDateTimeNoneZPtr { +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ { + CResult_ChannelTransactionParametersDecodeErrorZ { + contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_LSPSDateTimeNoneZ in the error state. -pub extern "C" fn CResult_LSPSDateTimeNoneZ_err() -> CResult_LSPSDateTimeNoneZ { - CResult_LSPSDateTimeNoneZ { - contents: CResult_LSPSDateTimeNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ { + CResult_ChannelTransactionParametersDecodeErrorZ { + contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + 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_LSPSDateTimeNoneZ_is_ok(o: &CResult_LSPSDateTimeNoneZ) -> bool { +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_LSPSDateTimeNoneZ. -pub extern "C" fn CResult_LSPSDateTimeNoneZ_free(_res: CResult_LSPSDateTimeNoneZ) { } -impl Drop for CResult_LSPSDateTimeNoneZ { +/// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { } +impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { 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_LSPSDateTimeNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelTransactionParametersDecodeErrorZ { + 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_LSPSDateTimeNoneZPtr { result } + CResult_ChannelTransactionParametersDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_LSPSDateTimeNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -22927,59 +26620,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_LSPSDateTimeNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_LSPSDateTimeNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_LSPSDateTimeNoneZ which has the same data as `orig` +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_LSPSDateTimeNoneZ_clone(orig: &CResult_LSPSDateTimeNoneZ) -> CResult_LSPSDateTimeNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HeldHtlcAvailableDecodeErrorZ -pub union CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ +pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr { /// 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::onion_message::async_payments::HeldHtlcAvailable, + pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction, /// 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_HeldHtlcAvailableDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::HeldHtlcAvailable on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction 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_HeldHtlcAvailableDecodeErrorZ { - /// The contents of this CResult_HeldHtlcAvailableDecodeErrorZ, accessible via either +pub struct CResult_HolderCommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HeldHtlcAvailableDecodeErrorZPtr, - /// Whether this CResult_HeldHtlcAvailableDecodeErrorZ represents a success state. + pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> CResult_HeldHtlcAvailableDecodeErrorZ { - CResult_HeldHtlcAvailableDecodeErrorZ { - contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ { + CResult_HolderCommitmentTransactionDecodeErrorZ { + contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HeldHtlcAvailableDecodeErrorZ { - CResult_HeldHtlcAvailableDecodeErrorZ { - contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ { + CResult_HolderCommitmentTransactionDecodeErrorZ { + contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -22987,13 +26680,13 @@ pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(o: &CResult_HeldHtlcAvailableDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_free(_res: CResult_HeldHtlcAvailableDecodeErrorZ) { } -impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { +/// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23006,16 +26699,16 @@ impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { } } } -impl From> for CResult_HeldHtlcAvailableDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HolderCommitmentTransactionDecodeErrorZ { + 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_HeldHtlcAvailableDecodeErrorZPtr { result } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HeldHtlcAvailableDecodeErrorZPtr { err } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -23023,59 +26716,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_clone(orig: &CResult_HeldHtlcAvailableDecodeErrorZ) -> CResult_HeldHtlcAvailableDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReleaseHeldHtlcDecodeErrorZ -pub union CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ +pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr { /// 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::onion_message::async_payments::ReleaseHeldHtlc, + pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, /// 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_ReleaseHeldHtlcDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::ReleaseHeldHtlc on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction 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_ReleaseHeldHtlcDecodeErrorZ { - /// The contents of this CResult_ReleaseHeldHtlcDecodeErrorZ, accessible via either +pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr, - /// Whether this CResult_ReleaseHeldHtlcDecodeErrorZ represents a success state. + pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) -> CResult_ReleaseHeldHtlcDecodeErrorZ { - CResult_ReleaseHeldHtlcDecodeErrorZ { - contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { + CResult_BuiltCommitmentTransactionDecodeErrorZ { + contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReleaseHeldHtlcDecodeErrorZ { - CResult_ReleaseHeldHtlcDecodeErrorZ { - contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { + CResult_BuiltCommitmentTransactionDecodeErrorZ { + contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23083,13 +26776,13 @@ pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(o: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_free(_res: CResult_ReleaseHeldHtlcDecodeErrorZ) { } -impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { +/// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23102,16 +26795,16 @@ impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { } } } -impl From> for CResult_ReleaseHeldHtlcDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BuiltCommitmentTransactionDecodeErrorZ { + 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_ReleaseHeldHtlcDecodeErrorZPtr { result } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReleaseHeldHtlcDecodeErrorZPtr { err } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -23119,95 +26812,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_clone(orig: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> CResult_ReleaseHeldHtlcDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AsyncPaymentsMessageDecodeErrorZ -pub union CResult_AsyncPaymentsMessageDecodeErrorZPtr { +/// The contents of CResult_TrustedClosingTransactionNoneZ +pub union CResult_TrustedClosingTransactionNoneZPtr { /// 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::onion_message::async_payments::AsyncPaymentsMessage, - /// 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::chan_utils::TrustedClosingTransaction, + /// 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_AsyncPaymentsMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::AsyncPaymentsMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_AsyncPaymentsMessageDecodeErrorZ { - /// The contents of this CResult_AsyncPaymentsMessageDecodeErrorZ, accessible via either +pub struct CResult_TrustedClosingTransactionNoneZ { + /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr, - /// Whether this CResult_AsyncPaymentsMessageDecodeErrorZ represents a success state. + pub contents: CResult_TrustedClosingTransactionNoneZPtr, + /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage) -> CResult_AsyncPaymentsMessageDecodeErrorZ { - CResult_AsyncPaymentsMessageDecodeErrorZ { - contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { +/// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ { + CResult_TrustedClosingTransactionNoneZ { + contents: CResult_TrustedClosingTransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncPaymentsMessageDecodeErrorZ { - CResult_AsyncPaymentsMessageDecodeErrorZ { - contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ { + CResult_TrustedClosingTransactionNoneZ { + contents: CResult_TrustedClosingTransactionNoneZPtr { + 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_AsyncPaymentsMessageDecodeErrorZ_is_ok(o: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_free(_res: CResult_AsyncPaymentsMessageDecodeErrorZ) { } -impl Drop for CResult_AsyncPaymentsMessageDecodeErrorZ { +/// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { } +impl Drop for CResult_TrustedClosingTransactionNoneZ { 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_AsyncPaymentsMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TrustedClosingTransactionNoneZ { + 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_AsyncPaymentsMessageDecodeErrorZPtr { result } + CResult_TrustedClosingTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AsyncPaymentsMessageDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -23215,59 +26904,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_clone(orig: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> CResult_AsyncPaymentsMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OffersMessageDecodeErrorZ -pub union CResult_OffersMessageDecodeErrorZPtr { +/// The contents of CResult_CommitmentTransactionDecodeErrorZ +pub union CResult_CommitmentTransactionDecodeErrorZPtr { /// 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::onion_message::offers::OffersMessage, + pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction, /// 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_OffersMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::offers::OffersMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::CommitmentTransaction 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_OffersMessageDecodeErrorZ { - /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either +pub struct CResult_CommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OffersMessageDecodeErrorZPtr, - /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state. + pub contents: CResult_CommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OffersMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ { - CResult_OffersMessageDecodeErrorZ { - contents: CResult_OffersMessageDecodeErrorZPtr { +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ { + CResult_CommitmentTransactionDecodeErrorZ { + contents: CResult_CommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OffersMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ { - CResult_OffersMessageDecodeErrorZ { - contents: CResult_OffersMessageDecodeErrorZPtr { +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ { + CResult_CommitmentTransactionDecodeErrorZ { + contents: CResult_CommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23275,13 +26947,13 @@ pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OffersMessageDecodeErrorZ. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { } -impl Drop for CResult_OffersMessageDecodeErrorZ { +/// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_CommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23294,16 +26966,16 @@ impl Drop for CResult_OffersMessageDecodeErrorZ { } } } -impl From> for CResult_OffersMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CommitmentTransactionDecodeErrorZ { + 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_OffersMessageDecodeErrorZPtr { result } + CResult_CommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OffersMessageDecodeErrorZPtr { err } + CResult_CommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -23311,127 +26983,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not -pub enum COption_HTLCClaimZ { - /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim - Some(crate::lightning::ln::chan_utils::HTLCClaim), - /// When we're in this state, this COption_HTLCClaimZ contains nothing - None -} -impl COption_HTLCClaimZ { - #[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::chan_utils::HTLCClaim { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim -pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ { - COption_HTLCClaimZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_HTLCClaimZ containing nothing -pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ { - COption_HTLCClaimZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state -pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { } +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ -pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +/// The contents of CResult_TrustedCommitmentTransactionNoneZ +pub union CResult_TrustedCommitmentTransactionNoneZPtr { /// 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::chan_utils::CounterpartyCommitmentSecrets, - /// 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::chan_utils::TrustedCommitmentTransaction, + /// 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_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either +pub struct CResult_TrustedCommitmentTransactionNoneZ { + /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr, - /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + pub contents: CResult_TrustedCommitmentTransactionNoneZPtr, + /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ { + CResult_TrustedCommitmentTransactionNoneZ { + contents: CResult_TrustedCommitmentTransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ { + CResult_TrustedCommitmentTransactionNoneZ { + contents: CResult_TrustedCommitmentTransactionNoneZPtr { + 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_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { } -impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +/// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { } +impl Drop for CResult_TrustedCommitmentTransactionNoneZ { 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_CounterpartyCommitmentSecretsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TrustedCommitmentTransactionNoneZ { + 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_CounterpartyCommitmentSecretsDecodeErrorZPtr { result } + CResult_TrustedCommitmentTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -23439,95 +27075,74 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCreationKeysDecodeErrorZ -pub union CResult_TxCreationKeysDecodeErrorZPtr { +/// The contents of CResult_CVec_ECDSASignatureZNoneZ +pub union CResult_CVec_ECDSASignatureZNoneZPtr { /// 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::chan_utils::TxCreationKeys, - /// 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::c_types::derived::CVec_ECDSASignatureZ, + /// 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_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError 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`. -pub struct CResult_TxCreationKeysDecodeErrorZ { - /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either +pub struct CResult_CVec_ECDSASignatureZNoneZ { + /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxCreationKeysDecodeErrorZPtr, - /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. + pub contents: CResult_CVec_ECDSASignatureZNoneZPtr, + /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ { - CResult_TxCreationKeysDecodeErrorZ { - contents: CResult_TxCreationKeysDecodeErrorZPtr { +/// 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_TxCreationKeysDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ { - CResult_TxCreationKeysDecodeErrorZ { - contents: CResult_TxCreationKeysDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// 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, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> 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_TxCreationKeysDecodeErrorZ. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } -impl Drop for CResult_TxCreationKeysDecodeErrorZ { +/// 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() } { 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_TxCreationKeysDecodeErrorZ { - 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_TxCreationKeysDecodeErrorZPtr { result } + CResult_CVec_ECDSASignatureZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCreationKeysDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -23535,59 +27150,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_TxCreationKeysDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` +/// 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_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelPublicKeysDecodeErrorZ -pub union CResult_ChannelPublicKeysDecodeErrorZPtr { +#[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] +/// 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 COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ShutdownScriptDecodeErrorZ +pub union CResult_ShutdownScriptDecodeErrorZPtr { /// 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::chan_utils::ChannelPublicKeys, + pub result: *mut crate::lightning::ln::script::ShutdownScript, /// 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_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::script::ShutdownScript 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_ChannelPublicKeysDecodeErrorZ { - /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either +pub struct CResult_ShutdownScriptDecodeErrorZ { + /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr, - /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. + pub contents: CResult_ShutdownScriptDecodeErrorZPtr, + /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ { - CResult_ChannelPublicKeysDecodeErrorZ { - contents: CResult_ChannelPublicKeysDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ { + CResult_ShutdownScriptDecodeErrorZ { + contents: CResult_ShutdownScriptDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ { - CResult_ChannelPublicKeysDecodeErrorZ { - contents: CResult_ChannelPublicKeysDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ { + CResult_ShutdownScriptDecodeErrorZ { + contents: CResult_ShutdownScriptDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23595,13 +27247,13 @@ pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { } -impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { +/// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { } +impl Drop for CResult_ShutdownScriptDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23614,16 +27266,16 @@ impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { } } } -impl From> for CResult_ChannelPublicKeysDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownScriptDecodeErrorZ { + 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_ChannelPublicKeysDecodeErrorZPtr { result } + CResult_ShutdownScriptDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelPublicKeysDecodeErrorZPtr { err } + CResult_ShutdownScriptDecodeErrorZPtr { err } }; Self { contents, @@ -23631,59 +27283,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ -pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ +pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr { /// 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::chan_utils::HTLCOutputInCommitment, + pub result: *mut crate::lightning::ln::script::ShutdownScript, /// 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::script::InvalidShutdownScript, } #[repr(C)] -/// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ { - /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either +pub struct CResult_ShutdownScriptInvalidShutdownScriptZ { + /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr, - /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. + pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr, + /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { - CResult_HTLCOutputInCommitmentDecodeErrorZ { - contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { + CResult_ShutdownScriptInvalidShutdownScriptZ { + contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { - CResult_HTLCOutputInCommitmentDecodeErrorZ { - contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { + CResult_ShutdownScriptInvalidShutdownScriptZ { + contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23691,13 +27343,13 @@ pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } -impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { +/// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { } +impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23710,16 +27362,16 @@ impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { } } } -impl From> for CResult_HTLCOutputInCommitmentDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownScriptInvalidShutdownScriptZ { + 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_HTLCOutputInCommitmentDecodeErrorZPtr { result } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } }; Self { contents, @@ -23727,59 +27379,105 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TransactionZ { + /// 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::Transaction, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TransactionZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::Transaction] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TransactionZ { + 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_TransactionZ_free(_res: CVec_TransactionZ) { } +impl Drop for CVec_TransactionZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_TransactionZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ -pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// The contents of CResult_FundingInfoDecodeErrorZ +pub union CResult_FundingInfoDecodeErrorZPtr { /// 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::chan_utils::CounterpartyChannelTransactionParameters, + pub result: *mut crate::lightning::events::FundingInfo, /// 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_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::FundingInfo 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_CounterpartyChannelTransactionParametersDecodeErrorZ { - /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either +pub struct CResult_FundingInfoDecodeErrorZ { + /// The contents of this CResult_FundingInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr, - /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. + pub contents: CResult_FundingInfoDecodeErrorZPtr, + /// Whether this CResult_FundingInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_FundingInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_ok(o: crate::lightning::events::FundingInfo) -> CResult_FundingInfoDecodeErrorZ { + CResult_FundingInfoDecodeErrorZ { + contents: CResult_FundingInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_FundingInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingInfoDecodeErrorZ { + CResult_FundingInfoDecodeErrorZ { + contents: CResult_FundingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23787,13 +27485,13 @@ pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_e } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_is_ok(o: &CResult_FundingInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { } -impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +/// Frees any resources used by the CResult_FundingInfoDecodeErrorZ. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_free(_res: CResult_FundingInfoDecodeErrorZ) { } +impl Drop for CResult_FundingInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23806,16 +27504,16 @@ impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { } } } -impl From> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingInfoDecodeErrorZ { + 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_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result } + CResult_FundingInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } + CResult_FundingInfoDecodeErrorZPtr { err } }; Self { contents, @@ -23823,59 +27521,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_clone(orig: &CResult_FundingInfoDecodeErrorZ) -> CResult_FundingInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelTransactionParametersDecodeErrorZ -pub union CResult_ChannelTransactionParametersDecodeErrorZPtr { +/// The contents of CResult_PaymentPurposeDecodeErrorZ +pub union CResult_PaymentPurposeDecodeErrorZPtr { /// 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::chan_utils::ChannelTransactionParameters, + pub result: *mut crate::lightning::events::PaymentPurpose, /// 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_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::PaymentPurpose 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_ChannelTransactionParametersDecodeErrorZ { - /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either +pub struct CResult_PaymentPurposeDecodeErrorZ { + /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr, - /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. + pub contents: CResult_PaymentPurposeDecodeErrorZPtr, + /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ { - CResult_ChannelTransactionParametersDecodeErrorZ { - contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ { + CResult_PaymentPurposeDecodeErrorZ { + contents: CResult_PaymentPurposeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ { - CResult_ChannelTransactionParametersDecodeErrorZ { - contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ { + CResult_PaymentPurposeDecodeErrorZ { + contents: CResult_PaymentPurposeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23883,13 +27581,13 @@ pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { } -impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { +/// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { } +impl Drop for CResult_PaymentPurposeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23902,16 +27600,16 @@ impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { } } } -impl From> for CResult_ChannelTransactionParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentPurposeDecodeErrorZ { + 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_ChannelTransactionParametersDecodeErrorZPtr { result } + CResult_PaymentPurposeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelTransactionParametersDecodeErrorZPtr { err } + CResult_PaymentPurposeDecodeErrorZPtr { err } }; Self { contents, @@ -23919,59 +27617,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ -pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// 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::ln::chan_utils::HolderCommitmentTransaction, + 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_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_HolderCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either +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_HolderCommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. + pub contents: CResult_ClaimedHTLCDecodeErrorZPtr, + /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ { - CResult_HolderCommitmentTransactionDecodeErrorZ { - contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// 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_HolderCommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ { - CResult_HolderCommitmentTransactionDecodeErrorZ { - contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// 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, @@ -23979,13 +27677,13 @@ pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { +/// 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() } { @@ -23998,16 +27696,16 @@ impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_HolderCommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_HolderCommitmentTransactionDecodeErrorZPtr { result } + CResult_ClaimedHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } + CResult_ClaimedHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -24015,59 +27713,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_HolderCommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` +/// 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_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ -pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::PathFailure or not +pub enum COption_PathFailureZ { + /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure + Some(crate::lightning::events::PathFailure), + /// When we're in this state, this COption_PathFailureZ contains nothing + None +} +impl COption_PathFailureZ { + #[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::events::PathFailure { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure +pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ { + COption_PathFailureZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_PathFailureZ containing nothing +pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ { + COption_PathFailureZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state +pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { } +#[no_mangle] +/// Creates a new COption_PathFailureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_PathFailureZDecodeErrorZ +pub union CResult_COption_PathFailureZDecodeErrorZPtr { /// 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::chan_utils::BuiltCommitmentTransaction, + pub result: *mut crate::c_types::derived::COption_PathFailureZ, /// 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_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_PathFailureZ 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_BuiltCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. +pub struct CResult_COption_PathFailureZDecodeErrorZ { + /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_PathFailureZDecodeErrorZPtr, + /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { - CResult_BuiltCommitmentTransactionDecodeErrorZ { - contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ { + CResult_COption_PathFailureZDecodeErrorZ { + contents: CResult_COption_PathFailureZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { - CResult_BuiltCommitmentTransactionDecodeErrorZ { - contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ { + CResult_COption_PathFailureZDecodeErrorZ { + contents: CResult_COption_PathFailureZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24075,13 +27810,13 @@ pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { +/// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { } +impl Drop for CResult_COption_PathFailureZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24094,16 +27829,16 @@ impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_BuiltCommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_PathFailureZDecodeErrorZ { + 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_BuiltCommitmentTransactionDecodeErrorZPtr { result } + CResult_COption_PathFailureZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } + CResult_COption_PathFailureZDecodeErrorZPtr { err } }; Self { contents, @@ -24111,134 +27846,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_TrustedClosingTransactionNoneZ -pub union CResult_TrustedClosingTransactionNoneZPtr { - /// 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::chan_utils::TrustedClosingTransaction, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, -} +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TrustedClosingTransactionNoneZ { - /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TrustedClosingTransactionNoneZPtr, - /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. - pub result_ok: bool, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::ClosureReason or not +pub enum COption_ClosureReasonZ { + /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason + Some(crate::lightning::events::ClosureReason), + /// When we're in this state, this COption_ClosureReasonZ contains nothing + None } -#[no_mangle] -/// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ { - CResult_TrustedClosingTransactionNoneZ { - contents: CResult_TrustedClosingTransactionNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl COption_ClosureReasonZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -#[no_mangle] -/// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ { - CResult_TrustedClosingTransactionNoneZ { - contents: CResult_TrustedClosingTransactionNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::ClosureReason { + 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_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { - o.result_ok +/// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason +pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ { + COption_ClosureReasonZ::Some(o) } #[no_mangle] -/// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { } -impl Drop for CResult_TrustedClosingTransactionNoneZ { - 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_TrustedClosingTransactionNoneZ { - 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_TrustedClosingTransactionNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } +/// Constructs a new COption_ClosureReasonZ containing nothing +pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ { + COption_ClosureReasonZ::None } +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state +pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { } +#[no_mangle] +/// Creates a new COption_ClosureReasonZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentTransactionDecodeErrorZ -pub union CResult_CommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_COption_ClosureReasonZDecodeErrorZ +pub union CResult_COption_ClosureReasonZDecodeErrorZPtr { /// 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::chan_utils::CommitmentTransaction, + pub result: *mut crate::c_types::derived::COption_ClosureReasonZ, /// 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_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_ClosureReasonZ 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_CommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either +pub struct CResult_COption_ClosureReasonZDecodeErrorZ { + /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. + pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr, + /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ { - CResult_CommitmentTransactionDecodeErrorZ { - contents: CResult_CommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ { - CResult_CommitmentTransactionDecodeErrorZ { - contents: CResult_CommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24246,13 +27943,13 @@ pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_CommitmentTransactionDecodeErrorZ { +/// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { } +impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24265,16 +27962,16 @@ impl Drop for CResult_CommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_CommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_ClosureReasonZDecodeErrorZ { + 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_CommitmentTransactionDecodeErrorZPtr { result } + CResult_COption_ClosureReasonZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentTransactionDecodeErrorZPtr { err } + CResult_COption_ClosureReasonZDecodeErrorZPtr { err } }; Self { contents, @@ -24282,91 +27979,132 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TrustedCommitmentTransactionNoneZ -pub union CResult_TrustedCommitmentTransactionNoneZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::HTLCHandlingFailureType or not +pub enum COption_HTLCHandlingFailureTypeZ { + /// When we're in this state, this COption_HTLCHandlingFailureTypeZ contains a crate::lightning::events::HTLCHandlingFailureType + Some(crate::lightning::events::HTLCHandlingFailureType), + /// When we're in this state, this COption_HTLCHandlingFailureTypeZ contains nothing + None +} +impl COption_HTLCHandlingFailureTypeZ { + #[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::events::HTLCHandlingFailureType { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_HTLCHandlingFailureTypeZ containing a crate::lightning::events::HTLCHandlingFailureType +pub extern "C" fn COption_HTLCHandlingFailureTypeZ_some(o: crate::lightning::events::HTLCHandlingFailureType) -> COption_HTLCHandlingFailureTypeZ { + COption_HTLCHandlingFailureTypeZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_HTLCHandlingFailureTypeZ containing nothing +pub extern "C" fn COption_HTLCHandlingFailureTypeZ_none() -> COption_HTLCHandlingFailureTypeZ { + COption_HTLCHandlingFailureTypeZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::HTLCHandlingFailureType, if we are in the Some state +pub extern "C" fn COption_HTLCHandlingFailureTypeZ_free(_res: COption_HTLCHandlingFailureTypeZ) { } +#[no_mangle] +/// Creates a new COption_HTLCHandlingFailureTypeZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_HTLCHandlingFailureTypeZ_clone(orig: &COption_HTLCHandlingFailureTypeZ) -> COption_HTLCHandlingFailureTypeZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ +pub union CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { /// 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::chan_utils::TrustedCommitmentTransaction, - /// 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::COption_HTLCHandlingFailureTypeZ, + /// 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_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure. +/// A CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_HTLCHandlingFailureTypeZ 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_TrustedCommitmentTransactionNoneZ { - /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either +pub struct CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + /// The contents of this CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TrustedCommitmentTransactionNoneZPtr, - /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. + pub contents: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr, + /// Whether this CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ { - CResult_TrustedCommitmentTransactionNoneZ { - contents: CResult_TrustedCommitmentTransactionNoneZPtr { +/// Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCHandlingFailureTypeZ) -> CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + contents: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ { - CResult_TrustedCommitmentTransactionNoneZ { - contents: CResult_TrustedCommitmentTransactionNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + contents: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { + 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_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool { +pub extern "C" fn CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { } -impl Drop for CResult_TrustedCommitmentTransactionNoneZ { +/// Frees any resources used by the CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ. +pub extern "C" fn CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_free(_res: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ) { } +impl Drop for CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { 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_TrustedCommitmentTransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + 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_TrustedCommitmentTransactionNoneZPtr { result } + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { err } }; Self { contents, @@ -24374,74 +28112,95 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ_clone(orig: &CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ) -> CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_ECDSASignatureZNoneZ -pub union CResult_CVec_ECDSASignatureZNoneZPtr { +/// The contents of CResult_HTLCHandlingFailureReasonDecodeErrorZ +pub union CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { /// 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_ECDSASignatureZ, - /// 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::lightning::events::HTLCHandlingFailureReason, + /// 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_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure. +/// A CResult_HTLCHandlingFailureReasonDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::HTLCHandlingFailureReason 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_CVec_ECDSASignatureZNoneZ { - /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either +pub struct CResult_HTLCHandlingFailureReasonDecodeErrorZ { + /// The contents of this CResult_HTLCHandlingFailureReasonDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_ECDSASignatureZNoneZPtr, - /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. + pub contents: CResult_HTLCHandlingFailureReasonDecodeErrorZPtr, + /// Whether this CResult_HTLCHandlingFailureReasonDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCHandlingFailureReasonDecodeErrorZ_ok(o: crate::lightning::events::HTLCHandlingFailureReason) -> CResult_HTLCHandlingFailureReasonDecodeErrorZ { + CResult_HTLCHandlingFailureReasonDecodeErrorZ { + contents: CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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(), +/// Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCHandlingFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCHandlingFailureReasonDecodeErrorZ { + CResult_HTLCHandlingFailureReasonDecodeErrorZ { + contents: CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { + 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_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool { +pub extern "C" fn CResult_HTLCHandlingFailureReasonDecodeErrorZ_is_ok(o: &CResult_HTLCHandlingFailureReasonDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// 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 { +/// Frees any resources used by the CResult_HTLCHandlingFailureReasonDecodeErrorZ. +pub extern "C" fn CResult_HTLCHandlingFailureReasonDecodeErrorZ_free(_res: CResult_HTLCHandlingFailureReasonDecodeErrorZ) { } +impl Drop for CResult_HTLCHandlingFailureReasonDecodeErrorZ { 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_ECDSASignatureZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HTLCHandlingFailureReasonDecodeErrorZ { + 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_ECDSASignatureZNoneZPtr { result } + CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { err } }; Self { contents, @@ -24449,96 +28208,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { + 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() + Self { result_ok: false, contents: CResult_HTLCHandlingFailureReasonDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` +/// Creates a new CResult_HTLCHandlingFailureReasonDecodeErrorZ 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) } +pub extern "C" fn CResult_HTLCHandlingFailureReasonDecodeErrorZ_clone(orig: &CResult_HTLCHandlingFailureReasonDecodeErrorZ) -> CResult_HTLCHandlingFailureReasonDecodeErrorZ { 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 +/// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not +pub enum COption_PaymentFailureReasonZ { + /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason + Some(crate::lightning::events::PaymentFailureReason), + /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing None } -impl COption_usizeZ { +impl COption_PaymentFailureReasonZ { #[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 { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_usizeZ containing a usize -pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ { - COption_usizeZ::Some(o) +/// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason +pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ { + COption_PaymentFailureReasonZ::Some(o) } #[no_mangle] -/// Constructs a new COption_usizeZ containing nothing -pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ { - COption_usizeZ::None +/// Constructs a new COption_PaymentFailureReasonZ containing nothing +pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ { + COption_PaymentFailureReasonZ::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) { } +/// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state +pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { } #[no_mangle] -/// Creates a new COption_usizeZ which has the same data as `orig` +/// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) } +pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptDecodeErrorZ -pub union CResult_ShutdownScriptDecodeErrorZPtr { +/// The contents of CResult_COption_PaymentFailureReasonZDecodeErrorZ +pub union CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { /// 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::script::ShutdownScript, + pub result: *mut crate::c_types::derived::COption_PaymentFailureReasonZ, /// 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_ShutdownScriptDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_PaymentFailureReasonZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_PaymentFailureReasonZ 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_ShutdownScriptDecodeErrorZ { - /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either +pub struct CResult_COption_PaymentFailureReasonZDecodeErrorZ { + /// The contents of this CResult_COption_PaymentFailureReasonZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownScriptDecodeErrorZPtr, - /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. + pub contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr, + /// Whether this CResult_COption_PaymentFailureReasonZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ { - CResult_ShutdownScriptDecodeErrorZ { - contents: CResult_ShutdownScriptDecodeErrorZPtr { +/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PaymentFailureReasonZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { + CResult_COption_PaymentFailureReasonZDecodeErrorZ { + contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ { - CResult_ShutdownScriptDecodeErrorZ { - contents: CResult_ShutdownScriptDecodeErrorZPtr { +/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { + CResult_COption_PaymentFailureReasonZDecodeErrorZ { + contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24546,13 +28305,13 @@ pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { } -impl Drop for CResult_ShutdownScriptDecodeErrorZ { +/// Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(_res: CResult_COption_PaymentFailureReasonZDecodeErrorZ) { } +impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24565,16 +28324,16 @@ impl Drop for CResult_ShutdownScriptDecodeErrorZ { } } } -impl From> for CResult_ShutdownScriptDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_PaymentFailureReasonZDecodeErrorZ { + 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_ShutdownScriptDecodeErrorZPtr { result } + CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptDecodeErrorZPtr { err } + CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err } }; Self { contents, @@ -24582,143 +28341,255 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(orig: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { Clone::clone(&orig) } +#[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 + Some(crate::c_types::U128), + /// When we're in this state, this COption_U128Z contains nothing + None +} +impl COption_U128Z { + #[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::U128 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[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) +} +#[no_mangle] +/// 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) { } +#[no_mangle] +/// 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) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ChannelIdCOption_U128ZZ { + /// The element at position 0 + pub a: crate::lightning::ln::types::ChannelId, + /// The element at position 1 + pub b: crate::c_types::derived::COption_U128Z, +} +impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::derived::COption_U128Z)> for C2Tuple_ChannelIdCOption_U128ZZ { + fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::derived::COption_U128Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ChannelIdCOption_U128ZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::derived::COption_U128Z) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ChannelIdCOption_U128ZZ { + 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_ChannelIdCOption_U128ZZ_clone(orig: &C2Tuple_ChannelIdCOption_U128ZZ) -> C2Tuple_ChannelIdCOption_U128ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ChannelIdCOption_U128ZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ChannelIdCOption_U128ZZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::derived::COption_U128Z) -> C2Tuple_ChannelIdCOption_U128ZZ { + C2Tuple_ChannelIdCOption_U128ZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ChannelIdCOption_U128ZZ. +pub extern "C" fn C2Tuple_ChannelIdCOption_U128ZZ_free(_res: C2Tuple_ChannelIdCOption_U128ZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdCOption_U128ZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ChannelIdCOption_U128ZZZ { + /// 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_ChannelIdCOption_U128ZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_ChannelIdCOption_U128ZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_ChannelIdCOption_U128ZZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_ChannelIdCOption_U128ZZZ { + 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_ChannelIdCOption_U128ZZZ_free(_res: CVec_C2Tuple_ChannelIdCOption_U128ZZZ) { } +impl Drop for CVec_C2Tuple_ChannelIdCOption_U128ZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_ChannelIdCOption_U128ZZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ -pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr { - /// 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::script::ShutdownScript, - /// 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::script::InvalidShutdownScript, -} #[repr(C)] -/// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ShutdownScriptInvalidShutdownScriptZ { - /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr, - /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. - pub result_ok: bool, +/// 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 } -#[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { - CResult_ShutdownScriptInvalidShutdownScriptZ { - contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: 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(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -#[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { - CResult_ShutdownScriptInvalidShutdownScriptZ { - contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool { - o.result_ok +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] -/// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { } -impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { +/// 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.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) }; - } - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl From> for CResult_ShutdownScriptInvalidShutdownScriptZ { - 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_ShutdownScriptInvalidShutdownScriptZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +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 { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::PaidBolt12Invoice or not +pub enum COption_PaidBolt12InvoiceZ { + /// When we're in this state, this COption_PaidBolt12InvoiceZ contains a crate::lightning::events::PaidBolt12Invoice + Some(crate::lightning::events::PaidBolt12Invoice), + /// When we're in this state, this COption_PaidBolt12InvoiceZ contains nothing + None +} +impl COption_PaidBolt12InvoiceZ { + #[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::events::PaidBolt12Invoice { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` +/// Constructs a new COption_PaidBolt12InvoiceZ containing a crate::lightning::events::PaidBolt12Invoice +pub extern "C" fn COption_PaidBolt12InvoiceZ_some(o: crate::lightning::events::PaidBolt12Invoice) -> COption_PaidBolt12InvoiceZ { + COption_PaidBolt12InvoiceZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_PaidBolt12InvoiceZ containing nothing +pub extern "C" fn COption_PaidBolt12InvoiceZ_none() -> COption_PaidBolt12InvoiceZ { + COption_PaidBolt12InvoiceZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::PaidBolt12Invoice, if we are in the Some state +pub extern "C" fn COption_PaidBolt12InvoiceZ_free(_res: COption_PaidBolt12InvoiceZ) { } +#[no_mangle] +/// Creates a new COption_PaidBolt12InvoiceZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) } +pub extern "C" fn COption_PaidBolt12InvoiceZ_clone(orig: &COption_PaidBolt12InvoiceZ) -> COption_PaidBolt12InvoiceZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. +/// A dynamically-allocated array of u32s of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_TransactionZ { +pub struct CVec_u32Z { /// 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::Transaction, + pub data: *mut u32, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_TransactionZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_u32Z { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::Transaction] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[u32] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_TransactionZ { - fn from(v: Vec) -> Self { +impl From> for CVec_u32Z { + 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() } } @@ -24726,245 +28597,214 @@ impl From> for CVec_TransactionZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { } -impl Drop for CVec_TransactionZ { +pub extern "C" fn CVec_u32Z_free(_res: CVec_u32Z) { } +impl Drop for CVec_u32Z { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_TransactionZ { +impl Clone for CVec_u32Z { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_u64NoneZ -pub union CResult_u64NoneZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut u64, - /// 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_u64NoneZ represents the result of a fallible operation, -/// containing a u64 on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_u64NoneZ { - /// The contents of this CResult_u64NoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_u64NoneZPtr, - /// Whether this CResult_u64NoneZ represents a success state. - pub result_ok: bool, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::chain::transaction::OutPoint or not +pub enum COption_OutPointZ { + /// When we're in this state, this COption_OutPointZ contains a crate::lightning::chain::transaction::OutPoint + Some(crate::lightning::chain::transaction::OutPoint), + /// When we're in this state, this COption_OutPointZ contains nothing + None } -#[no_mangle] -/// Creates a new CResult_u64NoneZ in the success state. -pub extern "C" fn CResult_u64NoneZ_ok(o: u64) -> CResult_u64NoneZ { - CResult_u64NoneZ { - contents: CResult_u64NoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl COption_OutPointZ { + #[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::chain::transaction::OutPoint { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_u64NoneZ in the error state. -pub extern "C" fn CResult_u64NoneZ_err() -> CResult_u64NoneZ { - CResult_u64NoneZ { - contents: CResult_u64NoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, - } +/// Constructs a new COption_OutPointZ containing a crate::lightning::chain::transaction::OutPoint +pub extern "C" fn COption_OutPointZ_some(o: crate::lightning::chain::transaction::OutPoint) -> COption_OutPointZ { + COption_OutPointZ::Some(o) } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_u64NoneZ_is_ok(o: &CResult_u64NoneZ) -> bool { - o.result_ok +/// Constructs a new COption_OutPointZ containing nothing +pub extern "C" fn COption_OutPointZ_none() -> COption_OutPointZ { + COption_OutPointZ::None } #[no_mangle] -/// Frees any resources used by the CResult_u64NoneZ. -pub extern "C" fn CResult_u64NoneZ_free(_res: CResult_u64NoneZ) { } -impl Drop for CResult_u64NoneZ { - 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 associated with the crate::lightning::chain::transaction::OutPoint, if we are in the Some state +pub extern "C" fn COption_OutPointZ_free(_res: COption_OutPointZ) { } +#[no_mangle] +/// Creates a new COption_OutPointZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_OutPointZ_clone(orig: &COption_OutPointZ) -> COption_OutPointZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_OutPointZ { + /// 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::chain::transaction::OutPoint, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl From> for CResult_u64NoneZ { - 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_u64NoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_u64NoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl CVec_OutPointZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::chain::transaction::OutPoint] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl Clone for CResult_u64NoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_u64NoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_u64NoneZPtr { - err: core::ptr::null_mut() - } } - } +impl From> for CVec_OutPointZ { + 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] -/// Creates a new CResult_u64NoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_u64NoneZ_clone(orig: &CResult_u64NoneZ) -> CResult_u64NoneZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_FundingInfoDecodeErrorZ -pub union CResult_FundingInfoDecodeErrorZPtr { - /// 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::FundingInfo, - /// 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, +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { } +impl Drop for CVec_OutPointZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_OutPointZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } } #[repr(C)] -/// A CResult_FundingInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::events::FundingInfo 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_FundingInfoDecodeErrorZ { - /// The contents of this CResult_FundingInfoDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingInfoDecodeErrorZPtr, - /// Whether this CResult_FundingInfoDecodeErrorZ represents a success state. - pub result_ok: bool, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::HTLCHandlingFailureReason or not +pub enum COption_HTLCHandlingFailureReasonZ { + /// When we're in this state, this COption_HTLCHandlingFailureReasonZ contains a crate::lightning::events::HTLCHandlingFailureReason + Some(crate::lightning::events::HTLCHandlingFailureReason), + /// When we're in this state, this COption_HTLCHandlingFailureReasonZ contains nothing + None } -#[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_ok(o: crate::lightning::events::FundingInfo) -> CResult_FundingInfoDecodeErrorZ { - CResult_FundingInfoDecodeErrorZ { - contents: CResult_FundingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl COption_HTLCHandlingFailureReasonZ { + #[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::events::HTLCHandlingFailureReason { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingInfoDecodeErrorZ { - CResult_FundingInfoDecodeErrorZ { - contents: CResult_FundingInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } +/// Constructs a new COption_HTLCHandlingFailureReasonZ containing a crate::lightning::events::HTLCHandlingFailureReason +pub extern "C" fn COption_HTLCHandlingFailureReasonZ_some(o: crate::lightning::events::HTLCHandlingFailureReason) -> COption_HTLCHandlingFailureReasonZ { + COption_HTLCHandlingFailureReasonZ::Some(o) } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_is_ok(o: &CResult_FundingInfoDecodeErrorZ) -> bool { - o.result_ok +/// Constructs a new COption_HTLCHandlingFailureReasonZ containing nothing +pub extern "C" fn COption_HTLCHandlingFailureReasonZ_none() -> COption_HTLCHandlingFailureReasonZ { + COption_HTLCHandlingFailureReasonZ::None } #[no_mangle] -/// Frees any resources used by the CResult_FundingInfoDecodeErrorZ. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_free(_res: CResult_FundingInfoDecodeErrorZ) { } -impl Drop for CResult_FundingInfoDecodeErrorZ { - 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) }; - } - } - } +/// Frees any resources associated with the crate::lightning::events::HTLCHandlingFailureReason, if we are in the Some state +pub extern "C" fn COption_HTLCHandlingFailureReasonZ_free(_res: COption_HTLCHandlingFailureReasonZ) { } +#[no_mangle] +/// Creates a new COption_HTLCHandlingFailureReasonZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_HTLCHandlingFailureReasonZ_clone(orig: &COption_HTLCHandlingFailureReasonZ) -> COption_HTLCHandlingFailureReasonZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::Event or not +pub enum COption_EventZ { + /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event + Some(crate::lightning::events::Event), + /// When we're in this state, this COption_EventZ contains nothing + None } -impl From> for CResult_FundingInfoDecodeErrorZ { - 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_FundingInfoDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingInfoDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl COption_EventZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl Clone for CResult_FundingInfoDecodeErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_FundingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_FundingInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::Event { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ which has the same data as `orig` +/// Constructs a new COption_EventZ containing a crate::lightning::events::Event +pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ { + COption_EventZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_EventZ containing nothing +pub extern "C" fn COption_EventZ_none() -> COption_EventZ { + COption_EventZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state +pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { } +#[no_mangle] +/// Creates a new COption_EventZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_clone(orig: &CResult_FundingInfoDecodeErrorZ) -> CResult_FundingInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentPurposeDecodeErrorZ -pub union CResult_PaymentPurposeDecodeErrorZPtr { +/// The contents of CResult_COption_EventZDecodeErrorZ +pub union CResult_COption_EventZDecodeErrorZPtr { /// 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::PaymentPurpose, + pub result: *mut crate::c_types::derived::COption_EventZ, /// 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_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_EventZ 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_PaymentPurposeDecodeErrorZ { - /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either +pub struct CResult_COption_EventZDecodeErrorZ { + /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentPurposeDecodeErrorZPtr, - /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. + pub contents: CResult_COption_EventZDecodeErrorZPtr, + /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ { - CResult_PaymentPurposeDecodeErrorZ { - contents: CResult_PaymentPurposeDecodeErrorZPtr { +/// Creates a new CResult_COption_EventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ { - CResult_PaymentPurposeDecodeErrorZ { - contents: CResult_PaymentPurposeDecodeErrorZPtr { +/// Creates a new CResult_COption_EventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24972,13 +28812,13 @@ pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { } -impl Drop for CResult_PaymentPurposeDecodeErrorZ { +/// Frees any resources used by the CResult_COption_EventZDecodeErrorZ. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { } +impl Drop for CResult_COption_EventZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24991,16 +28831,16 @@ impl Drop for CResult_PaymentPurposeDecodeErrorZ { } } } -impl From> for CResult_PaymentPurposeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_EventZDecodeErrorZ { + 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_PaymentPurposeDecodeErrorZPtr { result } + CResult_COption_EventZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentPurposeDecodeErrorZPtr { err } + CResult_COption_EventZDecodeErrorZPtr { err } }; Self { contents, @@ -25008,59 +28848,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClaimedHTLCDecodeErrorZ -pub union CResult_ClaimedHTLCDecodeErrorZPtr { +/// The contents of CResult_PaidBolt12InvoiceDecodeErrorZ +pub union CResult_PaidBolt12InvoiceDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::events::PaidBolt12Invoice, /// 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. +/// A CResult_PaidBolt12InvoiceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::PaidBolt12Invoice 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 +pub struct CResult_PaidBolt12InvoiceDecodeErrorZ { + /// The contents of this CResult_PaidBolt12InvoiceDecodeErrorZ, 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 contents: CResult_PaidBolt12InvoiceDecodeErrorZPtr, + /// Whether this CResult_PaidBolt12InvoiceDecodeErrorZ 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 { +/// Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaidBolt12InvoiceDecodeErrorZ_ok(o: crate::lightning::events::PaidBolt12Invoice) -> CResult_PaidBolt12InvoiceDecodeErrorZ { + CResult_PaidBolt12InvoiceDecodeErrorZ { + contents: CResult_PaidBolt12InvoiceDecodeErrorZPtr { 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 { +/// Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaidBolt12InvoiceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaidBolt12InvoiceDecodeErrorZ { + CResult_PaidBolt12InvoiceDecodeErrorZ { + contents: CResult_PaidBolt12InvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25068,13 +28908,13 @@ pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::m } /// 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 { +pub extern "C" fn CResult_PaidBolt12InvoiceDecodeErrorZ_is_ok(o: &CResult_PaidBolt12InvoiceDecodeErrorZ) -> 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 { +/// Frees any resources used by the CResult_PaidBolt12InvoiceDecodeErrorZ. +pub extern "C" fn CResult_PaidBolt12InvoiceDecodeErrorZ_free(_res: CResult_PaidBolt12InvoiceDecodeErrorZ) { } +impl Drop for CResult_PaidBolt12InvoiceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25087,16 +28927,16 @@ impl Drop for CResult_ClaimedHTLCDecodeErrorZ { } } } -impl From> for CResult_ClaimedHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaidBolt12InvoiceDecodeErrorZ { + 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 } + CResult_PaidBolt12InvoiceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClaimedHTLCDecodeErrorZPtr { err } + CResult_PaidBolt12InvoiceDecodeErrorZPtr { err } }; Self { contents, @@ -25104,96 +28944,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaidBolt12InvoiceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaidBolt12InvoiceDecodeErrorZPtr { 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 { - /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure - Some(crate::lightning::events::PathFailure), - /// When we're in this state, this COption_PathFailureZ contains nothing - None -} -impl COption_PathFailureZ { - #[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::events::PathFailure { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure -pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ { - COption_PathFailureZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_PathFailureZ containing nothing -pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ { - COption_PathFailureZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state -pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { } -#[no_mangle] -/// Creates a new COption_PathFailureZ which has the same data as `orig` +/// Creates a new CResult_PaidBolt12InvoiceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaidBolt12InvoiceDecodeErrorZ_clone(orig: &CResult_PaidBolt12InvoiceDecodeErrorZ) -> CResult_PaidBolt12InvoiceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_PathFailureZDecodeErrorZ -pub union CResult_COption_PathFailureZDecodeErrorZPtr { +/// The contents of CResult_PacketDecodeErrorZ +pub union CResult_PacketDecodeErrorZPtr { /// 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_PathFailureZ, + pub result: *mut crate::lightning::onion_message::packet::Packet, /// 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_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PacketDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::packet::Packet 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_COption_PathFailureZDecodeErrorZ { - /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either +pub struct CResult_PacketDecodeErrorZ { + /// The contents of this CResult_PacketDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_PathFailureZDecodeErrorZPtr, - /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. + pub contents: CResult_PacketDecodeErrorZPtr, + /// Whether this CResult_PacketDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ { - CResult_COption_PathFailureZDecodeErrorZ { - contents: CResult_COption_PathFailureZDecodeErrorZPtr { +/// Creates a new CResult_PacketDecodeErrorZ in the success state. +pub extern "C" fn CResult_PacketDecodeErrorZ_ok(o: crate::lightning::onion_message::packet::Packet) -> CResult_PacketDecodeErrorZ { + CResult_PacketDecodeErrorZ { + contents: CResult_PacketDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ { - CResult_COption_PathFailureZDecodeErrorZ { - contents: CResult_COption_PathFailureZDecodeErrorZPtr { +/// Creates a new CResult_PacketDecodeErrorZ in the error state. +pub extern "C" fn CResult_PacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PacketDecodeErrorZ { + CResult_PacketDecodeErrorZ { + contents: CResult_PacketDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25201,13 +29004,13 @@ pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PacketDecodeErrorZ_is_ok(o: &CResult_PacketDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { } -impl Drop for CResult_COption_PathFailureZDecodeErrorZ { +/// Frees any resources used by the CResult_PacketDecodeErrorZ. +pub extern "C" fn CResult_PacketDecodeErrorZ_free(_res: CResult_PacketDecodeErrorZ) { } +impl Drop for CResult_PacketDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25220,16 +29023,16 @@ impl Drop for CResult_COption_PathFailureZDecodeErrorZ { } } } -impl From> for CResult_COption_PathFailureZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PacketDecodeErrorZ { + 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_PathFailureZDecodeErrorZPtr { result } + CResult_PacketDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_PathFailureZDecodeErrorZPtr { err } + CResult_PacketDecodeErrorZPtr { err } }; Self { contents, @@ -25237,96 +29040,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PacketDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PacketDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::ClosureReason or not -pub enum COption_ClosureReasonZ { - /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason - Some(crate::lightning::events::ClosureReason), - /// When we're in this state, this COption_ClosureReasonZ contains nothing - None -} -impl COption_ClosureReasonZ { - #[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::events::ClosureReason { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason -pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ { - COption_ClosureReasonZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_ClosureReasonZ containing nothing -pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ { - COption_ClosureReasonZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state -pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { } -#[no_mangle] -/// Creates a new COption_ClosureReasonZ which has the same data as `orig` +/// Creates a new CResult_PacketDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PacketDecodeErrorZ_clone(orig: &CResult_PacketDecodeErrorZ) -> CResult_PacketDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_ClosureReasonZDecodeErrorZ -pub union CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// The contents of CResult_NonceDecodeErrorZ +pub union CResult_NonceDecodeErrorZPtr { /// 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_ClosureReasonZ, + pub result: *mut crate::lightning::offers::nonce::Nonce, /// 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_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NonceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::nonce::Nonce 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_COption_ClosureReasonZDecodeErrorZ { - /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either +pub struct CResult_NonceDecodeErrorZ { + /// The contents of this CResult_NonceDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr, - /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + pub contents: CResult_NonceDecodeErrorZPtr, + /// Whether this CResult_NonceDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { - CResult_COption_ClosureReasonZDecodeErrorZ { - contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// Creates a new CResult_NonceDecodeErrorZ in the success state. +pub extern "C" fn CResult_NonceDecodeErrorZ_ok(o: crate::lightning::offers::nonce::Nonce) -> CResult_NonceDecodeErrorZ { + CResult_NonceDecodeErrorZ { + contents: CResult_NonceDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ { - CResult_COption_ClosureReasonZDecodeErrorZ { - contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// Creates a new CResult_NonceDecodeErrorZ in the error state. +pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NonceDecodeErrorZ { + CResult_NonceDecodeErrorZ { + contents: CResult_NonceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25334,13 +29100,13 @@ pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NonceDecodeErrorZ_is_ok(o: &CResult_NonceDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { } -impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { +/// Frees any resources used by the CResult_NonceDecodeErrorZ. +pub extern "C" fn CResult_NonceDecodeErrorZ_free(_res: CResult_NonceDecodeErrorZ) { } +impl Drop for CResult_NonceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25353,16 +29119,16 @@ impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { } } } -impl From> for CResult_COption_ClosureReasonZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NonceDecodeErrorZ { + 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_ClosureReasonZDecodeErrorZPtr { result } + CResult_NonceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_ClosureReasonZDecodeErrorZPtr { err } + CResult_NonceDecodeErrorZPtr { err } }; Self { contents, @@ -25370,96 +29136,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NonceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NonceDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NonceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NonceDecodeErrorZ_clone(orig: &CResult_NonceDecodeErrorZ) -> CResult_NonceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::HTLCDestination or not -pub enum COption_HTLCDestinationZ { - /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination - Some(crate::lightning::events::HTLCDestination), - /// When we're in this state, this COption_HTLCDestinationZ contains nothing - None +/// A dynamically-allocated array of crate::lightning_types::routing::RouteHintHops of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_RouteHintHopZ { + /// 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_types::routing::RouteHintHop, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_HTLCDestinationZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_RouteHintHopZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_types::routing::RouteHintHop] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_RouteHintHopZ { + 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_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination -pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ { - COption_HTLCDestinationZ::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { } +impl Drop for CVec_RouteHintHopZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } } -#[no_mangle] -/// Constructs a new COption_HTLCDestinationZ containing nothing -pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ { - COption_HTLCDestinationZ::None +impl Clone for CVec_RouteHintHopZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) + } } -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state -pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { } -#[no_mangle] -/// Creates a new COption_HTLCDestinationZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ -pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// The contents of CResult_SiPrefixBolt11ParseErrorZ +pub union CResult_SiPrefixBolt11ParseErrorZPtr { /// 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_HTLCDestinationZ, + pub result: *mut crate::lightning_invoice::SiPrefix, /// 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_invoice::Bolt11ParseError, } #[repr(C)] -/// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_HTLCDestinationZDecodeErrorZ { - /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either +pub struct CResult_SiPrefixBolt11ParseErrorZ { + /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr, - /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + pub contents: CResult_SiPrefixBolt11ParseErrorZPtr, + /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { - CResult_COption_HTLCDestinationZDecodeErrorZ { - contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ { + CResult_SiPrefixBolt11ParseErrorZ { + contents: CResult_SiPrefixBolt11ParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ { - CResult_COption_HTLCDestinationZDecodeErrorZ { - contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ { + CResult_SiPrefixBolt11ParseErrorZ { + contents: CResult_SiPrefixBolt11ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25467,13 +29242,13 @@ pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { } -impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ { +/// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { } +impl Drop for CResult_SiPrefixBolt11ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25486,16 +29261,16 @@ impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ { } } } -impl From> for CResult_COption_HTLCDestinationZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SiPrefixBolt11ParseErrorZ { + 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_HTLCDestinationZDecodeErrorZPtr { result } + CResult_SiPrefixBolt11ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_HTLCDestinationZDecodeErrorZPtr { err } + CResult_SiPrefixBolt11ParseErrorZPtr { err } }; Self { contents, @@ -25503,96 +29278,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not -pub enum COption_PaymentFailureReasonZ { - /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason - Some(crate::lightning::events::PaymentFailureReason), - /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing - None -} -impl COption_PaymentFailureReasonZ { - #[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::events::PaymentFailureReason { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason -pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ { - COption_PaymentFailureReasonZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_PaymentFailureReasonZ containing nothing -pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ { - COption_PaymentFailureReasonZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state -pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { } -#[no_mangle] -/// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_PaymentFailureReasonZDecodeErrorZ -pub union CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ +pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { /// 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_PaymentFailureReasonZ, + pub result: *mut crate::lightning_invoice::Bolt11Invoice, /// 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_invoice::ParseOrSemanticError, } #[repr(C)] -/// A CResult_COption_PaymentFailureReasonZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_PaymentFailureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_PaymentFailureReasonZDecodeErrorZ { - /// The contents of this CResult_COption_PaymentFailureReasonZDecodeErrorZ, accessible via either +pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ { + /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr, - /// Whether this CResult_COption_PaymentFailureReasonZDecodeErrorZ represents a success state. + pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr, + /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PaymentFailureReasonZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { - CResult_COption_PaymentFailureReasonZDecodeErrorZ { - contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { + CResult_Bolt11InvoiceParseOrSemanticErrorZ { + contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { - CResult_COption_PaymentFailureReasonZDecodeErrorZ { - contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { + CResult_Bolt11InvoiceParseOrSemanticErrorZ { + contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25600,13 +29338,13 @@ pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(_res: CResult_COption_PaymentFailureReasonZDecodeErrorZ) { } -impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { } +impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25619,16 +29357,16 @@ impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { } } } -impl From> for CResult_COption_PaymentFailureReasonZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceParseOrSemanticErrorZ { + 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_PaymentFailureReasonZDecodeErrorZPtr { result } + CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err } + CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err } }; Self { contents, @@ -25636,179 +29374,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(orig: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { Clone::clone(&orig) } -#[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 - Some(crate::c_types::U128), - /// When we're in this state, this COption_U128Z contains nothing - None -} -impl COption_U128Z { - #[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::U128 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[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) -} -#[no_mangle] -/// 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) { } -#[no_mangle] -/// 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) } -#[repr(C)] -/// 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 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 as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -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] -/// 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)) }; - } -} -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) - } -} -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::Event or not -pub enum COption_EventZ { - /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event - Some(crate::lightning::events::Event), - /// When we're in this state, this COption_EventZ contains nothing - None -} -impl COption_EventZ { - #[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::events::Event { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_EventZ containing a crate::lightning::events::Event -pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ { - COption_EventZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_EventZ containing nothing -pub extern "C" fn COption_EventZ_none() -> COption_EventZ { - COption_EventZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state -pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { } -#[no_mangle] -/// Creates a new COption_EventZ which has the same data as `orig` +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_EventZDecodeErrorZ -pub union CResult_COption_EventZDecodeErrorZPtr { +/// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ +pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { /// 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_EventZ, + pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice, /// 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_invoice::Bolt11ParseError, } #[repr(C)] -/// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_EventZDecodeErrorZ { - /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either +pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_EventZDecodeErrorZPtr, - /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state. + pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr, + /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_EventZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ { - CResult_COption_EventZDecodeErrorZ { - contents: CResult_COption_EventZDecodeErrorZPtr { +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_EventZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ { - CResult_COption_EventZDecodeErrorZ { - contents: CResult_COption_EventZDecodeErrorZPtr { +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25816,13 +29434,13 @@ pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_EventZDecodeErrorZ. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { } -impl Drop for CResult_COption_EventZDecodeErrorZ { +/// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { } +impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25835,16 +29453,16 @@ impl Drop for CResult_COption_EventZDecodeErrorZ { } } } -impl From> for CResult_COption_EventZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + 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_EventZDecodeErrorZPtr { result } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_EventZDecodeErrorZPtr { err } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err } }; Self { contents, @@ -25852,59 +29470,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + /// The element at position 0 + pub a: crate::lightning_invoice::RawBolt11Invoice, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, + /// The element at position 2 + pub c: crate::lightning_invoice::Bolt11InvoiceSignature, +} +impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } + } +} +impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) { + (self.a, self.b, self.c) + } +} +impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + } + } +} +#[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 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, } +} + +#[no_mangle] +/// 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_NonceDecodeErrorZ -pub union CResult_NonceDecodeErrorZPtr { +/// 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::offers::nonce::Nonce, + pub result: *mut crate::lightning_invoice::PayeePubKey, /// 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::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_NonceDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::nonce::Nonce on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_NonceDecodeErrorZ { - /// The contents of this CResult_NonceDecodeErrorZ, 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_NonceDecodeErrorZPtr, - /// Whether this CResult_NonceDecodeErrorZ 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_NonceDecodeErrorZ in the success state. -pub extern "C" fn CResult_NonceDecodeErrorZ_ok(o: crate::lightning::offers::nonce::Nonce) -> CResult_NonceDecodeErrorZ { - CResult_NonceDecodeErrorZ { - contents: CResult_NonceDecodeErrorZPtr { +/// 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_NonceDecodeErrorZ in the error state. -pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NonceDecodeErrorZ { - CResult_NonceDecodeErrorZ { - contents: CResult_NonceDecodeErrorZPtr { +/// 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, @@ -25912,13 +29576,13 @@ pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::D } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NonceDecodeErrorZ_is_ok(o: &CResult_NonceDecodeErrorZ) -> 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_NonceDecodeErrorZ. -pub extern "C" fn CResult_NonceDecodeErrorZ_free(_res: CResult_NonceDecodeErrorZ) { } -impl Drop for CResult_NonceDecodeErrorZ { +/// 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() } { @@ -25931,16 +29595,16 @@ impl Drop for CResult_NonceDecodeErrorZ { } } } -impl From> for CResult_NonceDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_NonceDecodeErrorZPtr { result } + CResult_PayeePubKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonceDecodeErrorZPtr { err } + CResult_PayeePubKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -25948,47 +29612,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NonceDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_NonceDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NonceDecodeErrorZ 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_NonceDecodeErrorZ_clone(orig: &CResult_NonceDecodeErrorZ) -> CResult_NonceDecodeErrorZ { 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_types::routing::RouteHintHops of arbitrary size. +/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_RouteHintHopZ { +pub struct CVec_PrivateRouteZ { /// 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_types::routing::RouteHintHop, + pub data: *mut crate::lightning_invoice::PrivateRoute, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_RouteHintHopZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_PrivateRouteZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_types::routing::RouteHintHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_RouteHintHopZ { - fn from(v: Vec) -> Self { +impl From> for CVec_PrivateRouteZ { + 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() } } @@ -25996,57 +29660,57 @@ impl From> for CVec_RouteHint } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { } -impl Drop for CVec_RouteHintHopZ { +pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { } +impl Drop for CVec_PrivateRouteZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_RouteHintHopZ { +impl Clone for CVec_PrivateRouteZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_SiPrefixBolt11ParseErrorZ -pub union CResult_SiPrefixBolt11ParseErrorZPtr { +/// The contents of CResult_PositiveTimestampCreationErrorZ +pub union CResult_PositiveTimestampCreationErrorZPtr { /// 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::SiPrefix, + pub result: *mut crate::lightning_invoice::PositiveTimestamp, /// 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::Bolt11ParseError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure. +/// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SiPrefixBolt11ParseErrorZ { - /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either +pub struct CResult_PositiveTimestampCreationErrorZ { + /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SiPrefixBolt11ParseErrorZPtr, - /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state. + pub contents: CResult_PositiveTimestampCreationErrorZPtr, + /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ { - CResult_SiPrefixBolt11ParseErrorZ { - contents: CResult_SiPrefixBolt11ParseErrorZPtr { +/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ { + CResult_PositiveTimestampCreationErrorZ { + contents: CResult_PositiveTimestampCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ { - CResult_SiPrefixBolt11ParseErrorZ { - contents: CResult_SiPrefixBolt11ParseErrorZPtr { +/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ { + CResult_PositiveTimestampCreationErrorZ { + contents: CResult_PositiveTimestampCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26054,13 +29718,13 @@ pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invo } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool { +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { } -impl Drop for CResult_SiPrefixBolt11ParseErrorZ { +/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { } +impl Drop for CResult_PositiveTimestampCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26073,16 +29737,16 @@ impl Drop for CResult_SiPrefixBolt11ParseErrorZ { } } } -impl From> for CResult_SiPrefixBolt11ParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PositiveTimestampCreationErrorZ { + 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_SiPrefixBolt11ParseErrorZPtr { result } + CResult_PositiveTimestampCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SiPrefixBolt11ParseErrorZPtr { err } + CResult_PositiveTimestampCreationErrorZPtr { err } }; Self { contents, @@ -26090,59 +29754,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` +/// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ -pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { - /// 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::Bolt11Invoice, +/// The contents of CResult_NoneBolt11SemanticErrorZ +pub union CResult_NoneBolt11SemanticErrorZPtr { + /// 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. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::ParseOrSemanticError, + pub err: *mut crate::lightning_invoice::Bolt11SemanticError, } #[repr(C)] -/// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. +/// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ { - /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either +pub struct CResult_NoneBolt11SemanticErrorZ { + /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr, - /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state. + pub contents: CResult_NoneBolt11SemanticErrorZPtr, + /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { - CResult_Bolt11InvoiceParseOrSemanticErrorZ { - contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ { + CResult_NoneBolt11SemanticErrorZ { + contents: CResult_NoneBolt11SemanticErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { - CResult_Bolt11InvoiceParseOrSemanticErrorZ { - contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { +/// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ { + CResult_NoneBolt11SemanticErrorZ { + contents: CResult_NoneBolt11SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26150,18 +29813,15 @@ pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool { +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { } -impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { +/// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { } +impl Drop for CResult_NoneBolt11SemanticErrorZ { 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) }; @@ -26169,16 +29829,16 @@ impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { } } } -impl From> for CResult_Bolt11InvoiceParseOrSemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneBolt11SemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err } + CResult_NoneBolt11SemanticErrorZPtr { err } }; Self { contents, @@ -26186,59 +29846,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ -pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ +pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { /// 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::SignedRawBolt11Invoice, + pub result: *mut crate::lightning_invoice::Bolt11Invoice, /// 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::Bolt11ParseError, + pub err: *mut crate::lightning_invoice::Bolt11SemanticError, } #[repr(C)] -/// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure. +/// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either +pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ { + /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr, - /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state. + pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr, + /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { + CResult_Bolt11InvoiceBolt11SemanticErrorZ { + contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { + CResult_Bolt11InvoiceBolt11SemanticErrorZ { + contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26246,13 +29906,13 @@ pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { } -impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { +/// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { } +impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26265,16 +29925,16 @@ impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { } } } -impl From> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceBolt11SemanticErrorZ { + 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_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result } + CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err } + CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err } }; Self { contents, @@ -26282,105 +29942,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` +/// 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_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - /// The element at position 0 - pub a: crate::lightning_invoice::RawBolt11Invoice, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, - /// The element at position 2 - pub c: crate::lightning_invoice::Bolt11InvoiceSignature, +/// An enum which can either contain a crate::c_types::Address or not +pub enum COption_AddressZ { + /// When we're in this state, this COption_AddressZ contains a crate::c_types::Address + Some(crate::c_types::Address), + /// When we're in this state, this COption_AddressZ contains nothing + None } -impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } +impl COption_AddressZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) { - (self.a, self.b, self.c) + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::Address { + 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 C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. +/// Constructs a new COption_AddressZ containing a crate::c_types::Address +pub extern "C" fn COption_AddressZ_some(o: crate::c_types::Address) -> COption_AddressZ { + COption_AddressZ::Some(o) +} #[no_mangle] -pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, } +/// Constructs a new COption_AddressZ containing nothing +pub extern "C" fn COption_AddressZ_none() -> COption_AddressZ { + COption_AddressZ::None } - #[no_mangle] -/// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. -pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { } +/// Frees any resources associated with the crate::c_types::Address, if we are in the Some state +pub extern "C" fn COption_AddressZ_free(_res: COption_AddressZ) { } #[repr(C)] -/// The contents of CResult_PayeePubKeySecp256k1ErrorZ -pub union CResult_PayeePubKeySecp256k1ErrorZPtr { +/// The contents of CResult_DescriptionCreationErrorZ +pub union CResult_DescriptionCreationErrorZPtr { /// 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, + pub result: *mut crate::lightning_invoice::Description, /// 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::Secp256k1Error, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// 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. +/// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PayeePubKeySecp256k1ErrorZ { - /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either +pub struct CResult_DescriptionCreationErrorZ { + /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr, - /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. + pub contents: CResult_DescriptionCreationErrorZPtr, + /// Whether this CResult_DescriptionCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_DescriptionCreationErrorZ in the success state. +pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ { + CResult_DescriptionCreationErrorZ { + contents: CResult_DescriptionCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_DescriptionCreationErrorZ in the error state. +pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ { + CResult_DescriptionCreationErrorZ { + contents: CResult_DescriptionCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26388,13 +30034,13 @@ pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool { +pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { } -impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { +/// Frees any resources used by the CResult_DescriptionCreationErrorZ. +pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { } +impl Drop for CResult_DescriptionCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26407,16 +30053,16 @@ impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { } } } -impl From> for CResult_PayeePubKeySecp256k1ErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_DescriptionCreationErrorZ { + 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_PayeePubKeySecp256k1ErrorZPtr { result } + CResult_DescriptionCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PayeePubKeySecp256k1ErrorZPtr { err } + CResult_DescriptionCreationErrorZPtr { err } }; Self { contents, @@ -26424,105 +30070,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` +/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -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++ -pub struct CVec_PrivateRouteZ { - /// 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_invoice::PrivateRoute, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PrivateRouteZ { - #[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_invoice::PrivateRoute] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PrivateRouteZ { - 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_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { } -impl Drop for CVec_PrivateRouteZ { - 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_PrivateRouteZ { - 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_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PositiveTimestampCreationErrorZ -pub union CResult_PositiveTimestampCreationErrorZPtr { +/// The contents of CResult_PrivateRouteCreationErrorZ +pub union CResult_PrivateRouteCreationErrorZPtr { /// 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::PositiveTimestamp, + pub result: *mut crate::lightning_invoice::PrivateRoute, /// 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::CreationError, } #[repr(C)] -/// A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. +/// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PositiveTimestampCreationErrorZ { - /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either +pub struct CResult_PrivateRouteCreationErrorZ { + /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PositiveTimestampCreationErrorZPtr, - /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. + pub contents: CResult_PrivateRouteCreationErrorZPtr, + /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ { - CResult_PositiveTimestampCreationErrorZ { - contents: CResult_PositiveTimestampCreationErrorZPtr { +/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ { + CResult_PrivateRouteCreationErrorZ { + contents: CResult_PrivateRouteCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ { - CResult_PositiveTimestampCreationErrorZ { - contents: CResult_PositiveTimestampCreationErrorZPtr { +/// Creates a new CResult_PrivateRouteCreationErrorZ in the error state. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ { + CResult_PrivateRouteCreationErrorZ { + contents: CResult_PrivateRouteCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26530,13 +30130,13 @@ pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool { +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { } -impl Drop for CResult_PositiveTimestampCreationErrorZ { +/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { } +impl Drop for CResult_PrivateRouteCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26549,16 +30149,16 @@ impl Drop for CResult_PositiveTimestampCreationErrorZ { } } } -impl From> for CResult_PositiveTimestampCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PrivateRouteCreationErrorZ { + 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_PositiveTimestampCreationErrorZPtr { result } + CResult_PrivateRouteCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PositiveTimestampCreationErrorZPtr { err } + CResult_PrivateRouteCreationErrorZPtr { err } }; Self { contents, @@ -26566,58 +30166,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr { + Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` +/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneBolt11SemanticErrorZ -pub union CResult_NoneBolt11SemanticErrorZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, +/// The contents of CResult_OutPointDecodeErrorZ +pub union CResult_OutPointDecodeErrorZPtr { + /// 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::transaction::OutPoint, /// 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::Bolt11SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure. +/// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::transaction::OutPoint 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_NoneBolt11SemanticErrorZ { - /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either +pub struct CResult_OutPointDecodeErrorZ { + /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneBolt11SemanticErrorZPtr, - /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state. + pub contents: CResult_OutPointDecodeErrorZPtr, + /// Whether this CResult_OutPointDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ { - CResult_NoneBolt11SemanticErrorZ { - contents: CResult_NoneBolt11SemanticErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_OutPointDecodeErrorZ in the success state. +pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ { + CResult_OutPointDecodeErrorZ { + contents: CResult_OutPointDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ { - CResult_NoneBolt11SemanticErrorZ { - contents: CResult_NoneBolt11SemanticErrorZPtr { +/// Creates a new CResult_OutPointDecodeErrorZ in the error state. +pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ { + CResult_OutPointDecodeErrorZ { + contents: CResult_OutPointDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26625,15 +30226,18 @@ pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoi } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool { +pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { } -impl Drop for CResult_NoneBolt11SemanticErrorZ { +/// Frees any resources used by the CResult_OutPointDecodeErrorZ. +pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { } +impl Drop for CResult_OutPointDecodeErrorZ { 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) }; @@ -26641,16 +30245,16 @@ impl Drop for CResult_NoneBolt11SemanticErrorZ { } } } -impl From> for CResult_NoneBolt11SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self { +impl From> for CResult_OutPointDecodeErrorZ { + 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_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_OutPointDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneBolt11SemanticErrorZPtr { err } + CResult_OutPointDecodeErrorZPtr { err } }; Self { contents, @@ -26658,59 +30262,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ -pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { +/// The contents of CResult_BigSizeDecodeErrorZ +pub union CResult_BigSizeDecodeErrorZPtr { /// 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::Bolt11Invoice, + pub result: *mut crate::lightning::util::ser::BigSize, /// 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::Bolt11SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure. +/// A CResult_BigSizeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::BigSize 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_Bolt11InvoiceBolt11SemanticErrorZ { - /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either +pub struct CResult_BigSizeDecodeErrorZ { + /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr, - /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state. + pub contents: CResult_BigSizeDecodeErrorZPtr, + /// Whether this CResult_BigSizeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { - CResult_Bolt11InvoiceBolt11SemanticErrorZ { - contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { +/// Creates a new CResult_BigSizeDecodeErrorZ in the success state. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ { + CResult_BigSizeDecodeErrorZ { + contents: CResult_BigSizeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { - CResult_Bolt11InvoiceBolt11SemanticErrorZ { - contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { +/// Creates a new CResult_BigSizeDecodeErrorZ in the error state. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ { + CResult_BigSizeDecodeErrorZ { + contents: CResult_BigSizeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26718,13 +30322,13 @@ pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool { +pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { } -impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ { +/// Frees any resources used by the CResult_BigSizeDecodeErrorZ. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { } +impl Drop for CResult_BigSizeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26737,16 +30341,16 @@ impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ { } } } -impl From> for CResult_Bolt11InvoiceBolt11SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BigSizeDecodeErrorZ { + 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_Bolt11InvoiceBolt11SemanticErrorZPtr { result } + CResult_BigSizeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err } + CResult_BigSizeDecodeErrorZPtr { err } }; Self { contents, @@ -26754,59 +30358,59 @@ 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 }))) + Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr { + 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` +/// Creates a new CResult_BigSizeDecodeErrorZ 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) } +pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_DescriptionCreationErrorZ -pub union CResult_DescriptionCreationErrorZPtr { +/// The contents of CResult_CollectionLengthDecodeErrorZ +pub union CResult_CollectionLengthDecodeErrorZPtr { /// 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::Description, + pub result: *mut crate::lightning::util::ser::CollectionLength, /// 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::CreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. +/// A CResult_CollectionLengthDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::CollectionLength 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_DescriptionCreationErrorZ { - /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either +pub struct CResult_CollectionLengthDecodeErrorZ { + /// The contents of this CResult_CollectionLengthDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_DescriptionCreationErrorZPtr, - /// Whether this CResult_DescriptionCreationErrorZ represents a success state. + pub contents: CResult_CollectionLengthDecodeErrorZPtr, + /// Whether this CResult_CollectionLengthDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ in the success state. -pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ { - CResult_DescriptionCreationErrorZ { - contents: CResult_DescriptionCreationErrorZPtr { +/// Creates a new CResult_CollectionLengthDecodeErrorZ in the success state. +pub extern "C" fn CResult_CollectionLengthDecodeErrorZ_ok(o: crate::lightning::util::ser::CollectionLength) -> CResult_CollectionLengthDecodeErrorZ { + CResult_CollectionLengthDecodeErrorZ { + contents: CResult_CollectionLengthDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ in the error state. -pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ { - CResult_DescriptionCreationErrorZ { - contents: CResult_DescriptionCreationErrorZPtr { +/// Creates a new CResult_CollectionLengthDecodeErrorZ in the error state. +pub extern "C" fn CResult_CollectionLengthDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CollectionLengthDecodeErrorZ { + CResult_CollectionLengthDecodeErrorZ { + contents: CResult_CollectionLengthDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26814,13 +30418,13 @@ pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invo } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool { +pub extern "C" fn CResult_CollectionLengthDecodeErrorZ_is_ok(o: &CResult_CollectionLengthDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_DescriptionCreationErrorZ. -pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { } -impl Drop for CResult_DescriptionCreationErrorZ { +/// Frees any resources used by the CResult_CollectionLengthDecodeErrorZ. +pub extern "C" fn CResult_CollectionLengthDecodeErrorZ_free(_res: CResult_CollectionLengthDecodeErrorZ) { } +impl Drop for CResult_CollectionLengthDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26833,16 +30437,16 @@ impl Drop for CResult_DescriptionCreationErrorZ { } } } -impl From> for CResult_DescriptionCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CollectionLengthDecodeErrorZ { + 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_DescriptionCreationErrorZPtr { result } + CResult_CollectionLengthDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_DescriptionCreationErrorZPtr { err } + CResult_CollectionLengthDecodeErrorZPtr { err } }; Self { contents, @@ -26850,59 +30454,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PrivateRouteCreationErrorZ -pub union CResult_PrivateRouteCreationErrorZPtr { +/// 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_invoice::PrivateRoute, + pub result: *mut crate::lightning_types::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_invoice::CreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. +/// A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::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_PrivateRouteCreationErrorZ { - /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either +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_PrivateRouteCreationErrorZPtr, - /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state. + pub contents: CResult_UntrustedStringDecodeErrorZPtr, + /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ { - CResult_PrivateRouteCreationErrorZ { - contents: CResult_PrivateRouteCreationErrorZPtr { +/// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning_types::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_PrivateRouteCreationErrorZ in the error state. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ { - CResult_PrivateRouteCreationErrorZ { - contents: CResult_PrivateRouteCreationErrorZPtr { +/// 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, @@ -26910,13 +30497,13 @@ pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_inv } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool { +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { } -impl Drop for CResult_PrivateRouteCreationErrorZ { +/// 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() } { @@ -26929,16 +30516,16 @@ impl Drop for CResult_PrivateRouteCreationErrorZ { } } } -impl From> for CResult_PrivateRouteCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_PrivateRouteCreationErrorZPtr { result } + CResult_UntrustedStringDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PrivateRouteCreationErrorZPtr { err } + CResult_UntrustedStringDecodeErrorZPtr { err } }; Self { contents, @@ -26946,59 +30533,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_PrivateRouteCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` +/// 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_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OutPointDecodeErrorZ -pub union CResult_OutPointDecodeErrorZPtr { +/// The contents of CResult_HostnameDecodeErrorZ +pub union CResult_HostnameDecodeErrorZPtr { /// 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::transaction::OutPoint, + pub result: *mut crate::lightning::util::ser::Hostname, /// 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_OutPointDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::Hostname 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_OutPointDecodeErrorZ { - /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either +pub struct CResult_HostnameDecodeErrorZ { + /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OutPointDecodeErrorZPtr, - /// Whether this CResult_OutPointDecodeErrorZ represents a success state. + pub contents: CResult_HostnameDecodeErrorZPtr, + /// Whether this CResult_HostnameDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ in the success state. -pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ { - CResult_OutPointDecodeErrorZ { - contents: CResult_OutPointDecodeErrorZPtr { +/// Creates a new CResult_HostnameDecodeErrorZ in the success state. +pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ { + CResult_HostnameDecodeErrorZ { + contents: CResult_HostnameDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ in the error state. -pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ { - CResult_OutPointDecodeErrorZ { - contents: CResult_OutPointDecodeErrorZPtr { +/// Creates a new CResult_HostnameDecodeErrorZ in the error state. +pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ { + CResult_HostnameDecodeErrorZ { + contents: CResult_HostnameDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27006,13 +30593,13 @@ pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OutPointDecodeErrorZ. -pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { } -impl Drop for CResult_OutPointDecodeErrorZ { +/// Frees any resources used by the CResult_HostnameDecodeErrorZ. +pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { } +impl Drop for CResult_HostnameDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27025,16 +30612,16 @@ impl Drop for CResult_OutPointDecodeErrorZ { } } } -impl From> for CResult_OutPointDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HostnameDecodeErrorZ { + 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_OutPointDecodeErrorZPtr { result } + CResult_HostnameDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OutPointDecodeErrorZPtr { err } + CResult_HostnameDecodeErrorZPtr { err } }; Self { contents, @@ -27042,59 +30629,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BigSizeDecodeErrorZ -pub union CResult_BigSizeDecodeErrorZPtr { +/// 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::util::ser::BigSize, + pub result: *mut crate::lightning::blinded_path::payment::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_BigSizeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::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_BigSizeDecodeErrorZ { - /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either +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_BigSizeDecodeErrorZPtr, - /// Whether this CResult_BigSizeDecodeErrorZ represents a success state. + pub contents: CResult_BlindedPayInfoDecodeErrorZPtr, + /// Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ in the success state. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ { - CResult_BigSizeDecodeErrorZ { - contents: CResult_BigSizeDecodeErrorZPtr { +/// Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ { + CResult_BlindedPayInfoDecodeErrorZ { + contents: CResult_BlindedPayInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ in the error state. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ { - CResult_BigSizeDecodeErrorZ { - contents: CResult_BigSizeDecodeErrorZPtr { +/// 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, @@ -27102,13 +30689,13 @@ pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_is_ok(o: &CResult_BlindedPayInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BigSizeDecodeErrorZ. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { } -impl Drop for CResult_BigSizeDecodeErrorZ { +/// 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() } { @@ -27121,16 +30708,16 @@ impl Drop for CResult_BigSizeDecodeErrorZ { } } } -impl From> for CResult_BigSizeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_BigSizeDecodeErrorZPtr { result } + CResult_BlindedPayInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BigSizeDecodeErrorZPtr { err } + CResult_BlindedPayInfoDecodeErrorZPtr { err } }; Self { contents, @@ -27138,95 +30725,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_BigSizeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` +/// 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_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_clone(orig: &CResult_BlindedPayInfoDecodeErrorZ) -> CResult_BlindedPayInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UntrustedStringDecodeErrorZ -pub union CResult_UntrustedStringDecodeErrorZPtr { +/// The contents of CResult_BlindedPaymentPathNoneZ +pub union CResult_BlindedPaymentPathNoneZPtr { /// 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_types::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, + pub result: *mut crate::lightning::blinded_path::payment::BlindedPaymentPath, + /// 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_UntrustedStringDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedPaymentPathNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::BlindedPaymentPath on success and a () 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_BlindedPaymentPathNoneZ { + /// The contents of this CResult_BlindedPaymentPathNoneZ, 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_BlindedPaymentPathNoneZPtr, + /// Whether this CResult_BlindedPaymentPathNoneZ 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_types::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ { - CResult_UntrustedStringDecodeErrorZ { - contents: CResult_UntrustedStringDecodeErrorZPtr { +/// Creates a new CResult_BlindedPaymentPathNoneZ in the success state. +pub extern "C" fn CResult_BlindedPaymentPathNoneZ_ok(o: crate::lightning::blinded_path::payment::BlindedPaymentPath) -> CResult_BlindedPaymentPathNoneZ { + CResult_BlindedPaymentPathNoneZ { + contents: CResult_BlindedPaymentPathNoneZPtr { 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)), +/// Creates a new CResult_BlindedPaymentPathNoneZ in the error state. +pub extern "C" fn CResult_BlindedPaymentPathNoneZ_err() -> CResult_BlindedPaymentPathNoneZ { + CResult_BlindedPaymentPathNoneZ { + contents: CResult_BlindedPaymentPathNoneZPtr { + 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_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedPaymentPathNoneZ_is_ok(o: &CResult_BlindedPaymentPathNoneZ) -> 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_BlindedPaymentPathNoneZ. +pub extern "C" fn CResult_BlindedPaymentPathNoneZ_free(_res: CResult_BlindedPaymentPathNoneZ) { } +impl Drop for CResult_BlindedPaymentPathNoneZ { 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 { +impl From> for CResult_BlindedPaymentPathNoneZ { + 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_BlindedPaymentPathNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UntrustedStringDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_BlindedPaymentPathNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -27234,59 +30817,105 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_BlindedPaymentPathNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_BlindedPaymentPathNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_BlindedPaymentPathNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_BlindedPaymentPathNoneZ_clone(orig: &CResult_BlindedPaymentPathNoneZ) -> CResult_BlindedPaymentPathNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::blinded_path::payment::PaymentForwardNodes of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_PaymentForwardNodeZ { + /// 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::blinded_path::payment::PaymentForwardNode, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_PaymentForwardNodeZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::payment::PaymentForwardNode] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } + } +} +impl From> for CVec_PaymentForwardNodeZ { + 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_PaymentForwardNodeZ_free(_res: CVec_PaymentForwardNodeZ) { } +impl Drop for CVec_PaymentForwardNodeZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_PaymentForwardNodeZ { 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 }))) - } } - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[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_HostnameDecodeErrorZ -pub union CResult_HostnameDecodeErrorZPtr { +/// 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::util::ser::Hostname, + 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_HostnameDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_HostnameDecodeErrorZ { - /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either +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_HostnameDecodeErrorZPtr, - /// Whether this CResult_HostnameDecodeErrorZ represents a success state. + pub contents: CResult_PaymentRelayDecodeErrorZPtr, + /// Whether this CResult_PaymentRelayDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HostnameDecodeErrorZ in the success state. -pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ { - CResult_HostnameDecodeErrorZ { - contents: CResult_HostnameDecodeErrorZPtr { +/// 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_HostnameDecodeErrorZ in the error state. -pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ { - CResult_HostnameDecodeErrorZ { - contents: CResult_HostnameDecodeErrorZPtr { +/// 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, @@ -27294,13 +30923,13 @@ pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> 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_HostnameDecodeErrorZ. -pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { } -impl Drop for CResult_HostnameDecodeErrorZ { +/// 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() } { @@ -27313,16 +30942,16 @@ impl Drop for CResult_HostnameDecodeErrorZ { } } } -impl From> for CResult_HostnameDecodeErrorZ { - 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_HostnameDecodeErrorZPtr { result } + CResult_PaymentRelayDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HostnameDecodeErrorZPtr { err } + CResult_PaymentRelayDecodeErrorZPtr { err } }; Self { contents, @@ -27330,91 +30959,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr { - 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_HostnameDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HostnameDecodeErrorZ 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_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionU16LenLimitedNoneZ -pub union CResult_TransactionU16LenLimitedNoneZPtr { +/// 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::ser::TransactionU16LenLimited, - /// 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::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_TransactionU16LenLimitedNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () 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_TransactionU16LenLimitedNoneZ { - /// The contents of this CResult_TransactionU16LenLimitedNoneZ, 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_TransactionU16LenLimitedNoneZPtr, - /// Whether this CResult_TransactionU16LenLimitedNoneZ 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_TransactionU16LenLimitedNoneZ in the success state. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ { - CResult_TransactionU16LenLimitedNoneZ { - contents: CResult_TransactionU16LenLimitedNoneZPtr { +/// 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_TransactionU16LenLimitedNoneZ in the error state. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ { - CResult_TransactionU16LenLimitedNoneZ { - contents: CResult_TransactionU16LenLimitedNoneZPtr { - err: core::ptr::null_mut(), +/// 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, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> 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_TransactionU16LenLimitedNoneZ. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { } -impl Drop for CResult_TransactionU16LenLimitedNoneZ { +/// 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() } { 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_TransactionU16LenLimitedNoneZ { - 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_TransactionU16LenLimitedNoneZPtr { result } + CResult_PaymentConstraintsDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PaymentConstraintsDecodeErrorZPtr { err } }; Self { contents, @@ -27422,59 +31055,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr { - 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_TransactionU16LenLimitedNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedNoneZ 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_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ -pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// The contents of CResult_PaymentContextDecodeErrorZ +pub union CResult_PaymentContextDecodeErrorZPtr { /// 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::ser::TransactionU16LenLimited, + pub result: *mut crate::lightning::blinded_path::payment::PaymentContext, /// 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_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::PaymentContext 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_TransactionU16LenLimitedDecodeErrorZ { - /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either +pub struct CResult_PaymentContextDecodeErrorZ { + /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr, - /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state. + pub contents: CResult_PaymentContextDecodeErrorZPtr, + /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ { - CResult_TransactionU16LenLimitedDecodeErrorZ { - contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// Creates a new CResult_PaymentContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ { + CResult_PaymentContextDecodeErrorZ { + contents: CResult_PaymentContextDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[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_PaymentContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ { + CResult_PaymentContextDecodeErrorZ { + contents: CResult_PaymentContextDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27482,13 +31115,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_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> 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_PaymentContextDecodeErrorZ. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { } +impl Drop for CResult_PaymentContextDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27501,16 +31134,16 @@ impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { } } } -impl From> for CResult_TransactionU16LenLimitedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentContextDecodeErrorZ { + 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_PaymentContextDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TransactionU16LenLimitedDecodeErrorZPtr { err } + CResult_PaymentContextDecodeErrorZPtr { err } }; Self { contents, @@ -27518,59 +31151,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_PaymentContextDecodeErrorZPtr { + 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_PaymentContextDecodeErrorZPtr { 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_PaymentContextDecodeErrorZ 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_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelIdDecodeErrorZ -pub union CResult_ChannelIdDecodeErrorZPtr { +/// The contents of CResult_Bolt12OfferContextDecodeErrorZ +pub union CResult_Bolt12OfferContextDecodeErrorZPtr { /// 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::types::ChannelId, + pub result: *mut crate::lightning::blinded_path::payment::Bolt12OfferContext, /// 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_ChannelIdDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext 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_ChannelIdDecodeErrorZ { - /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either +pub struct CResult_Bolt12OfferContextDecodeErrorZ { + /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelIdDecodeErrorZPtr, - /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state. + pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr, + /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ { - CResult_ChannelIdDecodeErrorZ { - contents: CResult_ChannelIdDecodeErrorZPtr { +/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ { + CResult_Bolt12OfferContextDecodeErrorZ { + contents: CResult_Bolt12OfferContextDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ { - CResult_ChannelIdDecodeErrorZ { - contents: CResult_ChannelIdDecodeErrorZPtr { +/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ { + CResult_Bolt12OfferContextDecodeErrorZ { + contents: CResult_Bolt12OfferContextDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27578,13 +31211,13 @@ pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelIdDecodeErrorZ. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { } -impl Drop for CResult_ChannelIdDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ. +pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { } +impl Drop for CResult_Bolt12OfferContextDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27597,16 +31230,16 @@ impl Drop for CResult_ChannelIdDecodeErrorZ { } } } -impl From> for CResult_ChannelIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12OfferContextDecodeErrorZ { + 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_ChannelIdDecodeErrorZPtr { result } + CResult_Bolt12OfferContextDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelIdDecodeErrorZPtr { err } + CResult_Bolt12OfferContextDecodeErrorZPtr { err } }; Self { contents, @@ -27614,59 +31247,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InitFeaturesDecodeErrorZ -pub union CResult_InitFeaturesDecodeErrorZPtr { +/// The contents of CResult_AsyncBolt12OfferContextDecodeErrorZ +pub union CResult_AsyncBolt12OfferContextDecodeErrorZPtr { /// 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_types::features::InitFeatures, + pub result: *mut crate::lightning::blinded_path::payment::AsyncBolt12OfferContext, /// 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_InitFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AsyncBolt12OfferContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::AsyncBolt12OfferContext 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_InitFeaturesDecodeErrorZ { - /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either +pub struct CResult_AsyncBolt12OfferContextDecodeErrorZ { + /// The contents of this CResult_AsyncBolt12OfferContextDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InitFeaturesDecodeErrorZPtr, - /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_AsyncBolt12OfferContextDecodeErrorZPtr, + /// Whether this CResult_AsyncBolt12OfferContextDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ { - CResult_InitFeaturesDecodeErrorZ { - contents: CResult_InitFeaturesDecodeErrorZPtr { +/// Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_AsyncBolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::AsyncBolt12OfferContext) -> CResult_AsyncBolt12OfferContextDecodeErrorZ { + CResult_AsyncBolt12OfferContextDecodeErrorZ { + contents: CResult_AsyncBolt12OfferContextDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ { - CResult_InitFeaturesDecodeErrorZ { - contents: CResult_InitFeaturesDecodeErrorZPtr { +/// Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_AsyncBolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncBolt12OfferContextDecodeErrorZ { + CResult_AsyncBolt12OfferContextDecodeErrorZ { + contents: CResult_AsyncBolt12OfferContextDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27674,13 +31307,13 @@ pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AsyncBolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_AsyncBolt12OfferContextDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { } -impl Drop for CResult_InitFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_AsyncBolt12OfferContextDecodeErrorZ. +pub extern "C" fn CResult_AsyncBolt12OfferContextDecodeErrorZ_free(_res: CResult_AsyncBolt12OfferContextDecodeErrorZ) { } +impl Drop for CResult_AsyncBolt12OfferContextDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27693,16 +31326,16 @@ impl Drop for CResult_InitFeaturesDecodeErrorZ { } } } -impl From> for CResult_InitFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AsyncBolt12OfferContextDecodeErrorZ { + 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_InitFeaturesDecodeErrorZPtr { result } + CResult_AsyncBolt12OfferContextDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InitFeaturesDecodeErrorZPtr { err } + CResult_AsyncBolt12OfferContextDecodeErrorZPtr { err } }; Self { contents, @@ -27710,59 +31343,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AsyncBolt12OfferContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_AsyncBolt12OfferContextDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_AsyncBolt12OfferContextDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AsyncBolt12OfferContextDecodeErrorZ_clone(orig: &CResult_AsyncBolt12OfferContextDecodeErrorZ) -> CResult_AsyncBolt12OfferContextDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelFeaturesDecodeErrorZ -pub union CResult_ChannelFeaturesDecodeErrorZPtr { +/// The contents of CResult_Bolt12RefundContextDecodeErrorZ +pub union CResult_Bolt12RefundContextDecodeErrorZPtr { /// 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_types::features::ChannelFeatures, + pub result: *mut crate::lightning::blinded_path::payment::Bolt12RefundContext, /// 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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext 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_ChannelFeaturesDecodeErrorZ { - /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either +pub struct CResult_Bolt12RefundContextDecodeErrorZ { + /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelFeaturesDecodeErrorZPtr, - /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr, + /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ { - CResult_ChannelFeaturesDecodeErrorZ { - contents: CResult_ChannelFeaturesDecodeErrorZPtr { +/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ { + CResult_Bolt12RefundContextDecodeErrorZ { + contents: CResult_Bolt12RefundContextDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ { - CResult_ChannelFeaturesDecodeErrorZ { - contents: CResult_ChannelFeaturesDecodeErrorZPtr { +/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ { + CResult_Bolt12RefundContextDecodeErrorZ { + contents: CResult_Bolt12RefundContextDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27770,13 +31403,13 @@ pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { } -impl Drop for CResult_ChannelFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ. +pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { } +impl Drop for CResult_Bolt12RefundContextDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27789,16 +31422,16 @@ impl Drop for CResult_ChannelFeaturesDecodeErrorZ { } } } -impl From> for CResult_ChannelFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12RefundContextDecodeErrorZ { + 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_ChannelFeaturesDecodeErrorZPtr { result } + CResult_Bolt12RefundContextDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelFeaturesDecodeErrorZPtr { err } + CResult_Bolt12RefundContextDecodeErrorZPtr { err } }; Self { contents, @@ -27806,59 +31439,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeFeaturesDecodeErrorZ -pub union CResult_NodeFeaturesDecodeErrorZPtr { +/// The contents of CResult_ChannelIdDecodeErrorZ +pub union CResult_ChannelIdDecodeErrorZPtr { /// 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_types::features::NodeFeatures, + pub result: *mut crate::lightning::ln::types::ChannelId, /// 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_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::types::ChannelId 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_NodeFeaturesDecodeErrorZ { - /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either +pub struct CResult_ChannelIdDecodeErrorZ { + /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeFeaturesDecodeErrorZPtr, - /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_ChannelIdDecodeErrorZPtr, + /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ { - CResult_NodeFeaturesDecodeErrorZ { - contents: CResult_NodeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ChannelIdDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ { + CResult_ChannelIdDecodeErrorZ { + contents: CResult_ChannelIdDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ { - CResult_NodeFeaturesDecodeErrorZ { - contents: CResult_NodeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ChannelIdDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ { + CResult_ChannelIdDecodeErrorZ { + contents: CResult_ChannelIdDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27866,13 +31499,13 @@ pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { } -impl Drop for CResult_NodeFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelIdDecodeErrorZ. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { } +impl Drop for CResult_ChannelIdDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27885,16 +31518,16 @@ impl Drop for CResult_NodeFeaturesDecodeErrorZ { } } } -impl From> for CResult_NodeFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelIdDecodeErrorZ { + 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_NodeFeaturesDecodeErrorZPtr { result } + CResult_ChannelIdDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeFeaturesDecodeErrorZPtr { err } + CResult_ChannelIdDecodeErrorZPtr { err } }; Self { contents, @@ -27902,59 +31535,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ -pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +/// The contents of CResult_InitFeaturesDecodeErrorZ +pub union CResult_InitFeaturesDecodeErrorZPtr { /// 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_types::features::Bolt11InvoiceFeatures, + pub result: *mut crate::lightning_types::features::InitFeatures, /// 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_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::InitFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ { - /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either +pub struct CResult_InitFeaturesDecodeErrorZ { + /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr, - /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_InitFeaturesDecodeErrorZPtr, + /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ { + CResult_InitFeaturesDecodeErrorZ { + contents: CResult_InitFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ { + CResult_InitFeaturesDecodeErrorZ { + contents: CResult_InitFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27962,13 +31595,13 @@ pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { } -impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { } +impl Drop for CResult_InitFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27981,16 +31614,16 @@ impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { } } } -impl From> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InitFeaturesDecodeErrorZ { + 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_Bolt11InvoiceFeaturesDecodeErrorZPtr { result } + CResult_InitFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err } + CResult_InitFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -27998,59 +31631,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ -pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// The contents of CResult_ChannelFeaturesDecodeErrorZ +pub union CResult_ChannelFeaturesDecodeErrorZPtr { /// 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_types::features::Bolt12InvoiceFeatures, + pub result: *mut crate::lightning_types::features::ChannelFeatures, /// 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_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::ChannelFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ { - /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either +pub struct CResult_ChannelFeaturesDecodeErrorZ { + /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr, - /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_ChannelFeaturesDecodeErrorZPtr, + /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ { + CResult_ChannelFeaturesDecodeErrorZ { + contents: CResult_ChannelFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ { + CResult_ChannelFeaturesDecodeErrorZ { + contents: CResult_ChannelFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28058,13 +31691,13 @@ pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { } -impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { } +impl Drop for CResult_ChannelFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28077,16 +31710,16 @@ impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { } } } -impl From> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelFeaturesDecodeErrorZ { + 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { result } + CResult_ChannelFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err } + CResult_ChannelFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28094,59 +31727,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedHopFeaturesDecodeErrorZ -pub union CResult_BlindedHopFeaturesDecodeErrorZPtr { +/// The contents of CResult_NodeFeaturesDecodeErrorZ +pub union CResult_NodeFeaturesDecodeErrorZPtr { /// 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_types::features::BlindedHopFeatures, + pub result: *mut crate::lightning_types::features::NodeFeatures, /// 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_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::BlindedHopFeatures 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_BlindedHopFeaturesDecodeErrorZ { - /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either +/// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ { + /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr, - /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_NodeFeaturesDecodeErrorZPtr, + /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ { - CResult_BlindedHopFeaturesDecodeErrorZ { - contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { +/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ { + CResult_NodeFeaturesDecodeErrorZ { + contents: CResult_NodeFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ { - CResult_BlindedHopFeaturesDecodeErrorZ { - contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { +/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ { + CResult_NodeFeaturesDecodeErrorZ { + contents: CResult_NodeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28154,13 +31787,13 @@ pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { } -impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { } +impl Drop for CResult_NodeFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28173,16 +31806,16 @@ impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { } } } -impl From> for CResult_BlindedHopFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeFeaturesDecodeErrorZ { + 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_BlindedHopFeaturesDecodeErrorZPtr { result } + CResult_NodeFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedHopFeaturesDecodeErrorZPtr { err } + CResult_NodeFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28190,59 +31823,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ -pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ +pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { /// 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_types::features::ChannelTypeFeatures, + pub result: *mut crate::lightning_types::features::Bolt11InvoiceFeatures, /// 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_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::Bolt11InvoiceFeatures 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_ChannelTypeFeaturesDecodeErrorZ { - /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either +pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr, - /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr, + /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ { - CResult_ChannelTypeFeaturesDecodeErrorZ { - contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ { - CResult_ChannelTypeFeaturesDecodeErrorZ { - contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28250,13 +31883,13 @@ pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { } -impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { } +impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28269,16 +31902,16 @@ impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { } } } -impl From> for CResult_ChannelTypeFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + 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_ChannelTypeFeaturesDecodeErrorZPtr { result } + CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelTypeFeaturesDecodeErrorZPtr { err } + CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28286,101 +31919,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` -/// 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 tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple__u832u16Z { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: u16, -} -impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z { - fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple__u832u16Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) { - (self.a, self.b) - } -} -impl Clone for C2Tuple__u832u16Z { - 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` +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) } -/// Creates a new C2Tuple__u832u16Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z { - C2Tuple__u832u16Z { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple__u832u16Z. -pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { } +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedPayInfoDecodeErrorZ -pub union CResult_BlindedPayInfoDecodeErrorZPtr { +/// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ +pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { /// 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::BlindedPayInfo, + pub result: *mut crate::lightning_types::features::Bolt12InvoiceFeatures, /// 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::blinded_path::payment::BlindedPayInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::Bolt12InvoiceFeatures 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 +pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, 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_Bolt12InvoiceFeaturesDecodeErrorZPtr, + /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ 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::blinded_path::payment::BlindedPayInfo) -> CResult_BlindedPayInfoDecodeErrorZ { - CResult_BlindedPayInfoDecodeErrorZ { - contents: CResult_BlindedPayInfoDecodeErrorZPtr { +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { 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 { +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28388,13 +31979,13 @@ pub extern "C" fn CResult_BlindedPayInfoDecodeErrorZ_err(e: crate::lightning::ln } /// 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_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> 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_Bolt12InvoiceFeaturesDecodeErrorZ. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { } +impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28407,16 +31998,16 @@ impl Drop for CResult_BlindedPayInfoDecodeErrorZ { } } } -impl From> for CResult_BlindedPayInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedPayInfoDecodeErrorZPtr { err } + CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28424,91 +32015,95 @@ 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedPayInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { 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` +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ 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) } +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedPaymentPathNoneZ -pub union CResult_BlindedPaymentPathNoneZPtr { +/// The contents of CResult_BlindedHopFeaturesDecodeErrorZ +pub union CResult_BlindedHopFeaturesDecodeErrorZPtr { /// 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::BlindedPaymentPath, - /// 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::lightning_types::features::BlindedHopFeatures, + /// 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_BlindedPaymentPathNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::BlindedPaymentPath on success and a () on failure. +/// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::BlindedHopFeatures 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_BlindedPaymentPathNoneZ { - /// The contents of this CResult_BlindedPaymentPathNoneZ, accessible via either +pub struct CResult_BlindedHopFeaturesDecodeErrorZ { + /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedPaymentPathNoneZPtr, - /// Whether this CResult_BlindedPaymentPathNoneZ represents a success state. + pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr, + /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedPaymentPathNoneZ in the success state. -pub extern "C" fn CResult_BlindedPaymentPathNoneZ_ok(o: crate::lightning::blinded_path::payment::BlindedPaymentPath) -> CResult_BlindedPaymentPathNoneZ { - CResult_BlindedPaymentPathNoneZ { - contents: CResult_BlindedPaymentPathNoneZPtr { +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ { + CResult_BlindedHopFeaturesDecodeErrorZ { + contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_BlindedPaymentPathNoneZ in the error state. -pub extern "C" fn CResult_BlindedPaymentPathNoneZ_err() -> CResult_BlindedPaymentPathNoneZ { - CResult_BlindedPaymentPathNoneZ { - contents: CResult_BlindedPaymentPathNoneZPtr { - err: core::ptr::null_mut(), + } +} +#[no_mangle] +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ { + CResult_BlindedHopFeaturesDecodeErrorZ { + contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { + 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_BlindedPaymentPathNoneZ_is_ok(o: &CResult_BlindedPaymentPathNoneZ) -> bool { +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedPaymentPathNoneZ. -pub extern "C" fn CResult_BlindedPaymentPathNoneZ_free(_res: CResult_BlindedPaymentPathNoneZ) { } -impl Drop for CResult_BlindedPaymentPathNoneZ { +/// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { } +impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { 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_BlindedPaymentPathNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedHopFeaturesDecodeErrorZ { + 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_BlindedPaymentPathNoneZPtr { result } + CResult_BlindedHopFeaturesDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_BlindedPaymentPathNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_BlindedHopFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28516,105 +32111,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedPaymentPathNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedPaymentPathNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedPaymentPathNoneZ which has the same data as `orig` +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedPaymentPathNoneZ_clone(orig: &CResult_BlindedPaymentPathNoneZ) -> CResult_BlindedPaymentPathNoneZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::blinded_path::payment::PaymentForwardNodes of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PaymentForwardNodeZ { - /// 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::blinded_path::payment::PaymentForwardNode, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PaymentForwardNodeZ { - #[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::blinded_path::payment::PaymentForwardNode] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PaymentForwardNodeZ { - 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_PaymentForwardNodeZ_free(_res: CVec_PaymentForwardNodeZ) { } -impl Drop for CVec_PaymentForwardNodeZ { - 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_PaymentForwardNodeZ { - 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_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentRelayDecodeErrorZ -pub union CResult_PaymentRelayDecodeErrorZPtr { +/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ +pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning_types::features::ChannelTypeFeatures, /// 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. +/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::ChannelTypeFeatures 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 +pub struct CResult_ChannelTypeFeaturesDecodeErrorZ { + /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, 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 contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr, + /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ 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 { +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ { + CResult_ChannelTypeFeaturesDecodeErrorZ { + contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { 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 { +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ { + CResult_ChannelTypeFeaturesDecodeErrorZ { + contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28622,13 +32171,13 @@ pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_is_ok(o: &CResult_PaymentRelayDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentRelayDecodeErrorZ. -pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_free(_res: CResult_PaymentRelayDecodeErrorZ) { } -impl Drop for CResult_PaymentRelayDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { } +impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28641,16 +32190,16 @@ impl Drop for CResult_PaymentRelayDecodeErrorZ { } } } -impl From> for CResult_PaymentRelayDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelTypeFeaturesDecodeErrorZ { + 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_PaymentRelayDecodeErrorZPtr { result } + CResult_ChannelTypeFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentRelayDecodeErrorZPtr { err } + CResult_ChannelTypeFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -28658,59 +32207,101 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentRelayDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentRelayDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentRelayDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentRelayDecodeErrorZ_clone(orig: &CResult_PaymentRelayDecodeErrorZ) -> CResult_PaymentRelayDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentConstraintsDecodeErrorZ -pub union CResult_PaymentConstraintsDecodeErrorZPtr { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple__u832u16Z { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: u16, +} +impl From<(crate::c_types::ThirtyTwoBytes, u16)> for C2Tuple__u832u16Z { + fn from (tup: (crate::c_types::ThirtyTwoBytes, u16)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple__u832u16Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u16) { + (self.a, self.b) + } +} +impl Clone for C2Tuple__u832u16Z { + 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__u832u16Z_clone(orig: &C2Tuple__u832u16Z) -> C2Tuple__u832u16Z { Clone::clone(&orig) } +/// Creates a new C2Tuple__u832u16Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple__u832u16Z_new(a: crate::c_types::ThirtyTwoBytes, b: u16) -> C2Tuple__u832u16Z { + C2Tuple__u832u16Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple__u832u16Z. +pub extern "C" fn C2Tuple__u832u16Z_free(_res: C2Tuple__u832u16Z) { } +#[repr(C)] +/// The contents of CResult_ResponderDecodeErrorZ +pub union CResult_ResponderDecodeErrorZPtr { /// 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::PaymentConstraints, + pub result: *mut crate::lightning::onion_message::messenger::Responder, /// 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_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. +/// A CResult_ResponderDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::messenger::Responder 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_PaymentConstraintsDecodeErrorZ { - /// The contents of this CResult_PaymentConstraintsDecodeErrorZ, accessible via either +pub struct CResult_ResponderDecodeErrorZ { + /// The contents of this CResult_ResponderDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentConstraintsDecodeErrorZPtr, - /// Whether this CResult_PaymentConstraintsDecodeErrorZ represents a success state. + pub contents: CResult_ResponderDecodeErrorZPtr, + /// Whether this CResult_ResponderDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// 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 { +/// Creates a new CResult_ResponderDecodeErrorZ in the success state. +pub extern "C" fn CResult_ResponderDecodeErrorZ_ok(o: crate::lightning::onion_message::messenger::Responder) -> CResult_ResponderDecodeErrorZ { + CResult_ResponderDecodeErrorZ { + contents: CResult_ResponderDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// 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 { +/// Creates a new CResult_ResponderDecodeErrorZ in the error state. +pub extern "C" fn CResult_ResponderDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ResponderDecodeErrorZ { + CResult_ResponderDecodeErrorZ { + contents: CResult_ResponderDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28718,13 +32309,13 @@ pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_is_ok(o: &CResult_PaymentConstraintsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ResponderDecodeErrorZ_is_ok(o: &CResult_ResponderDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentConstraintsDecodeErrorZ. -pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_free(_res: CResult_PaymentConstraintsDecodeErrorZ) { } -impl Drop for CResult_PaymentConstraintsDecodeErrorZ { +/// Frees any resources used by the CResult_ResponderDecodeErrorZ. +pub extern "C" fn CResult_ResponderDecodeErrorZ_free(_res: CResult_ResponderDecodeErrorZ) { } +impl Drop for CResult_ResponderDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28737,16 +32328,16 @@ impl Drop for CResult_PaymentConstraintsDecodeErrorZ { } } } -impl From> for CResult_PaymentConstraintsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ResponderDecodeErrorZ { + 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_PaymentConstraintsDecodeErrorZPtr { result } + CResult_ResponderDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentConstraintsDecodeErrorZPtr { err } + CResult_ResponderDecodeErrorZPtr { err } }; Self { contents, @@ -28754,95 +32345,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentConstraintsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ResponderDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentConstraintsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ResponderDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentConstraintsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentConstraintsDecodeErrorZ_clone(orig: &CResult_PaymentConstraintsDecodeErrorZ) -> CResult_PaymentConstraintsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ResponderDecodeErrorZ_clone(orig: &CResult_ResponderDecodeErrorZ) -> CResult_ResponderDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentContextDecodeErrorZ -pub union CResult_PaymentContextDecodeErrorZPtr { +/// The contents of CResult_OnionMessagePathNoneZ +pub union CResult_OnionMessagePathNoneZPtr { /// 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::PaymentContext, - /// 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::onion_message::messenger::OnionMessagePath, + /// 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_PaymentContextDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::PaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentContextDecodeErrorZ { - /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either +pub struct CResult_OnionMessagePathNoneZ { + /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentContextDecodeErrorZPtr, - /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state. + pub contents: CResult_OnionMessagePathNoneZPtr, + /// Whether this CResult_OnionMessagePathNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ in the success state. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ { - CResult_PaymentContextDecodeErrorZ { - contents: CResult_PaymentContextDecodeErrorZPtr { +/// Creates a new CResult_OnionMessagePathNoneZ in the success state. +pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ { + CResult_OnionMessagePathNoneZ { + contents: CResult_OnionMessagePathNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ in the error state. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ { - CResult_PaymentContextDecodeErrorZ { - contents: CResult_PaymentContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_OnionMessagePathNoneZ in the error state. +pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ { + CResult_OnionMessagePathNoneZ { + contents: CResult_OnionMessagePathNoneZPtr { + 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_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentContextDecodeErrorZ. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { } -impl Drop for CResult_PaymentContextDecodeErrorZ { +/// Frees any resources used by the CResult_OnionMessagePathNoneZ. +pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { } +impl Drop for CResult_OnionMessagePathNoneZ { 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_PaymentContextDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OnionMessagePathNoneZ { + 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_PaymentContextDecodeErrorZPtr { result } + CResult_OnionMessagePathNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentContextDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -28850,59 +32437,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt12OfferContextDecodeErrorZ -pub union CResult_Bolt12OfferContextDecodeErrorZPtr { +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::msgs::OnionMessage, + /// The element at position 2 + pub c: crate::c_types::derived::CVec_SocketAddressZ, +} +impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::CVec_SocketAddressZ)> for C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::CVec_SocketAddressZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } + } +} +impl C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::CVec_SocketAddressZ) { + (self.a, self.b, self.c) + } +} +impl Clone for C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + } + } +} +#[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 C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::CVec_SocketAddressZ) -> C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { + C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ { a, b, c, } +} + +#[no_mangle] +/// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ. +pub extern "C" fn C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ_free(_res: C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ) { } +#[repr(C)] +/// The contents of CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ +pub union CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { /// 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::Bolt12OfferContext, + pub result: *mut crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ, /// 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::onion_message::messenger::SendError, } #[repr(C)] -/// A CResult_Bolt12OfferContextDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::Bolt12OfferContext on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ 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_Bolt12OfferContextDecodeErrorZ { - /// The contents of this CResult_Bolt12OfferContextDecodeErrorZ, accessible via either +pub struct CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12OfferContextDecodeErrorZPtr, - /// Whether this CResult_Bolt12OfferContextDecodeErrorZ represents a success state. + pub contents: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr, + /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> CResult_Bolt12OfferContextDecodeErrorZ { - CResult_Bolt12OfferContextDecodeErrorZ { - contents: CResult_Bolt12OfferContextDecodeErrorZPtr { +/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ in the success state. +pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + contents: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12OfferContextDecodeErrorZ { - CResult_Bolt12OfferContextDecodeErrorZ { - contents: CResult_Bolt12OfferContextDecodeErrorZPtr { +/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ in the error state. +pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + contents: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -28910,13 +32543,13 @@ pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_is_ok(o: &CResult_Bolt12OfferContextDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt12OfferContextDecodeErrorZ. -pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_free(_res: CResult_Bolt12OfferContextDecodeErrorZ) { } -impl Drop for CResult_Bolt12OfferContextDecodeErrorZ { +/// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ. +pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ) { } +impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -28929,16 +32562,16 @@ impl Drop for CResult_Bolt12OfferContextDecodeErrorZ { } } } -impl From> for CResult_Bolt12OfferContextDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { + 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_Bolt12OfferContextDecodeErrorZPtr { result } + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12OfferContextDecodeErrorZPtr { err } + CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { err } }; Self { contents, @@ -28946,95 +32579,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12OfferContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt12OfferContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt12OfferContextDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt12OfferContextDecodeErrorZ_clone(orig: &CResult_Bolt12OfferContextDecodeErrorZ) -> CResult_Bolt12OfferContextDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt12RefundContextDecodeErrorZ -pub union CResult_Bolt12RefundContextDecodeErrorZPtr { +/// The contents of CResult_PeeledOnionNoneZ +pub union CResult_PeeledOnionNoneZPtr { /// 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::Bolt12RefundContext, - /// 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::onion_message::messenger::PeeledOnion, + /// 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_Bolt12RefundContextDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::Bolt12RefundContext on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PeeledOnionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_Bolt12RefundContextDecodeErrorZ { - /// The contents of this CResult_Bolt12RefundContextDecodeErrorZ, accessible via either +pub struct CResult_PeeledOnionNoneZ { + /// The contents of this CResult_PeeledOnionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12RefundContextDecodeErrorZPtr, - /// Whether this CResult_Bolt12RefundContextDecodeErrorZ represents a success state. + pub contents: CResult_PeeledOnionNoneZPtr, + /// Whether this CResult_PeeledOnionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> CResult_Bolt12RefundContextDecodeErrorZ { - CResult_Bolt12RefundContextDecodeErrorZ { - contents: CResult_Bolt12RefundContextDecodeErrorZPtr { +/// Creates a new CResult_PeeledOnionNoneZ in the success state. +pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ { + CResult_PeeledOnionNoneZ { + contents: CResult_PeeledOnionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12RefundContextDecodeErrorZ { - CResult_Bolt12RefundContextDecodeErrorZ { - contents: CResult_Bolt12RefundContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_PeeledOnionNoneZ in the error state. +pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ { + CResult_PeeledOnionNoneZ { + contents: CResult_PeeledOnionNoneZPtr { + 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_Bolt12RefundContextDecodeErrorZ_is_ok(o: &CResult_Bolt12RefundContextDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt12RefundContextDecodeErrorZ. -pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_free(_res: CResult_Bolt12RefundContextDecodeErrorZ) { } -impl Drop for CResult_Bolt12RefundContextDecodeErrorZ { +/// Frees any resources used by the CResult_PeeledOnionNoneZ. +pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { } +impl Drop for CResult_PeeledOnionNoneZ { 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_Bolt12RefundContextDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PeeledOnionNoneZ { + 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_Bolt12RefundContextDecodeErrorZPtr { result } + CResult_PeeledOnionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12RefundContextDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -29042,59 +32671,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12RefundContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt12RefundContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_Bolt12RefundContextDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt12RefundContextDecodeErrorZ_clone(orig: &CResult_Bolt12RefundContextDecodeErrorZ) -> CResult_Bolt12RefundContextDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxOutUtxoLookupErrorZ -pub union CResult_TxOutUtxoLookupErrorZPtr { +/// The contents of CResult_SendSuccessSendErrorZ +pub union CResult_SendSuccessSendErrorZPtr { /// 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::TxOut, + pub result: *mut crate::lightning::onion_message::messenger::SendSuccess, /// 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::routing::utxo::UtxoLookupError, + pub err: *mut crate::lightning::onion_message::messenger::SendError, } #[repr(C)] -/// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure. +/// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::messenger::SendSuccess 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_TxOutUtxoLookupErrorZ { - /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either +pub struct CResult_SendSuccessSendErrorZ { + /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxOutUtxoLookupErrorZPtr, - /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state. + pub contents: CResult_SendSuccessSendErrorZPtr, + /// Whether this CResult_SendSuccessSendErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. -pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ { - CResult_TxOutUtxoLookupErrorZ { - contents: CResult_TxOutUtxoLookupErrorZPtr { +/// Creates a new CResult_SendSuccessSendErrorZ in the success state. +pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ { + CResult_SendSuccessSendErrorZ { + contents: CResult_SendSuccessSendErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. -pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ { - CResult_TxOutUtxoLookupErrorZ { - contents: CResult_TxOutUtxoLookupErrorZPtr { +/// Creates a new CResult_SendSuccessSendErrorZ in the error state. +pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ { + CResult_SendSuccessSendErrorZ { + contents: CResult_SendSuccessSendErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29102,13 +32731,13 @@ pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool { +pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. -pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { } -impl Drop for CResult_TxOutUtxoLookupErrorZ { +/// Frees any resources used by the CResult_SendSuccessSendErrorZ. +pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { } +impl Drop for CResult_SendSuccessSendErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -29121,16 +32750,16 @@ impl Drop for CResult_TxOutUtxoLookupErrorZ { } } } -impl From> for CResult_TxOutUtxoLookupErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SendSuccessSendErrorZ { + 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_TxOutUtxoLookupErrorZPtr { result } + CResult_SendSuccessSendErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxOutUtxoLookupErrorZPtr { err } + CResult_SendSuccessSendErrorZPtr { err } }; Self { contents, @@ -29138,59 +32767,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` +/// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ResponderDecodeErrorZ -pub union CResult_ResponderDecodeErrorZPtr { - /// 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::onion_message::messenger::Responder, +/// 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 + pub result: *mut core::ffi::c_void, /// 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::onion_message::messenger::SendError, } #[repr(C)] -/// A CResult_ResponderDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::messenger::Responder on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NoneSendErrorZ represents the result of a fallible operation, +/// containing a () 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_ResponderDecodeErrorZ { - /// The contents of this CResult_ResponderDecodeErrorZ, accessible via either +pub struct CResult_NoneSendErrorZ { + /// The contents of this CResult_NoneSendErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ResponderDecodeErrorZPtr, - /// Whether this CResult_ResponderDecodeErrorZ represents a success state. + pub contents: CResult_NoneSendErrorZPtr, + /// Whether this CResult_NoneSendErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ResponderDecodeErrorZ in the success state. -pub extern "C" fn CResult_ResponderDecodeErrorZ_ok(o: crate::lightning::onion_message::messenger::Responder) -> CResult_ResponderDecodeErrorZ { - CResult_ResponderDecodeErrorZ { - contents: CResult_ResponderDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneSendErrorZ in the success state. +pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ { + CResult_NoneSendErrorZ { + contents: CResult_NoneSendErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ResponderDecodeErrorZ in the error state. -pub extern "C" fn CResult_ResponderDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ResponderDecodeErrorZ { - CResult_ResponderDecodeErrorZ { - contents: CResult_ResponderDecodeErrorZPtr { +/// Creates a new CResult_NoneSendErrorZ in the error state. +pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ { + CResult_NoneSendErrorZ { + contents: CResult_NoneSendErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29198,18 +32826,15 @@ pub extern "C" fn CResult_ResponderDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ResponderDecodeErrorZ_is_ok(o: &CResult_ResponderDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ResponderDecodeErrorZ. -pub extern "C" fn CResult_ResponderDecodeErrorZ_free(_res: CResult_ResponderDecodeErrorZ) { } -impl Drop for CResult_ResponderDecodeErrorZ { +/// Frees any resources used by the CResult_NoneSendErrorZ. +pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { } +impl Drop for CResult_NoneSendErrorZ { 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) }; @@ -29217,16 +32842,16 @@ impl Drop for CResult_ResponderDecodeErrorZ { } } } -impl From> for CResult_ResponderDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneSendErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ResponderDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ResponderDecodeErrorZPtr { err } + CResult_NoneSendErrorZPtr { err } }; Self { contents, @@ -29234,91 +32859,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ResponderDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneSendErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_ResponderDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneSendErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneSendErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ResponderDecodeErrorZ_clone(orig: &CResult_ResponderDecodeErrorZ) -> CResult_ResponderDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneSendErrorZ_clone(orig: &CResult_NoneSendErrorZ) -> CResult_NoneSendErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionMessagePathNoneZ -pub union CResult_OnionMessagePathNoneZPtr { +/// The contents of CResult_TxOutUtxoLookupErrorZ +pub union CResult_TxOutUtxoLookupErrorZPtr { /// 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::onion_message::messenger::OnionMessagePath, - /// 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::TxOut, + /// 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::routing::utxo::UtxoLookupError, } #[repr(C)] -/// A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. +/// A CResult_TxOutUtxoLookupErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::TxOut on success and a crate::lightning::routing::utxo::UtxoLookupError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OnionMessagePathNoneZ { - /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either +pub struct CResult_TxOutUtxoLookupErrorZ { + /// The contents of this CResult_TxOutUtxoLookupErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionMessagePathNoneZPtr, - /// Whether this CResult_OnionMessagePathNoneZ represents a success state. + pub contents: CResult_TxOutUtxoLookupErrorZPtr, + /// Whether this CResult_TxOutUtxoLookupErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ in the success state. -pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ { - CResult_OnionMessagePathNoneZ { - contents: CResult_OnionMessagePathNoneZPtr { +/// Creates a new CResult_TxOutUtxoLookupErrorZ in the success state. +pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_ok(o: crate::c_types::TxOut) -> CResult_TxOutUtxoLookupErrorZ { + CResult_TxOutUtxoLookupErrorZ { + contents: CResult_TxOutUtxoLookupErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ in the error state. -pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ { - CResult_OnionMessagePathNoneZ { - contents: CResult_OnionMessagePathNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_TxOutUtxoLookupErrorZ in the error state. +pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_err(e: crate::lightning::routing::utxo::UtxoLookupError) -> CResult_TxOutUtxoLookupErrorZ { + CResult_TxOutUtxoLookupErrorZ { + contents: CResult_TxOutUtxoLookupErrorZPtr { + 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_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool { +pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_is_ok(o: &CResult_TxOutUtxoLookupErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionMessagePathNoneZ. -pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { } -impl Drop for CResult_OnionMessagePathNoneZ { +/// Frees any resources used by the CResult_TxOutUtxoLookupErrorZ. +pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_free(_res: CResult_TxOutUtxoLookupErrorZ) { } +impl Drop for CResult_TxOutUtxoLookupErrorZ { 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_OnionMessagePathNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxOutUtxoLookupErrorZ { + 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_OnionMessagePathNoneZPtr { result } + CResult_TxOutUtxoLookupErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_TxOutUtxoLookupErrorZPtr { err } }; Self { contents, @@ -29326,91 +32955,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxOutUtxoLookupErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_TxOutUtxoLookupErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` +/// Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_TxOutUtxoLookupErrorZ_clone(orig: &CResult_TxOutUtxoLookupErrorZ) -> CResult_TxOutUtxoLookupErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_BlindedMessagePathZNoneZ -pub union CResult_CVec_BlindedMessagePathZNoneZPtr { +/// The contents of CResult_BlindedHopDecodeErrorZ +pub union CResult_BlindedHopDecodeErrorZPtr { /// 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_BlindedMessagePathZ, - /// 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::lightning::blinded_path::BlindedHop, + /// 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_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. +/// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::BlindedHop 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_CVec_BlindedMessagePathZNoneZ { - /// The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either +pub struct CResult_BlindedHopDecodeErrorZ { + /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_BlindedMessagePathZNoneZPtr, - /// Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + pub contents: CResult_BlindedHopDecodeErrorZPtr, + /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedMessagePathZ) -> CResult_CVec_BlindedMessagePathZNoneZ { - CResult_CVec_BlindedMessagePathZNoneZ { - contents: CResult_CVec_BlindedMessagePathZNoneZPtr { +/// Creates a new CResult_BlindedHopDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ { + CResult_BlindedHopDecodeErrorZ { + contents: CResult_BlindedHopDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_err() -> CResult_CVec_BlindedMessagePathZNoneZ { - CResult_CVec_BlindedMessagePathZNoneZ { - contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_BlindedHopDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ { + CResult_BlindedHopDecodeErrorZ { + contents: CResult_BlindedHopDecodeErrorZPtr { + 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_BlindedMessagePathZNoneZ_is_ok(o: &CResult_CVec_BlindedMessagePathZNoneZ) -> bool { +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_free(_res: CResult_CVec_BlindedMessagePathZNoneZ) { } -impl Drop for CResult_CVec_BlindedMessagePathZNoneZ { +/// Frees any resources used by the CResult_BlindedHopDecodeErrorZ. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { } +impl Drop for CResult_BlindedHopDecodeErrorZ { 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_BlindedMessagePathZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedHopDecodeErrorZ { + 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_BlindedMessagePathZNoneZPtr { result } + CResult_BlindedHopDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_BlindedMessagePathZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_BlindedHopDecodeErrorZPtr { err } }; Self { contents, @@ -29418,47 +33051,47 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + if self.result_ok { + Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` +/// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_clone(orig: &CResult_CVec_BlindedMessagePathZNoneZ) -> CResult_CVec_BlindedMessagePathZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_MessageForwardNodeZ { +pub struct CVec_PhantomRouteHintsZ { /// 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::blinded_path::message::MessageForwardNode, + pub data: *mut crate::lightning::ln::channelmanager::PhantomRouteHints, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_MessageForwardNodeZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_PhantomRouteHintsZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::blinded_path::message::MessageForwardNode] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::PhantomRouteHints] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_MessageForwardNodeZ { - fn from(v: Vec) -> Self { +impl From> for CVec_PhantomRouteHintsZ { + 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() } } @@ -29466,140 +33099,103 @@ impl From> for } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_MessageForwardNodeZ_free(_res: CVec_MessageForwardNodeZ) { } -impl Drop for CVec_MessageForwardNodeZ { +pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { } +impl Drop for CVec_PhantomRouteHintsZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_MessageForwardNodeZ { +impl Clone for CVec_PhantomRouteHintsZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not -pub enum COption_MessageContextZ { - /// When we're in this state, this COption_MessageContextZ contains a crate::lightning::blinded_path::message::MessageContext - Some(crate::lightning::blinded_path::message::MessageContext), - /// When we're in this state, this COption_MessageContextZ contains nothing - None +/// A dynamically-allocated array of crate::lightning::ln::funding::FundingTxInputs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_FundingTxInputZ { + /// 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::funding::FundingTxInput, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_MessageContextZ { - #[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() +impl CVec_FundingTxInputZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::message::MessageContext { - if let Self::Some(v) = self { v } else { unreachable!() } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::funding::FundingTxInput] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -#[no_mangle] -/// Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext -pub extern "C" fn COption_MessageContextZ_some(o: crate::lightning::blinded_path::message::MessageContext) -> COption_MessageContextZ { - COption_MessageContextZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_MessageContextZ containing nothing -pub extern "C" fn COption_MessageContextZ_none() -> COption_MessageContextZ { - COption_MessageContextZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::blinded_path::message::MessageContext, if we are in the Some state -pub extern "C" fn COption_MessageContextZ_free(_res: COption_MessageContextZ) { } -#[no_mangle] -/// Creates a new COption_MessageContextZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_MessageContextZ_clone(orig: &COption_MessageContextZ) -> COption_MessageContextZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { - /// The element at position 0 - pub a: crate::c_types::PublicKey, - /// The element at position 1 - pub b: crate::lightning::ln::msgs::OnionMessage, - /// The element at position 2 - pub c: crate::c_types::derived::COption_CVec_SocketAddressZZ, -} -impl From<(crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)> for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { - fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } +impl From> for CVec_FundingTxInputZ { + 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() } } } } -impl C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::msgs::OnionMessage, crate::c_types::derived::COption_CVec_SocketAddressZZ) { - (self.a, self.b, self.c) +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_FundingTxInputZ_free(_res: CVec_FundingTxInputZ) { } +impl Drop for CVec_FundingTxInputZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { +impl Clone for CVec_FundingTxInputZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); + Self::from(res) } } -#[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 C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_clone(orig: &C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::msgs::OnionMessage, c: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { - C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ. -pub extern "C" fn C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ_free(_res: C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) { } #[repr(C)] -/// The contents of CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ -pub union CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { +/// The contents of CResult_FundingTxInputDecodeErrorZ +pub union CResult_FundingTxInputDecodeErrorZPtr { /// 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::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ, + pub result: *mut crate::lightning::ln::funding::FundingTxInput, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ on success and a crate::lightning::onion_message::messenger::SendError on failure. +/// A CResult_FundingTxInputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::funding::FundingTxInput 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_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - /// The contents of this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ, accessible via either +pub struct CResult_FundingTxInputDecodeErrorZ { + /// The contents of this CResult_FundingTxInputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr, - /// Whether this CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ represents a success state. + pub contents: CResult_FundingTxInputDecodeErrorZPtr, + /// Whether this CResult_FundingTxInputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the success state. -pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_ok(o: crate::c_types::derived::C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { +/// Creates a new CResult_FundingTxInputDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingTxInputDecodeErrorZ_ok(o: crate::lightning::ln::funding::FundingTxInput) -> CResult_FundingTxInputDecodeErrorZ { + CResult_FundingTxInputDecodeErrorZ { + contents: CResult_FundingTxInputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ in the error state. -pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { +/// Creates a new CResult_FundingTxInputDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingTxInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingTxInputDecodeErrorZ { + CResult_FundingTxInputDecodeErrorZ { + contents: CResult_FundingTxInputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29607,13 +33203,13 @@ pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddres } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_is_ok(o: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> bool { +pub extern "C" fn CResult_FundingTxInputDecodeErrorZ_is_ok(o: &CResult_FundingTxInputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ. -pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_free(_res: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) { } -impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { +/// Frees any resources used by the CResult_FundingTxInputDecodeErrorZ. +pub extern "C" fn CResult_FundingTxInputDecodeErrorZ_free(_res: CResult_FundingTxInputDecodeErrorZ) { } +impl Drop for CResult_FundingTxInputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -29626,16 +33222,16 @@ impl Drop for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZ } } } -impl From> for CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingTxInputDecodeErrorZ { + 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_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { result } + CResult_FundingTxInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { err } + CResult_FundingTxInputDecodeErrorZPtr { err } }; Self { contents, @@ -29643,58 +33239,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingTxInputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_FundingTxInputDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingTxInputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ_clone(orig: &CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ) -> CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingTxInputDecodeErrorZ_clone(orig: &CResult_FundingTxInputDecodeErrorZ) -> CResult_FundingTxInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PeeledOnionNoneZ -pub union CResult_PeeledOnionNoneZPtr { +/// The contents of CResult_FundingTxInputNoneZ +pub union CResult_FundingTxInputNoneZPtr { /// 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::onion_message::messenger::PeeledOnion, + pub result: *mut crate::lightning::ln::funding::FundingTxInput, /// 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_PeeledOnionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::messenger::PeeledOnion on success and a () on failure. +/// A CResult_FundingTxInputNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::funding::FundingTxInput on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PeeledOnionNoneZ { - /// The contents of this CResult_PeeledOnionNoneZ, accessible via either +pub struct CResult_FundingTxInputNoneZ { + /// The contents of this CResult_FundingTxInputNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PeeledOnionNoneZPtr, - /// Whether this CResult_PeeledOnionNoneZ represents a success state. + pub contents: CResult_FundingTxInputNoneZPtr, + /// Whether this CResult_FundingTxInputNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PeeledOnionNoneZ in the success state. -pub extern "C" fn CResult_PeeledOnionNoneZ_ok(o: crate::lightning::onion_message::messenger::PeeledOnion) -> CResult_PeeledOnionNoneZ { - CResult_PeeledOnionNoneZ { - contents: CResult_PeeledOnionNoneZPtr { +/// Creates a new CResult_FundingTxInputNoneZ in the success state. +pub extern "C" fn CResult_FundingTxInputNoneZ_ok(o: crate::lightning::ln::funding::FundingTxInput) -> CResult_FundingTxInputNoneZ { + CResult_FundingTxInputNoneZ { + contents: CResult_FundingTxInputNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PeeledOnionNoneZ in the error state. -pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ { - CResult_PeeledOnionNoneZ { - contents: CResult_PeeledOnionNoneZPtr { +/// Creates a new CResult_FundingTxInputNoneZ in the error state. +pub extern "C" fn CResult_FundingTxInputNoneZ_err() -> CResult_FundingTxInputNoneZ { + CResult_FundingTxInputNoneZ { + contents: CResult_FundingTxInputNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -29702,13 +33298,13 @@ pub extern "C" fn CResult_PeeledOnionNoneZ_err() -> CResult_PeeledOnionNoneZ { } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PeeledOnionNoneZ_is_ok(o: &CResult_PeeledOnionNoneZ) -> bool { +pub extern "C" fn CResult_FundingTxInputNoneZ_is_ok(o: &CResult_FundingTxInputNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PeeledOnionNoneZ. -pub extern "C" fn CResult_PeeledOnionNoneZ_free(_res: CResult_PeeledOnionNoneZ) { } -impl Drop for CResult_PeeledOnionNoneZ { +/// Frees any resources used by the CResult_FundingTxInputNoneZ. +pub extern "C" fn CResult_FundingTxInputNoneZ_free(_res: CResult_FundingTxInputNoneZ) { } +impl Drop for CResult_FundingTxInputNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -29718,16 +33314,16 @@ impl Drop for CResult_PeeledOnionNoneZ { } } } -impl From> for CResult_PeeledOnionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingTxInputNoneZ { + 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_PeeledOnionNoneZPtr { result } + CResult_FundingTxInputNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_PeeledOnionNoneZPtr { err: core::ptr::null_mut() } + CResult_FundingTxInputNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -29735,59 +33331,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PeeledOnionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingTxInputNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PeeledOnionNoneZPtr { + Self { result_ok: false, contents: CResult_FundingTxInputNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_PeeledOnionNoneZ which has the same data as `orig` +/// Creates a new CResult_FundingTxInputNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PeeledOnionNoneZ_clone(orig: &CResult_PeeledOnionNoneZ) -> CResult_PeeledOnionNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingTxInputNoneZ_clone(orig: &CResult_FundingTxInputNoneZ) -> CResult_FundingTxInputNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SendSuccessSendErrorZ -pub union CResult_SendSuccessSendErrorZPtr { +/// The contents of CResult_LocalHTLCFailureReasonDecodeErrorZ +pub union CResult_LocalHTLCFailureReasonDecodeErrorZPtr { /// 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::onion_message::messenger::SendSuccess, + pub result: *mut crate::lightning::ln::onion_utils::LocalHTLCFailureReason, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_SendSuccessSendErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::messenger::SendSuccess on success and a crate::lightning::onion_message::messenger::SendError on failure. +/// A CResult_LocalHTLCFailureReasonDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::onion_utils::LocalHTLCFailureReason 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_SendSuccessSendErrorZ { - /// The contents of this CResult_SendSuccessSendErrorZ, accessible via either +pub struct CResult_LocalHTLCFailureReasonDecodeErrorZ { + /// The contents of this CResult_LocalHTLCFailureReasonDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SendSuccessSendErrorZPtr, - /// Whether this CResult_SendSuccessSendErrorZ represents a success state. + pub contents: CResult_LocalHTLCFailureReasonDecodeErrorZPtr, + /// Whether this CResult_LocalHTLCFailureReasonDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SendSuccessSendErrorZ in the success state. -pub extern "C" fn CResult_SendSuccessSendErrorZ_ok(o: crate::lightning::onion_message::messenger::SendSuccess) -> CResult_SendSuccessSendErrorZ { - CResult_SendSuccessSendErrorZ { - contents: CResult_SendSuccessSendErrorZPtr { +/// Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ in the success state. +pub extern "C" fn CResult_LocalHTLCFailureReasonDecodeErrorZ_ok(o: crate::lightning::ln::onion_utils::LocalHTLCFailureReason) -> CResult_LocalHTLCFailureReasonDecodeErrorZ { + CResult_LocalHTLCFailureReasonDecodeErrorZ { + contents: CResult_LocalHTLCFailureReasonDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SendSuccessSendErrorZ in the error state. -pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_SendSuccessSendErrorZ { - CResult_SendSuccessSendErrorZ { - contents: CResult_SendSuccessSendErrorZPtr { +/// Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ in the error state. +pub extern "C" fn CResult_LocalHTLCFailureReasonDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_LocalHTLCFailureReasonDecodeErrorZ { + CResult_LocalHTLCFailureReasonDecodeErrorZ { + contents: CResult_LocalHTLCFailureReasonDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29795,13 +33391,13 @@ pub extern "C" fn CResult_SendSuccessSendErrorZ_err(e: crate::lightning::onion_m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SendSuccessSendErrorZ_is_ok(o: &CResult_SendSuccessSendErrorZ) -> bool { +pub extern "C" fn CResult_LocalHTLCFailureReasonDecodeErrorZ_is_ok(o: &CResult_LocalHTLCFailureReasonDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SendSuccessSendErrorZ. -pub extern "C" fn CResult_SendSuccessSendErrorZ_free(_res: CResult_SendSuccessSendErrorZ) { } -impl Drop for CResult_SendSuccessSendErrorZ { +/// Frees any resources used by the CResult_LocalHTLCFailureReasonDecodeErrorZ. +pub extern "C" fn CResult_LocalHTLCFailureReasonDecodeErrorZ_free(_res: CResult_LocalHTLCFailureReasonDecodeErrorZ) { } +impl Drop for CResult_LocalHTLCFailureReasonDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -29814,16 +33410,16 @@ impl Drop for CResult_SendSuccessSendErrorZ { } } } -impl From> for CResult_SendSuccessSendErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_LocalHTLCFailureReasonDecodeErrorZ { + 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_SendSuccessSendErrorZPtr { result } + CResult_LocalHTLCFailureReasonDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SendSuccessSendErrorZPtr { err } + CResult_LocalHTLCFailureReasonDecodeErrorZPtr { err } }; Self { contents, @@ -29831,58 +33427,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SendSuccessSendErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_LocalHTLCFailureReasonDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SendSuccessSendErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_LocalHTLCFailureReasonDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SendSuccessSendErrorZ which has the same data as `orig` +/// Creates a new CResult_LocalHTLCFailureReasonDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SendSuccessSendErrorZ_clone(orig: &CResult_SendSuccessSendErrorZ) -> CResult_SendSuccessSendErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_LocalHTLCFailureReasonDecodeErrorZ_clone(orig: &CResult_LocalHTLCFailureReasonDecodeErrorZ) -> CResult_LocalHTLCFailureReasonDecodeErrorZ { Clone::clone(&orig) } #[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 - pub result: *mut core::ffi::c_void, +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_OnionPacketu64u32Z { + /// The element at position 0 + pub a: crate::lightning::ln::msgs::OnionPacket, + /// The element at position 1 + pub b: u64, + /// The element at position 2 + pub c: u32, +} +impl From<(crate::lightning::ln::msgs::OnionPacket, u64, u32)> for C3Tuple_OnionPacketu64u32Z { + fn from (tup: (crate::lightning::ln::msgs::OnionPacket, u64, u32)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } + } +} +impl C3Tuple_OnionPacketu64u32Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::OnionPacket, u64, u32) { + (self.a, self.b, self.c) + } +} +impl Clone for C3Tuple_OnionPacketu64u32Z { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + } + } +} +#[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 C3Tuple_OnionPacketu64u32Z_clone(orig: &C3Tuple_OnionPacketu64u32Z) -> C3Tuple_OnionPacketu64u32Z { Clone::clone(&orig) } +/// Creates a new C3Tuple_OnionPacketu64u32Z from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_OnionPacketu64u32Z_new(a: crate::lightning::ln::msgs::OnionPacket, b: u64, c: u32) -> C3Tuple_OnionPacketu64u32Z { + C3Tuple_OnionPacketu64u32Z { a, b, c, } +} + +#[no_mangle] +/// Frees any resources used by the C3Tuple_OnionPacketu64u32Z. +pub extern "C" fn C3Tuple_OnionPacketu64u32Z_free(_res: C3Tuple_OnionPacketu64u32Z) { } +#[repr(C)] +/// The contents of CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ +pub union CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { + /// 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::C3Tuple_OnionPacketu64u32Z, /// 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, + pub err: *mut crate::lightning::util::errors::APIError, } #[repr(C)] -/// A CResult_NoneSendErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure. +/// A CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C3Tuple_OnionPacketu64u32Z 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_NoneSendErrorZ { - /// The contents of this CResult_NoneSendErrorZ, accessible via either +pub struct CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + /// The contents of this CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneSendErrorZPtr, - /// Whether this CResult_NoneSendErrorZ represents a success state. + pub contents: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr, + /// Whether this CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneSendErrorZ in the success state. -pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ { - CResult_NoneSendErrorZ { - contents: CResult_NoneSendErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ in the success state. +pub extern "C" fn CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_ok(o: crate::c_types::derived::C3Tuple_OnionPacketu64u32Z) -> CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + contents: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneSendErrorZ in the error state. -pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ { - CResult_NoneSendErrorZ { - contents: CResult_NoneSendErrorZPtr { +/// Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ in the error state. +pub extern "C" fn CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + contents: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29890,15 +33533,18 @@ pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool { +pub extern "C" fn CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_is_ok(o: &CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneSendErrorZ. -pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { } -impl Drop for CResult_NoneSendErrorZ { +/// Frees any resources used by the CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ. +pub extern "C" fn CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_free(_res: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ) { } +impl Drop for CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { 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) }; @@ -29906,16 +33552,16 @@ impl Drop for CResult_NoneSendErrorZ { } } } -impl From> for CResult_NoneSendErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self { +impl From> for CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + 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_NoneSendErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneSendErrorZPtr { err } + CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { err } }; Self { contents, @@ -29923,59 +33569,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneSendErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneSendErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneSendErrorZ which has the same data as `orig` +/// Creates a new CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneSendErrorZ_clone(orig: &CResult_NoneSendErrorZ) -> CResult_NoneSendErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ_clone(orig: &CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ) -> CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedHopDecodeErrorZ -pub union CResult_BlindedHopDecodeErrorZPtr { +/// The contents of CResult_AttributionDataDecodeErrorZ +pub union CResult_AttributionDataDecodeErrorZPtr { /// 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::BlindedHop, + pub result: *mut crate::lightning::ln::onion_utils::AttributionData, /// 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_BlindedHopDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AttributionDataDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::onion_utils::AttributionData 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_BlindedHopDecodeErrorZ { - /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either +pub struct CResult_AttributionDataDecodeErrorZ { + /// The contents of this CResult_AttributionDataDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedHopDecodeErrorZPtr, - /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + pub contents: CResult_AttributionDataDecodeErrorZPtr, + /// Whether this CResult_AttributionDataDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedHopDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ { - CResult_BlindedHopDecodeErrorZ { - contents: CResult_BlindedHopDecodeErrorZPtr { +/// Creates a new CResult_AttributionDataDecodeErrorZ in the success state. +pub extern "C" fn CResult_AttributionDataDecodeErrorZ_ok(o: crate::lightning::ln::onion_utils::AttributionData) -> CResult_AttributionDataDecodeErrorZ { + CResult_AttributionDataDecodeErrorZ { + contents: CResult_AttributionDataDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedHopDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ { - CResult_BlindedHopDecodeErrorZ { - contents: CResult_BlindedHopDecodeErrorZPtr { +/// Creates a new CResult_AttributionDataDecodeErrorZ in the error state. +pub extern "C" fn CResult_AttributionDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AttributionDataDecodeErrorZ { + CResult_AttributionDataDecodeErrorZ { + contents: CResult_AttributionDataDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -29983,13 +33629,13 @@ pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AttributionDataDecodeErrorZ_is_ok(o: &CResult_AttributionDataDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedHopDecodeErrorZ. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { } -impl Drop for CResult_BlindedHopDecodeErrorZ { +/// Frees any resources used by the CResult_AttributionDataDecodeErrorZ. +pub extern "C" fn CResult_AttributionDataDecodeErrorZ_free(_res: CResult_AttributionDataDecodeErrorZ) { } +impl Drop for CResult_AttributionDataDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -30002,16 +33648,16 @@ impl Drop for CResult_BlindedHopDecodeErrorZ { } } } -impl From> for CResult_BlindedHopDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AttributionDataDecodeErrorZ { + 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_BlindedHopDecodeErrorZPtr { result } + CResult_AttributionDataDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedHopDecodeErrorZPtr { err } + CResult_AttributionDataDecodeErrorZPtr { err } }; Self { contents, @@ -30019,69 +33665,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AttributionDataDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_AttributionDataDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_AttributionDataDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PhantomRouteHintsZ { - /// 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::channelmanager::PhantomRouteHints, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PhantomRouteHintsZ { - #[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::channelmanager::PhantomRouteHints] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PhantomRouteHintsZ { - 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_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { } -impl Drop for CVec_PhantomRouteHintsZ { - 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_PhantomRouteHintsZ { - 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_AttributionDataDecodeErrorZ_clone(orig: &CResult_AttributionDataDecodeErrorZ) -> CResult_AttributionDataDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_InvoiceErrorDecodeErrorZ pub union CResult_InvoiceErrorDecodeErrorZPtr { @@ -30415,13 +34015,13 @@ pub struct CVec_TrackedSpendableOutputZ { impl CVec_TrackedSpendableOutputZ { #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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::util::sweep::TrackedSpendableOutput] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } impl From> for CVec_TrackedSpendableOutputZ { @@ -30437,162 +34037,83 @@ pub extern "C" fn CVec_TrackedSpendableOutputZ_free(_res: CVec_TrackedSpendableO impl Drop for CVec_TrackedSpendableOutputZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } impl Clone for CVec_TrackedSpendableOutputZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } #[repr(C)] -/// The contents of CResult_OutputSweeperDecodeErrorZ -pub union CResult_OutputSweeperDecodeErrorZPtr { - /// 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::sweep::OutputSweeper, - /// 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_OutputSweeperDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::sweep::OutputSweeper 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_OutputSweeperDecodeErrorZ { - /// The contents of this CResult_OutputSweeperDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OutputSweeperDecodeErrorZPtr, - /// Whether this CResult_OutputSweeperDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_OutputSweeperDecodeErrorZ in the success state. -pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_ok(o: crate::lightning::util::sweep::OutputSweeper) -> CResult_OutputSweeperDecodeErrorZ { - CResult_OutputSweeperDecodeErrorZ { - contents: CResult_OutputSweeperDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_OutputSweeperDecodeErrorZ in the error state. -pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutputSweeperDecodeErrorZ { - CResult_OutputSweeperDecodeErrorZ { - contents: CResult_OutputSweeperDecodeErrorZPtr { - 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_OutputSweeperDecodeErrorZ_is_ok(o: &CResult_OutputSweeperDecodeErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_OutputSweeperDecodeErrorZ. -pub extern "C" fn CResult_OutputSweeperDecodeErrorZ_free(_res: CResult_OutputSweeperDecodeErrorZ) { } -impl Drop for CResult_OutputSweeperDecodeErrorZ { - 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_OutputSweeperDecodeErrorZ { - 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_OutputSweeperDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OutputSweeperDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -#[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_BestBlockOutputSweeperZ { +pub struct C2Tuple_BestBlockOutputSweeperSyncZ { /// The element at position 0 pub a: crate::lightning::chain::BestBlock, /// The element at position 1 - pub b: crate::lightning::util::sweep::OutputSweeper, + pub b: crate::lightning::util::sweep::OutputSweeperSync, } -impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)> for C2Tuple_BestBlockOutputSweeperZ { - fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper)) -> Self { +impl From<(crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeperSync)> for C2Tuple_BestBlockOutputSweeperSyncZ { + fn from (tup: (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeperSync)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_BestBlockOutputSweeperZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeper) { +impl C2Tuple_BestBlockOutputSweeperSyncZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::BestBlock, crate::lightning::util::sweep::OutputSweeperSync) { (self.a, self.b) } } -/// Creates a new C2Tuple_BestBlockOutputSweeperZ from the contained elements. +/// Creates a new C2Tuple_BestBlockOutputSweeperSyncZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeper) -> C2Tuple_BestBlockOutputSweeperZ { - C2Tuple_BestBlockOutputSweeperZ { a, b, } +pub extern "C" fn C2Tuple_BestBlockOutputSweeperSyncZ_new(a: crate::lightning::chain::BestBlock, b: crate::lightning::util::sweep::OutputSweeperSync) -> C2Tuple_BestBlockOutputSweeperSyncZ { + C2Tuple_BestBlockOutputSweeperSyncZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_BestBlockOutputSweeperZ. -pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_free(_res: C2Tuple_BestBlockOutputSweeperZ) { } +/// Frees any resources used by the C2Tuple_BestBlockOutputSweeperSyncZ. +pub extern "C" fn C2Tuple_BestBlockOutputSweeperSyncZ_free(_res: C2Tuple_BestBlockOutputSweeperSyncZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ -pub union CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { +/// The contents of CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ +pub union CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { /// 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_BestBlockOutputSweeperZ, + pub result: *mut crate::c_types::derived::C2Tuple_BestBlockOutputSweeperSyncZ, /// 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_BestBlockOutputSweeperZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_BestBlockOutputSweeperSyncZ 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_BestBlockOutputSweeperZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ, accessible via either +pub struct CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ represents a success state. + pub contents: CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperZ) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { - contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BestBlockOutputSweeperSyncZ) -> CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + contents: CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { - contents: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { +/// Creates a new CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + contents: CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -30600,13 +34121,13 @@ pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_err(e: cra } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { +/// Frees any resources used by the CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ_free(_res: CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -30619,16 +34140,16 @@ impl Drop for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { + 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_BestBlockOutputSweeperZDecodeErrorZPtr { result } + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZPtr { err } + CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZPtr { err } }; Self { contents, @@ -31289,114 +34810,26 @@ impl From for C2Tuple_OutPointChannelIdZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OutPointChannelIdZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OutPointChannelIdZ { - 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_OutPointChannelIdZ_clone(orig: &C2Tuple_OutPointChannelIdZ) -> C2Tuple_OutPointChannelIdZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OutPointChannelIdZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OutPointChannelIdZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_OutPointChannelIdZ { - C2Tuple_OutPointChannelIdZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OutPointChannelIdZ. -pub extern "C" fn C2Tuple_OutPointChannelIdZ_free(_res: C2Tuple_OutPointChannelIdZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointChannelIdZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_OutPointChannelIdZZ { - /// 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_OutPointChannelIdZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_OutPointChannelIdZZ { - #[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_OutPointChannelIdZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C2Tuple_OutPointChannelIdZZ { - 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_OutPointChannelIdZZ_free(_res: CVec_C2Tuple_OutPointChannelIdZZ) { } -impl Drop for CVec_C2Tuple_OutPointChannelIdZZ { - 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_OutPointChannelIdZZ { - 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_OutPointCVec_u64ZZ { +pub struct C2Tuple_ChannelIdCVec_u64ZZ { /// The element at position 0 - pub a: crate::lightning::chain::transaction::OutPoint, + pub a: crate::lightning::ln::types::ChannelId, /// The element at position 1 pub b: crate::c_types::derived::CVec_u64Z, } -impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u64Z)> for C2Tuple_OutPointCVec_u64ZZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u64Z)) -> Self { +impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_u64Z)> for C2Tuple_ChannelIdCVec_u64ZZ { + fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_u64Z)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_OutPointCVec_u64ZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u64Z) { +impl C2Tuple_ChannelIdCVec_u64ZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_u64Z) { (self.a, self.b) } } -impl Clone for C2Tuple_OutPointCVec_u64ZZ { +impl Clone for C2Tuple_ChannelIdCVec_u64ZZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -31407,40 +34840,40 @@ impl Clone for C2Tuple_OutPointCVec_u64ZZ { #[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_OutPointCVec_u64ZZ_clone(orig: &C2Tuple_OutPointCVec_u64ZZ) -> C2Tuple_OutPointCVec_u64ZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OutPointCVec_u64ZZ from the contained elements. +pub extern "C" fn C2Tuple_ChannelIdCVec_u64ZZ_clone(orig: &C2Tuple_ChannelIdCVec_u64ZZ) -> C2Tuple_ChannelIdCVec_u64ZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ChannelIdCVec_u64ZZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_OutPointCVec_u64ZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u64Z) -> C2Tuple_OutPointCVec_u64ZZ { - C2Tuple_OutPointCVec_u64ZZ { a, b, } +pub extern "C" fn C2Tuple_ChannelIdCVec_u64ZZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::derived::CVec_u64Z) -> C2Tuple_ChannelIdCVec_u64ZZ { + C2Tuple_ChannelIdCVec_u64ZZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_OutPointCVec_u64ZZ. -pub extern "C" fn C2Tuple_OutPointCVec_u64ZZ_free(_res: C2Tuple_OutPointCVec_u64ZZ) { } +/// Frees any resources used by the C2Tuple_ChannelIdCVec_u64ZZ. +pub extern "C" fn C2Tuple_ChannelIdCVec_u64ZZ_free(_res: C2Tuple_ChannelIdCVec_u64ZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_u64ZZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdCVec_u64ZZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_OutPointCVec_u64ZZZ { +pub struct CVec_C2Tuple_ChannelIdCVec_u64ZZZ { /// 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_OutPointCVec_u64ZZ, + pub data: *mut crate::c_types::derived::C2Tuple_ChannelIdCVec_u64ZZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_OutPointCVec_u64ZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_ChannelIdCVec_u64ZZZ { + #[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(); + let ret = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_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_OutPointCVec_u64ZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdCVec_u64ZZ] { + unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_OutPointCVec_u64ZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_ChannelIdCVec_u64ZZZ { + 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() } } @@ -31448,18 +34881,18 @@ impl From> for CVec_C2T } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_OutPointCVec_u64ZZZ_free(_res: CVec_C2Tuple_OutPointCVec_u64ZZZ) { } -impl Drop for CVec_C2Tuple_OutPointCVec_u64ZZZ { +pub extern "C" fn CVec_C2Tuple_ChannelIdCVec_u64ZZZ_free(_res: CVec_C2Tuple_ChannelIdCVec_u64ZZZ) { } +impl Drop for CVec_C2Tuple_ChannelIdCVec_u64ZZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_C2Tuple_OutPointCVec_u64ZZZ { +impl Clone for CVec_C2Tuple_ChannelIdCVec_u64ZZZ { 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) }); + res.extend_from_slice(unsafe { crate::c_types::from_raw_parts_safer_mut(self.data, self.datalen) }); Self::from(res) } } @@ -31560,98 +34993,6 @@ impl Clone for CResult_BlindedMessagePathDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_BlindedMessagePathDecodeErrorZ_clone(orig: &CResult_BlindedMessagePathDecodeErrorZ) -> CResult_BlindedMessagePathDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedMessagePathNoneZ -pub union CResult_BlindedMessagePathNoneZPtr { - /// 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::message::BlindedMessagePath, - /// 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_BlindedMessagePathNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::message::BlindedMessagePath on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedMessagePathNoneZ { - /// The contents of this CResult_BlindedMessagePathNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedMessagePathNoneZPtr, - /// Whether this CResult_BlindedMessagePathNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_BlindedMessagePathNoneZ in the success state. -pub extern "C" fn CResult_BlindedMessagePathNoneZ_ok(o: crate::lightning::blinded_path::message::BlindedMessagePath) -> CResult_BlindedMessagePathNoneZ { - CResult_BlindedMessagePathNoneZ { - contents: CResult_BlindedMessagePathNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_BlindedMessagePathNoneZ in the error state. -pub extern "C" fn CResult_BlindedMessagePathNoneZ_err() -> CResult_BlindedMessagePathNoneZ { - CResult_BlindedMessagePathNoneZ { - contents: CResult_BlindedMessagePathNoneZPtr { - 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_BlindedMessagePathNoneZ_is_ok(o: &CResult_BlindedMessagePathNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_BlindedMessagePathNoneZ. -pub extern "C" fn CResult_BlindedMessagePathNoneZ_free(_res: CResult_BlindedMessagePathNoneZ) { } -impl Drop for CResult_BlindedMessagePathNoneZ { - 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_BlindedMessagePathNoneZ { - 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_BlindedMessagePathNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_BlindedMessagePathNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_BlindedMessagePathNoneZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedMessagePathNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_BlindedMessagePathNoneZPtr { - err: core::ptr::null_mut() - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_BlindedMessagePathNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedMessagePathNoneZ_clone(orig: &CResult_BlindedMessagePathNoneZ) -> CResult_BlindedMessagePathNoneZ { Clone::clone(&orig) } -#[repr(C)] /// The contents of CResult_MessageContextDecodeErrorZ pub union CResult_MessageContextDecodeErrorZPtr { /// 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 75e01723..a666f984 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -35,6 +35,30 @@ use alloc::{boxed::Box, vec::Vec, string::String}; use core::convert::TryFrom; +/// [`core::slice::from_raw_parts`] requires the pointer to be non-NULL even if the len is 0, which +/// is annoying, so we wrap it here and fill in garbage in that case. +pub(crate) unsafe fn from_raw_parts_safer_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] { + if len == 0 { + core::slice::from_raw_parts_mut(core::ptr::NonNull::dangling().as_ptr(), len) + } else { + assert!(data != core::ptr::null_mut()); + assert!(data != core::ptr::NonNull::dangling().as_ptr()); + core::slice::from_raw_parts_mut(data, len) + } +} + +/// [`core::slice::from_raw_parts`] requires the pointer to be non-NULL even if the len is 0, which +/// is annoying, so we wrap it here and fill in garbage in that case. +pub(crate) unsafe fn from_raw_parts_safer<'a, T>(data: *const T, len: usize) -> &'a [T] { + if len == 0 { + core::slice::from_raw_parts(core::ptr::NonNull::dangling().as_ptr(), len) + } else { + assert!(data != core::ptr::null()); + assert!(data != core::ptr::NonNull::dangling().as_ptr()); + core::slice::from_raw_parts(data, len) + } +} + #[repr(C)] /// A dummy struct of which an instance must never exist. /// This corresponds to the Rust type `Infallible`, or, in unstable rust, `!` @@ -575,7 +599,7 @@ impl Transaction { } pub(crate) fn into_bitcoin(&self) -> BitcoinTransaction { if self.datalen == 0 { panic!("0-length buffer can never represent a valid Transaction"); } - ::bitcoin::consensus::encode::deserialize(unsafe { core::slice::from_raw_parts(self.data, self.datalen) }).unwrap() + ::bitcoin::consensus::encode::deserialize(unsafe { from_raw_parts_safer(self.data, self.datalen) }).unwrap() } pub(crate) fn from_bitcoin(btc: &BitcoinTransaction) -> Self { let vec = ::bitcoin::consensus::encode::serialize(btc); @@ -591,7 +615,7 @@ impl Drop for Transaction { } impl Clone for Transaction { fn clone(&self) -> Self { - let sl = unsafe { core::slice::from_raw_parts(self.data, self.datalen) }; + let sl = unsafe { from_raw_parts_safer(self.data, self.datalen) }; let mut v = Vec::new(); v.extend_from_slice(&sl); Self::from_vec(v) @@ -624,7 +648,7 @@ impl Witness { } } pub(crate) fn into_bitcoin(&self) -> BitcoinWitness { - ::bitcoin::consensus::encode::deserialize(unsafe { core::slice::from_raw_parts(self.data, self.datalen) }).unwrap() + ::bitcoin::consensus::encode::deserialize(unsafe { from_raw_parts_safer(self.data, self.datalen) }).unwrap() } pub(crate) fn from_bitcoin(btc: &BitcoinWitness) -> Self { let vec = ::bitcoin::consensus::encode::serialize(btc); @@ -641,7 +665,7 @@ impl Drop for Witness { } impl Clone for Witness { fn clone(&self) -> Self { - let sl = unsafe { core::slice::from_raw_parts(self.data, self.datalen) }; + let sl = unsafe { from_raw_parts_safer(self.data, self.datalen) }; let mut v = Vec::new(); v.extend_from_slice(&sl); Self::from_vec(v) @@ -797,12 +821,7 @@ impl u8slice { } } pub(crate) fn to_slice(&self) -> &[u8] { - if self.datalen == 0 { return &[]; } - unsafe { core::slice::from_raw_parts(self.data, self.datalen) } - } - pub(crate) fn to_reader<'a>(&'a self) -> Cursor<&'a [u8]> { - let sl = self.to_slice(); - Cursor::new(sl) + unsafe { from_raw_parts_safer(self.data, self.datalen) } } pub(crate) fn from_vec(v: &derived::CVec_u8Z) -> u8slice { Self::from_slice(v.as_slice()) @@ -861,8 +880,8 @@ pub(crate) fn serialize_obj(i: &I) -> derive i.write(&mut out).unwrap(); derived::CVec_u8Z::from(out.0) } -pub(crate) fn deserialize_obj(s: u8slice) -> Result { - I::read(&mut s.to_slice()) +pub(crate) fn deserialize_obj(s: u8slice) -> Result { + I::read_from_fixed_length_buffer(&mut s.to_slice()) } pub(crate) fn maybe_deserialize_obj(s: u8slice) -> Result, lightning::ln::msgs::DecodeError> { I::read(&mut s.to_slice()) @@ -897,20 +916,20 @@ impl Into for &mut &str { impl Str { pub(crate) fn into_str(&self) -> &'static str { if self.len == 0 { return ""; } - core::str::from_utf8(unsafe { core::slice::from_raw_parts(self.chars, self.len) }).unwrap() + core::str::from_utf8(unsafe { from_raw_parts_safer(self.chars, self.len) }).unwrap() } pub(crate) fn into_string(mut self) -> String { let bytes = if self.len == 0 { Vec::new() } else if self.chars_is_owned { let ret = unsafe { - Box::from_raw(core::slice::from_raw_parts_mut(unsafe { self.chars as *mut u8 }, self.len)) + Box::from_raw(from_raw_parts_safer_mut(unsafe { self.chars as *mut u8 }, self.len)) }.into(); self.chars_is_owned = false; ret } else { let mut ret = Vec::with_capacity(self.len); - ret.extend_from_slice(unsafe { core::slice::from_raw_parts(self.chars, self.len) }); + ret.extend_from_slice(unsafe { from_raw_parts_safer(self.chars, self.len) }); ret }; String::from_utf8(bytes).unwrap() diff --git a/lightning-c-bindings/src/lib.rs b/lightning-c-bindings/src/lib.rs index 6f5c45c2..a076598a 100644 --- a/lightning-c-bindings/src/lib.rs +++ b/lightning-c-bindings/src/lib.rs @@ -29,4 +29,3 @@ pub mod lightning_persister; pub mod lightning_background_processor; pub mod lightning_invoice; pub mod lightning_rapid_gossip_sync; -pub mod lightning_liquidity; diff --git a/lightning-c-bindings/src/lightning/blinded_path/message.rs b/lightning-c-bindings/src/lightning/blinded_path/message.rs index 0c30ae4c..8204ee8d 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/message.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/message.rs @@ -82,7 +82,7 @@ impl Clone for BlindedMessagePath { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedMessagePath>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -90,12 +90,12 @@ impl Clone for BlindedMessagePath { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedMessagePath_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedMessagePath)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedMessagePath) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedMessagePath pub extern "C" fn BlindedMessagePath_clone(orig: &BlindedMessagePath) -> BlindedMessagePath { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedMessagePath object pub extern "C" fn BlindedMessagePath_debug_str_void(o: *const c_void) -> Str { @@ -138,23 +138,30 @@ pub extern "C" fn BlindedMessagePath_read(ser: crate::c_types::u8slice) -> crate /// Create a one-hop blinded path for a message. #[must_use] #[no_mangle] -pub extern "C" fn BlindedMessagePath_one_hop(mut recipient_node_id: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedMessagePathNoneZ { - let mut ret = lightning::blinded_path::message::BlindedMessagePath::one_hop(recipient_node_id.into_rust(), context.into_native(), entropy_source, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret +pub extern "C" fn BlindedMessagePath_one_hop(mut recipient_node_id: crate::c_types::PublicKey, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::lightning::blinded_path::message::BlindedMessagePath { + let mut ret = lightning::blinded_path::message::BlindedMessagePath::one_hop(recipient_node_id.into_rust(), *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), entropy_source, secp256k1::global::SECP256K1); + crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Create a path for an onion message, to be forwarded along `node_pks`. The last node -/// pubkey in `node_pks` will be the destination node. +/// Create a path for an onion message, to be forwarded along `node_pks`. +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedMessagePath_new(mut intermediate_nodes: crate::c_types::derived::CVec_MessageForwardNodeZ, mut recipient_node_id: crate::c_types::PublicKey, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::lightning::blinded_path::message::BlindedMessagePath { + let mut local_intermediate_nodes = Vec::new(); for mut item in intermediate_nodes.into_rust().drain(..) { local_intermediate_nodes.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::blinded_path::message::BlindedMessagePath::new(&local_intermediate_nodes[..], recipient_node_id.into_rust(), *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), entropy_source, secp256k1::global::SECP256K1); + crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Same as [`BlindedMessagePath::new`], but allows specifying a number of dummy hops. /// -/// Errors if no hops are provided or if `node_pk`(s) are invalid. +/// Note: +/// At most [`MAX_DUMMY_HOPS_COUNT`] dummy hops can be added to the blinded path. #[must_use] #[no_mangle] -pub extern "C" fn BlindedMessagePath_new(mut intermediate_nodes: crate::c_types::derived::CVec_MessageForwardNodeZ, mut recipient_node_id: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_BlindedMessagePathNoneZ { +pub extern "C" fn BlindedMessagePath_new_with_dummy_hops(mut intermediate_nodes: crate::c_types::derived::CVec_MessageForwardNodeZ, mut recipient_node_id: crate::c_types::PublicKey, mut dummy_hop_count: usize, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::lightning::blinded_path::message::BlindedMessagePath { let mut local_intermediate_nodes = Vec::new(); for mut item in intermediate_nodes.into_rust().drain(..) { local_intermediate_nodes.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = lightning::blinded_path::message::BlindedMessagePath::new(&local_intermediate_nodes[..], recipient_node_id.into_rust(), context.into_native(), entropy_source, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret + let mut ret = lightning::blinded_path::message::BlindedMessagePath::new_with_dummy_hops(&local_intermediate_nodes[..], recipient_node_id.into_rust(), dummy_hop_count, *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), entropy_source, secp256k1::global::SECP256K1); + crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Attempts to a use a compact representation for the [`IntroductionNode`] by using a directed @@ -219,6 +226,22 @@ pub extern "C" fn BlindedMessagePath_advance_path_by_one(this_arg: &mut crate::l local_ret } +/// Creates a new [`BlindedMessagePath`] from its constituent parts. +/// +/// Useful when you need to reconstruct a blinded path from previously serialized components. +/// +/// Parameters: +/// * `introduction_node_id`: The public key of the introduction node in the path +/// * `blinding_point`: The public key used for blinding the path +/// * `blinded_hops`: The encrypted routing information for each hop in the path +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedMessagePath_from_blinded_path(mut introduction_node_id: crate::c_types::PublicKey, mut blinding_point: crate::c_types::PublicKey, mut blinded_hops: crate::c_types::derived::CVec_BlindedHopZ) -> crate::lightning::blinded_path::message::BlindedMessagePath { + let mut local_blinded_hops = Vec::new(); for mut item in blinded_hops.into_rust().drain(..) { local_blinded_hops.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::blinded_path::message::BlindedMessagePath::from_blinded_path(introduction_node_id.into_rust(), blinding_point.into_rust(), local_blinded_hops); + crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// The next hop to forward an onion message along its path. /// /// Note that payment blinded paths always specify their next hop using an explicit node id. @@ -354,6 +377,12 @@ use lightning::blinded_path::message::MessageForwardNode as nativeMessageForward pub(crate) type nativeMessageForwardNode = nativeMessageForwardNodeImport; /// An intermediate node, and possibly a short channel id leading to the next node. +/// +/// Note: +/// [`MessageForwardNode`] must represent a node that supports [`supports_onion_messages`] +/// in order to be included in valid blinded paths for onion messaging. +/// +/// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages #[must_use] #[repr(C)] pub struct MessageForwardNode { @@ -412,7 +441,7 @@ impl MessageForwardNode { /// This node's pubkey. #[no_mangle] pub extern "C" fn MessageForwardNode_get_node_id(this_ptr: &MessageForwardNode) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; + let mut inner_val = &mut MessageForwardNode::get_native_mut_ref(this_ptr).node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// This node's pubkey. @@ -425,7 +454,7 @@ pub extern "C" fn MessageForwardNode_set_node_id(this_ptr: &mut MessageForwardNo /// more compact representation. #[no_mangle] pub extern "C" fn MessageForwardNode_get_short_channel_id(this_ptr: &MessageForwardNode) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + let mut inner_val = &mut MessageForwardNode::get_native_mut_ref(this_ptr).short_channel_id; 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 } @@ -451,7 +480,7 @@ impl Clone for MessageForwardNode { fn clone(&self) -> Self { Self { inner: if <*mut nativeMessageForwardNode>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -459,12 +488,12 @@ impl Clone for MessageForwardNode { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MessageForwardNode_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeMessageForwardNode)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeMessageForwardNode) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the MessageForwardNode pub extern "C" fn MessageForwardNode_clone(orig: &MessageForwardNode) -> MessageForwardNode { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a MessageForwardNode object pub extern "C" fn MessageForwardNode_debug_str_void(o: *const c_void) -> Str { @@ -699,6 +728,41 @@ pub enum OffersContext { /// [`Offer`]: crate::offers::offer::Offer nonce: crate::lightning::offers::nonce::Nonce, }, + /// Context used by a [`BlindedMessagePath`] within the [`Offer`] of an async recipient. + /// + /// This variant is received by the static invoice server when handling an [`InvoiceRequest`] on + /// behalf of said async recipient. + /// + /// [`Offer`]: crate::offers::offer::Offer + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + StaticInvoiceRequested { + /// An identifier for the async recipient for whom we as a static invoice server are serving + /// [`StaticInvoice`]s. Used paired with the + /// [`OffersContext::StaticInvoiceRequested::invoice_slot`] when looking up a corresponding + /// [`StaticInvoice`] to return to the payer if the recipient is offline. This id was previously + /// provided via [`AsyncPaymentsContext::ServeStaticInvoice::recipient_id`]. + /// + /// Also useful for rate limiting the number of [`InvoiceRequest`]s we will respond to on + /// recipient's behalf. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + recipient_id: crate::c_types::derived::CVec_u8Z, + /// The slot number for a specific [`StaticInvoice`] that the recipient previously + /// requested be served on their behalf. Useful when paired with the + /// [`OffersContext::StaticInvoiceRequested::recipient_id`] to pull that specific invoice from + /// the database when payers send an [`InvoiceRequest`]. This id was previously + /// provided via [`AsyncPaymentsContext::ServeStaticInvoice::invoice_slot`]. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + invoice_slot: u16, + /// The time as duration since the Unix epoch at which this path expires and messages sent over + /// it should be ignored. + /// + /// Useful to timeout async recipients that are no longer supported as clients. + path_absolute_expiry: u64, + }, /// Context used by a [`BlindedMessagePath`] within a [`Refund`] or as a reply path for an /// [`InvoiceRequest`]. /// @@ -722,13 +786,6 @@ pub enum OffersContext { /// [`Refund`]: crate::offers::refund::Refund /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest nonce: crate::lightning::offers::nonce::Nonce, - /// Authentication code for the [`PaymentId`], which should be checked when the context is - /// used with an [`InvoiceError`]. - /// - /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - hmac: crate::c_types::ThirtyTwoBytes, }, /// Context used by a [`BlindedMessagePath`] as a reply path for a [`Bolt12Invoice`]. /// @@ -741,17 +798,6 @@ pub enum OffersContext { /// /// [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash payment_hash: crate::c_types::ThirtyTwoBytes, - /// A nonce used for authenticating that a received [`InvoiceError`] is for a valid - /// sent [`Bolt12Invoice`]. - /// - /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - nonce: crate::lightning::offers::nonce::Nonce, - /// Authentication code for the [`PaymentHash`], which should be checked when the context is - /// used to log the received [`InvoiceError`]. - /// - /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - hmac: crate::c_types::ThirtyTwoBytes, }, } use lightning::blinded_path::message::OffersContext as OffersContextImport; @@ -767,25 +813,29 @@ impl OffersContext { nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, } }, - OffersContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + OffersContext::StaticInvoiceRequested {ref recipient_id, ref invoice_slot, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + nativeOffersContext::StaticInvoiceRequested { + recipient_id: local_recipient_id_nonref, + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry_nonref), + } + }, + OffersContext::OutboundPayment {ref payment_id, ref nonce, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); - let mut local_hmac_nonref = if hmac_nonref.data == [0; 32] { None } else { Some( { hmac_nonref.data }) }; nativeOffersContext::OutboundPayment { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, - hmac: local_hmac_nonref, } }, - OffersContext::InboundPayment {ref payment_hash, ref nonce, ref hmac, } => { + OffersContext::InboundPayment {ref payment_hash, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); nativeOffersContext::InboundPayment { payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), - nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, - hmac: hmac_nonref.data, } }, } @@ -798,19 +848,23 @@ impl OffersContext { nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, } }, - OffersContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { - let mut local_hmac = if hmac.data == [0; 32] { None } else { Some( { hmac.data }) }; + OffersContext::StaticInvoiceRequested {mut recipient_id, mut invoice_slot, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + nativeOffersContext::StaticInvoiceRequested { + recipient_id: local_recipient_id, + invoice_slot: invoice_slot, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry), + } + }, + OffersContext::OutboundPayment {mut payment_id, mut nonce, } => { nativeOffersContext::OutboundPayment { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, - hmac: local_hmac, } }, - OffersContext::InboundPayment {mut payment_hash, mut nonce, mut hmac, } => { + OffersContext::InboundPayment {mut payment_hash, } => { nativeOffersContext::InboundPayment { payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), - nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, - hmac: hmac.data, } }, } @@ -825,25 +879,29 @@ impl OffersContext { nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, } }, - nativeOffersContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + nativeOffersContext::StaticInvoiceRequested {ref recipient_id, ref invoice_slot, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + OffersContext::StaticInvoiceRequested { + recipient_id: local_recipient_id_nonref.into(), + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: path_absolute_expiry_nonref.as_secs(), + } + }, + nativeOffersContext::OutboundPayment {ref payment_id, ref nonce, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); - let mut local_hmac_nonref = if hmac_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (hmac_nonref.unwrap()) } } }; OffersContext::OutboundPayment { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, - hmac: local_hmac_nonref, } }, - nativeOffersContext::InboundPayment {ref payment_hash, ref nonce, ref hmac, } => { + nativeOffersContext::InboundPayment {ref payment_hash, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); OffersContext::InboundPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, - nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, - hmac: crate::c_types::ThirtyTwoBytes { data: hmac_nonref }, } }, } @@ -856,19 +914,23 @@ impl OffersContext { nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, } }, - nativeOffersContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { - let mut local_hmac = if hmac.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (hmac.unwrap()) } } }; + nativeOffersContext::StaticInvoiceRequested {mut recipient_id, mut invoice_slot, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + OffersContext::StaticInvoiceRequested { + recipient_id: local_recipient_id.into(), + invoice_slot: invoice_slot, + path_absolute_expiry: path_absolute_expiry.as_secs(), + } + }, + nativeOffersContext::OutboundPayment {mut payment_id, mut nonce, } => { OffersContext::OutboundPayment { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, - hmac: local_hmac, } }, - nativeOffersContext::InboundPayment {mut payment_hash, mut nonce, mut hmac, } => { + nativeOffersContext::InboundPayment {mut payment_hash, } => { OffersContext::InboundPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, - nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, - hmac: crate::c_types::ThirtyTwoBytes { data: hmac }, } }, } @@ -900,21 +962,27 @@ pub extern "C" fn OffersContext_invoice_request(nonce: crate::lightning::offers: } } #[no_mangle] +/// Utility method to constructs a new StaticInvoiceRequested-variant OffersContext +pub extern "C" fn OffersContext_static_invoice_requested(recipient_id: crate::c_types::derived::CVec_u8Z, invoice_slot: u16, path_absolute_expiry: u64) -> OffersContext { + OffersContext::StaticInvoiceRequested { + recipient_id, + invoice_slot, + path_absolute_expiry, + } +} +#[no_mangle] /// Utility method to constructs a new OutboundPayment-variant OffersContext -pub extern "C" fn OffersContext_outbound_payment(payment_id: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, hmac: crate::c_types::ThirtyTwoBytes) -> OffersContext { +pub extern "C" fn OffersContext_outbound_payment(payment_id: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce) -> OffersContext { OffersContext::OutboundPayment { payment_id, nonce, - hmac, } } #[no_mangle] /// Utility method to constructs a new InboundPayment-variant OffersContext -pub extern "C" fn OffersContext_inbound_payment(payment_hash: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, hmac: crate::c_types::ThirtyTwoBytes) -> OffersContext { +pub extern "C" fn OffersContext_inbound_payment(payment_hash: crate::c_types::ThirtyTwoBytes) -> OffersContext { OffersContext::InboundPayment { payment_hash, - nonce, - hmac, } } /// Get a string which allows debug introspection of a OffersContext object @@ -933,9 +1001,103 @@ pub extern "C" fn OffersContext_eq(a: &OffersContext, b: &OffersContext) -> bool #[must_use] #[repr(C)] pub enum AsyncPaymentsContext { + /// Context used by a [`BlindedMessagePath`] provided out-of-band to an async recipient, where the + /// context is provided back to the static invoice server in corresponding [`OfferPathsRequest`]s. + /// + /// [`OfferPathsRequest`]: crate::onion_message::async_payments::OfferPathsRequest + OfferPathsRequest { + /// An identifier for the async recipient that is requesting blinded paths to include in their + /// [`Offer::paths`]. This ID will be surfaced when the async recipient eventually sends a + /// corresponding [`ServeStaticInvoice`] message, and can be used to rate limit the recipient. + /// + /// [`Offer::paths`]: crate::offers::offer::Offer::paths + /// [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + recipient_id: crate::c_types::derived::CVec_u8Z, + /// An optional field indicating the time as duration since the Unix epoch at which this path + /// expires and messages sent over it should be ignored. + /// + /// Useful to timeout async recipients that are no longer supported as clients. + path_absolute_expiry: crate::c_types::derived::COption_u64Z, + }, + /// Context used by a reply path to an [`OfferPathsRequest`], provided back to us as an async + /// recipient in corresponding [`OfferPaths`] messages from the static invoice server. + /// + /// [`OfferPathsRequest`]: crate::onion_message::async_payments::OfferPathsRequest + /// [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + OfferPaths { + /// The \"slot\" in the static invoice server's database that the invoice corresponding to these + /// offer paths should go into, originally set by us in [`OfferPathsRequest::invoice_slot`]. This + /// value allows us as the recipient to replace a specific invoice that is stored by the server, + /// which is useful for limiting the number of invoices stored by the server while also keeping + /// all the invoices persisted with the server fresh. + /// + /// [`OfferPathsRequest::invoice_slot`]: crate::onion_message::async_payments::OfferPathsRequest::invoice_slot + invoice_slot: u16, + /// The time as duration since the Unix epoch at which this path expires and messages sent over + /// it should be ignored. + /// + /// This avoids the situation where the [`OfferPaths`] message is very delayed and thus + /// outdated. + /// + /// [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + path_absolute_expiry: u64, + }, + /// Context used by a reply path to an [`OfferPaths`] message, provided back to us as the static + /// invoice server in corresponding [`ServeStaticInvoice`] messages. + /// + /// [`OfferPaths`]: crate::onion_message::async_payments::OfferPaths + /// [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + ServeStaticInvoice { + /// An identifier for the async recipient that is requesting that a [`StaticInvoice`] be served + /// on their behalf. + /// + /// Useful when surfaced alongside the below `invoice_slot` when payers send an + /// [`InvoiceRequest`], to pull the specific static invoice from the database. + /// + /// Also useful to rate limit the invoices being persisted on behalf of a particular recipient. + /// + /// This id will be provided back to us as the static invoice server via + /// [`OffersContext::StaticInvoiceRequested::recipient_id`]. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + recipient_id: crate::c_types::derived::CVec_u8Z, + /// The slot number for the specific [`StaticInvoice`] that the recipient is requesting be + /// served on their behalf. Useful when surfaced alongside the above `recipient_id` when payers + /// send an [`InvoiceRequest`], to pull the specific static invoice from the database. This id + /// will be provided back to us as the static invoice server via + /// [`OffersContext::StaticInvoiceRequested::invoice_slot`]. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + invoice_slot: u16, + /// The time as duration since the Unix epoch at which this path expires and messages sent over + /// it should be ignored. + /// + /// Useful to timeout async recipients that are no longer supported as clients. + path_absolute_expiry: u64, + }, + /// Context used by a reply path to a [`ServeStaticInvoice`] message, provided back to us in + /// corresponding [`StaticInvoicePersisted`] messages. + /// + /// [`ServeStaticInvoice`]: crate::onion_message::async_payments::ServeStaticInvoice + /// [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted + StaticInvoicePersisted { + /// The id of the offer in the cache corresponding to the [`StaticInvoice`] that has been + /// persisted. This invoice is now ready to be provided by the static invoice server in response + /// to [`InvoiceRequest`]s, so the corresponding offer can be marked as ready to receive + /// payments. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + offer_id: crate::lightning::offers::offer::OfferId, + /// The time as duration since the Unix epoch at which the invoice corresponding to this path + /// was created. Useful to know when an invoice needs replacement. + invoice_created_at: u64, + }, /// Context contained within the reply [`BlindedMessagePath`] we put in outbound /// [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`] - /// messages. + /// messages if we are an always-online sender paying an async recipient. /// /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc @@ -945,17 +1107,41 @@ pub enum AsyncPaymentsContext { /// /// [`Offer`]: crate::offers::offer::Offer payment_id: crate::c_types::ThirtyTwoBytes, - /// A nonce used for authenticating that a [`ReleaseHeldHtlc`] message is valid for a preceding - /// [`HeldHtlcAvailable`] message. + }, + /// Context contained within the [`BlindedMessagePath`]s we put in static invoices, provided back + /// to us in corresponding [`HeldHtlcAvailable`] messages. + /// + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + InboundPayment { + /// The time as duration since the Unix epoch at which this path expires and messages sent over + /// it should be ignored. Without this, anyone with the path corresponding to this context is + /// able to trivially ask if we're online forever. + path_absolute_expiry: u64, + }, + /// Context contained within the reply [`BlindedMessagePath`] put in outbound + /// [`HeldHtlcAvailable`] messages, provided back to the async sender's always-online counterparty + /// in corresponding [`ReleaseHeldHtlc`] messages. + /// + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + ReleaseHeldHtlc { + /// An identifier for the HTLC that should be released by us as the sender's always-online + /// channel counterparty to the often-offline recipient. + intercept_id: crate::c_types::ThirtyTwoBytes, + /// The short channel id alias corresponding to the to-be-released inbound HTLC, to help locate + /// the HTLC internally if the [`ReleaseHeldHtlc`] races our node decoding the held HTLC's + /// onion. + /// + /// We use the outbound scid alias because it is stable even if the channel splices, unlike + /// regular short channel ids. /// /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc - /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable - nonce: crate::lightning::offers::nonce::Nonce, - /// Authentication code for the [`PaymentId`]. + prev_outbound_scid_alias: u64, + /// The id of the to-be-released HTLC, to help locate the HTLC internally if the + /// [`ReleaseHeldHtlc`] races our node decoding the held HTLC's onion. /// - /// Prevents the recipient from being able to deanonymize us by creating a blinded path to us - /// containing the expected [`PaymentId`]. - hmac: crate::c_types::ThirtyTwoBytes, + /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + htlc_id: u64, }, } use lightning::blinded_path::message::AsyncPaymentsContext as AsyncPaymentsContextImport; @@ -965,14 +1151,63 @@ impl AsyncPaymentsContext { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeAsyncPaymentsContext { match self { - AsyncPaymentsContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + AsyncPaymentsContext::OfferPathsRequest {ref recipient_id, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + let mut local_path_absolute_expiry_nonref = { /*path_absolute_expiry_nonref*/ let path_absolute_expiry_nonref_opt = path_absolute_expiry_nonref; if path_absolute_expiry_nonref_opt.is_none() { None } else { Some({ { core::time::Duration::from_secs({ path_absolute_expiry_nonref_opt.take() }) }})} }; + nativeAsyncPaymentsContext::OfferPathsRequest { + recipient_id: local_recipient_id_nonref, + path_absolute_expiry: local_path_absolute_expiry_nonref, + } + }, + AsyncPaymentsContext::OfferPaths {ref invoice_slot, ref path_absolute_expiry, } => { + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + nativeAsyncPaymentsContext::OfferPaths { + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry_nonref), + } + }, + AsyncPaymentsContext::ServeStaticInvoice {ref recipient_id, ref invoice_slot, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + nativeAsyncPaymentsContext::ServeStaticInvoice { + recipient_id: local_recipient_id_nonref, + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry_nonref), + } + }, + AsyncPaymentsContext::StaticInvoicePersisted {ref offer_id, ref invoice_created_at, } => { + let mut offer_id_nonref = Clone::clone(offer_id); + let mut invoice_created_at_nonref = Clone::clone(invoice_created_at); + nativeAsyncPaymentsContext::StaticInvoicePersisted { + offer_id: *unsafe { Box::from_raw(offer_id_nonref.take_inner()) }, + invoice_created_at: core::time::Duration::from_secs(invoice_created_at_nonref), + } + }, + AsyncPaymentsContext::OutboundPayment {ref payment_id, } => { let mut payment_id_nonref = Clone::clone(payment_id); - let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); nativeAsyncPaymentsContext::OutboundPayment { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), - nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, - hmac: hmac_nonref.data, + } + }, + AsyncPaymentsContext::InboundPayment {ref path_absolute_expiry, } => { + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + nativeAsyncPaymentsContext::InboundPayment { + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry_nonref), + } + }, + AsyncPaymentsContext::ReleaseHeldHtlc {ref intercept_id, ref prev_outbound_scid_alias, ref htlc_id, } => { + let mut intercept_id_nonref = Clone::clone(intercept_id); + let mut prev_outbound_scid_alias_nonref = Clone::clone(prev_outbound_scid_alias); + let mut htlc_id_nonref = Clone::clone(htlc_id); + nativeAsyncPaymentsContext::ReleaseHeldHtlc { + intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id_nonref.data), + prev_outbound_scid_alias: prev_outbound_scid_alias_nonref, + htlc_id: htlc_id_nonref, } }, } @@ -980,11 +1215,49 @@ impl AsyncPaymentsContext { #[allow(unused)] pub(crate) fn into_native(self) -> nativeAsyncPaymentsContext { match self { - AsyncPaymentsContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { + AsyncPaymentsContext::OfferPathsRequest {mut recipient_id, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + let mut local_path_absolute_expiry = { /*path_absolute_expiry*/ let path_absolute_expiry_opt = path_absolute_expiry; if path_absolute_expiry_opt.is_none() { None } else { Some({ { core::time::Duration::from_secs({ path_absolute_expiry_opt.take() }) }})} }; + nativeAsyncPaymentsContext::OfferPathsRequest { + recipient_id: local_recipient_id, + path_absolute_expiry: local_path_absolute_expiry, + } + }, + AsyncPaymentsContext::OfferPaths {mut invoice_slot, mut path_absolute_expiry, } => { + nativeAsyncPaymentsContext::OfferPaths { + invoice_slot: invoice_slot, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry), + } + }, + AsyncPaymentsContext::ServeStaticInvoice {mut recipient_id, mut invoice_slot, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + nativeAsyncPaymentsContext::ServeStaticInvoice { + recipient_id: local_recipient_id, + invoice_slot: invoice_slot, + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry), + } + }, + AsyncPaymentsContext::StaticInvoicePersisted {mut offer_id, mut invoice_created_at, } => { + nativeAsyncPaymentsContext::StaticInvoicePersisted { + offer_id: *unsafe { Box::from_raw(offer_id.take_inner()) }, + invoice_created_at: core::time::Duration::from_secs(invoice_created_at), + } + }, + AsyncPaymentsContext::OutboundPayment {mut payment_id, } => { nativeAsyncPaymentsContext::OutboundPayment { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, - hmac: hmac.data, + } + }, + AsyncPaymentsContext::InboundPayment {mut path_absolute_expiry, } => { + nativeAsyncPaymentsContext::InboundPayment { + path_absolute_expiry: core::time::Duration::from_secs(path_absolute_expiry), + } + }, + AsyncPaymentsContext::ReleaseHeldHtlc {mut intercept_id, mut prev_outbound_scid_alias, mut htlc_id, } => { + nativeAsyncPaymentsContext::ReleaseHeldHtlc { + intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id.data), + prev_outbound_scid_alias: prev_outbound_scid_alias, + htlc_id: htlc_id, } }, } @@ -993,14 +1266,63 @@ impl AsyncPaymentsContext { pub(crate) fn from_native(native: &AsyncPaymentsContextImport) -> Self { let native = unsafe { &*(native as *const _ as *const c_void as *const nativeAsyncPaymentsContext) }; match native { - nativeAsyncPaymentsContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + nativeAsyncPaymentsContext::OfferPathsRequest {ref recipient_id, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + let mut local_path_absolute_expiry_nonref = if path_absolute_expiry_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { path_absolute_expiry_nonref.unwrap().as_secs() }) }; + AsyncPaymentsContext::OfferPathsRequest { + recipient_id: local_recipient_id_nonref.into(), + path_absolute_expiry: local_path_absolute_expiry_nonref, + } + }, + nativeAsyncPaymentsContext::OfferPaths {ref invoice_slot, ref path_absolute_expiry, } => { + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + AsyncPaymentsContext::OfferPaths { + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: path_absolute_expiry_nonref.as_secs(), + } + }, + nativeAsyncPaymentsContext::ServeStaticInvoice {ref recipient_id, ref invoice_slot, ref path_absolute_expiry, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + AsyncPaymentsContext::ServeStaticInvoice { + recipient_id: local_recipient_id_nonref.into(), + invoice_slot: invoice_slot_nonref, + path_absolute_expiry: path_absolute_expiry_nonref.as_secs(), + } + }, + nativeAsyncPaymentsContext::StaticInvoicePersisted {ref offer_id, ref invoice_created_at, } => { + let mut offer_id_nonref = Clone::clone(offer_id); + let mut invoice_created_at_nonref = Clone::clone(invoice_created_at); + AsyncPaymentsContext::StaticInvoicePersisted { + offer_id: crate::lightning::offers::offer::OfferId { inner: ObjOps::heap_alloc(offer_id_nonref), is_owned: true }, + invoice_created_at: invoice_created_at_nonref.as_secs(), + } + }, + nativeAsyncPaymentsContext::OutboundPayment {ref payment_id, } => { let mut payment_id_nonref = Clone::clone(payment_id); - let mut nonce_nonref = Clone::clone(nonce); - let mut hmac_nonref = Clone::clone(hmac); AsyncPaymentsContext::OutboundPayment { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, - nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, - hmac: crate::c_types::ThirtyTwoBytes { data: hmac_nonref }, + } + }, + nativeAsyncPaymentsContext::InboundPayment {ref path_absolute_expiry, } => { + let mut path_absolute_expiry_nonref = Clone::clone(path_absolute_expiry); + AsyncPaymentsContext::InboundPayment { + path_absolute_expiry: path_absolute_expiry_nonref.as_secs(), + } + }, + nativeAsyncPaymentsContext::ReleaseHeldHtlc {ref intercept_id, ref prev_outbound_scid_alias, ref htlc_id, } => { + let mut intercept_id_nonref = Clone::clone(intercept_id); + let mut prev_outbound_scid_alias_nonref = Clone::clone(prev_outbound_scid_alias); + let mut htlc_id_nonref = Clone::clone(htlc_id); + AsyncPaymentsContext::ReleaseHeldHtlc { + intercept_id: crate::c_types::ThirtyTwoBytes { data: intercept_id_nonref.0 }, + prev_outbound_scid_alias: prev_outbound_scid_alias_nonref, + htlc_id: htlc_id_nonref, } }, } @@ -1008,11 +1330,49 @@ impl AsyncPaymentsContext { #[allow(unused)] pub(crate) fn native_into(native: nativeAsyncPaymentsContext) -> Self { match native { - nativeAsyncPaymentsContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { + nativeAsyncPaymentsContext::OfferPathsRequest {mut recipient_id, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + let mut local_path_absolute_expiry = if path_absolute_expiry.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { path_absolute_expiry.unwrap().as_secs() }) }; + AsyncPaymentsContext::OfferPathsRequest { + recipient_id: local_recipient_id.into(), + path_absolute_expiry: local_path_absolute_expiry, + } + }, + nativeAsyncPaymentsContext::OfferPaths {mut invoice_slot, mut path_absolute_expiry, } => { + AsyncPaymentsContext::OfferPaths { + invoice_slot: invoice_slot, + path_absolute_expiry: path_absolute_expiry.as_secs(), + } + }, + nativeAsyncPaymentsContext::ServeStaticInvoice {mut recipient_id, mut invoice_slot, mut path_absolute_expiry, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + AsyncPaymentsContext::ServeStaticInvoice { + recipient_id: local_recipient_id.into(), + invoice_slot: invoice_slot, + path_absolute_expiry: path_absolute_expiry.as_secs(), + } + }, + nativeAsyncPaymentsContext::StaticInvoicePersisted {mut offer_id, mut invoice_created_at, } => { + AsyncPaymentsContext::StaticInvoicePersisted { + offer_id: crate::lightning::offers::offer::OfferId { inner: ObjOps::heap_alloc(offer_id), is_owned: true }, + invoice_created_at: invoice_created_at.as_secs(), + } + }, + nativeAsyncPaymentsContext::OutboundPayment {mut payment_id, } => { AsyncPaymentsContext::OutboundPayment { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, - nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, - hmac: crate::c_types::ThirtyTwoBytes { data: hmac }, + } + }, + nativeAsyncPaymentsContext::InboundPayment {mut path_absolute_expiry, } => { + AsyncPaymentsContext::InboundPayment { + path_absolute_expiry: path_absolute_expiry.as_secs(), + } + }, + nativeAsyncPaymentsContext::ReleaseHeldHtlc {mut intercept_id, mut prev_outbound_scid_alias, mut htlc_id, } => { + AsyncPaymentsContext::ReleaseHeldHtlc { + intercept_id: crate::c_types::ThirtyTwoBytes { data: intercept_id.0 }, + prev_outbound_scid_alias: prev_outbound_scid_alias, + htlc_id: htlc_id, } }, } @@ -1037,12 +1397,59 @@ pub(crate) extern "C" fn AsyncPaymentsContext_free_void(this_ptr: *mut c_void) { let _ = unsafe { Box::from_raw(this_ptr as *mut AsyncPaymentsContext) }; } #[no_mangle] +/// Utility method to constructs a new OfferPathsRequest-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_offer_paths_request(recipient_id: crate::c_types::derived::CVec_u8Z, path_absolute_expiry: crate::c_types::derived::COption_u64Z) -> AsyncPaymentsContext { + AsyncPaymentsContext::OfferPathsRequest { + recipient_id, + path_absolute_expiry, + } +} +#[no_mangle] +/// Utility method to constructs a new OfferPaths-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_offer_paths(invoice_slot: u16, path_absolute_expiry: u64) -> AsyncPaymentsContext { + AsyncPaymentsContext::OfferPaths { + invoice_slot, + path_absolute_expiry, + } +} +#[no_mangle] +/// Utility method to constructs a new ServeStaticInvoice-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_serve_static_invoice(recipient_id: crate::c_types::derived::CVec_u8Z, invoice_slot: u16, path_absolute_expiry: u64) -> AsyncPaymentsContext { + AsyncPaymentsContext::ServeStaticInvoice { + recipient_id, + invoice_slot, + path_absolute_expiry, + } +} +#[no_mangle] +/// Utility method to constructs a new StaticInvoicePersisted-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_static_invoice_persisted(offer_id: crate::lightning::offers::offer::OfferId, invoice_created_at: u64) -> AsyncPaymentsContext { + AsyncPaymentsContext::StaticInvoicePersisted { + offer_id, + invoice_created_at, + } +} +#[no_mangle] /// Utility method to constructs a new OutboundPayment-variant AsyncPaymentsContext -pub extern "C" fn AsyncPaymentsContext_outbound_payment(payment_id: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, hmac: crate::c_types::ThirtyTwoBytes) -> AsyncPaymentsContext { +pub extern "C" fn AsyncPaymentsContext_outbound_payment(payment_id: crate::c_types::ThirtyTwoBytes) -> AsyncPaymentsContext { AsyncPaymentsContext::OutboundPayment { payment_id, - nonce, - hmac, + } +} +#[no_mangle] +/// Utility method to constructs a new InboundPayment-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_inbound_payment(path_absolute_expiry: u64) -> AsyncPaymentsContext { + AsyncPaymentsContext::InboundPayment { + path_absolute_expiry, + } +} +#[no_mangle] +/// Utility method to constructs a new ReleaseHeldHtlc-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_release_held_htlc(intercept_id: crate::c_types::ThirtyTwoBytes, prev_outbound_scid_alias: u64, htlc_id: u64) -> AsyncPaymentsContext { + AsyncPaymentsContext::ReleaseHeldHtlc { + intercept_id, + prev_outbound_scid_alias, + htlc_id, } } /// Get a string which allows debug introspection of a AsyncPaymentsContext object @@ -1160,19 +1567,15 @@ impl DNSResolverContext { Self { inner: self.inner, is_owned: false } } } -/// A nonce which uniquely describes a DNS resolution. -/// -/// When we receive a DNSSEC proof message, we should check that it was sent over the blinded -/// path we included in the request by comparing a stored nonce with this one. +/// A nonce which uniquely describes a DNS resolution, useful for looking up metadata about the +/// request. #[no_mangle] pub extern "C" fn DNSResolverContext_get_nonce(this_ptr: &DNSResolverContext) -> *const [u8; 16] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().nonce; + let mut inner_val = &mut DNSResolverContext::get_native_mut_ref(this_ptr).nonce; inner_val } -/// A nonce which uniquely describes a DNS resolution. -/// -/// When we receive a DNSSEC proof message, we should check that it was sent over the blinded -/// path we included in the request by comparing a stored nonce with this one. +/// A nonce which uniquely describes a DNS resolution, useful for looking up metadata about the +/// request. #[no_mangle] pub extern "C" fn DNSResolverContext_set_nonce(this_ptr: &mut DNSResolverContext, mut val: crate::c_types::SixteenBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.nonce = val.data; @@ -1189,7 +1592,7 @@ impl Clone for DNSResolverContext { fn clone(&self) -> Self { Self { inner: if <*mut nativeDNSResolverContext>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1197,12 +1600,12 @@ impl Clone for DNSResolverContext { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DNSResolverContext_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSResolverContext)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDNSResolverContext) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DNSResolverContext pub extern "C" fn DNSResolverContext_clone(orig: &DNSResolverContext) -> DNSResolverContext { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DNSResolverContext object pub extern "C" fn DNSResolverContext_debug_str_void(o: *const c_void) -> Str { @@ -1242,3 +1645,9 @@ pub extern "C" fn DNSResolverContext_read(ser: crate::c_types::u8slice) -> crate let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::message::DNSResolverContext { 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 } +/// The maximum number of dummy hops that can be added to a blinded path. +/// This is to prevent paths from becoming too long and potentially causing +/// issues with message processing or routing. + +#[no_mangle] +pub static MAX_DUMMY_HOPS_COUNT: usize = lightning::blinded_path::message::MAX_DUMMY_HOPS_COUNT; diff --git a/lightning-c-bindings/src/lightning/blinded_path/mod.rs b/lightning-c-bindings/src/lightning/blinded_path/mod.rs index 4c2f1f6c..dde1fe78 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/mod.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/mod.rs @@ -17,8 +17,8 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod payment; pub mod message; +pub mod payment; mod utils { use alloc::str::FromStr; @@ -490,7 +490,7 @@ impl BlindedHop { /// The blinded node id of this hop in a blinded path. #[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; + let mut inner_val = &mut BlindedHop::get_native_mut_ref(this_ptr).blinded_node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// The blinded node id of this hop in a blinded path. @@ -503,7 +503,7 @@ pub extern "C" fn BlindedHop_set_blinded_node_id(this_ptr: &mut BlindedHop, mut /// 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 inner_val = BlindedHop::get_native_mut_ref(this_ptr).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() } @@ -527,7 +527,7 @@ impl Clone for BlindedHop { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedHop>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -535,12 +535,12 @@ impl Clone for BlindedHop { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedHop_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHop)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedHop) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedHop pub extern "C" fn BlindedHop_clone(orig: &BlindedHop) -> BlindedHop { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedHop object pub extern "C" fn BlindedHop_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/blinded_path/payment.rs b/lightning-c-bindings/src/lightning/blinded_path/payment.rs index a8623bab..9e337f3d 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/payment.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/payment.rs @@ -80,7 +80,7 @@ impl BlindedPayInfo { /// Base fee charged (in millisatoshi) for the entire blinded path. #[no_mangle] pub extern "C" fn BlindedPayInfo_get_fee_base_msat(this_ptr: &BlindedPayInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).fee_base_msat; *inner_val } /// Base fee charged (in millisatoshi) for the entire blinded path. @@ -92,7 +92,7 @@ pub extern "C" fn BlindedPayInfo_set_fee_base_msat(this_ptr: &mut BlindedPayInfo /// (i.e., 10,000 is 1%). #[no_mangle] pub extern "C" fn BlindedPayInfo_get_fee_proportional_millionths(this_ptr: &BlindedPayInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).fee_proportional_millionths; *inner_val } /// Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path @@ -105,7 +105,7 @@ pub extern "C" fn BlindedPayInfo_set_fee_proportional_millionths(this_ptr: &mut /// path. #[no_mangle] pub extern "C" fn BlindedPayInfo_get_cltv_expiry_delta(this_ptr: &BlindedPayInfo) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded @@ -119,7 +119,7 @@ pub extern "C" fn BlindedPayInfo_set_cltv_expiry_delta(this_ptr: &mut BlindedPay /// seen by the recipient. #[no_mangle] pub extern "C" fn BlindedPayInfo_get_htlc_minimum_msat(this_ptr: &BlindedPayInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the @@ -134,7 +134,7 @@ pub extern "C" fn BlindedPayInfo_set_htlc_minimum_msat(this_ptr: &mut BlindedPay /// seen by the recipient. #[no_mangle] pub extern "C" fn BlindedPayInfo_get_htlc_maximum_msat(this_ptr: &BlindedPayInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).htlc_maximum_msat; *inner_val } /// The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the @@ -148,7 +148,7 @@ pub extern "C" fn BlindedPayInfo_set_htlc_maximum_msat(this_ptr: &mut BlindedPay /// onion payload. #[no_mangle] pub extern "C" fn BlindedPayInfo_get_features(this_ptr: &BlindedPayInfo) -> crate::lightning_types::features::BlindedHopFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut BlindedPayInfo::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::BlindedHopFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::BlindedHopFeatures<>) as *mut _) }, is_owned: false } } /// Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an @@ -174,7 +174,7 @@ impl Clone for BlindedPayInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedPayInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -182,12 +182,12 @@ impl Clone for BlindedPayInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedPayInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPayInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedPayInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedPayInfo pub extern "C" fn BlindedPayInfo_clone(orig: &BlindedPayInfo) -> BlindedPayInfo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedPayInfo object pub extern "C" fn BlindedPayInfo_debug_str_void(o: *const c_void) -> Str { @@ -291,7 +291,7 @@ impl BlindedPaymentPath { /// The [`BlindedPayInfo`] used to pay this blinded path. #[no_mangle] pub extern "C" fn BlindedPaymentPath_get_payinfo(this_ptr: &BlindedPaymentPath) -> crate::lightning::blinded_path::payment::BlindedPayInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payinfo; + let mut inner_val = &mut BlindedPaymentPath::get_native_mut_ref(this_ptr).payinfo; crate::lightning::blinded_path::payment::BlindedPayInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::BlindedPayInfo<>) as *mut _) }, is_owned: false } } /// The [`BlindedPayInfo`] used to pay this blinded path. @@ -303,7 +303,7 @@ impl Clone for BlindedPaymentPath { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedPaymentPath>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -311,12 +311,12 @@ impl Clone for BlindedPaymentPath { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedPaymentPath_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPaymentPath)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedPaymentPath) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedPaymentPath pub extern "C" fn BlindedPaymentPath_clone(orig: &BlindedPaymentPath) -> BlindedPaymentPath { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedPaymentPath object pub extern "C" fn BlindedPaymentPath_debug_str_void(o: *const c_void) -> Str { @@ -352,7 +352,6 @@ pub extern "C" fn BlindedPaymentPath_one_hop(mut payee_node_id: crate::c_types:: /// Create a blinded path for a payment, to be forwarded along `intermediate_nodes`. /// /// Errors if: -/// * a provided node id is invalid /// * [`BlindedPayInfo`] calculation results in an integer overflow /// * any unknown features are required in the provided [`ForwardTlvs`] #[must_use] @@ -415,6 +414,23 @@ pub extern "C" fn BlindedPaymentPath_advance_path_by_one(this_arg: &mut crate::l local_ret } +/// Builds a new [`BlindedPaymentPath`] from its constituent parts. +/// +/// Useful when reconstructing a blinded path from previously serialized components. +/// +/// Parameters: +/// * `introduction_node_id`: The public key of the introduction node in the path. +/// * `blinding_point`: The public key used for blinding the path. +/// * `blinded_hops`: The encrypted routing information for each hop in the path. +/// * `payinfo`: The [`BlindedPayInfo`] for the blinded path. +#[must_use] +#[no_mangle] +pub extern "C" fn BlindedPaymentPath_from_blinded_path_and_payinfo(mut introduction_node_id: crate::c_types::PublicKey, mut blinding_point: crate::c_types::PublicKey, mut blinded_hops: crate::c_types::derived::CVec_BlindedHopZ, mut payinfo: crate::lightning::blinded_path::payment::BlindedPayInfo) -> crate::lightning::blinded_path::payment::BlindedPaymentPath { + let mut local_blinded_hops = Vec::new(); for mut item in blinded_hops.into_rust().drain(..) { local_blinded_hops.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::blinded_path::payment::BlindedPaymentPath::from_blinded_path_and_payinfo(introduction_node_id.into_rust(), blinding_point.into_rust(), local_blinded_hops, *unsafe { Box::from_raw(payinfo.take_inner()) }); + crate::lightning::blinded_path::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + use lightning::blinded_path::payment::PaymentForwardNode as nativePaymentForwardNodeImport; pub(crate) type nativePaymentForwardNode = nativePaymentForwardNodeImport; @@ -479,7 +495,7 @@ impl PaymentForwardNode { /// used for [`BlindedPayInfo`] construction. #[no_mangle] pub extern "C" fn PaymentForwardNode_get_tlvs(this_ptr: &PaymentForwardNode) -> crate::lightning::blinded_path::payment::ForwardTlvs { - let mut inner_val = &mut this_ptr.get_native_mut_ref().tlvs; + let mut inner_val = &mut PaymentForwardNode::get_native_mut_ref(this_ptr).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 @@ -491,7 +507,7 @@ pub extern "C" fn PaymentForwardNode_set_tlvs(this_ptr: &mut PaymentForwardNode, /// This node's pubkey. #[no_mangle] pub extern "C" fn PaymentForwardNode_get_node_id(this_ptr: &PaymentForwardNode) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; + let mut inner_val = &mut PaymentForwardNode::get_native_mut_ref(this_ptr).node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// This node's pubkey. @@ -502,7 +518,7 @@ pub extern "C" fn PaymentForwardNode_set_node_id(this_ptr: &mut PaymentForwardNo /// The maximum value, in msat, that may be accepted by this node. #[no_mangle] pub extern "C" fn PaymentForwardNode_get_htlc_maximum_msat(this_ptr: &PaymentForwardNode) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; + let mut inner_val = &mut PaymentForwardNode::get_native_mut_ref(this_ptr).htlc_maximum_msat; *inner_val } /// The maximum value, in msat, that may be accepted by this node. @@ -524,7 +540,7 @@ impl Clone for PaymentForwardNode { fn clone(&self) -> Self { Self { inner: if <*mut nativePaymentForwardNode>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -532,12 +548,12 @@ impl Clone for PaymentForwardNode { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PaymentForwardNode_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentForwardNode)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePaymentForwardNode) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentForwardNode pub extern "C" fn PaymentForwardNode_clone(orig: &PaymentForwardNode) -> PaymentForwardNode { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PaymentForwardNode object pub extern "C" fn PaymentForwardNode_debug_str_void(o: *const c_void) -> Str { @@ -605,7 +621,7 @@ impl ForwardTlvs { /// 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; + let mut inner_val = &mut ForwardTlvs::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } /// The short channel id this payment should be forwarded out over. @@ -616,7 +632,7 @@ pub extern "C" fn ForwardTlvs_set_short_channel_id(this_ptr: &mut ForwardTlvs, m /// 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; + let mut inner_val = &mut ForwardTlvs::get_native_mut_ref(this_ptr).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`]. @@ -627,7 +643,7 @@ pub extern "C" fn ForwardTlvs_set_payment_relay(this_ptr: &mut ForwardTlvs, mut /// 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; + let mut inner_val = &mut ForwardTlvs::get_native_mut_ref(this_ptr).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`]. @@ -641,7 +657,7 @@ pub extern "C" fn ForwardTlvs_set_payment_constraints(this_ptr: &mut ForwardTlvs /// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload #[no_mangle] pub extern "C" fn ForwardTlvs_get_features(this_ptr: &ForwardTlvs) -> crate::lightning_types::features::BlindedHopFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut ForwardTlvs::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::BlindedHopFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::BlindedHopFeatures<>) as *mut _) }, is_owned: false } } /// Supported and required features when relaying a payment onion containing this object's @@ -658,7 +674,7 @@ pub extern "C" fn ForwardTlvs_set_features(this_ptr: &mut ForwardTlvs, mut val: /// 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 ForwardTlvs_get_next_blinding_override(this_ptr: &ForwardTlvs) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_blinding_override; + let mut inner_val = &mut ForwardTlvs::get_native_mut_ref(this_ptr).next_blinding_override; let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; local_inner_val } @@ -690,7 +706,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -698,17 +714,183 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeForwardTlvs)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeForwardTlvs) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ForwardTlvs pub extern "C" fn ForwardTlvs_clone(orig: &ForwardTlvs) -> ForwardTlvs { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ForwardTlvs object pub extern "C" fn ForwardTlvs_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ForwardTlvs }).into()} +use lightning::blinded_path::payment::TrampolineForwardTlvs as nativeTrampolineForwardTlvsImport; +pub(crate) type nativeTrampolineForwardTlvs = nativeTrampolineForwardTlvsImport; + +/// Data to construct a [`BlindedHop`] for forwarding a Trampoline payment. +#[must_use] +#[repr(C)] +pub struct TrampolineForwardTlvs { + /// 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 nativeTrampolineForwardTlvs, + /// 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 core::ops::Deref for TrampolineForwardTlvs { + type Target = nativeTrampolineForwardTlvs; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for TrampolineForwardTlvs { } +unsafe impl core::marker::Sync for TrampolineForwardTlvs { } +impl Drop for TrampolineForwardTlvs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeTrampolineForwardTlvs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the TrampolineForwardTlvs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_free(this_obj: TrampolineForwardTlvs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn TrampolineForwardTlvs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTrampolineForwardTlvs) }; +} +#[allow(unused)] +impl TrampolineForwardTlvs { + pub(crate) fn get_native_ref(&self) -> &'static nativeTrampolineForwardTlvs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTrampolineForwardTlvs { + 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 nativeTrampolineForwardTlvs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The node id to which the trampoline node must find a route. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_get_next_trampoline(this_ptr: &TrampolineForwardTlvs) -> crate::c_types::PublicKey { + let mut inner_val = &mut TrampolineForwardTlvs::get_native_mut_ref(this_ptr).next_trampoline; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// The node id to which the trampoline node must find a route. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_set_next_trampoline(this_ptr: &mut TrampolineForwardTlvs, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_trampoline = val.into_rust(); +} +/// Payment parameters for relaying over [`Self::next_trampoline`]. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_get_payment_relay(this_ptr: &TrampolineForwardTlvs) -> crate::lightning::blinded_path::payment::PaymentRelay { + let mut inner_val = &mut TrampolineForwardTlvs::get_native_mut_ref(this_ptr).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::next_trampoline`]. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_set_payment_relay(this_ptr: &mut TrampolineForwardTlvs, 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::next_trampoline`]. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_get_payment_constraints(this_ptr: &TrampolineForwardTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { + let mut inner_val = &mut TrampolineForwardTlvs::get_native_mut_ref(this_ptr).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::next_trampoline`]. +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_set_payment_constraints(this_ptr: &mut TrampolineForwardTlvs, 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 TrampolineForwardTlvs_get_features(this_ptr: &TrampolineForwardTlvs) -> crate::lightning_types::features::BlindedHopFeatures { + let mut inner_val = &mut TrampolineForwardTlvs::get_native_mut_ref(this_ptr).features; + crate::lightning_types::features::BlindedHopFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::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 TrampolineForwardTlvs_set_features(this_ptr: &mut TrampolineForwardTlvs, mut val: crate::lightning_types::features::BlindedHopFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the +/// [`BlindedPaymentPath::blinding_point`] of the appended blinded path. +/// +/// 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 TrampolineForwardTlvs_get_next_blinding_override(this_ptr: &TrampolineForwardTlvs) -> crate::c_types::PublicKey { + let mut inner_val = &mut TrampolineForwardTlvs::get_native_mut_ref(this_ptr).next_blinding_override; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; + local_inner_val +} +/// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the +/// [`BlindedPaymentPath::blinding_point`] of the appended blinded path. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_set_next_blinding_override(this_ptr: &mut TrampolineForwardTlvs, mut val: crate::c_types::PublicKey) { + let mut local_val = if val.is_null() { None } else { Some( { val.into_rust() }) }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_blinding_override = local_val; +} +/// Constructs a new TrampolineForwardTlvs given each field +/// +/// Note that next_blinding_override_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +#[must_use] +#[no_mangle] +pub extern "C" fn TrampolineForwardTlvs_new(mut next_trampoline_arg: crate::c_types::PublicKey, 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_types::features::BlindedHopFeatures, mut next_blinding_override_arg: crate::c_types::PublicKey) -> TrampolineForwardTlvs { + let mut local_next_blinding_override_arg = if next_blinding_override_arg.is_null() { None } else { Some( { next_blinding_override_arg.into_rust() }) }; + TrampolineForwardTlvs { inner: ObjOps::heap_alloc(nativeTrampolineForwardTlvs { + next_trampoline: next_trampoline_arg.into_rust(), + 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()) }, + next_blinding_override: local_next_blinding_override_arg, + }), is_owned: true } +} +impl Clone for TrampolineForwardTlvs { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeTrampolineForwardTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 TrampolineForwardTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTrampolineForwardTlvs) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the TrampolineForwardTlvs +pub extern "C" fn TrampolineForwardTlvs_clone(orig: &TrampolineForwardTlvs) -> TrampolineForwardTlvs { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a TrampolineForwardTlvs object +pub extern "C" fn TrampolineForwardTlvs_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::TrampolineForwardTlvs }).into()} + use lightning::blinded_path::payment::ReceiveTlvs as nativeReceiveTlvsImport; pub(crate) type nativeReceiveTlvs = nativeReceiveTlvsImport; @@ -775,7 +957,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -783,12 +965,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReceiveTlvs)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReceiveTlvs) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ReceiveTlvs pub extern "C" fn ReceiveTlvs_clone(orig: &ReceiveTlvs) -> ReceiveTlvs { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ReceiveTlvs object pub extern "C" fn ReceiveTlvs_debug_str_void(o: *const c_void) -> Str { @@ -864,7 +1046,7 @@ impl UnauthenticatedReceiveTlvs { /// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. #[no_mangle] pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_secret(this_ptr: &UnauthenticatedReceiveTlvs) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_secret; + let mut inner_val = &mut UnauthenticatedReceiveTlvs::get_native_mut_ref(this_ptr).payment_secret; &inner_val.0 } /// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. @@ -875,7 +1057,7 @@ pub extern "C" fn UnauthenticatedReceiveTlvs_set_payment_secret(this_ptr: &mut U /// Constraints for the receiver of this payment. #[no_mangle] pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_constraints(this_ptr: &UnauthenticatedReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_constraints; + let mut inner_val = &mut UnauthenticatedReceiveTlvs::get_native_mut_ref(this_ptr).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. @@ -886,7 +1068,7 @@ pub extern "C" fn UnauthenticatedReceiveTlvs_set_payment_constraints(this_ptr: & /// Context for the receiver of this payment. #[no_mangle] pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_context(this_ptr: &UnauthenticatedReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentContext { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_context; + let mut inner_val = &mut UnauthenticatedReceiveTlvs::get_native_mut_ref(this_ptr).payment_context; crate::lightning::blinded_path::payment::PaymentContext::from_native(inner_val) } /// Context for the receiver of this payment. @@ -908,7 +1090,7 @@ impl Clone for UnauthenticatedReceiveTlvs { fn clone(&self) -> Self { Self { inner: if <*mut nativeUnauthenticatedReceiveTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -916,12 +1098,12 @@ impl Clone for UnauthenticatedReceiveTlvs { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnauthenticatedReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnauthenticatedReceiveTlvs)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnauthenticatedReceiveTlvs) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UnauthenticatedReceiveTlvs pub extern "C" fn UnauthenticatedReceiveTlvs_clone(orig: &UnauthenticatedReceiveTlvs) -> UnauthenticatedReceiveTlvs { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a UnauthenticatedReceiveTlvs object pub extern "C" fn UnauthenticatedReceiveTlvs_debug_str_void(o: *const c_void) -> Str { @@ -1000,7 +1182,7 @@ impl PaymentRelay { /// 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; + let mut inner_val = &mut PaymentRelay::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for this [`BlindedHop`]. @@ -1012,7 +1194,7 @@ pub extern "C" fn PaymentRelay_set_cltv_expiry_delta(this_ptr: &mut PaymentRelay /// 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; + let mut inner_val = &mut PaymentRelay::get_native_mut_ref(this_ptr).fee_proportional_millionths; *inner_val } /// Liquidity fee charged (in millionths of the amount transferred) for relaying a payment over @@ -1024,7 +1206,7 @@ pub extern "C" fn PaymentRelay_set_fee_proportional_millionths(this_ptr: &mut Pa /// 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; + let mut inner_val = &mut PaymentRelay::get_native_mut_ref(this_ptr).fee_base_msat; *inner_val } /// Base fee charged (in millisatoshi) for relaying a payment over this [`BlindedHop`]. @@ -1046,7 +1228,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1054,12 +1236,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentRelay)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePaymentRelay) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentRelay pub extern "C" fn PaymentRelay_clone(orig: &PaymentRelay) -> PaymentRelay { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PaymentRelay object pub extern "C" fn PaymentRelay_debug_str_void(o: *const c_void) -> Str { @@ -1129,7 +1311,7 @@ impl PaymentConstraints { /// The maximum total CLTV 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; + let mut inner_val = &mut PaymentConstraints::get_native_mut_ref(this_ptr).max_cltv_expiry; *inner_val } /// The maximum total CLTV that is acceptable when relaying a payment over this [`BlindedHop`]. @@ -1141,7 +1323,7 @@ pub extern "C" fn PaymentConstraints_set_max_cltv_expiry(this_ptr: &mut PaymentC /// [`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; + let mut inner_val = &mut PaymentConstraints::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum value, in msat, that may be accepted by the node corresponding to this @@ -1163,7 +1345,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1171,12 +1353,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentConstraints)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePaymentConstraints) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentConstraints pub extern "C" fn PaymentConstraints_clone(orig: &PaymentConstraints) -> PaymentConstraints { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PaymentConstraints object pub extern "C" fn PaymentConstraints_debug_str_void(o: *const c_void) -> Str { @@ -1194,6 +1376,11 @@ pub enum PaymentContext { /// [`Offer`]: crate::offers::offer::Offer Bolt12Offer( crate::lightning::blinded_path::payment::Bolt12OfferContext), + /// The payment was made for a static invoice requested from a BOLT 12 [`Offer`]. + /// + /// [`Offer`]: crate::offers::offer::Offer + AsyncBolt12Offer( + crate::lightning::blinded_path::payment::AsyncBolt12OfferContext), /// The payment was made for an invoice sent for a BOLT 12 [`Refund`]. /// /// [`Refund`]: crate::offers::refund::Refund @@ -1213,6 +1400,12 @@ impl PaymentContext { *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, + PaymentContext::AsyncBolt12Offer (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativePaymentContext::AsyncBolt12Offer ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, PaymentContext::Bolt12Refund (ref a, ) => { let mut a_nonref = Clone::clone(a); nativePaymentContext::Bolt12Refund ( @@ -1229,6 +1422,11 @@ impl PaymentContext { *unsafe { Box::from_raw(a.take_inner()) }, ) }, + PaymentContext::AsyncBolt12Offer (mut a, ) => { + nativePaymentContext::AsyncBolt12Offer ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, PaymentContext::Bolt12Refund (mut a, ) => { nativePaymentContext::Bolt12Refund ( *unsafe { Box::from_raw(a.take_inner()) }, @@ -1246,6 +1444,12 @@ impl PaymentContext { crate::lightning::blinded_path::payment::Bolt12OfferContext { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, + nativePaymentContext::AsyncBolt12Offer (ref a, ) => { + let mut a_nonref = Clone::clone(a); + PaymentContext::AsyncBolt12Offer ( + crate::lightning::blinded_path::payment::AsyncBolt12OfferContext { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, nativePaymentContext::Bolt12Refund (ref a, ) => { let mut a_nonref = Clone::clone(a); PaymentContext::Bolt12Refund ( @@ -1262,6 +1466,11 @@ impl PaymentContext { crate::lightning::blinded_path::payment::Bolt12OfferContext { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, + nativePaymentContext::AsyncBolt12Offer (mut a, ) => { + PaymentContext::AsyncBolt12Offer ( + crate::lightning::blinded_path::payment::AsyncBolt12OfferContext { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, nativePaymentContext::Bolt12Refund (mut a, ) => { PaymentContext::Bolt12Refund ( crate::lightning::blinded_path::payment::Bolt12RefundContext { inner: ObjOps::heap_alloc(a), is_owned: true }, @@ -1294,6 +1503,11 @@ pub extern "C" fn PaymentContext_bolt12_offer(a: crate::lightning::blinded_path: PaymentContext::Bolt12Offer(a, ) } #[no_mangle] +/// Utility method to constructs a new AsyncBolt12Offer-variant PaymentContext +pub extern "C" fn PaymentContext_async_bolt12_offer(a: crate::lightning::blinded_path::payment::AsyncBolt12OfferContext) -> PaymentContext { + PaymentContext::AsyncBolt12Offer(a, ) +} +#[no_mangle] /// Utility method to constructs a new Bolt12Refund-variant PaymentContext pub extern "C" fn PaymentContext_bolt12_refund(a: crate::lightning::blinded_path::payment::Bolt12RefundContext) -> PaymentContext { PaymentContext::Bolt12Refund(a, ) @@ -1374,7 +1588,7 @@ impl Bolt12OfferContext { /// [`Offer`]: crate::offers::offer::Offer #[no_mangle] pub extern "C" fn Bolt12OfferContext_get_offer_id(this_ptr: &Bolt12OfferContext) -> crate::lightning::offers::offer::OfferId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().offer_id; + let mut inner_val = &mut Bolt12OfferContext::get_native_mut_ref(this_ptr).offer_id; crate::lightning::offers::offer::OfferId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::offer::OfferId<>) as *mut _) }, is_owned: false } } /// The identifier of the [`Offer`]. @@ -1390,7 +1604,7 @@ pub extern "C" fn Bolt12OfferContext_set_offer_id(this_ptr: &mut Bolt12OfferCont /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice #[no_mangle] pub extern "C" fn Bolt12OfferContext_get_invoice_request(this_ptr: &Bolt12OfferContext) -> crate::lightning::offers::invoice_request::InvoiceRequestFields { - let mut inner_val = &mut this_ptr.get_native_mut_ref().invoice_request; + let mut inner_val = &mut Bolt12OfferContext::get_native_mut_ref(this_ptr).invoice_request; crate::lightning::offers::invoice_request::InvoiceRequestFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::invoice_request::InvoiceRequestFields<>) as *mut _) }, is_owned: false } } /// Fields from an [`InvoiceRequest`] sent for a [`Bolt12Invoice`]. @@ -1414,7 +1628,7 @@ impl Clone for Bolt12OfferContext { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt12OfferContext>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1422,12 +1636,12 @@ impl Clone for Bolt12OfferContext { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt12OfferContext_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12OfferContext)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt12OfferContext) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt12OfferContext pub extern "C" fn Bolt12OfferContext_clone(orig: &Bolt12OfferContext) -> Bolt12OfferContext { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Bolt12OfferContext object pub extern "C" fn Bolt12OfferContext_debug_str_void(o: *const c_void) -> Str { @@ -1442,6 +1656,124 @@ pub extern "C" fn Bolt12OfferContext_eq(a: &Bolt12OfferContext, b: &Bolt12OfferC if a.get_native_ref() == b.get_native_ref() { true } else { false } } +use lightning::blinded_path::payment::AsyncBolt12OfferContext as nativeAsyncBolt12OfferContextImport; +pub(crate) type nativeAsyncBolt12OfferContext = nativeAsyncBolt12OfferContextImport; + +/// The context of a payment made for a static invoice requested from a BOLT 12 [`Offer`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +#[must_use] +#[repr(C)] +pub struct AsyncBolt12OfferContext { + /// 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 nativeAsyncBolt12OfferContext, + /// 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 core::ops::Deref for AsyncBolt12OfferContext { + type Target = nativeAsyncBolt12OfferContext; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for AsyncBolt12OfferContext { } +unsafe impl core::marker::Sync for AsyncBolt12OfferContext { } +impl Drop for AsyncBolt12OfferContext { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeAsyncBolt12OfferContext>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the AsyncBolt12OfferContext, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn AsyncBolt12OfferContext_free(this_obj: AsyncBolt12OfferContext) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AsyncBolt12OfferContext_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAsyncBolt12OfferContext) }; +} +#[allow(unused)] +impl AsyncBolt12OfferContext { + pub(crate) fn get_native_ref(&self) -> &'static nativeAsyncBolt12OfferContext { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAsyncBolt12OfferContext { + 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 nativeAsyncBolt12OfferContext { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The [`Nonce`] used to verify that an inbound [`InvoiceRequest`] corresponds to this static +/// invoice's offer. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +#[no_mangle] +pub extern "C" fn AsyncBolt12OfferContext_get_offer_nonce(this_ptr: &AsyncBolt12OfferContext) -> crate::lightning::offers::nonce::Nonce { + let mut inner_val = &mut AsyncBolt12OfferContext::get_native_mut_ref(this_ptr).offer_nonce; + crate::lightning::offers::nonce::Nonce { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::nonce::Nonce<>) as *mut _) }, is_owned: false } +} +/// The [`Nonce`] used to verify that an inbound [`InvoiceRequest`] corresponds to this static +/// invoice's offer. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +#[no_mangle] +pub extern "C" fn AsyncBolt12OfferContext_set_offer_nonce(this_ptr: &mut AsyncBolt12OfferContext, mut val: crate::lightning::offers::nonce::Nonce) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.offer_nonce = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new AsyncBolt12OfferContext given each field +#[must_use] +#[no_mangle] +pub extern "C" fn AsyncBolt12OfferContext_new(mut offer_nonce_arg: crate::lightning::offers::nonce::Nonce) -> AsyncBolt12OfferContext { + AsyncBolt12OfferContext { inner: ObjOps::heap_alloc(nativeAsyncBolt12OfferContext { + offer_nonce: *unsafe { Box::from_raw(offer_nonce_arg.take_inner()) }, + }), is_owned: true } +} +impl Clone for AsyncBolt12OfferContext { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeAsyncBolt12OfferContext>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 AsyncBolt12OfferContext_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAsyncBolt12OfferContext) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the AsyncBolt12OfferContext +pub extern "C" fn AsyncBolt12OfferContext_clone(orig: &AsyncBolt12OfferContext) -> AsyncBolt12OfferContext { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a AsyncBolt12OfferContext object +pub extern "C" fn AsyncBolt12OfferContext_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::AsyncBolt12OfferContext }).into()} +/// Checks if two AsyncBolt12OfferContexts 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 AsyncBolt12OfferContext_eq(a: &AsyncBolt12OfferContext, b: &AsyncBolt12OfferContext) -> 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 } +} + use lightning::blinded_path::payment::Bolt12RefundContext as nativeBolt12RefundContextImport; pub(crate) type nativeBolt12RefundContext = nativeBolt12RefundContextImport; @@ -1514,7 +1846,7 @@ impl Clone for Bolt12RefundContext { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt12RefundContext>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1522,12 +1854,12 @@ impl Clone for Bolt12RefundContext { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt12RefundContext_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12RefundContext)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt12RefundContext) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt12RefundContext pub extern "C" fn Bolt12RefundContext_clone(orig: &Bolt12RefundContext) -> Bolt12RefundContext { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Bolt12RefundContext object pub extern "C" fn Bolt12RefundContext_debug_str_void(o: *const c_void) -> Str { @@ -1551,6 +1883,15 @@ pub(crate) extern "C" fn ForwardTlvs_write_void(obj: *const c_void) -> crate::c_ crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeForwardTlvs) }) } #[no_mangle] +/// Serialize the TrampolineForwardTlvs object into a byte array which can be read by TrampolineForwardTlvs_read +pub extern "C" fn TrampolineForwardTlvs_write(obj: &crate::lightning::blinded_path::payment::TrampolineForwardTlvs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn TrampolineForwardTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeTrampolineForwardTlvs) }) +} +#[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()) @@ -1633,6 +1974,22 @@ pub extern "C" fn Bolt12OfferContext_read(ser: crate::c_types::u8slice) -> crate local_res } #[no_mangle] +/// Serialize the AsyncBolt12OfferContext object into a byte array which can be read by AsyncBolt12OfferContext_read +pub extern "C" fn AsyncBolt12OfferContext_write(obj: &crate::lightning::blinded_path::payment::AsyncBolt12OfferContext) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn AsyncBolt12OfferContext_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeAsyncBolt12OfferContext) }) +} +#[no_mangle] +/// Read a AsyncBolt12OfferContext from a byte array, created by AsyncBolt12OfferContext_write +pub extern "C" fn AsyncBolt12OfferContext_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AsyncBolt12OfferContextDecodeErrorZ { + 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::AsyncBolt12OfferContext { 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 Bolt12RefundContext object into a byte array which can be read by Bolt12RefundContext_read pub extern "C" fn Bolt12RefundContext_write(obj: &crate::lightning::blinded_path::payment::Bolt12RefundContext) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index 2f86326d..e2a3df95 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -34,13 +34,20 @@ pub struct BroadcasterInterface { /// In some cases LDK may attempt to broadcast a transaction which double-spends another /// and this isn't a bug and can be safely ignored. /// - /// If more than one transaction is given, these transactions should be considered to be a - /// package and broadcast together. Some of the transactions may or may not depend on each other, - /// be sure to manage both cases correctly. + /// If more than one transaction is given, these transactions MUST be a + /// single child and its parents and be broadcast together as a package + /// (see the [`submitpackage`](https://bitcoincore.org/en/doc/30.0.0/rpc/rawtransactions/submitpackage) + /// Bitcoin Core RPC). + /// + /// Implementations MUST NOT assume any topological order on the transactions. /// /// Bitcoin transaction packages are defined in BIP 331 and here: /// pub broadcast_transactions: extern "C" fn (this_arg: *const c_void, txs: crate::c_types::derived::CVec_TransactionZ), + /// Called, if set, after this BroadcasterInterface has been cloned into a duplicate object. + /// The new BroadcasterInterface 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, @@ -52,9 +59,27 @@ pub(crate) fn BroadcasterInterface_clone_fields(orig: &BroadcasterInterface) -> BroadcasterInterface { this_arg: orig.this_arg, broadcast_transactions: Clone::clone(&orig.broadcast_transactions), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } +#[no_mangle] +/// Creates a copy of a BroadcasterInterface +pub extern "C" fn BroadcasterInterface_clone(orig: &BroadcasterInterface) -> BroadcasterInterface { + let mut res = BroadcasterInterface_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for BroadcasterInterface { + fn clone(&self) -> Self { + BroadcasterInterface_clone(self) + } +} +impl Clone for BroadcasterInterfaceRef { + fn clone(&self) -> Self { + Self(BroadcasterInterface_clone(&self.0)) + } +} use lightning::chain::chaininterface::BroadcasterInterface as rustBroadcasterInterface; impl rustBroadcasterInterface for BroadcasterInterface { @@ -101,11 +126,14 @@ impl Drop for BroadcasterInterface { #[must_use] #[repr(C)] pub enum ConfirmationTarget { - /// The most aggressive (i.e. highest) feerate estimate available. + /// The most aggressive feerate estimate which we think is reasonable. /// /// This is used to sanity-check our counterparty's feerates and should be as conservative as /// possible to ensure that we don't confuse a peer using a very conservative estimator for one - /// trying to burn channel balance to dust. + /// trying to burn channel balance to dust. To ensure that this is never lower than an honest + /// counterparty's feerate estimate you may wish to use a value which is higher than your + /// maximum feerate estimate, for example by adding a constant few-hundred or few-thousand + /// sats-per-kW. MaximumFeeEstimate, /// We have some funds available on chain which we need to spend prior to some expiry time at /// which point our counterparty may be able to steal them. @@ -408,7 +436,7 @@ impl Drop for FeeEstimator { /// Minimum relay fee as required by bitcoin network mempool policy. #[no_mangle] -pub static MIN_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = lightning::chain::chaininterface::MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +pub static INCREMENTAL_RELAY_FEE_SAT_PER_1000_WEIGHT: u64 = lightning::chain::chaininterface::INCREMENTAL_RELAY_FEE_SAT_PER_1000_WEIGHT; /// Minimum feerate that takes a sane approach to bitcoind weight-to-vbytes rounding. /// See the following Core Lightning commit for an explanation: /// diff --git a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs index 513b080b..49e62841 100644 --- a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs @@ -92,11 +92,13 @@ pub struct Persist { /// This has no meaning in the LDK, and can be NULL or any other value. pub this_arg: *mut c_void, /// 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. + /// called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup, + /// with the `monitor_name` returned by [`ChannelMonitor::persistence_key`]. /// - /// 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 data can be stored any way you want, so long as `monitor_name` is used to maintain a + /// correct mapping with the stored channel data (i.e., calls to `update_persisted_channel` with + /// the same `monitor_name` must be applied to or overwrite this data). Note that you **must** + /// persist every new monitor to disk. /// /// The [`ChannelMonitor::get_latest_update_id`] uniquely links this call to [`ChainMonitor::channel_monitor_updated`]. /// For [`Persist::persist_new_channel`], it is only necessary to call [`ChainMonitor::channel_monitor_updated`] @@ -107,7 +109,7 @@ pub struct Persist { /// /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager /// [`Writeable::write`]: crate::util::ser::Writeable::write - pub persist_new_channel: extern "C" fn (this_arg: *const c_void, channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus, + pub persist_new_channel: extern "C" fn (this_arg: *const c_void, monitor_name: crate::lightning::util::persist::MonitorName, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus, /// Update one channel's data. The provided [`ChannelMonitor`] has already applied the given /// update. /// @@ -147,7 +149,7 @@ pub struct Persist { /// [`Writeable::write`]: crate::util::ser::Writeable::write /// /// Note that monitor_update (or a relevant inner pointer) may be NULL or all-0s to represent None - pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint, monitor_update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus, + pub update_persisted_channel: extern "C" fn (this_arg: *const c_void, monitor_name: crate::lightning::util::persist::MonitorName, monitor_update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus, /// Prevents the channel monitor from being loaded on startup. /// /// Archiving the data in a backup location (rather than deleting it fully) is useful for @@ -159,7 +161,14 @@ pub struct Persist { /// the archive process. Additionally, because the archive operation could be retried on /// restart, this method must in that case be idempotent, ensuring it can handle scenarios where /// the monitor already exists in the archive. - pub archive_persisted_channel: extern "C" fn (this_arg: *const c_void, channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint), + pub archive_persisted_channel: extern "C" fn (this_arg: *const c_void, monitor_name: crate::lightning::util::persist::MonitorName), + /// Fetches the set of [`ChannelMonitorUpdate`]s, previously persisted with + /// [`Self::update_persisted_channel`], which have completed. + /// + /// Returning an update here is equivalent to calling + /// [`ChainMonitor::channel_monitor_updated`]. Because of this, this method is defaulted and + /// hidden in the docs. + pub get_and_clear_completed_updates: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_ChannelIdu64ZZ, /// 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, @@ -173,39 +182,50 @@ pub(crate) fn Persist_clone_fields(orig: &Persist) -> Persist { persist_new_channel: Clone::clone(&orig.persist_new_channel), update_persisted_channel: Clone::clone(&orig.update_persisted_channel), archive_persisted_channel: Clone::clone(&orig.archive_persisted_channel), + get_and_clear_completed_updates: Clone::clone(&orig.get_and_clear_completed_updates), free: Clone::clone(&orig.free), } } use lightning::chain::chainmonitor::Persist as rustPersist; impl rustPersist for Persist { - fn persist_new_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { - let mut ret = (self.persist_new_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); + fn persist_new_channel(&self, mut monitor_name: lightning::util::persist::MonitorName, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = (self.persist_new_channel)(self.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name), &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); ret.into_native() } - fn update_persisted_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint, mut monitor_update: Option<&lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { + fn update_persisted_channel(&self, mut monitor_name: lightning::util::persist::MonitorName, mut monitor_update: Option<&lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { let mut local_monitor_update = crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { (if monitor_update.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (monitor_update.unwrap()) }) } as *const lightning::chain::channelmonitor::ChannelMonitorUpdate<>) as *mut _ }, is_owned: false }; - let mut ret = (self.update_persisted_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }, local_monitor_update, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); + let mut ret = (self.update_persisted_channel)(self.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name), local_monitor_update, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); ret.into_native() } - fn archive_persisted_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint) { - (self.archive_persisted_channel)(self.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }) + fn archive_persisted_channel(&self, mut monitor_name: lightning::util::persist::MonitorName) { + (self.archive_persisted_channel)(self.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name)) + } + fn get_and_clear_completed_updates(&self) -> Vec<(lightning::ln::types::ChannelId, u64)> { + let mut ret = (self.get_and_clear_completed_updates)(self.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item.to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, orig_ret_0_1); local_ret_0 }); }; + local_ret } } pub struct PersistRef(Persist); impl rustPersist for PersistRef { - fn persist_new_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { - let mut ret = (self.0.persist_new_channel)(self.0.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); + fn persist_new_channel(&self, mut monitor_name: lightning::util::persist::MonitorName, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = (self.0.persist_new_channel)(self.0.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name), &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); ret.into_native() } - fn update_persisted_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint, mut monitor_update: Option<&lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { + fn update_persisted_channel(&self, mut monitor_name: lightning::util::persist::MonitorName, mut monitor_update: Option<&lightning::chain::channelmonitor::ChannelMonitorUpdate>, mut monitor: &lightning::chain::channelmonitor::ChannelMonitor) -> lightning::chain::ChannelMonitorUpdateStatus { let mut local_monitor_update = crate::lightning::chain::channelmonitor::ChannelMonitorUpdate { inner: unsafe { (if monitor_update.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (monitor_update.unwrap()) }) } as *const lightning::chain::channelmonitor::ChannelMonitorUpdate<>) as *mut _ }, is_owned: false }; - let mut ret = (self.0.update_persisted_channel)(self.0.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }, local_monitor_update, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); + let mut ret = (self.0.update_persisted_channel)(self.0.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name), local_monitor_update, &crate::lightning::chain::channelmonitor::ChannelMonitor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((monitor as *const lightning::chain::channelmonitor::ChannelMonitor<_, >) as *mut _) }, is_owned: false }); ret.into_native() } - fn archive_persisted_channel(&self, mut channel_funding_outpoint: lightning::chain::transaction::OutPoint) { - (self.0.archive_persisted_channel)(self.0.this_arg, crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(channel_funding_outpoint), is_owned: true }) + fn archive_persisted_channel(&self, mut monitor_name: lightning::util::persist::MonitorName) { + (self.0.archive_persisted_channel)(self.0.this_arg, crate::lightning::util::persist::MonitorName::native_into(monitor_name)) + } + fn get_and_clear_completed_updates(&self) -> Vec<(lightning::ln::types::ChannelId, u64)> { + let mut ret = (self.0.get_and_clear_completed_updates)(self.0.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item.to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, orig_ret_0_1); local_ret_0 }); }; + local_ret } } @@ -297,7 +317,7 @@ impl LockedChannelMonitor { } use lightning::chain::chainmonitor::ChainMonitor as nativeChainMonitorImport; -pub(crate) type nativeChainMonitor = nativeChainMonitorImport; +pub(crate) type nativeChainMonitor = nativeChainMonitorImport; /// An implementation of [`chain::Watch`] for monitoring channels. /// @@ -377,11 +397,23 @@ impl ChainMonitor { /// pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may /// always need to fetch full blocks absent another means for determining which blocks contain /// transactions relevant to the watched channels. +/// +/// # Note +/// `our_peerstorage_encryption_key` must be obtained from [`NodeSigner::get_peer_storage_key`]. +/// This key is used to encrypt peer storage backups. +/// +/// **Important**: This key should not be set arbitrarily or changed after initialization. The same key +/// is obtained by the [`ChannelManager`] through [`NodeSigner`] to decrypt peer backups. +/// Using an inconsistent or incorrect key will result in the inability to decrypt previously encrypted backups. +/// +/// [`NodeSigner`]: crate::sign::NodeSigner +/// [`NodeSigner::get_peer_storage_key`]: crate::sign::NodeSigner::get_peer_storage_key +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_new(mut chain_source: crate::c_types::derived::COption_FilterZ, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut feeest: crate::lightning::chain::chaininterface::FeeEstimator, mut persister: crate::lightning::chain::chainmonitor::Persist) -> crate::lightning::chain::chainmonitor::ChainMonitor { +pub extern "C" fn ChainMonitor_new(mut chain_source: crate::c_types::derived::COption_FilterZ, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut logger: crate::lightning::util::logger::Logger, mut feeest: crate::lightning::chain::chaininterface::FeeEstimator, mut persister: crate::lightning::chain::chainmonitor::Persist, mut _entropy_source: crate::lightning::sign::EntropySource, mut _our_peerstorage_encryption_key: crate::lightning::sign::PeerStorageKey) -> crate::lightning::chain::chainmonitor::ChainMonitor { let mut local_chain_source = { /*chain_source*/ let chain_source_opt = chain_source; if chain_source_opt.is_none() { None } else { Some({ { { chain_source_opt.take() } }})} }; - let mut ret = lightning::chain::chainmonitor::ChainMonitor::new(local_chain_source, broadcaster, logger, feeest, persister); + let mut ret = lightning::chain::chainmonitor::ChainMonitor::new(local_chain_source, broadcaster, logger, feeest, persister, _entropy_source, *unsafe { Box::from_raw(_our_peerstorage_encryption_key.take_inner()) }); crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -409,8 +441,8 @@ pub extern "C" fn ChainMonitor_get_claimable_balances(this_arg: &crate::lightnin /// indefinitely. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_get_monitor(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint) -> crate::c_types::derived::CResult_LockedChannelMonitorNoneZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_monitor(*unsafe { Box::from_raw(funding_txo.take_inner()) }); +pub extern "C" fn ChainMonitor_get_monitor(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut channel_id: crate::lightning::ln::types::ChannelId) -> crate::c_types::derived::CResult_LockedChannelMonitorNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_monitor(*unsafe { Box::from_raw(channel_id.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::chainmonitor::LockedChannelMonitor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -421,21 +453,21 @@ pub extern "C" fn ChainMonitor_get_monitor(this_arg: &crate::lightning::chain::c /// monitoring for on-chain state resolutions. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_list_monitors(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_C2Tuple_OutPointChannelIdZZ { +pub extern "C" fn ChainMonitor_list_monitors(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_ChannelIdZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_monitors(); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() } -/// Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). +/// Lists the pending updates for each [`ChannelMonitor`] (by `ChannelId` being monitored). /// Each `Vec` contains `update_id`s from [`ChannelMonitor::get_latest_update_id`] for updates /// that have not yet been fully persisted. Note that if a full monitor is persisted all the pending /// monitor updates must be individually marked completed by calling [`ChainMonitor::channel_monitor_updated`]. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_list_pending_monitor_updates(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_C2Tuple_OutPointCVec_u64ZZZ { +pub extern "C" fn ChainMonitor_list_pending_monitor_updates(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_C2Tuple_ChannelIdCVec_u64ZZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_pending_monitor_updates(); - 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 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1.into()).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 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { item }); }; let mut local_ret_0 = (crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; local_ret.into() } @@ -461,8 +493,8 @@ pub extern "C" fn ChainMonitor_list_pending_monitor_updates(this_arg: &crate::li /// registered [`ChannelMonitor`]s. #[must_use] #[no_mangle] -pub extern "C" fn ChainMonitor_channel_monitor_updated(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut funding_txo: crate::lightning::chain::transaction::OutPoint, mut completed_update_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_monitor_updated(*unsafe { Box::from_raw(funding_txo.take_inner()) }, completed_update_id); +pub extern "C" fn ChainMonitor_channel_monitor_updated(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut channel_id: crate::lightning::ln::types::ChannelId, mut completed_update_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_monitor_updated(*unsafe { Box::from_raw(channel_id.take_inner()) }, completed_update_id); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -499,7 +531,7 @@ pub extern "C" fn ChainMonitor_rebroadcast_pending_claims(this_arg: &crate::ligh /// /// Note that monitor_opt (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn ChainMonitor_signer_unblocked(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut monitor_opt: crate::lightning::chain::transaction::OutPoint) { +pub extern "C" fn ChainMonitor_signer_unblocked(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut monitor_opt: crate::lightning::ln::types::ChannelId) { let mut local_monitor_opt = if monitor_opt.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(monitor_opt.take_inner()) } }) }; unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signer_unblocked(local_monitor_opt) } @@ -518,6 +550,113 @@ pub extern "C" fn ChainMonitor_archive_fully_resolved_channel_monitors(this_arg: unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.archive_fully_resolved_channel_monitors() } +/// Loads a [`ChannelMonitor`] which already exists on disk after startup. +/// +/// Using this over [`chain::Watch::watch_channel`] avoids re-persisting a [`ChannelMonitor`] +/// that hasn't changed, slowing down startup. +/// +/// Note that this method *can* be used if additional blocks were replayed against the +/// [`ChannelMonitor`] or if a [`ChannelMonitorUpdate`] loaded from disk was replayed such that +/// it will replayed on startup, and in general can only *not* be used if you directly accessed +/// the [`ChannelMonitor`] and changed its state in some way that will not be replayed again on +/// a restart. Such direct access should generally never occur for most LDK-based nodes. +/// +/// For [`ChannelMonitor`]s which were last serialized by an LDK version prior to 0.1 this will +/// fall back to calling [`chain::Watch::watch_channel`] and persisting the [`ChannelMonitor`]. +/// See the release notes for LDK 0.1 for more information on this requirement. +/// +/// [`ChannelMonitor`]s which do not need to be persisted (i.e. were last written by LDK 0.1 or +/// later) will be loaded without persistence and this method will return +/// [`ChannelMonitorUpdateStatus::Completed`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChainMonitor_load_existing_monitor(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor, mut channel_id: crate::lightning::ln::types::ChannelId, mut monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_ChannelMonitorUpdateStatusNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.load_existing_monitor(*unsafe { Box::from_raw(channel_id.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) }); + 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 +} + +impl From for crate::lightning::ln::msgs::BaseMessageHandler { + fn from(obj: nativeChainMonitor) -> Self { + let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ChainMonitor_as_BaseMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(ChainMonitor_free_void); + ret + } +} +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ChainMonitor_as_BaseMessageHandler(this_arg: &ChainMonitor) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: ChainMonitor_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ChainMonitor_BaseMessageHandler_peer_disconnected, + provided_node_features: ChainMonitor_BaseMessageHandler_provided_node_features, + provided_init_features: ChainMonitor_BaseMessageHandler_provided_init_features, + peer_connected: ChainMonitor_BaseMessageHandler_peer_connected, + } +} + +#[must_use] +extern "C" fn ChainMonitor_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; + local_ret.into() +} +extern "C" fn ChainMonitor_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn ChainMonitor_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ChainMonitor_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ChainMonitor_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} + +impl From for crate::lightning::ln::msgs::SendOnlyMessageHandler { + fn from(obj: nativeChainMonitor) -> Self { + let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ChainMonitor_as_SendOnlyMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(ChainMonitor_free_void); + ret + } +} +/// Constructs a new SendOnlyMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned SendOnlyMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ChainMonitor_as_SendOnlyMessageHandler(this_arg: &ChainMonitor) -> crate::lightning::ln::msgs::SendOnlyMessageHandler { + crate::lightning::ln::msgs::SendOnlyMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: ChainMonitor_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ChainMonitor_BaseMessageHandler_peer_disconnected, + provided_node_features: ChainMonitor_BaseMessageHandler_provided_node_features, + provided_init_features: ChainMonitor_BaseMessageHandler_provided_init_features, + peer_connected: ChainMonitor_BaseMessageHandler_peer_connected, + }, + } +} + + impl From for crate::lightning::chain::Listen { fn from(obj: nativeChainMonitor) -> Self { let rust_obj = crate::lightning::chain::chainmonitor::ChainMonitor { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -537,7 +676,7 @@ pub extern "C" fn ChainMonitor_as_Listen(this_arg: &ChainMonitor) -> crate::ligh free: None, filtered_block_connected: ChainMonitor_Listen_filtered_block_connected, block_connected: ChainMonitor_Listen_block_connected, - block_disconnected: ChainMonitor_Listen_block_disconnected, + blocks_disconnected: ChainMonitor_Listen_blocks_disconnected, } } @@ -548,8 +687,8 @@ extern "C" fn ChainMonitor_Listen_filtered_block_connected(this_arg: *const c_vo extern "C" fn ChainMonitor_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) { ::block_connected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height) } -extern "C" fn ChainMonitor_Listen_block_disconnected(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) { - ::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) +extern "C" fn ChainMonitor_Listen_blocks_disconnected(this_arg: *const c_void, mut fork_point_block: crate::lightning::chain::BestBlock) { + ::blocks_disconnected(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(fork_point_block.take_inner()) }) } impl From for crate::lightning::chain::Confirm { @@ -617,20 +756,20 @@ 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::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()) }); +extern "C" fn ChainMonitor_Watch_watch_channel(this_arg: *const c_void, mut channel_id: crate::lightning::ln::types::ChannelId, 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(channel_id.take_inner()) }, *unsafe { Box::from_raw(monitor.take_inner()) }); 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 { - let mut ret = >::update_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(funding_txo.take_inner()) }, update.get_native_ref()); +extern "C" fn ChainMonitor_Watch_update_channel(this_arg: *const c_void, mut channel_id: crate::lightning::ln::types::ChannelId, update: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = >::update_channel(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, *unsafe { Box::from_raw(channel_id.take_inner()) }, update.get_native_ref()); crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) } #[must_use] extern "C" fn ChainMonitor_Watch_release_pending_monitor_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { let mut ret = >::release_pending_monitor_events(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, mut orig_ret_0_2, mut orig_ret_0_3) = item; let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.drain(..) { local_orig_ret_0_2.push( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); }; let mut local_orig_ret_0_3 = if orig_ret_0_3.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(orig_ret_0_3.unwrap())) } }; let mut local_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }, local_orig_ret_0_2.into(), local_orig_ret_0_3).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, mut orig_ret_0_2, mut orig_ret_0_3) = item; let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.drain(..) { local_orig_ret_0_2.push( { crate::lightning::chain::channelmonitor::MonitorEvent::native_into(item) }); }; let mut local_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }, local_orig_ret_0_2.into(), crate::c_types::PublicKey::from_rust(&orig_ret_0_3)).into(); local_ret_0 }); }; local_ret.into() } diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index 63bbcaf8..ec6f8ece 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -109,7 +109,7 @@ impl ChannelMonitorUpdate { /// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress #[no_mangle] pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUpdate) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_id; + let mut inner_val = &mut ChannelMonitorUpdate::get_native_mut_ref(this_ptr).update_id; *inner_val } /// The sequence number of this update. Updates *must* be replayed in-order according to this @@ -137,7 +137,7 @@ pub extern "C" fn ChannelMonitorUpdate_set_update_id(this_ptr: &mut ChannelMonit /// 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 ChannelMonitorUpdate_get_channel_id(this_ptr: &ChannelMonitorUpdate) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ChannelMonitorUpdate::get_native_mut_ref(this_ptr).channel_id; let mut local_inner_val = crate::lightning::ln::types::ChannelId { 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::types::ChannelId<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -156,7 +156,7 @@ impl Clone for ChannelMonitorUpdate { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelMonitorUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -164,12 +164,12 @@ impl Clone for ChannelMonitorUpdate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelMonitorUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelMonitorUpdate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelMonitorUpdate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelMonitorUpdate pub extern "C" fn ChannelMonitorUpdate_clone(orig: &ChannelMonitorUpdate) -> ChannelMonitorUpdate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelMonitorUpdate object pub extern "C" fn ChannelMonitorUpdate_debug_str_void(o: *const c_void) -> Str { @@ -183,6 +183,16 @@ pub extern "C" fn ChannelMonitorUpdate_eq(a: &ChannelMonitorUpdate, b: &ChannelM if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +/// Returns a `Vec` of new (funding outpoint, funding script) to monitor the chain for as a +/// result of a renegotiated funding transaction. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitorUpdate_renegotiated_funding_data(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_C2Tuple_OutPointCVec_u8ZZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.renegotiated_funding_data(); + 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_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, orig_ret_0_1.to_bytes().into()).into(); local_ret_0 }); }; + local_ret.into() +} + #[no_mangle] /// Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read pub extern "C" fn ChannelMonitorUpdate_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { @@ -221,6 +231,9 @@ pub enum MonitorEvent { /// channel. HolderForceClosed( crate::lightning::chain::transaction::OutPoint), + /// Indicates that we've detected a commitment transaction (either holder's or counterparty's) + /// be included in a block and should consider the channel closed. + CommitmentTxConfirmed, /// Indicates a [`ChannelMonitor`] update has completed. See /// [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. /// @@ -267,6 +280,11 @@ impl MonitorEvent { *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, + MonitorEvent::CommitmentTxConfirmed => { + nativeMonitorEvent::CommitmentTxConfirmed ( + () /*a_nonref*/, + ) + }, MonitorEvent::Completed {ref funding_txo, ref channel_id, ref monitor_update_id, } => { let mut funding_txo_nonref = Clone::clone(funding_txo); let mut channel_id_nonref = Clone::clone(channel_id); @@ -299,6 +317,11 @@ impl MonitorEvent { *unsafe { Box::from_raw(a.take_inner()) }, ) }, + MonitorEvent::CommitmentTxConfirmed => { + nativeMonitorEvent::CommitmentTxConfirmed ( + () /*a*/, + ) + }, MonitorEvent::Completed {mut funding_txo, mut channel_id, mut monitor_update_id, } => { nativeMonitorEvent::Completed { funding_txo: *unsafe { Box::from_raw(funding_txo.take_inner()) }, @@ -334,6 +357,8 @@ impl MonitorEvent { crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, + nativeMonitorEvent::CommitmentTxConfirmed (ref a, ) => { + MonitorEvent::CommitmentTxConfirmed }, nativeMonitorEvent::Completed {ref funding_txo, ref channel_id, ref monitor_update_id, } => { let mut funding_txo_nonref = Clone::clone(funding_txo); let mut channel_id_nonref = Clone::clone(channel_id); @@ -366,6 +391,8 @@ impl MonitorEvent { crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, + nativeMonitorEvent::CommitmentTxConfirmed (mut a, ) => { + MonitorEvent::CommitmentTxConfirmed }, nativeMonitorEvent::Completed {mut funding_txo, mut channel_id, mut monitor_update_id, } => { MonitorEvent::Completed { funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo), is_owned: true }, @@ -414,6 +441,11 @@ pub extern "C" fn MonitorEvent_holder_force_closed(a: crate::lightning::chain::t MonitorEvent::HolderForceClosed(a, ) } #[no_mangle] +/// Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent +pub extern "C" fn MonitorEvent_commitment_tx_confirmed() -> MonitorEvent { + MonitorEvent::CommitmentTxConfirmed +} +#[no_mangle] /// Utility method to constructs a new Completed-variant MonitorEvent pub extern "C" fn MonitorEvent_completed(funding_txo: crate::lightning::chain::transaction::OutPoint, channel_id: crate::lightning::ln::types::ChannelId, monitor_update_id: u64) -> MonitorEvent { MonitorEvent::Completed { @@ -510,7 +542,7 @@ impl Clone for HTLCUpdate { fn clone(&self) -> Self { Self { inner: if <*mut nativeHTLCUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -518,12 +550,12 @@ impl Clone for HTLCUpdate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HTLCUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCUpdate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHTLCUpdate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HTLCUpdate pub extern "C" fn HTLCUpdate_clone(orig: &HTLCUpdate) -> HTLCUpdate { - orig.clone() + Clone::clone(orig) } /// Checks if two HTLCUpdates contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -565,6 +597,25 @@ pub static ANTI_REORG_DELAY: u32 = lightning::chain::channelmonitor::ANTI_REORG_ #[no_mangle] pub static ARCHIVAL_DELAY_BLOCKS: u32 = lightning::chain::channelmonitor::ARCHIVAL_DELAY_BLOCKS; +/// Number of blocks before confirmation at which we fail back an un-relayed HTLC or at which we +/// refuse to accept a new HTLC. +/// +/// This is used for a few separate purposes: +/// 1) if we've received an MPP HTLC to us and it expires within this many blocks and we are +/// waiting on additional parts (or waiting on the preimage for any HTLC from the user), we will +/// fail this HTLC, +/// 2) if we receive an HTLC within this many blocks of its expiry (plus one to avoid a race +/// condition with the above), we will fail this HTLC without telling the user we received it, +/// +/// (1) is all about protecting us - we need enough time to update the channel state before we hit +/// CLTV_CLAIM_BUFFER, at which point we'd go on chain to claim the HTLC with the preimage. +/// +/// (2) is the same, but with an additional buffer to avoid accepting an HTLC which is immediately +/// in a race condition between the user connecting a block (which would fail it) and the user +/// providing us the preimage (which would claim it). + +#[no_mangle] +pub static HTLC_FAIL_BACK_BUFFER: u32 = lightning::chain::channelmonitor::HTLC_FAIL_BACK_BUFFER; /// Indicates whether the balance is derived from a cooperative close, a force-close /// (for holder or counterparty), or whether it is for an HTLC. #[derive(Clone)] @@ -662,6 +713,144 @@ pub extern "C" fn BalanceSource_debug_str_void(o: *const c_void) -> Str { pub extern "C" fn BalanceSource_eq(a: &BalanceSource, b: &BalanceSource) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } + +use lightning::chain::channelmonitor::HolderCommitmentTransactionBalance as nativeHolderCommitmentTransactionBalanceImport; +pub(crate) type nativeHolderCommitmentTransactionBalance = nativeHolderCommitmentTransactionBalanceImport; + +/// The claimable balance of a holder commitment transaction that has yet to be broadcast. +#[must_use] +#[repr(C)] +pub struct HolderCommitmentTransactionBalance { + /// 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 nativeHolderCommitmentTransactionBalance, + /// 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 core::ops::Deref for HolderCommitmentTransactionBalance { + type Target = nativeHolderCommitmentTransactionBalance; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for HolderCommitmentTransactionBalance { } +unsafe impl core::marker::Sync for HolderCommitmentTransactionBalance { } +impl Drop for HolderCommitmentTransactionBalance { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeHolderCommitmentTransactionBalance>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the HolderCommitmentTransactionBalance, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_free(this_obj: HolderCommitmentTransactionBalance) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HolderCommitmentTransactionBalance_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHolderCommitmentTransactionBalance) }; +} +#[allow(unused)] +impl HolderCommitmentTransactionBalance { + pub(crate) fn get_native_ref(&self) -> &'static nativeHolderCommitmentTransactionBalance { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeHolderCommitmentTransactionBalance { + 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 nativeHolderCommitmentTransactionBalance { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The amount available to claim, in satoshis, excluding the on-chain fees which will be +/// required to do so. +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_get_amount_satoshis(this_ptr: &HolderCommitmentTransactionBalance) -> u64 { + let mut inner_val = &mut HolderCommitmentTransactionBalance::get_native_mut_ref(this_ptr).amount_satoshis; + *inner_val +} +/// The amount available to claim, in satoshis, excluding the on-chain fees which will be +/// required to do so. +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_set_amount_satoshis(this_ptr: &mut HolderCommitmentTransactionBalance, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_satoshis = val; +} +/// The transaction fee we pay for the closing commitment transaction. This amount is not +/// included in the [`HolderCommitmentTransactionBalance::amount_satoshis`] value. +/// This amount includes the sum of dust HTLCs on the commitment transaction, any elided anchors, +/// as well as the sum of msat amounts rounded down from non-dust HTLCs. +/// +/// Note that if this channel is inbound (and thus our counterparty pays the commitment +/// transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK +/// 0.0.124, the channel is always treated as outbound (and thus this value is never zero). +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_get_transaction_fee_satoshis(this_ptr: &HolderCommitmentTransactionBalance) -> u64 { + let mut inner_val = &mut HolderCommitmentTransactionBalance::get_native_mut_ref(this_ptr).transaction_fee_satoshis; + *inner_val +} +/// The transaction fee we pay for the closing commitment transaction. This amount is not +/// included in the [`HolderCommitmentTransactionBalance::amount_satoshis`] value. +/// This amount includes the sum of dust HTLCs on the commitment transaction, any elided anchors, +/// as well as the sum of msat amounts rounded down from non-dust HTLCs. +/// +/// Note that if this channel is inbound (and thus our counterparty pays the commitment +/// transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK +/// 0.0.124, the channel is always treated as outbound (and thus this value is never zero). +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_set_transaction_fee_satoshis(this_ptr: &mut HolderCommitmentTransactionBalance, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.transaction_fee_satoshis = val; +} +/// Constructs a new HolderCommitmentTransactionBalance given each field +#[must_use] +#[no_mangle] +pub extern "C" fn HolderCommitmentTransactionBalance_new(mut amount_satoshis_arg: u64, mut transaction_fee_satoshis_arg: u64) -> HolderCommitmentTransactionBalance { + HolderCommitmentTransactionBalance { inner: ObjOps::heap_alloc(nativeHolderCommitmentTransactionBalance { + amount_satoshis: amount_satoshis_arg, + transaction_fee_satoshis: transaction_fee_satoshis_arg, + }), is_owned: true } +} +impl Clone for HolderCommitmentTransactionBalance { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeHolderCommitmentTransactionBalance>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 HolderCommitmentTransactionBalance_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHolderCommitmentTransactionBalance) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the HolderCommitmentTransactionBalance +pub extern "C" fn HolderCommitmentTransactionBalance_clone(orig: &HolderCommitmentTransactionBalance) -> HolderCommitmentTransactionBalance { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a HolderCommitmentTransactionBalance object +pub extern "C" fn HolderCommitmentTransactionBalance_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::chain::channelmonitor::HolderCommitmentTransactionBalance }).into()} +/// Checks if two HolderCommitmentTransactionBalances 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 HolderCommitmentTransactionBalance_eq(a: &HolderCommitmentTransactionBalance, b: &HolderCommitmentTransactionBalance) -> 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 } +} /// Details about the balance(s) available for spending once the channel appears on chain. /// /// See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not @@ -671,19 +860,31 @@ pub extern "C" fn BalanceSource_eq(a: &BalanceSource, b: &BalanceSource) -> bool #[repr(C)] pub enum Balance { /// The channel is not yet closed (or the commitment or closing transaction has not yet - /// appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - /// force-closed now. + /// appeared in a block). ClaimableOnChannelClose { - /// The amount available to claim, in satoshis, excluding the on-chain fees which will be - /// required to do so. - amount_satoshis: u64, - /// The transaction fee we pay for the closing commitment transaction. This amount is not - /// included in the [`Balance::ClaimableOnChannelClose::amount_satoshis`] value. + /// A list of balance candidates based on the latest set of valid holder commitment + /// transactions that can hit the chain. Typically, a channel only has one valid holder + /// commitment transaction that spends the current funding output. As soon as a channel is + /// spliced, an alternative holder commitment transaction exists spending the new funding + /// output. More alternative holder commitment transactions can exist as the splice remains + /// pending and RBF attempts are made. + /// + /// The candidates are sorted by the order in which the holder commitment transactions were + /// negotiated. When only one candidate exists, the channel does not have a splice pending. + /// When multiple candidates exist, the last one reflects the balance of the + /// latest splice/RBF attempt, while the first reflects the balance prior to the splice + /// occurring. /// - /// Note that if this channel is inbound (and thus our counterparty pays the commitment - /// transaction fee) this value will be zero. For [`ChannelMonitor`]s created prior to LDK - /// 0.0.124, the channel is always treated as outbound (and thus this value is never zero). - transaction_fee_satoshis: u64, + /// Entries remain in this vec until the pending splice has reached [`ANTI_REORG_DELAY`] + /// confirmations, at which point any conflicts will be removed. Once a splice confirms + /// [`Self::ClaimableOnChannelClose::confirmed_balance_candidate_index`] will point to the + /// confirmed entry, even if it has fewer than [`ANTI_REORG_DELAY`] confirmations. + balance_candidates: crate::c_types::derived::CVec_HolderCommitmentTransactionBalanceZ, + /// The index within [`Balance::ClaimableOnChannelClose::balance_candidates`] for the + /// balance according to the current onchain state of the channel. This can be helpful when + /// wanting to determine the claimable amount when the holder commitment transaction for the + /// current funding transaction is broadcast and/or confirms. + confirmed_balance_candidate_index: usize, /// The amount of millisatoshis which has been burned to fees from HTLCs which are outbound /// from us and are related to a payment which was sent by us. This is the sum of the /// millisatoshis part of all HTLCs which are otherwise represented by @@ -705,7 +906,7 @@ pub enum Balance { /// to us and for which we know the preimage. This is the sum of the millisatoshis part of /// all HTLCs which would be represented by [`Balance::ContentiousClaimable`] on channel /// close, but whose current value is included in - /// [`Balance::ClaimableOnChannelClose::amount_satoshis`], as well as any dust HTLCs which + /// [`HolderCommitmentTransactionBalance::amount_satoshis`], as well as any dust HTLCs which /// would otherwise be represented the same. /// /// This amount (rounded up to a whole satoshi value) will not be included in the counterparty's @@ -802,16 +1003,17 @@ impl Balance { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeBalance { match self { - Balance::ClaimableOnChannelClose {ref amount_satoshis, ref transaction_fee_satoshis, ref outbound_payment_htlc_rounded_msat, ref outbound_forwarded_htlc_rounded_msat, ref inbound_claiming_htlc_rounded_msat, ref inbound_htlc_rounded_msat, } => { - let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); - let mut transaction_fee_satoshis_nonref = Clone::clone(transaction_fee_satoshis); + Balance::ClaimableOnChannelClose {ref balance_candidates, ref confirmed_balance_candidate_index, ref outbound_payment_htlc_rounded_msat, ref outbound_forwarded_htlc_rounded_msat, ref inbound_claiming_htlc_rounded_msat, ref inbound_htlc_rounded_msat, } => { + let mut balance_candidates_nonref = Clone::clone(balance_candidates); + let mut local_balance_candidates_nonref = Vec::new(); for mut item in balance_candidates_nonref.into_rust().drain(..) { local_balance_candidates_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut confirmed_balance_candidate_index_nonref = Clone::clone(confirmed_balance_candidate_index); let mut outbound_payment_htlc_rounded_msat_nonref = Clone::clone(outbound_payment_htlc_rounded_msat); let mut outbound_forwarded_htlc_rounded_msat_nonref = Clone::clone(outbound_forwarded_htlc_rounded_msat); let mut inbound_claiming_htlc_rounded_msat_nonref = Clone::clone(inbound_claiming_htlc_rounded_msat); let mut inbound_htlc_rounded_msat_nonref = Clone::clone(inbound_htlc_rounded_msat); nativeBalance::ClaimableOnChannelClose { - amount_satoshis: amount_satoshis_nonref, - transaction_fee_satoshis: transaction_fee_satoshis_nonref, + balance_candidates: local_balance_candidates_nonref, + confirmed_balance_candidate_index: confirmed_balance_candidate_index_nonref, outbound_payment_htlc_rounded_msat: outbound_payment_htlc_rounded_msat_nonref, outbound_forwarded_htlc_rounded_msat: outbound_forwarded_htlc_rounded_msat_nonref, inbound_claiming_htlc_rounded_msat: inbound_claiming_htlc_rounded_msat_nonref, @@ -873,10 +1075,11 @@ impl Balance { #[allow(unused)] pub(crate) fn into_native(self) -> nativeBalance { match self { - Balance::ClaimableOnChannelClose {mut amount_satoshis, mut transaction_fee_satoshis, mut outbound_payment_htlc_rounded_msat, mut outbound_forwarded_htlc_rounded_msat, mut inbound_claiming_htlc_rounded_msat, mut inbound_htlc_rounded_msat, } => { + Balance::ClaimableOnChannelClose {mut balance_candidates, mut confirmed_balance_candidate_index, mut outbound_payment_htlc_rounded_msat, mut outbound_forwarded_htlc_rounded_msat, mut inbound_claiming_htlc_rounded_msat, mut inbound_htlc_rounded_msat, } => { + let mut local_balance_candidates = Vec::new(); for mut item in balance_candidates.into_rust().drain(..) { local_balance_candidates.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; nativeBalance::ClaimableOnChannelClose { - amount_satoshis: amount_satoshis, - transaction_fee_satoshis: transaction_fee_satoshis, + balance_candidates: local_balance_candidates, + confirmed_balance_candidate_index: confirmed_balance_candidate_index, outbound_payment_htlc_rounded_msat: outbound_payment_htlc_rounded_msat, outbound_forwarded_htlc_rounded_msat: outbound_forwarded_htlc_rounded_msat, inbound_claiming_htlc_rounded_msat: inbound_claiming_htlc_rounded_msat, @@ -924,16 +1127,17 @@ impl Balance { pub(crate) fn from_native(native: &BalanceImport) -> Self { let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBalance) }; match native { - nativeBalance::ClaimableOnChannelClose {ref amount_satoshis, ref transaction_fee_satoshis, ref outbound_payment_htlc_rounded_msat, ref outbound_forwarded_htlc_rounded_msat, ref inbound_claiming_htlc_rounded_msat, ref inbound_htlc_rounded_msat, } => { - let mut amount_satoshis_nonref = Clone::clone(amount_satoshis); - let mut transaction_fee_satoshis_nonref = Clone::clone(transaction_fee_satoshis); + nativeBalance::ClaimableOnChannelClose {ref balance_candidates, ref confirmed_balance_candidate_index, ref outbound_payment_htlc_rounded_msat, ref outbound_forwarded_htlc_rounded_msat, ref inbound_claiming_htlc_rounded_msat, ref inbound_htlc_rounded_msat, } => { + let mut balance_candidates_nonref = Clone::clone(balance_candidates); + let mut local_balance_candidates_nonref = Vec::new(); for mut item in balance_candidates_nonref.drain(..) { local_balance_candidates_nonref.push( { crate::lightning::chain::channelmonitor::HolderCommitmentTransactionBalance { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut confirmed_balance_candidate_index_nonref = Clone::clone(confirmed_balance_candidate_index); let mut outbound_payment_htlc_rounded_msat_nonref = Clone::clone(outbound_payment_htlc_rounded_msat); let mut outbound_forwarded_htlc_rounded_msat_nonref = Clone::clone(outbound_forwarded_htlc_rounded_msat); let mut inbound_claiming_htlc_rounded_msat_nonref = Clone::clone(inbound_claiming_htlc_rounded_msat); let mut inbound_htlc_rounded_msat_nonref = Clone::clone(inbound_htlc_rounded_msat); Balance::ClaimableOnChannelClose { - amount_satoshis: amount_satoshis_nonref, - transaction_fee_satoshis: transaction_fee_satoshis_nonref, + balance_candidates: local_balance_candidates_nonref.into(), + confirmed_balance_candidate_index: confirmed_balance_candidate_index_nonref, outbound_payment_htlc_rounded_msat: outbound_payment_htlc_rounded_msat_nonref, outbound_forwarded_htlc_rounded_msat: outbound_forwarded_htlc_rounded_msat_nonref, inbound_claiming_htlc_rounded_msat: inbound_claiming_htlc_rounded_msat_nonref, @@ -995,10 +1199,11 @@ impl Balance { #[allow(unused)] pub(crate) fn native_into(native: nativeBalance) -> Self { match native { - nativeBalance::ClaimableOnChannelClose {mut amount_satoshis, mut transaction_fee_satoshis, mut outbound_payment_htlc_rounded_msat, mut outbound_forwarded_htlc_rounded_msat, mut inbound_claiming_htlc_rounded_msat, mut inbound_htlc_rounded_msat, } => { + nativeBalance::ClaimableOnChannelClose {mut balance_candidates, mut confirmed_balance_candidate_index, mut outbound_payment_htlc_rounded_msat, mut outbound_forwarded_htlc_rounded_msat, mut inbound_claiming_htlc_rounded_msat, mut inbound_htlc_rounded_msat, } => { + let mut local_balance_candidates = Vec::new(); for mut item in balance_candidates.drain(..) { local_balance_candidates.push( { crate::lightning::chain::channelmonitor::HolderCommitmentTransactionBalance { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; Balance::ClaimableOnChannelClose { - amount_satoshis: amount_satoshis, - transaction_fee_satoshis: transaction_fee_satoshis, + balance_candidates: local_balance_candidates.into(), + confirmed_balance_candidate_index: confirmed_balance_candidate_index, outbound_payment_htlc_rounded_msat: outbound_payment_htlc_rounded_msat, outbound_forwarded_htlc_rounded_msat: outbound_forwarded_htlc_rounded_msat, inbound_claiming_htlc_rounded_msat: inbound_claiming_htlc_rounded_msat, @@ -1063,10 +1268,10 @@ pub(crate) extern "C" fn Balance_free_void(this_ptr: *mut c_void) { } #[no_mangle] /// Utility method to constructs a new ClaimableOnChannelClose-variant Balance -pub extern "C" fn Balance_claimable_on_channel_close(amount_satoshis: u64, transaction_fee_satoshis: u64, outbound_payment_htlc_rounded_msat: u64, outbound_forwarded_htlc_rounded_msat: u64, inbound_claiming_htlc_rounded_msat: u64, inbound_htlc_rounded_msat: u64) -> Balance { +pub extern "C" fn Balance_claimable_on_channel_close(balance_candidates: crate::c_types::derived::CVec_HolderCommitmentTransactionBalanceZ, confirmed_balance_candidate_index: usize, outbound_payment_htlc_rounded_msat: u64, outbound_forwarded_htlc_rounded_msat: u64, inbound_claiming_htlc_rounded_msat: u64, inbound_htlc_rounded_msat: u64) -> Balance { Balance::ClaimableOnChannelClose { - amount_satoshis, - transaction_fee_satoshis, + balance_candidates, + confirmed_balance_candidate_index, outbound_payment_htlc_rounded_msat, outbound_forwarded_htlc_rounded_msat, inbound_claiming_htlc_rounded_msat, @@ -1129,6 +1334,13 @@ pub extern "C" fn Balance_eq(a: &Balance, b: &Balance) -> bool { } /// The amount claimable, in satoshis. /// +/// When the channel has yet to close, this returns the balance we expect to claim from the +/// channel. This may change throughout the lifetime of the channel due to payments, but also +/// due to splicing. If there's a pending splice, this will return the balance we expect to have +/// assuming the latest negotiated splice confirms. However, if one of the negotiated splice +/// transactions has already confirmed but is not yet locked, this reports the corresponding +/// balance for said splice transaction instead. +/// /// For outbound payments, this excludes the balance from the possible HTLC timeout. /// /// For forwarded payments, this includes the balance from the possible HTLC timeout as @@ -1156,11 +1368,21 @@ pub(crate) type nativeChannelMonitor = nativeChannelMonitorImport`. LDK can no longer deserialize a [`ChannelMonitor`] +/// that was first created in LDK prior to 0.0.110 and last updated prior to LDK 0.0.119. In such +/// cases, the `Option<(..)>` deserialization option may return `Ok(None)` rather than failing to +/// deserialize, allowing you to differentiate between the two cases. +/// +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor #[must_use] #[repr(C)] pub struct ChannelMonitor { @@ -1220,7 +1442,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1228,12 +1450,12 @@ impl Clone for ChannelMonitor { #[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 *const nativeChannelMonitor)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelMonitor) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelMonitor pub extern "C" fn ChannelMonitor_clone(orig: &ChannelMonitor) -> ChannelMonitor { - orig.clone() + Clone::clone(orig) } #[no_mangle] /// Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read @@ -1244,6 +1466,22 @@ pub extern "C" fn ChannelMonitor_write(obj: &crate::lightning::chain::channelmon pub(crate) extern "C" fn ChannelMonitor_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::chain::channelmonitor::nativeChannelMonitor) }) } +/// Returns a unique id for persisting the [`ChannelMonitor`], which is used as a key in a +/// key-value store. +/// +/// Note: Previously, the funding outpoint was used in the [`Persist`] trait. However, since the +/// outpoint may change during splicing, this method is used to obtain a unique key instead. For +/// v1 channels, the funding outpoint is still used for backwards compatibility, whereas v2 +/// channels use the channel id since it is fixed. +/// +/// [`Persist`]: crate::chain::chainmonitor::Persist +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_persistence_key(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::util::persist::MonitorName { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.persistence_key(); + crate::lightning::util::persist::MonitorName::native_into(ret) +} + /// Updates a ChannelMonitor on the basis of some new information provided by the Channel /// itself. /// @@ -1270,10 +1508,17 @@ 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_OutPointCVec_u8ZZ { +pub extern "C" fn ChannelMonitor_get_funding_txo(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::transaction::OutPoint { 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.to_bytes().into()).into(); - local_ret + crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Gets the funding script of the channel this ChannelMonitor is monitoring for. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_get_funding_script(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_u8Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_funding_script(); + ret.to_bytes().into() } /// Gets the channel_id of the channel this ChannelMonitor is monitoring for. @@ -1284,6 +1529,14 @@ pub extern "C" fn ChannelMonitor_channel_id(this_arg: &crate::lightning::chain:: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Gets the channel type of the corresponding channel. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelMonitor_channel_type_features(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning_types::features::ChannelTypeFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features(); + crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// 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] @@ -1400,6 +1653,10 @@ pub extern "C" fn ChannelMonitor_counterparty_commitment_txs_from_update(this_ar /// to the commitment transaction being revoked, this will return a signed transaction, but /// the signature will not be valid. /// +/// Note that due to splicing, this can also return an `Err` when the counterparty commitment +/// this transaction is attempting to claim is no longer valid because the corresponding funding +/// transaction was spliced. +/// /// [`EcdsaChannelSigner::sign_justice_revoked_output`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_justice_revoked_output /// [`Persist`]: crate::chain::chainmonitor::Persist #[must_use] @@ -1411,17 +1668,11 @@ pub extern "C" fn ChannelMonitor_sign_to_local_justice_tx(this_arg: &crate::ligh } /// 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` -/// otherwise. -/// -/// 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_get_counterparty_node_id(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::PublicKey { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_counterparty_node_id(); - let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; - local_ret + crate::c_types::PublicKey::from_rust(&ret) } /// You may use this to broadcast the latest local commitment transaction, either because @@ -1433,6 +1684,16 @@ pub extern "C" fn ChannelMonitor_get_counterparty_node_id(this_arg: &crate::ligh /// 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. +/// +/// Note: For channels using manual funding broadcast (see +/// [`crate::ln::channelmanager::ChannelManager::funding_transaction_generated_manual_broadcast`]), +/// automatic broadcasts are suppressed until the funding transaction has been observed on-chain. +/// Calling this method overrides that suppression and queues the latest holder commitment +/// transaction for broadcast even if the funding has not yet been seen on-chain. This may result +/// in unconfirmable transactions being broadcast or [`Event::BumpTransaction`] notifications for +/// transactions that cannot be confirmed until the funding transaction is visible. +/// +/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction #[no_mangle] pub extern "C" fn ChannelMonitor_broadcast_latest_holder_commitment_txn(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, broadcaster: &crate::lightning::chain::chaininterface::BroadcasterInterface, fee_estimator: &crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.broadcast_latest_holder_commitment_txn(broadcaster, fee_estimator, logger) @@ -1461,8 +1722,8 @@ pub extern "C" fn ChannelMonitor_block_connected(this_arg: &crate::lightning::ch /// Determines if the disconnected block contained any transactions of interest and updates /// appropriately. #[no_mangle] -pub extern "C" fn ChannelMonitor_block_disconnected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, header: *const [u8; 80], mut height: u32, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.block_disconnected(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height, broadcaster, fee_estimator, logger) +pub extern "C" fn ChannelMonitor_blocks_disconnected(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, mut fork_point: crate::lightning::chain::BestBlock, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.blocks_disconnected(*unsafe { Box::from_raw(fork_point.take_inner()) }, broadcaster, fee_estimator, logger) } /// Processes transactions confirmed in a block with the given header and height, returning new @@ -1483,10 +1744,10 @@ pub extern "C" fn ChannelMonitor_transactions_confirmed(this_arg: &crate::lightn /// Processes a transaction that was reorganized out of the chain. /// -/// Used instead of [`block_disconnected`] by clients that are notified of transactions rather +/// Used instead of [`blocks_disconnected`] by clients that are notified of transactions rather /// than blocks. See [`chain::Confirm`] for calling expectations. /// -/// [`block_disconnected`]: Self::block_disconnected +/// [`blocks_disconnected`]: Self::blocks_disconnected #[no_mangle] pub extern "C" fn ChannelMonitor_transaction_unconfirmed(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, txid: *const [u8; 32], mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, logger: &crate::lightning::util::logger::Logger) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.transaction_unconfirmed(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap(), broadcaster, fee_estimator, logger) diff --git a/lightning-c-bindings/src/lightning/chain/mod.rs b/lightning-c-bindings/src/lightning/chain/mod.rs index c981ca35..aa97f405 100644 --- a/lightning-c-bindings/src/lightning/chain/mod.rs +++ b/lightning-c-bindings/src/lightning/chain/mod.rs @@ -108,7 +108,7 @@ impl BestBlock { /// The block's hash #[no_mangle] pub extern "C" fn BestBlock_get_block_hash(this_ptr: &BestBlock) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().block_hash; + let mut inner_val = &mut BestBlock::get_native_mut_ref(this_ptr).block_hash; inner_val.as_ref() } /// The block's hash @@ -119,7 +119,7 @@ pub extern "C" fn BestBlock_set_block_hash(this_ptr: &mut BestBlock, mut val: cr /// The height at which the block was confirmed. #[no_mangle] pub extern "C" fn BestBlock_get_height(this_ptr: &BestBlock) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().height; + let mut inner_val = &mut BestBlock::get_native_mut_ref(this_ptr).height; *inner_val } /// The height at which the block was confirmed. @@ -140,7 +140,7 @@ impl Clone for BestBlock { fn clone(&self) -> Self { Self { inner: if <*mut nativeBestBlock>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -148,12 +148,12 @@ impl Clone for BestBlock { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BestBlock_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBestBlock)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBestBlock) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BestBlock pub extern "C" fn BestBlock_clone(orig: &BestBlock) -> BestBlock { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BestBlock object pub extern "C" fn BestBlock_debug_str_void(o: *const c_void) -> Str { @@ -213,6 +213,24 @@ pub extern "C" fn BestBlock_read(ser: crate::c_types::u8slice) -> crate::c_types /// By using [`Listen::filtered_block_connected`] this interface supports clients fetching the /// entire header chain and only blocks with matching transaction data using BIP 157 filters or /// other similar filtering. +/// +/// # Requirements +/// +/// Each block must be connected in chain order with one call to either +/// [`Listen::block_connected`] or [`Listen::filtered_block_connected`]. If a call to the +/// [`Filter`] interface was made during block processing and further transaction(s) from the same +/// block now match the filter, a second call to [`Listen::filtered_block_connected`] should be +/// made immediately for the same block (prior to any other calls to the [`Listen`] interface). +/// +/// In case of a reorg, you must call [`Listen::blocks_disconnected`] once with information on the +/// \"fork point\" block, i.e. the highest block that is in both forks. You may call +/// [`Listen::blocks_disconnected`] multiple times as you walk the chain backwards, but each must +/// include a fork point block that is before the last. +/// +/// # Object Birthday +/// +/// Note that most implementations take a [`BestBlock`] on construction and blocks only need to be +/// applied starting from that point. #[repr(C)] pub struct Listen { /// An opaque pointer which is passed to your function implementations as an argument. @@ -223,8 +241,13 @@ pub struct Listen { pub filtered_block_connected: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, height: u32), /// Notifies the listener that a block was added at the given height. pub block_connected: extern "C" fn (this_arg: *const c_void, block: crate::c_types::u8slice, height: u32), - /// Notifies the listener that a block was removed at the given height. - pub block_disconnected: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], height: u32), + /// Notifies the listener that one or more blocks were removed in anticipation of a reorg. + /// + /// The provided [`BestBlock`] is the new best block after disconnecting blocks in the reorg + /// but before connecting new ones (i.e. the \"fork point\" block). For backwards compatibility, + /// you may instead walk the chain backwards, calling `blocks_disconnected` for each block + /// that is disconnected in a reorg. + pub blocks_disconnected: extern "C" fn (this_arg: *const c_void, fork_point_block: crate::lightning::chain::BestBlock), /// 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, @@ -237,7 +260,7 @@ pub(crate) fn Listen_clone_fields(orig: &Listen) -> Listen { this_arg: orig.this_arg, filtered_block_connected: Clone::clone(&orig.filtered_block_connected), block_connected: Clone::clone(&orig.block_connected), - block_disconnected: Clone::clone(&orig.block_disconnected), + blocks_disconnected: Clone::clone(&orig.blocks_disconnected), free: Clone::clone(&orig.free), } } @@ -253,9 +276,8 @@ impl rustListen for Listen { let mut local_block = ::bitcoin::consensus::encode::serialize(block); (self.block_connected)(self.this_arg, crate::c_types::u8slice::from_slice(&local_block), height) } - fn block_disconnected(&self, mut header: &bitcoin::block::Header, mut height: u32) { - let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s }; - (self.block_disconnected)(self.this_arg, &local_header, height) + fn blocks_disconnected(&self, mut fork_point_block: lightning::chain::BestBlock) { + (self.blocks_disconnected)(self.this_arg, crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(fork_point_block), is_owned: true }) } } @@ -270,9 +292,8 @@ impl rustListen for ListenRef { let mut local_block = ::bitcoin::consensus::encode::serialize(block); (self.0.block_connected)(self.0.this_arg, crate::c_types::u8slice::from_slice(&local_block), height) } - fn block_disconnected(&self, mut header: &bitcoin::block::Header, mut height: u32) { - let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s }; - (self.0.block_disconnected)(self.0.this_arg, &local_header, height) + fn blocks_disconnected(&self, mut fork_point_block: lightning::chain::BestBlock) { + (self.0.blocks_disconnected)(self.0.this_arg, crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(fork_point_block), is_owned: true }) } } @@ -503,6 +524,12 @@ 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. + /// + /// If you return this variant, you cannot later return [`InProgress`] from the same instance of + /// [`Persist`]/[`Watch`] without first restarting. + /// + /// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress + /// [`Persist`]: chainmonitor::Persist Completed, /// 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. @@ -528,7 +555,12 @@ pub enum ChannelMonitorUpdateStatus { /// 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*. /// + /// If you return this variant, you cannot later return [`Completed`] from the same instance of + /// [`Persist`]/[`Watch`] without first restarting. + /// /// [`InProgress`]: ChannelMonitorUpdateStatus::InProgress + /// [`Completed`]: ChannelMonitorUpdateStatus::Completed + /// [`Persist`]: chainmonitor::Persist InProgress, /// Indicates that an update has failed and will not complete at any point in the future. /// @@ -632,23 +664,23 @@ pub struct Watch { /// 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, - /// Watches a channel identified by `funding_txo` using `monitor`. + /// Watches a channel identified by `channel_id` using `monitor`. /// /// Implementations are responsible for watching the chain for the funding transaction along /// with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - /// calling [`block_connected`] and [`block_disconnected`] on the monitor. + /// calling [`block_connected`] and [`blocks_disconnected`] on the monitor. /// /// 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(())` + /// If the given `channel_id` 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::c_types::derived::CResult_ChannelMonitorUpdateStatusNoneZ, - /// Updates a channel identified by `funding_txo` by applying `update` to its monitor. + /// [`blocks_disconnected`]: channelmonitor::ChannelMonitor::blocks_disconnected + pub watch_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::ln::types::ChannelId, monitor: crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CResult_ChannelMonitorUpdateStatusNoneZ, + /// Updates a channel identified by `channel_id` by applying `update` to its monitor. /// /// Implementations must call [`ChannelMonitor::update_monitor`] with the given update. This /// may fail (returning an `Err(())`), in which case this should return @@ -663,7 +695,7 @@ pub struct Watch { /// [`ChannelMonitorUpdateStatus::UnrecoverableError`], see its documentation for more info. /// /// [`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, + pub update_channel: extern "C" fn (this_arg: *const c_void, channel_id: crate::lightning::ln::types::ChannelId, 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. /// @@ -693,36 +725,36 @@ pub(crate) 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) -> 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 }); + fn watch_channel(&self, mut channel_id: lightning::ln::types::ChannelId, mut monitor: lightning::chain::channelmonitor::ChannelMonitor) -> Result { + let mut ret = (self.watch_channel)(self.this_arg, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(monitor), is_owned: true }); 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 }); + fn update_channel(&self, mut channel_id: lightning::ln::types::ChannelId, mut update: &lightning::chain::channelmonitor::ChannelMonitorUpdate) -> lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = (self.update_channel)(self.this_arg, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), 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 }); ret.into_native() } - fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, lightning::ln::types::ChannelId, Vec, Option)> { + fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, lightning::ln::types::ChannelId, Vec, bitcoin::secp256k1::PublicKey)> { let mut ret = (self.release_pending_monitor_events)(self.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2, mut orig_ret_0_3) = item.to_rust(); let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.into_rust().drain(..) { local_orig_ret_0_2.push( { item.into_native() }); }; let mut local_orig_ret_0_3 = if orig_ret_0_3.is_null() { None } else { Some( { orig_ret_0_3.into_rust() }) }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }, local_orig_ret_0_2, local_orig_ret_0_3); local_ret_0 }); }; + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2, mut orig_ret_0_3) = item.to_rust(); let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.into_rust().drain(..) { local_orig_ret_0_2.push( { item.into_native() }); }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }, local_orig_ret_0_2, orig_ret_0_3.into_rust()); local_ret_0 }); }; local_ret } } pub struct WatchRef(Watch); impl rustWatch for WatchRef { - fn watch_channel(&self, mut funding_txo: lightning::chain::transaction::OutPoint, mut monitor: lightning::chain::channelmonitor::ChannelMonitor) -> Result { - let mut ret = (self.0.watch_channel)(self.0.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 }); + fn watch_channel(&self, mut channel_id: lightning::ln::types::ChannelId, mut monitor: lightning::chain::channelmonitor::ChannelMonitor) -> Result { + let mut ret = (self.0.watch_channel)(self.0.this_arg, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, crate::lightning::chain::channelmonitor::ChannelMonitor { inner: ObjOps::heap_alloc(monitor), is_owned: true }); 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.0.update_channel)(self.0.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 }); + fn update_channel(&self, mut channel_id: lightning::ln::types::ChannelId, mut update: &lightning::chain::channelmonitor::ChannelMonitorUpdate) -> lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = (self.0.update_channel)(self.0.this_arg, crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), 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 }); ret.into_native() } - fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, lightning::ln::types::ChannelId, Vec, Option)> { + fn release_pending_monitor_events(&self) -> Vec<(lightning::chain::transaction::OutPoint, lightning::ln::types::ChannelId, Vec, bitcoin::secp256k1::PublicKey)> { let mut ret = (self.0.release_pending_monitor_events)(self.0.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2, mut orig_ret_0_3) = item.to_rust(); let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.into_rust().drain(..) { local_orig_ret_0_2.push( { item.into_native() }); }; let mut local_orig_ret_0_3 = if orig_ret_0_3.is_null() { None } else { Some( { orig_ret_0_3.into_rust() }) }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }, local_orig_ret_0_2, local_orig_ret_0_3); local_ret_0 }); }; + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1, mut orig_ret_0_2, mut orig_ret_0_3) = item.to_rust(); let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.into_rust().drain(..) { local_orig_ret_0_2.push( { item.into_native() }); }; let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }, local_orig_ret_0_2, orig_ret_0_3.into_rust()); local_ret_0 }); }; local_ret } } @@ -928,7 +960,7 @@ 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_ThirtyTwoBytesZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().block_hash; + let mut inner_val = &mut WatchedOutput::get_native_mut_ref(this_ptr).block_hash; 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().as_ref() } }) }; local_inner_val } @@ -941,7 +973,7 @@ pub extern "C" fn WatchedOutput_set_block_hash(this_ptr: &mut WatchedOutput, mut /// Outpoint identifying the transaction output. #[no_mangle] pub extern "C" fn WatchedOutput_get_outpoint(this_ptr: &WatchedOutput) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut WatchedOutput::get_native_mut_ref(this_ptr).outpoint; crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } /// Outpoint identifying the transaction output. @@ -952,7 +984,7 @@ pub extern "C" fn WatchedOutput_set_outpoint(this_ptr: &mut WatchedOutput, mut v /// Spending condition of the transaction output. #[no_mangle] pub extern "C" fn WatchedOutput_get_script_pubkey(this_ptr: &WatchedOutput) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().script_pubkey; + let mut inner_val = &mut WatchedOutput::get_native_mut_ref(this_ptr).script_pubkey; inner_val.as_bytes().to_vec().into() } /// Spending condition of the transaction output. @@ -975,7 +1007,7 @@ impl Clone for WatchedOutput { fn clone(&self) -> Self { Self { inner: if <*mut nativeWatchedOutput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -983,12 +1015,12 @@ impl Clone for WatchedOutput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn WatchedOutput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeWatchedOutput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeWatchedOutput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the WatchedOutput pub extern "C" fn WatchedOutput_clone(orig: &WatchedOutput) -> WatchedOutput { - orig.clone() + Clone::clone(orig) } /// Checks if two WatchedOutputs contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index d807fc34..63fbd7c0 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -83,7 +83,7 @@ impl OutPoint { /// The referenced transaction's txid. #[no_mangle] pub extern "C" fn OutPoint_get_txid(this_ptr: &OutPoint) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().txid; + let mut inner_val = &mut OutPoint::get_native_mut_ref(this_ptr).txid; inner_val.as_ref() } /// The referenced transaction's txid. @@ -94,7 +94,7 @@ pub extern "C" fn OutPoint_set_txid(this_ptr: &mut OutPoint, mut val: crate::c_t /// The index of the referenced output in its transaction's vout. #[no_mangle] pub extern "C" fn OutPoint_get_index(this_ptr: &OutPoint) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().index; + let mut inner_val = &mut OutPoint::get_native_mut_ref(this_ptr).index; *inner_val } /// The index of the referenced output in its transaction's vout. @@ -115,7 +115,7 @@ impl Clone for OutPoint { fn clone(&self) -> Self { Self { inner: if <*mut nativeOutPoint>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -123,12 +123,12 @@ impl Clone for OutPoint { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OutPoint_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOutPoint)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOutPoint) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OutPoint pub extern "C" fn OutPoint_clone(orig: &OutPoint) -> OutPoint { - orig.clone() + Clone::clone(orig) } /// Checks if two OutPoints contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. diff --git a/lightning-c-bindings/src/lightning/events/bump_transaction.rs b/lightning-c-bindings/src/lightning/events/bump_transaction/mod.rs similarity index 62% rename from lightning-c-bindings/src/lightning/events/bump_transaction.rs rename to lightning-c-bindings/src/lightning/events/bump_transaction/mod.rs index 1d500718..291face1 100644 --- a/lightning-c-bindings/src/lightning/events/bump_transaction.rs +++ b/lightning-c-bindings/src/lightning/events/bump_transaction/mod.rs @@ -19,6 +19,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +pub mod sync; use lightning::events::bump_transaction::AnchorDescriptor as nativeAnchorDescriptorImport; pub(crate) type nativeAnchorDescriptor = nativeAnchorDescriptorImport; @@ -82,7 +83,7 @@ impl AnchorDescriptor { /// The parameters required to derive the signer for the anchor input. #[no_mangle] pub extern "C" fn AnchorDescriptor_get_channel_derivation_parameters(this_ptr: &AnchorDescriptor) -> crate::lightning::sign::ChannelDerivationParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_derivation_parameters; + let mut inner_val = &mut AnchorDescriptor::get_native_mut_ref(this_ptr).channel_derivation_parameters; crate::lightning::sign::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::sign::ChannelDerivationParameters<>) as *mut _) }, is_owned: false } } /// The parameters required to derive the signer for the anchor input. @@ -94,7 +95,7 @@ pub extern "C" fn AnchorDescriptor_set_channel_derivation_parameters(this_ptr: & /// output. #[no_mangle] pub extern "C" fn AnchorDescriptor_get_outpoint(this_ptr: &AnchorDescriptor) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut AnchorDescriptor::get_native_mut_ref(this_ptr).outpoint; crate::c_types::bitcoin_to_C_outpoint(inner_val) } /// The transaction input's outpoint corresponding to the commitment transaction's anchor @@ -103,20 +104,32 @@ pub extern "C" fn AnchorDescriptor_get_outpoint(this_ptr: &AnchorDescriptor) -> pub extern "C" fn AnchorDescriptor_set_outpoint(this_ptr: &mut AnchorDescriptor, mut val: crate::lightning::chain::transaction::OutPoint) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outpoint = crate::c_types::C_to_bitcoin_outpoint(val); } +/// Zero-fee-commitment anchors have variable value, which is tracked here. +#[no_mangle] +pub extern "C" fn AnchorDescriptor_get_value(this_ptr: &AnchorDescriptor) -> u64 { + let mut inner_val = &mut AnchorDescriptor::get_native_mut_ref(this_ptr).value; + inner_val.to_sat() +} +/// Zero-fee-commitment anchors have variable value, which is tracked here. +#[no_mangle] +pub extern "C" fn AnchorDescriptor_set_value(this_ptr: &mut AnchorDescriptor, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.value = ::bitcoin::amount::Amount::from_sat(val); +} /// Constructs a new AnchorDescriptor given each field #[must_use] #[no_mangle] -pub extern "C" fn AnchorDescriptor_new(mut channel_derivation_parameters_arg: crate::lightning::sign::ChannelDerivationParameters, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint) -> AnchorDescriptor { +pub extern "C" fn AnchorDescriptor_new(mut channel_derivation_parameters_arg: crate::lightning::sign::ChannelDerivationParameters, mut outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut value_arg: u64) -> AnchorDescriptor { AnchorDescriptor { inner: ObjOps::heap_alloc(nativeAnchorDescriptor { channel_derivation_parameters: *unsafe { Box::from_raw(channel_derivation_parameters_arg.take_inner()) }, outpoint: crate::c_types::C_to_bitcoin_outpoint(outpoint_arg), + value: ::bitcoin::amount::Amount::from_sat(value_arg), }), is_owned: true } } impl Clone for AnchorDescriptor { fn clone(&self) -> Self { Self { inner: if <*mut nativeAnchorDescriptor>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -124,12 +137,12 @@ impl Clone for AnchorDescriptor { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn AnchorDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAnchorDescriptor)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAnchorDescriptor) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the AnchorDescriptor pub extern "C" fn AnchorDescriptor_clone(orig: &AnchorDescriptor) -> AnchorDescriptor { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a AnchorDescriptor object pub extern "C" fn AnchorDescriptor_debug_str_void(o: *const c_void) -> Str { @@ -161,14 +174,6 @@ pub extern "C" fn AnchorDescriptor_unsigned_tx_input(this_arg: &crate::lightning crate::c_types::TxIn::from_rust(&ret) } -/// Returns the witness script of the anchor output in the commitment transaction. -#[must_use] -#[no_mangle] -pub extern "C" fn AnchorDescriptor_witness_script(this_arg: &crate::lightning::events::bump_transaction::AnchorDescriptor) -> crate::c_types::derived::CVec_u8Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.witness_script(); - ret.to_bytes().into() -} - /// Returns the fully signed witness required to spend the anchor output in the commitment /// transaction. #[must_use] @@ -178,14 +183,6 @@ pub extern "C" fn AnchorDescriptor_tx_input_witness(this_arg: &crate::lightning: crate::c_types::Witness::from_bitcoin(&ret) } -/// Derives the channel signer required to sign the anchor input. -#[must_use] -#[no_mangle] -pub extern "C" fn AnchorDescriptor_derive_channel_signer(this_arg: &crate::lightning::events::bump_transaction::AnchorDescriptor, signer_provider: &crate::lightning::sign::SignerProvider) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_signer(signer_provider); - Into::into(ret) -} - /// Represents the different types of transactions, originating from LDK, to be bumped. #[derive(Clone)] #[must_use] @@ -201,14 +198,25 @@ pub enum BumpTransactionEvent { /// and child anchor transactions), possibly resulting in a loss of funds. Once the transaction /// is constructed, it must be fully signed for and broadcast by the consumer of the event /// along with the `commitment_tx` enclosed. Note that the `commitment_tx` must always be - /// broadcast first, as the child anchor transaction depends on it. + /// broadcast first, as the child anchor transaction depends on it. It is also possible that the + /// feerate of the commitment transaction is already sufficient, in which case the child anchor + /// transaction is not needed and only the commitment transaction should be broadcast. + /// + /// In zero-fee commitment channels, the commitment transaction and the anchor transaction + /// form a 1-parent-1-child package that conforms to BIP 431 (known as TRUC transactions). + /// The anchor transaction must be version 3, and its size must be no more than 1000 vB. + /// The anchor transaction is usually needed to bump the fee of the commitment transaction + /// as the commitment transaction is not explicitly assigned any fees. In those cases the + /// anchor transaction must be broadcast together with the commitment transaction as a + /// `child-with-parents` package (usually using the Bitcoin Core `submitpackage` RPC). /// /// The consumer should be able to sign for any of the additional inputs included within the - /// child anchor transaction. To sign its anchor input, an [`EcdsaChannelSigner`] should be - /// re-derived through [`AnchorDescriptor::derive_channel_signer`]. The anchor input signature - /// can be computed with [`EcdsaChannelSigner::sign_holder_anchor_input`], which can then be - /// provided to [`build_anchor_input_witness`] along with the `funding_pubkey` to obtain the - /// full witness required to spend. + /// child anchor transaction. To sign its keyed-anchor input, an [`EcdsaChannelSigner`] should + /// be re-derived through [`SignerProvider::derive_channel_signer`]. The anchor input signature + /// can be computed with [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`], which can then + /// be provided to [`build_keyed_anchor_input_witness`] along with the `funding_pubkey` to + /// obtain the full witness required to spend. Note that no signature or witness data is + /// required to spend the keyless anchor used in zero-fee commitment channels. /// /// It is possible to receive more than one instance of this event if a valid child anchor /// transaction is never broadcast or is but not with a sufficient fee to be mined. Care should @@ -228,8 +236,8 @@ pub enum BumpTransactionEvent { /// be not urgent. /// /// [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner - /// [`EcdsaChannelSigner::sign_holder_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_anchor_input - /// [`build_anchor_input_witness`]: crate::ln::chan_utils::build_anchor_input_witness + /// [`EcdsaChannelSigner::sign_holder_keyed_anchor_input`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_keyed_anchor_input + /// [`build_keyed_anchor_input_witness`]: crate::ln::chan_utils::build_keyed_anchor_input_witness ChannelClose { /// The `channel_id` of the channel which has been closed. channel_id: crate::lightning::ln::types::ChannelId, @@ -259,18 +267,29 @@ pub enum BumpTransactionEvent { pending_htlcs: crate::c_types::derived::CVec_HTLCOutputInCommitmentZ, }, /// Indicates that a channel featuring anchor outputs has unilaterally closed on-chain by a - /// holder commitment transaction and its HTLC(s) need to be resolved on-chain. With the - /// zero-HTLC-transaction-fee variant of anchor outputs, the pre-signed HTLC - /// transactions have a zero fee, thus requiring additional inputs and/or outputs to be attached - /// for a timely confirmation within the chain. These additional inputs and/or outputs must be - /// appended to the resulting HTLC transaction to meet the target feerate. Failure to meet the - /// target feerate decreases the confirmation odds of the transaction, possibly resulting in a - /// loss of funds. Once the transaction meets the target feerate, it must be signed for and - /// broadcast by the consumer of the event. + /// holder commitment transaction and its HTLC(s) need to be resolved on-chain. In all such + /// channels, the pre-signed HTLC transactions have a zero fee, thus requiring additional + /// inputs and/or outputs to be attached for a timely confirmation within the chain. These + /// additional inputs and/or outputs must be appended to the resulting HTLC transaction to + /// meet the target feerate. Failure to meet the target feerate decreases the confirmation + /// odds of the transaction, possibly resulting in a loss of funds. Once the transaction + /// meets the target feerate, it must be signed for and broadcast by the consumer of the + /// event. + /// + /// In zero-fee commitment channels, you must set the version of the HTLC claim transaction + /// to version 3 as the counterparty's signature commits to the version of + /// the transaction. You must also make sure that this claim transaction does not grow + /// bigger than 10,000 vB, the maximum vsize of any TRUC transaction as specified in + /// BIP 431. It is possible for [`htlc_descriptors`] to be long enough such + /// that claiming all the HTLCs therein in a single transaction would exceed this limit. + /// In this case, you must claim all the HTLCs in [`htlc_descriptors`] using multiple + /// transactions. Finally, note that while HTLCs in zero-fee commitment channels no + /// longer have the 1 CSV lock, LDK will still emit this event only after the commitment + /// transaction has 1 confirmation. /// /// The consumer should be able to sign for any of the non-HTLC inputs added to the resulting /// HTLC transaction. To sign HTLC inputs, an [`EcdsaChannelSigner`] should be re-derived - /// through [`HTLCDescriptor::derive_channel_signer`]. Each HTLC input's signature can be + /// through [`SignerProvider::derive_channel_signer`]. Each HTLC input's signature can be /// computed with [`EcdsaChannelSigner::sign_holder_htlc_transaction`], which can then be /// provided to [`HTLCDescriptor::tx_input_witness`] to obtain the fully signed witness required /// to spend. @@ -287,6 +306,7 @@ pub enum BumpTransactionEvent { /// /// [`EcdsaChannelSigner`]: crate::sign::ecdsa::EcdsaChannelSigner /// [`EcdsaChannelSigner::sign_holder_htlc_transaction`]: crate::sign::ecdsa::EcdsaChannelSigner::sign_holder_htlc_transaction + /// [`htlc_descriptors`]: `BumpTransactionEvent::HTLCResolution::htlc_descriptors` HTLCResolution { /// The `channel_id` of the channel which has been closed. channel_id: crate::lightning::ln::types::ChannelId, @@ -576,7 +596,7 @@ impl Input { /// The unique identifier of the input. #[no_mangle] pub extern "C" fn Input_get_outpoint(this_ptr: &Input) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut Input::get_native_mut_ref(this_ptr).outpoint; crate::c_types::bitcoin_to_C_outpoint(inner_val) } /// The unique identifier of the input. @@ -587,7 +607,7 @@ pub extern "C" fn Input_set_outpoint(this_ptr: &mut Input, mut val: crate::light /// The UTXO being spent by the input. #[no_mangle] pub extern "C" fn Input_get_previous_utxo(this_ptr: &Input) -> crate::c_types::TxOut { - let mut inner_val = &mut this_ptr.get_native_mut_ref().previous_utxo; + let mut inner_val = &mut Input::get_native_mut_ref(this_ptr).previous_utxo; crate::c_types::TxOut::from_rust(inner_val) } /// The UTXO being spent by the input. @@ -600,7 +620,7 @@ pub extern "C" fn Input_set_previous_utxo(this_ptr: &mut Input, mut val: crate:: /// script. #[no_mangle] pub extern "C" fn Input_get_satisfaction_weight(this_ptr: &Input) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().satisfaction_weight; + let mut inner_val = &mut Input::get_native_mut_ref(this_ptr).satisfaction_weight; *inner_val } /// The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and @@ -624,7 +644,7 @@ impl Clone for Input { fn clone(&self) -> Self { Self { inner: if <*mut nativeInput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -632,12 +652,12 @@ impl Clone for Input { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Input_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Input pub extern "C" fn Input_clone(orig: &Input) -> Input { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Input object pub extern "C" fn Input_debug_str_void(o: *const c_void) -> Str { @@ -725,7 +745,7 @@ impl Utxo { /// The unique identifier of the output. #[no_mangle] pub extern "C" fn Utxo_get_outpoint(this_ptr: &Utxo) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut Utxo::get_native_mut_ref(this_ptr).outpoint; crate::c_types::bitcoin_to_C_outpoint(inner_val) } /// The unique identifier of the output. @@ -736,7 +756,7 @@ pub extern "C" fn Utxo_set_outpoint(this_ptr: &mut Utxo, mut val: crate::lightni /// The output to spend. #[no_mangle] pub extern "C" fn Utxo_get_output(this_ptr: &Utxo) -> crate::c_types::TxOut { - let mut inner_val = &mut this_ptr.get_native_mut_ref().output; + let mut inner_val = &mut Utxo::get_native_mut_ref(this_ptr).output; crate::c_types::TxOut::from_rust(inner_val) } /// The output to spend. @@ -749,7 +769,7 @@ pub extern "C" fn Utxo_set_output(this_ptr: &mut Utxo, mut val: crate::c_types:: /// the input's `script_sig` must account for [`WITNESS_SCALE_FACTOR`]. #[no_mangle] pub extern "C" fn Utxo_get_satisfaction_weight(this_ptr: &Utxo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().satisfaction_weight; + let mut inner_val = &mut Utxo::get_native_mut_ref(this_ptr).satisfaction_weight; *inner_val } /// The upper-bound weight consumed by the input's full [`TxIn::script_sig`] and [`TxIn::witness`], each @@ -773,7 +793,7 @@ impl Clone for Utxo { fn clone(&self) -> Self { Self { inner: if <*mut nativeUtxo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -781,12 +801,12 @@ impl Clone for Utxo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Utxo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUtxo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUtxo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Utxo pub extern "C" fn Utxo_clone(orig: &Utxo) -> Utxo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Utxo object pub extern "C" fn Utxo_debug_str_void(o: *const c_void) -> Str { @@ -810,6 +830,22 @@ pub extern "C" fn Utxo_eq(a: &Utxo, b: &Utxo) -> bool { 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 Utxo object into a byte array which can be read by Utxo_read +pub extern "C" fn Utxo_write(obj: &crate::lightning::events::bump_transaction::Utxo) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn Utxo_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::events::bump_transaction::nativeUtxo) }) +} +#[no_mangle] +/// Read a Utxo from a byte array, created by Utxo_write +pub extern "C" fn Utxo_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UtxoDecodeErrorZ { + 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::Utxo { 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 a `Utxo` with the `satisfaction_weight` estimate for a legacy P2PKH output. #[must_use] #[no_mangle] @@ -883,7 +919,7 @@ impl CoinSelection { /// requiring additional fees. #[no_mangle] pub extern "C" fn CoinSelection_get_confirmed_utxos(this_ptr: &CoinSelection) -> crate::c_types::derived::CVec_UtxoZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmed_utxos; + let mut inner_val = &mut CoinSelection::get_native_mut_ref(this_ptr).confirmed_utxos; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::events::bump_transaction::Utxo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::events::bump_transaction::Utxo<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -900,7 +936,7 @@ pub extern "C" fn CoinSelection_set_confirmed_utxos(this_ptr: &mut CoinSelection /// not met. This implies no other party should be able to spend it except us. #[no_mangle] pub extern "C" fn CoinSelection_get_change_output(this_ptr: &CoinSelection) -> crate::c_types::derived::COption_TxOutZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().change_output; + let mut inner_val = &mut CoinSelection::get_native_mut_ref(this_ptr).change_output; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_TxOutZ::None } else { crate::c_types::derived::COption_TxOutZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::TxOut::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } @@ -928,7 +964,7 @@ impl Clone for CoinSelection { fn clone(&self) -> Self { Self { inner: if <*mut nativeCoinSelection>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -936,411 +972,13 @@ impl Clone for CoinSelection { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CoinSelection_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCoinSelection)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCoinSelection) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CoinSelection pub extern "C" fn CoinSelection_clone(orig: &CoinSelection) -> CoinSelection { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CoinSelection object pub extern "C" fn CoinSelection_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::bump_transaction::CoinSelection }).into()} -/// An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can -/// sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, -/// which most wallets should be able to satisfy. Otherwise, consider implementing [`WalletSource`], -/// which can provide a default implementation of this trait when used with [`Wallet`]. -#[repr(C)] -pub struct CoinSelectionSource { - /// 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, - /// Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are - /// available to spend. Implementations are free to pick their coin selection algorithm of - /// choice, as long as the following requirements are met: - /// - /// 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction - /// throughout coin selection, but must not be returned as part of the result. - /// 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction - /// throughout coin selection. In some cases, like when funding an anchor transaction, this - /// set is empty. Implementations should ensure they handle this correctly on their end, - /// e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be - /// provided, in which case a zero-value empty OP_RETURN output can be used instead. - /// 3. Enough inputs must be selected/contributed for the resulting transaction (including the - /// inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. - /// - /// Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of - /// the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require - /// providing the full input weight. Failing to do so may lead to underestimating fee bumps and - /// delaying block inclusion. - /// - /// The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they - /// can be re-used within new fee-bumped iterations of the original claiming transaction, - /// ensuring that claims don't double spend each other. If a specific `claim_id` has never had a - /// transaction associated with it, and all of the available UTXOs have already been assigned to - /// other claims, implementations must be willing to double spend their UTXOs. The choice of - /// which UTXOs to double spend is left to the implementation, but it must strive to keep the - /// set of other claims being double spent to a minimum. - pub select_confirmed_utxos: extern "C" fn (this_arg: *const c_void, claim_id: crate::c_types::ThirtyTwoBytes, must_spend: crate::c_types::derived::CVec_InputZ, must_pay_to: crate::c_types::derived::CVec_TxOutZ, target_feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_CoinSelectionNoneZ, - /// Signs and provides the full witness for all inputs within the transaction known to the - /// trait (i.e., any provided via [`CoinSelectionSource::select_confirmed_utxos`]). - /// - /// If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - /// unsigned transaction and then sign it with your wallet. - pub sign_psbt: extern "C" fn (this_arg: *const c_void, psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ, - /// 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 CoinSelectionSource {} -unsafe impl Sync for CoinSelectionSource {} -#[allow(unused)] -pub(crate) fn CoinSelectionSource_clone_fields(orig: &CoinSelectionSource) -> CoinSelectionSource { - CoinSelectionSource { - this_arg: orig.this_arg, - select_confirmed_utxos: Clone::clone(&orig.select_confirmed_utxos), - sign_psbt: Clone::clone(&orig.sign_psbt), - free: Clone::clone(&orig.free), - } -} - -use lightning::events::bump_transaction::CoinSelectionSource as rustCoinSelectionSource; -impl rustCoinSelectionSource for CoinSelectionSource { - fn select_confirmed_utxos(&self, mut claim_id: lightning::chain::ClaimId, mut must_spend: Vec, mut must_pay_to: &[bitcoin::TxOut], mut target_feerate_sat_per_1000_weight: u32) -> Result { - let mut local_must_spend = Vec::new(); for mut item in must_spend.drain(..) { local_must_spend.push( { crate::lightning::events::bump_transaction::Input { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut local_must_pay_to_clone = Vec::new(); local_must_pay_to_clone.extend_from_slice(must_pay_to); let mut must_pay_to = local_must_pay_to_clone; let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.drain(..) { local_must_pay_to.push( { crate::c_types::TxOut::from_rust(&item) }); }; - let mut ret = (self.select_confirmed_utxos)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: claim_id.0 }, local_must_spend.into(), local_must_pay_to.into(), target_feerate_sat_per_1000_weight); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn sign_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { - let mut ret = (self.sign_psbt)(self.this_arg, psbt.serialize().into()); - let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } -} - -pub struct CoinSelectionSourceRef(CoinSelectionSource); -impl rustCoinSelectionSource for CoinSelectionSourceRef { - fn select_confirmed_utxos(&self, mut claim_id: lightning::chain::ClaimId, mut must_spend: Vec, mut must_pay_to: &[bitcoin::TxOut], mut target_feerate_sat_per_1000_weight: u32) -> Result { - let mut local_must_spend = Vec::new(); for mut item in must_spend.drain(..) { local_must_spend.push( { crate::lightning::events::bump_transaction::Input { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut local_must_pay_to_clone = Vec::new(); local_must_pay_to_clone.extend_from_slice(must_pay_to); let mut must_pay_to = local_must_pay_to_clone; let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.drain(..) { local_must_pay_to.push( { crate::c_types::TxOut::from_rust(&item) }); }; - let mut ret = (self.0.select_confirmed_utxos)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: claim_id.0 }, local_must_spend.into(), local_must_pay_to.into(), target_feerate_sat_per_1000_weight); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn sign_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { - let mut ret = (self.0.sign_psbt)(self.0.this_arg, psbt.serialize().into()); - let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - 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 CoinSelectionSource { - type Target = CoinSelectionSourceRef; - fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const CoinSelectionSourceRef) } - } -} -impl core::ops::DerefMut for CoinSelectionSource { - fn deref_mut(&mut self) -> &mut CoinSelectionSourceRef { - unsafe { &mut *(self as *mut _ as *mut CoinSelectionSourceRef) } - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn CoinSelectionSource_free(this_ptr: CoinSelectionSource) { } -impl Drop for CoinSelectionSource { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} -/// An alternative to [`CoinSelectionSource`] that can be implemented and used along [`Wallet`] to -/// provide a default implementation to [`CoinSelectionSource`]. -#[repr(C)] -pub struct WalletSource { - /// 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 all UTXOs, with at least 1 confirmation each, that are available to spend. - 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_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`]). - /// - /// If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the - /// unsigned transaction and then sign it with your wallet. - pub sign_psbt: extern "C" fn (this_arg: *const c_void, psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ, - /// 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 WalletSource {} -unsafe impl Sync for WalletSource {} -#[allow(unused)] -pub(crate) fn WalletSource_clone_fields(orig: &WalletSource) -> WalletSource { - WalletSource { - this_arg: orig.this_arg, - list_confirmed_utxos: Clone::clone(&orig.list_confirmed_utxos), - get_change_script: Clone::clone(&orig.get_change_script), - sign_psbt: Clone::clone(&orig.sign_psbt), - free: Clone::clone(&orig.free), - } -} - -use lightning::events::bump_transaction::WalletSource as rustWalletSource; -impl rustWalletSource for WalletSource { - fn list_confirmed_utxos(&self) -> Result, ()> { - let mut ret = (self.list_confirmed_utxos)(self.this_arg); - 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn get_change_script(&self) -> Result { - let mut ret = (self.get_change_script)(self.this_arg); - let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { - let mut ret = (self.sign_psbt)(self.this_arg, psbt.serialize().into()); - let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } -} - -pub struct WalletSourceRef(WalletSource); -impl rustWalletSource for WalletSourceRef { - fn list_confirmed_utxos(&self) -> Result, ()> { - let mut ret = (self.0.list_confirmed_utxos)(self.0.this_arg); - 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn get_change_script(&self) -> Result { - let mut ret = (self.0.get_change_script)(self.0.this_arg); - let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { - let mut ret = (self.0.sign_psbt)(self.0.this_arg, psbt.serialize().into()); - let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - 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 WalletSource { - type Target = WalletSourceRef; - fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const WalletSourceRef) } - } -} -impl core::ops::DerefMut for WalletSource { - fn deref_mut(&mut self) -> &mut WalletSourceRef { - unsafe { &mut *(self as *mut _ as *mut WalletSourceRef) } - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn WalletSource_free(this_ptr: WalletSource) { } -impl Drop for WalletSource { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} - -use lightning::events::bump_transaction::Wallet as nativeWalletImport; -pub(crate) type nativeWallet = nativeWalletImport; - -/// A wrapper over [`WalletSource`] that implements [`CoinSelection`] by preferring UTXOs that would -/// avoid conflicting double spends. If not enough UTXOs are available to do so, conflicting double -/// spends may happen. -#[must_use] -#[repr(C)] -pub struct Wallet { - /// 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 nativeWallet, - /// 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 core::ops::Deref for Wallet { - type Target = nativeWallet; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for Wallet { } -unsafe impl core::marker::Sync for Wallet { } -impl Drop for Wallet { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeWallet>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the Wallet, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn Wallet_free(this_obj: Wallet) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn Wallet_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeWallet) }; -} -#[allow(unused)] -impl Wallet { - pub(crate) fn get_native_ref(&self) -> &'static nativeWallet { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeWallet { - 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 nativeWallet { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Returns a new instance backed by the given [`WalletSource`] that serves as an implementation -/// of [`CoinSelectionSource`]. -#[must_use] -#[no_mangle] -pub extern "C" fn Wallet_new(mut source: crate::lightning::events::bump_transaction::WalletSource, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::events::bump_transaction::Wallet { - let mut ret = lightning::events::bump_transaction::Wallet::new(source, logger); - crate::lightning::events::bump_transaction::Wallet { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -impl From for crate::lightning::events::bump_transaction::CoinSelectionSource { - fn from(obj: nativeWallet) -> Self { - let rust_obj = crate::lightning::events::bump_transaction::Wallet { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = Wallet_as_CoinSelectionSource(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn - core::mem::forget(rust_obj); - ret.free = Some(Wallet_free_void); - ret - } -} -/// Constructs a new CoinSelectionSource which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSource must be freed before this_arg is -#[no_mangle] -pub extern "C" fn Wallet_as_CoinSelectionSource(this_arg: &Wallet) -> crate::lightning::events::bump_transaction::CoinSelectionSource { - crate::lightning::events::bump_transaction::CoinSelectionSource { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - select_confirmed_utxos: Wallet_CoinSelectionSource_select_confirmed_utxos, - sign_psbt: Wallet_CoinSelectionSource_sign_psbt, - } -} - -#[must_use] -extern "C" fn Wallet_CoinSelectionSource_select_confirmed_utxos(this_arg: *const c_void, mut claim_id: crate::c_types::ThirtyTwoBytes, mut must_spend: crate::c_types::derived::CVec_InputZ, mut must_pay_to: crate::c_types::derived::CVec_TxOutZ, mut target_feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_CoinSelectionNoneZ { - let mut local_must_spend = Vec::new(); for mut item in must_spend.into_rust().drain(..) { local_must_spend.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.into_rust().drain(..) { local_must_pay_to.push( { item.into_rust() }); }; - let mut ret = ::select_confirmed_utxos(unsafe { &mut *(this_arg as *mut nativeWallet) }, ::lightning::chain::ClaimId(claim_id.data), local_must_spend, &local_must_pay_to[..], target_feerate_sat_per_1000_weight); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::bump_transaction::CoinSelection { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} -#[must_use] -extern "C" fn Wallet_CoinSelectionSource_sign_psbt(this_arg: *const c_void, mut psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ { - let mut ret = ::sign_psbt(unsafe { &mut *(this_arg as *mut nativeWallet) }, ::bitcoin::Psbt::deserialize(psbt.as_slice()).expect("Invalid PSBT format")); - 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 -} - - -use lightning::events::bump_transaction::BumpTransactionEventHandler as nativeBumpTransactionEventHandlerImport; -pub(crate) type nativeBumpTransactionEventHandler = nativeBumpTransactionEventHandlerImport; - -/// A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a -/// [`CoinSelectionSource`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or -/// Replace-By-Fee (RBF). -/// -/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction -#[must_use] -#[repr(C)] -pub struct BumpTransactionEventHandler { - /// 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 nativeBumpTransactionEventHandler, - /// 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 core::ops::Deref for BumpTransactionEventHandler { - type Target = nativeBumpTransactionEventHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for BumpTransactionEventHandler { } -unsafe impl core::marker::Sync for BumpTransactionEventHandler { } -impl Drop for BumpTransactionEventHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeBumpTransactionEventHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the BumpTransactionEventHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn BumpTransactionEventHandler_free(this_obj: BumpTransactionEventHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn BumpTransactionEventHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBumpTransactionEventHandler) }; -} -#[allow(unused)] -impl BumpTransactionEventHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeBumpTransactionEventHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBumpTransactionEventHandler { - 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 nativeBumpTransactionEventHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Returns a new instance capable of handling [`Event::BumpTransaction`] events. -/// -/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction -#[must_use] -#[no_mangle] -pub extern "C" fn BumpTransactionEventHandler_new(mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut utxo_source: crate::lightning::events::bump_transaction::CoinSelectionSource, mut signer_provider: crate::lightning::sign::SignerProvider, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::events::bump_transaction::BumpTransactionEventHandler { - let mut ret = lightning::events::bump_transaction::BumpTransactionEventHandler::new(broadcaster, utxo_source, signer_provider, logger); - crate::lightning::events::bump_transaction::BumpTransactionEventHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Handles all variants of [`BumpTransactionEvent`]. -#[no_mangle] -pub extern "C" fn BumpTransactionEventHandler_handle_event(this_arg: &crate::lightning::events::bump_transaction::BumpTransactionEventHandler, event: &crate::lightning::events::bump_transaction::BumpTransactionEvent) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_event(&event.to_native()) -} - diff --git a/lightning-c-bindings/src/lightning/events/bump_transaction/sync.rs b/lightning-c-bindings/src/lightning/events/bump_transaction/sync.rs new file mode 100644 index 00000000..dcc4e29a --- /dev/null +++ b/lightning-c-bindings/src/lightning/events/bump_transaction/sync.rs @@ -0,0 +1,434 @@ +// 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. + +//! This module provides synchronous wrappers around [`BumpTransactionEventHandler`] and related types. + +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}; + +/// An alternative to [`CoinSelectionSourceSync`] that can be implemented and used along +/// [`WalletSync`] to provide a default implementation to [`CoinSelectionSourceSync`]. +/// +/// For an asynchronous version of this trait, see [`WalletSource`]. +#[repr(C)] +pub struct WalletSourceSync { + /// 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 all UTXOs, with at least 1 confirmation each, that are available to spend. + 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_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`]). + /// + /// If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + /// unsigned transaction and then sign it with your wallet. + /// + /// [`TxIn::script_sig`]: bitcoin::TxIn::script_sig + /// [`TxIn::witness`]: bitcoin::TxIn::witness + pub sign_psbt: extern "C" fn (this_arg: *const c_void, psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ, + /// 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 WalletSourceSync {} +unsafe impl Sync for WalletSourceSync {} +#[allow(unused)] +pub(crate) fn WalletSourceSync_clone_fields(orig: &WalletSourceSync) -> WalletSourceSync { + WalletSourceSync { + this_arg: orig.this_arg, + list_confirmed_utxos: Clone::clone(&orig.list_confirmed_utxos), + get_change_script: Clone::clone(&orig.get_change_script), + sign_psbt: Clone::clone(&orig.sign_psbt), + free: Clone::clone(&orig.free), + } +} + +use lightning::events::bump_transaction::sync::WalletSourceSync as rustWalletSourceSync; +impl rustWalletSourceSync for WalletSourceSync { + fn list_confirmed_utxos(&self) -> Result, ()> { + let mut ret = (self.list_confirmed_utxos)(self.this_arg); + 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn get_change_script(&self) -> Result { + let mut ret = (self.get_change_script)(self.this_arg); + let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { + let mut ret = (self.sign_psbt)(self.this_arg, psbt.serialize().into()); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } +} + +pub struct WalletSourceSyncRef(WalletSourceSync); +impl rustWalletSourceSync for WalletSourceSyncRef { + fn list_confirmed_utxos(&self) -> Result, ()> { + let mut ret = (self.0.list_confirmed_utxos)(self.0.this_arg); + 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn get_change_script(&self) -> Result { + let mut ret = (self.0.get_change_script)(self.0.this_arg); + let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { + let mut ret = (self.0.sign_psbt)(self.0.this_arg, psbt.serialize().into()); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + 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 WalletSourceSync { + type Target = WalletSourceSyncRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const WalletSourceSyncRef) } + } +} +impl core::ops::DerefMut for WalletSourceSync { + fn deref_mut(&mut self) -> &mut WalletSourceSyncRef { + unsafe { &mut *(self as *mut _ as *mut WalletSourceSyncRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn WalletSourceSync_free(this_ptr: WalletSourceSync) { } +impl Drop for WalletSourceSync { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} + +use lightning::events::bump_transaction::sync::WalletSync as nativeWalletSyncImport; +pub(crate) type nativeWalletSync = nativeWalletSyncImport; + +/// A wrapper over [`WalletSourceSync`] that implements [`CoinSelectionSourceSync`] by preferring +/// UTXOs that would avoid conflicting double spends. If not enough UTXOs are available to do so, +/// conflicting double spends may happen. +/// +/// For an asynchronous version of this wrapper, see [`Wallet`]. +#[must_use] +#[repr(C)] +pub struct WalletSync { + /// 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 nativeWalletSync, + /// 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 core::ops::Deref for WalletSync { + type Target = nativeWalletSync; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for WalletSync { } +unsafe impl core::marker::Sync for WalletSync { } +impl Drop for WalletSync { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeWalletSync>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the WalletSync, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn WalletSync_free(this_obj: WalletSync) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn WalletSync_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeWalletSync) }; +} +#[allow(unused)] +impl WalletSync { + pub(crate) fn get_native_ref(&self) -> &'static nativeWalletSync { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeWalletSync { + 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 nativeWalletSync { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new [`WalletSync`] instance. +#[must_use] +#[no_mangle] +pub extern "C" fn WalletSync_new(mut source: crate::lightning::events::bump_transaction::sync::WalletSourceSync, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::events::bump_transaction::sync::WalletSync { + let mut ret = lightning::events::bump_transaction::sync::WalletSync::new(source, logger); + crate::lightning::events::bump_transaction::sync::WalletSync { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +impl From for crate::lightning::events::bump_transaction::sync::CoinSelectionSourceSync { + fn from(obj: nativeWalletSync) -> Self { + let rust_obj = crate::lightning::events::bump_transaction::sync::WalletSync { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = WalletSync_as_CoinSelectionSourceSync(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(WalletSync_free_void); + ret + } +} +/// Constructs a new CoinSelectionSourceSync which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned CoinSelectionSourceSync must be freed before this_arg is +#[no_mangle] +pub extern "C" fn WalletSync_as_CoinSelectionSourceSync(this_arg: &WalletSync) -> crate::lightning::events::bump_transaction::sync::CoinSelectionSourceSync { + crate::lightning::events::bump_transaction::sync::CoinSelectionSourceSync { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + select_confirmed_utxos: WalletSync_CoinSelectionSourceSync_select_confirmed_utxos, + sign_psbt: WalletSync_CoinSelectionSourceSync_sign_psbt, + } +} + +#[must_use] +extern "C" fn WalletSync_CoinSelectionSourceSync_select_confirmed_utxos(this_arg: *const c_void, mut claim_id: crate::c_types::ThirtyTwoBytes, mut must_spend: crate::c_types::derived::CVec_InputZ, mut must_pay_to: crate::c_types::derived::CVec_TxOutZ, mut target_feerate_sat_per_1000_weight: u32, mut max_tx_weight: u64) -> crate::c_types::derived::CResult_CoinSelectionNoneZ { + let mut local_must_spend = Vec::new(); for mut item in must_spend.into_rust().drain(..) { local_must_spend.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.into_rust().drain(..) { local_must_pay_to.push( { item.into_rust() }); }; + let mut ret = ::select_confirmed_utxos(unsafe { &mut *(this_arg as *mut nativeWalletSync) }, ::lightning::chain::ClaimId(claim_id.data), local_must_spend, &local_must_pay_to[..], target_feerate_sat_per_1000_weight, max_tx_weight); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::events::bump_transaction::CoinSelection { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn WalletSync_CoinSelectionSourceSync_sign_psbt(this_arg: *const c_void, mut psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ { + let mut ret = ::sign_psbt(unsafe { &mut *(this_arg as *mut nativeWalletSync) }, ::bitcoin::Psbt::deserialize(psbt.as_slice()).expect("Invalid PSBT format")); + 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 +} + +/// An abstraction over a bitcoin wallet that can perform coin selection over a set of UTXOs and can +/// sign for them. The coin selection method aims to mimic Bitcoin Core's `fundrawtransaction` RPC, +/// which most wallets should be able to satisfy. Otherwise, consider implementing +/// [`WalletSourceSync`], which can provide a default implementation of this trait when used with +/// [`WalletSync`]. +/// +/// For an asynchronous version of this trait, see [`CoinSelectionSource`]. +#[repr(C)] +pub struct CoinSelectionSourceSync { + /// 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, + /// Performs coin selection of a set of UTXOs, with at least 1 confirmation each, that are + /// available to spend. Implementations are free to pick their coin selection algorithm of + /// choice, as long as the following requirements are met: + /// + /// 1. `must_spend` contains a set of [`Input`]s that must be included in the transaction + /// throughout coin selection, but must not be returned as part of the result. + /// 2. `must_pay_to` contains a set of [`TxOut`]s that must be included in the transaction + /// throughout coin selection. In some cases, like when funding an anchor transaction, this + /// set is empty. Implementations should ensure they handle this correctly on their end, + /// e.g., Bitcoin Core's `fundrawtransaction` RPC requires at least one output to be + /// provided, in which case a zero-value empty OP_RETURN output can be used instead. + /// 3. Enough inputs must be selected/contributed for the resulting transaction (including the + /// inputs and outputs noted above) to meet `target_feerate_sat_per_1000_weight`. + /// 4. The final transaction must have a weight smaller than `max_tx_weight`; if this + /// constraint can't be met, return an `Err`. In the case of counterparty-signed HTLC + /// transactions, we will remove a chunk of HTLCs and try your algorithm again. As for + /// anchor transactions, we will try your coin selection again with the same input-output + /// set when you call [`ChannelMonitor::rebroadcast_pending_claims`], as anchor transactions + /// cannot be downsized. + /// + /// Implementations must take note that [`Input::satisfaction_weight`] only tracks the weight of + /// the input's `script_sig` and `witness`. Some wallets, like Bitcoin Core's, may require + /// providing the full input weight. Failing to do so may lead to underestimating fee bumps and + /// delaying block inclusion. + /// + /// The `claim_id` must map to the set of external UTXOs assigned to the claim, such that they + /// can be re-used within new fee-bumped iterations of the original claiming transaction, + /// ensuring that claims don't double spend each other. If a specific `claim_id` has never had a + /// transaction associated with it, and all of the available UTXOs have already been assigned to + /// other claims, implementations must be willing to double spend their UTXOs. The choice of + /// which UTXOs to double spend is left to the implementation, but it must strive to keep the + /// set of other claims being double spent to a minimum. + /// + /// [`ChannelMonitor::rebroadcast_pending_claims`]: crate::chain::channelmonitor::ChannelMonitor::rebroadcast_pending_claims + pub select_confirmed_utxos: extern "C" fn (this_arg: *const c_void, claim_id: crate::c_types::ThirtyTwoBytes, must_spend: crate::c_types::derived::CVec_InputZ, must_pay_to: crate::c_types::derived::CVec_TxOutZ, target_feerate_sat_per_1000_weight: u32, max_tx_weight: u64) -> crate::c_types::derived::CResult_CoinSelectionNoneZ, + /// Signs and provides the full witness for all inputs within the transaction known to the + /// trait (i.e., any provided via [`CoinSelectionSourceSync::select_confirmed_utxos`]). + /// + /// If your wallet does not support signing PSBTs you can call `psbt.extract_tx()` to get the + /// unsigned transaction and then sign it with your wallet. + pub sign_psbt: extern "C" fn (this_arg: *const c_void, psbt: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_TransactionNoneZ, + /// 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 CoinSelectionSourceSync {} +unsafe impl Sync for CoinSelectionSourceSync {} +#[allow(unused)] +pub(crate) fn CoinSelectionSourceSync_clone_fields(orig: &CoinSelectionSourceSync) -> CoinSelectionSourceSync { + CoinSelectionSourceSync { + this_arg: orig.this_arg, + select_confirmed_utxos: Clone::clone(&orig.select_confirmed_utxos), + sign_psbt: Clone::clone(&orig.sign_psbt), + free: Clone::clone(&orig.free), + } +} + +use lightning::events::bump_transaction::sync::CoinSelectionSourceSync as rustCoinSelectionSourceSync; +impl rustCoinSelectionSourceSync for CoinSelectionSourceSync { + fn select_confirmed_utxos(&self, mut claim_id: lightning::chain::ClaimId, mut must_spend: Vec, mut must_pay_to: &[bitcoin::TxOut], mut target_feerate_sat_per_1000_weight: u32, mut max_tx_weight: u64) -> Result { + let mut local_must_spend = Vec::new(); for mut item in must_spend.drain(..) { local_must_spend.push( { crate::lightning::events::bump_transaction::Input { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_must_pay_to_clone = Vec::new(); local_must_pay_to_clone.extend_from_slice(must_pay_to); let mut must_pay_to = local_must_pay_to_clone; let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.drain(..) { local_must_pay_to.push( { crate::c_types::TxOut::from_rust(&item) }); }; + let mut ret = (self.select_confirmed_utxos)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: claim_id.0 }, local_must_spend.into(), local_must_pay_to.into(), target_feerate_sat_per_1000_weight, max_tx_weight); + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn sign_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { + let mut ret = (self.sign_psbt)(self.this_arg, psbt.serialize().into()); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } +} + +pub struct CoinSelectionSourceSyncRef(CoinSelectionSourceSync); +impl rustCoinSelectionSourceSync for CoinSelectionSourceSyncRef { + fn select_confirmed_utxos(&self, mut claim_id: lightning::chain::ClaimId, mut must_spend: Vec, mut must_pay_to: &[bitcoin::TxOut], mut target_feerate_sat_per_1000_weight: u32, mut max_tx_weight: u64) -> Result { + let mut local_must_spend = Vec::new(); for mut item in must_spend.drain(..) { local_must_spend.push( { crate::lightning::events::bump_transaction::Input { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_must_pay_to_clone = Vec::new(); local_must_pay_to_clone.extend_from_slice(must_pay_to); let mut must_pay_to = local_must_pay_to_clone; let mut local_must_pay_to = Vec::new(); for mut item in must_pay_to.drain(..) { local_must_pay_to.push( { crate::c_types::TxOut::from_rust(&item) }); }; + let mut ret = (self.0.select_confirmed_utxos)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: claim_id.0 }, local_must_spend.into(), local_must_pay_to.into(), target_feerate_sat_per_1000_weight, max_tx_weight); + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn sign_psbt(&self, mut psbt: bitcoin::Psbt) -> Result { + let mut ret = (self.0.sign_psbt)(self.0.this_arg, psbt.serialize().into()); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_bitcoin() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + 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 CoinSelectionSourceSync { + type Target = CoinSelectionSourceSyncRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const CoinSelectionSourceSyncRef) } + } +} +impl core::ops::DerefMut for CoinSelectionSourceSync { + fn deref_mut(&mut self) -> &mut CoinSelectionSourceSyncRef { + unsafe { &mut *(self as *mut _ as *mut CoinSelectionSourceSyncRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn CoinSelectionSourceSync_free(this_ptr: CoinSelectionSourceSync) { } +impl Drop for CoinSelectionSourceSync { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} + +use lightning::events::bump_transaction::sync::BumpTransactionEventHandlerSync as nativeBumpTransactionEventHandlerSyncImport; +pub(crate) type nativeBumpTransactionEventHandlerSync = nativeBumpTransactionEventHandlerSyncImport; + +/// A handler for [`Event::BumpTransaction`] events that sources confirmed UTXOs from a +/// [`CoinSelectionSourceSync`] to fee bump transactions via Child-Pays-For-Parent (CPFP) or +/// Replace-By-Fee (RBF). +/// +/// For an asynchronous version of this handler, see [`BumpTransactionEventHandler`]. +/// +/// [`Event::BumpTransaction`]: crate::events::Event::BumpTransaction +#[must_use] +#[repr(C)] +pub struct BumpTransactionEventHandlerSync { + /// 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 nativeBumpTransactionEventHandlerSync, + /// 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 core::ops::Deref for BumpTransactionEventHandlerSync { + type Target = nativeBumpTransactionEventHandlerSync; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for BumpTransactionEventHandlerSync { } +unsafe impl core::marker::Sync for BumpTransactionEventHandlerSync { } +impl Drop for BumpTransactionEventHandlerSync { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeBumpTransactionEventHandlerSync>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the BumpTransactionEventHandlerSync, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn BumpTransactionEventHandlerSync_free(this_obj: BumpTransactionEventHandlerSync) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn BumpTransactionEventHandlerSync_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBumpTransactionEventHandlerSync) }; +} +#[allow(unused)] +impl BumpTransactionEventHandlerSync { + pub(crate) fn get_native_ref(&self) -> &'static nativeBumpTransactionEventHandlerSync { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBumpTransactionEventHandlerSync { + 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 nativeBumpTransactionEventHandlerSync { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new instance of [`BumpTransactionEventHandlerSync`]. +#[must_use] +#[no_mangle] +pub extern "C" fn BumpTransactionEventHandlerSync_new(mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut utxo_source: crate::lightning::events::bump_transaction::sync::CoinSelectionSourceSync, mut signer_provider: crate::lightning::sign::SignerProvider, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::events::bump_transaction::sync::BumpTransactionEventHandlerSync { + let mut ret = lightning::events::bump_transaction::sync::BumpTransactionEventHandlerSync::new(broadcaster, utxo_source, signer_provider, logger); + crate::lightning::events::bump_transaction::sync::BumpTransactionEventHandlerSync { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Handles all variants of [`BumpTransactionEvent`]. +#[no_mangle] +pub extern "C" fn BumpTransactionEventHandlerSync_handle_event(this_arg: &crate::lightning::events::bump_transaction::sync::BumpTransactionEventHandlerSync, event: &crate::lightning::events::bump_transaction::BumpTransactionEvent) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_event(&event.to_native()) +} + diff --git a/lightning-c-bindings/src/lightning/events/mod.rs b/lightning-c-bindings/src/lightning/events/mod.rs index ff28906c..0062689a 100644 --- a/lightning-c-bindings/src/lightning/events/mod.rs +++ b/lightning-c-bindings/src/lightning/events/mod.rs @@ -551,10 +551,33 @@ impl ClaimedHTLC { Self { inner: self.inner, is_owned: false } } } +/// The counterparty of the channel. +/// +/// This value will always be `None` for objects serialized with LDK versions prior to 0.2 and +/// `Some` otherwise. +/// +/// 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 ClaimedHTLC_get_counterparty_node_id(this_ptr: &ClaimedHTLC) -> crate::c_types::PublicKey { + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).counterparty_node_id; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; + local_inner_val +} +/// The counterparty of the channel. +/// +/// This value will always be `None` for objects serialized with LDK versions prior to 0.2 and +/// `Some` otherwise. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ClaimedHTLC_set_counterparty_node_id(this_ptr: &mut ClaimedHTLC, mut val: crate::c_types::PublicKey) { + let mut local_val = if val.is_null() { None } else { Some( { val.into_rust() }) }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_node_id = local_val; +} /// 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) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The `channel_id` of the channel over which the HTLC was received. @@ -577,7 +600,7 @@ pub extern "C" fn ClaimedHTLC_set_channel_id(this_ptr: &mut ClaimedHTLC, mut val /// [`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; + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).user_channel_id; inner_val.into() } /// The `user_channel_id` of the channel over which the HTLC was received. This is the value @@ -600,7 +623,7 @@ pub extern "C" fn ClaimedHTLC_set_user_channel_id(this_ptr: &mut ClaimedHTLC, mu /// 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; + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).cltv_expiry; *inner_val } /// The block height at which this HTLC expires. @@ -611,7 +634,7 @@ pub extern "C" fn ClaimedHTLC_set_cltv_expiry(this_ptr: &mut ClaimedHTLC, mut va /// 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; + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).value_msat; *inner_val } /// The amount (in msats) of this part of an MPP. @@ -625,7 +648,7 @@ pub extern "C" fn ClaimedHTLC_set_value_msat(this_ptr: &mut ClaimedHTLC, mut val /// 0.0.119. #[no_mangle] pub extern "C" fn ClaimedHTLC_get_counterparty_skimmed_fee_msat(this_ptr: &ClaimedHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_skimmed_fee_msat; + let mut inner_val = &mut ClaimedHTLC::get_native_mut_ref(this_ptr).counterparty_skimmed_fee_msat; *inner_val } /// The extra fee our counterparty skimmed off the top of this HTLC, if any. @@ -637,10 +660,14 @@ pub extern "C" fn ClaimedHTLC_set_counterparty_skimmed_fee_msat(this_ptr: &mut C unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.counterparty_skimmed_fee_msat = val; } /// Constructs a new ClaimedHTLC given each field +/// +/// Note that counterparty_node_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ClaimedHTLC_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut user_channel_id_arg: crate::c_types::U128, mut cltv_expiry_arg: u32, mut value_msat_arg: u64, mut counterparty_skimmed_fee_msat_arg: u64) -> ClaimedHTLC { +pub extern "C" fn ClaimedHTLC_new(mut counterparty_node_id_arg: crate::c_types::PublicKey, mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut user_channel_id_arg: crate::c_types::U128, mut cltv_expiry_arg: u32, mut value_msat_arg: u64, mut counterparty_skimmed_fee_msat_arg: u64) -> ClaimedHTLC { + let mut local_counterparty_node_id_arg = if counterparty_node_id_arg.is_null() { None } else { Some( { counterparty_node_id_arg.into_rust() }) }; ClaimedHTLC { inner: ObjOps::heap_alloc(nativeClaimedHTLC { + counterparty_node_id: local_counterparty_node_id_arg, channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, user_channel_id: user_channel_id_arg.into(), cltv_expiry: cltv_expiry_arg, @@ -652,7 +679,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -660,12 +687,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClaimedHTLC)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClaimedHTLC) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ClaimedHTLC pub extern "C" fn ClaimedHTLC_clone(orig: &ClaimedHTLC) -> ClaimedHTLC { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ClaimedHTLC object pub extern "C" fn ClaimedHTLC_debug_str_void(o: *const c_void) -> Str { @@ -867,26 +894,33 @@ pub enum ClosureReason { /// a security vulnerability in the terminal emulator or the logging subsystem. /// To be safe, use `Display` on `UntrustedString` /// - /// [`UntrustedString`]: crate::util::string::UntrustedString + /// [`UntrustedString`]: crate::types::string::UntrustedString peer_msg: crate::lightning_types::string::UntrustedString, }, - /// Closure generated from [`ChannelManager::force_close_channel`], called by the user. + /// Closure generated from [`ChannelManager::force_close_broadcasting_latest_txn`] or + /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`], called by the user. /// - /// [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel. + /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn + /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn HolderForceClosed { /// Whether or not the latest transaction was broadcasted when the channel was force /// closed. /// - /// Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have - /// this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`] - /// or force-closed prior to being funded will have this field set to false. + /// This will be set to `Some(true)` for any channels closed after their funding + /// transaction was (or might have been) broadcasted, and `Some(false)` for any channels + /// closed prior to their funding transaction being broadcasted. /// /// This will be `None` for objects generated or written by LDK 0.0.123 and /// earlier. - /// - /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn. - /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn. broadcasted_latest_txn: crate::c_types::derived::COption_boolZ, + /// The error message provided to [`ChannelManager::force_close_broadcasting_latest_txn`] or + /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]. + /// + /// This will be the empty string for objects generated or written by LDK 0.1 and earlier. + /// + /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn + /// [`ChannelManager::force_close_all_channels_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_all_channels_broadcasting_latest_txn + message: crate::c_types::Str, }, /// The channel was closed after negotiating a cooperative close and we've now broadcasted /// the cooperative close transaction. Note the shutdown may have been initiated by us. @@ -907,7 +941,8 @@ pub enum ClosureReason { /// commitment transaction came from our counterparty, but it may also have come from /// a copy of our own `ChannelMonitor`. CommitmentTxConfirmed, - /// The funding transaction failed to confirm in a timely manner on an inbound channel. + /// The funding transaction failed to confirm in a timely manner on an inbound channel or the + /// counterparty failed to fund the channel in a timely manner. FundingTimedOut, /// Closure generated from processing an event, likely a HTLC forward/relay/reception. ProcessingError { @@ -934,11 +969,22 @@ 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, + /// We requested a cooperative close of a channel that had not been funded yet. + /// The channel has been immediately closed. + /// + /// Note that events containing this variant will be lost on downgrade to a version of LDK + /// prior to 0.2. + LocallyCoopClosedUnfundedChannel, /// Another channel in the same funding batch closed before the funding transaction /// was ready to be broadcast. FundingBatchClosure, /// One of our HTLCs timed out in a channel, causing us to force close the channel. - HTLCsTimedOut, + HTLCsTimedOut { + /// The payment hash of an HTLC that timed out. + /// + /// Will be `None` for any event serialized by LDK prior to 0.2. + payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, + }, /// Our peer provided a feerate which violated our required minimum (fetched from our /// [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or /// [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]). @@ -968,11 +1014,13 @@ impl ClosureReason { peer_msg: *unsafe { Box::from_raw(peer_msg_nonref.take_inner()) }, } }, - ClosureReason::HolderForceClosed {ref broadcasted_latest_txn, } => { + ClosureReason::HolderForceClosed {ref broadcasted_latest_txn, ref message, } => { let mut broadcasted_latest_txn_nonref = Clone::clone(broadcasted_latest_txn); let mut local_broadcasted_latest_txn_nonref = if broadcasted_latest_txn_nonref.is_some() { Some( { broadcasted_latest_txn_nonref.take() }) } else { None }; + let mut message_nonref = Clone::clone(message); nativeClosureReason::HolderForceClosed { broadcasted_latest_txn: local_broadcasted_latest_txn_nonref, + message: message_nonref.into_string(), } }, ClosureReason::LegacyCooperativeClosure => nativeClosureReason::LegacyCooperativeClosure, @@ -989,8 +1037,15 @@ impl ClosureReason { ClosureReason::DisconnectedPeer => nativeClosureReason::DisconnectedPeer, ClosureReason::OutdatedChannelManager => nativeClosureReason::OutdatedChannelManager, ClosureReason::CounterpartyCoopClosedUnfundedChannel => nativeClosureReason::CounterpartyCoopClosedUnfundedChannel, + ClosureReason::LocallyCoopClosedUnfundedChannel => nativeClosureReason::LocallyCoopClosedUnfundedChannel, ClosureReason::FundingBatchClosure => nativeClosureReason::FundingBatchClosure, - ClosureReason::HTLCsTimedOut => nativeClosureReason::HTLCsTimedOut, + ClosureReason::HTLCsTimedOut {ref payment_hash, } => { + 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::types::payment::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; + nativeClosureReason::HTLCsTimedOut { + payment_hash: local_payment_hash_nonref, + } + }, ClosureReason::PeerFeerateTooLow {ref peer_feerate_sat_per_kw, ref required_feerate_sat_per_kw, } => { let mut peer_feerate_sat_per_kw_nonref = Clone::clone(peer_feerate_sat_per_kw); let mut required_feerate_sat_per_kw_nonref = Clone::clone(required_feerate_sat_per_kw); @@ -1009,10 +1064,11 @@ impl ClosureReason { peer_msg: *unsafe { Box::from_raw(peer_msg.take_inner()) }, } }, - ClosureReason::HolderForceClosed {mut broadcasted_latest_txn, } => { + ClosureReason::HolderForceClosed {mut broadcasted_latest_txn, mut message, } => { let mut local_broadcasted_latest_txn = if broadcasted_latest_txn.is_some() { Some( { broadcasted_latest_txn.take() }) } else { None }; nativeClosureReason::HolderForceClosed { broadcasted_latest_txn: local_broadcasted_latest_txn, + message: message.into_string(), } }, ClosureReason::LegacyCooperativeClosure => nativeClosureReason::LegacyCooperativeClosure, @@ -1028,8 +1084,14 @@ impl ClosureReason { ClosureReason::DisconnectedPeer => nativeClosureReason::DisconnectedPeer, ClosureReason::OutdatedChannelManager => nativeClosureReason::OutdatedChannelManager, ClosureReason::CounterpartyCoopClosedUnfundedChannel => nativeClosureReason::CounterpartyCoopClosedUnfundedChannel, + ClosureReason::LocallyCoopClosedUnfundedChannel => nativeClosureReason::LocallyCoopClosedUnfundedChannel, ClosureReason::FundingBatchClosure => nativeClosureReason::FundingBatchClosure, - ClosureReason::HTLCsTimedOut => nativeClosureReason::HTLCsTimedOut, + ClosureReason::HTLCsTimedOut {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::types::payment::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + nativeClosureReason::HTLCsTimedOut { + payment_hash: local_payment_hash, + } + }, ClosureReason::PeerFeerateTooLow {mut peer_feerate_sat_per_kw, mut required_feerate_sat_per_kw, } => { nativeClosureReason::PeerFeerateTooLow { peer_feerate_sat_per_kw: peer_feerate_sat_per_kw, @@ -1048,11 +1110,13 @@ impl ClosureReason { peer_msg: crate::lightning_types::string::UntrustedString { inner: ObjOps::heap_alloc(peer_msg_nonref), is_owned: true }, } }, - nativeClosureReason::HolderForceClosed {ref broadcasted_latest_txn, } => { + nativeClosureReason::HolderForceClosed {ref broadcasted_latest_txn, ref message, } => { let mut broadcasted_latest_txn_nonref = Clone::clone(broadcasted_latest_txn); let mut local_broadcasted_latest_txn_nonref = if broadcasted_latest_txn_nonref.is_none() { crate::c_types::derived::COption_boolZ::None } else { crate::c_types::derived::COption_boolZ::Some( { broadcasted_latest_txn_nonref.unwrap() }) }; + let mut message_nonref = Clone::clone(message); ClosureReason::HolderForceClosed { broadcasted_latest_txn: local_broadcasted_latest_txn_nonref, + message: message_nonref.into(), } }, nativeClosureReason::LegacyCooperativeClosure => ClosureReason::LegacyCooperativeClosure, @@ -1069,8 +1133,15 @@ impl ClosureReason { nativeClosureReason::DisconnectedPeer => ClosureReason::DisconnectedPeer, nativeClosureReason::OutdatedChannelManager => ClosureReason::OutdatedChannelManager, nativeClosureReason::CounterpartyCoopClosedUnfundedChannel => ClosureReason::CounterpartyCoopClosedUnfundedChannel, + nativeClosureReason::LocallyCoopClosedUnfundedChannel => ClosureReason::LocallyCoopClosedUnfundedChannel, nativeClosureReason::FundingBatchClosure => ClosureReason::FundingBatchClosure, - nativeClosureReason::HTLCsTimedOut => ClosureReason::HTLCsTimedOut, + nativeClosureReason::HTLCsTimedOut {ref payment_hash, } => { + 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_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.unwrap().0 } }) }; + ClosureReason::HTLCsTimedOut { + payment_hash: local_payment_hash_nonref, + } + }, nativeClosureReason::PeerFeerateTooLow {ref peer_feerate_sat_per_kw, ref required_feerate_sat_per_kw, } => { let mut peer_feerate_sat_per_kw_nonref = Clone::clone(peer_feerate_sat_per_kw); let mut required_feerate_sat_per_kw_nonref = Clone::clone(required_feerate_sat_per_kw); @@ -1089,10 +1160,11 @@ impl ClosureReason { peer_msg: crate::lightning_types::string::UntrustedString { inner: ObjOps::heap_alloc(peer_msg), is_owned: true }, } }, - nativeClosureReason::HolderForceClosed {mut broadcasted_latest_txn, } => { + nativeClosureReason::HolderForceClosed {mut broadcasted_latest_txn, mut message, } => { let mut local_broadcasted_latest_txn = if broadcasted_latest_txn.is_none() { crate::c_types::derived::COption_boolZ::None } else { crate::c_types::derived::COption_boolZ::Some( { broadcasted_latest_txn.unwrap() }) }; ClosureReason::HolderForceClosed { broadcasted_latest_txn: local_broadcasted_latest_txn, + message: message.into(), } }, nativeClosureReason::LegacyCooperativeClosure => ClosureReason::LegacyCooperativeClosure, @@ -1108,8 +1180,14 @@ impl ClosureReason { nativeClosureReason::DisconnectedPeer => ClosureReason::DisconnectedPeer, nativeClosureReason::OutdatedChannelManager => ClosureReason::OutdatedChannelManager, nativeClosureReason::CounterpartyCoopClosedUnfundedChannel => ClosureReason::CounterpartyCoopClosedUnfundedChannel, + nativeClosureReason::LocallyCoopClosedUnfundedChannel => ClosureReason::LocallyCoopClosedUnfundedChannel, nativeClosureReason::FundingBatchClosure => ClosureReason::FundingBatchClosure, - nativeClosureReason::HTLCsTimedOut => ClosureReason::HTLCsTimedOut, + nativeClosureReason::HTLCsTimedOut {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 } }) }; + ClosureReason::HTLCsTimedOut { + payment_hash: local_payment_hash, + } + }, nativeClosureReason::PeerFeerateTooLow {mut peer_feerate_sat_per_kw, mut required_feerate_sat_per_kw, } => { ClosureReason::PeerFeerateTooLow { peer_feerate_sat_per_kw: peer_feerate_sat_per_kw, @@ -1146,9 +1224,10 @@ pub extern "C" fn ClosureReason_counterparty_force_closed(peer_msg: crate::light } #[no_mangle] /// Utility method to constructs a new HolderForceClosed-variant ClosureReason -pub extern "C" fn ClosureReason_holder_force_closed(broadcasted_latest_txn: crate::c_types::derived::COption_boolZ) -> ClosureReason { +pub extern "C" fn ClosureReason_holder_force_closed(broadcasted_latest_txn: crate::c_types::derived::COption_boolZ, message: crate::c_types::Str) -> ClosureReason { ClosureReason::HolderForceClosed { broadcasted_latest_txn, + message, } } #[no_mangle] @@ -1191,13 +1270,20 @@ pub extern "C" fn ClosureReason_outdated_channel_manager() -> ClosureReason { pub extern "C" fn ClosureReason_counterparty_coop_closed_unfunded_channel() -> ClosureReason { ClosureReason::CounterpartyCoopClosedUnfundedChannel} #[no_mangle] +/// Utility method to constructs a new LocallyCoopClosedUnfundedChannel-variant ClosureReason +pub extern "C" fn ClosureReason_locally_coop_closed_unfunded_channel() -> ClosureReason { + ClosureReason::LocallyCoopClosedUnfundedChannel} +#[no_mangle] /// Utility method to constructs a new FundingBatchClosure-variant ClosureReason pub extern "C" fn ClosureReason_funding_batch_closure() -> ClosureReason { ClosureReason::FundingBatchClosure} #[no_mangle] /// Utility method to constructs a new HTLCsTimedOut-variant ClosureReason -pub extern "C" fn ClosureReason_htlcs_timed_out() -> ClosureReason { - ClosureReason::HTLCsTimedOut} +pub extern "C" fn ClosureReason_htlcs_timed_out(payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> ClosureReason { + ClosureReason::HTLCsTimedOut { + payment_hash, + } +} #[no_mangle] /// Utility method to constructs a new PeerFeerateTooLow-variant ClosureReason pub extern "C" fn ClosureReason_peer_feerate_too_low(peer_feerate_sat_per_kw: u32, required_feerate_sat_per_kw: u32) -> ClosureReason { @@ -1236,14 +1322,14 @@ pub extern "C" fn ClosureReason_read(ser: crate::c_types::u8slice) -> crate::c_t let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_ClosureReasonZ::None } else { crate::c_types::derived::COption_ClosureReasonZ::Some( { crate::lightning::events::ClosureReason::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } -/// Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. +/// The type of HTLC handling performed in [`Event::HTLCHandlingFailed`]. #[derive(Clone)] #[must_use] #[repr(C)] -pub enum HTLCDestination { +pub enum HTLCHandlingFailureType { /// We tried forwarding to a channel but failed to do so. An example of such an instance is when /// there is insufficient capacity in our outbound channel. - NextHopChannel { + Forward { /// The `node_id` of the next node. For backwards compatibility, this field is /// marked as optional, versions prior to 0.0.110 may not always be able to provide /// counterparty node information. @@ -1254,12 +1340,17 @@ pub enum HTLCDestination { channel_id: crate::lightning::ln::types::ChannelId, }, /// Scenario where we are unsure of the next node to forward the HTLC to. + /// + /// Deprecated: will only be used in versions before LDK v0.2.0. Downgrades will result in + /// this type being represented as [`Self::InvalidForward`]. UnknownNextHop { /// Short channel id we are requesting to forward an HTLC to. requested_forward_scid: u64, }, /// We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate /// intercept HTLC. + /// + /// In LDK v0.2.0 and greater, this variant replaces [`Self::UnknownNextHop`]. InvalidForward { /// Short channel id we are requesting to forward an HTLC to. requested_forward_scid: u64, @@ -1276,215 +1367,340 @@ pub enum HTLCDestination { /// * The counterparty node modified the HTLC in transit, /// * A probing attack where an intermediary node is trying to detect if we are the ultimate /// recipient for a payment. - FailedPayment { + Receive { /// The payment hash of the payment we attempted to process. payment_hash: crate::c_types::ThirtyTwoBytes, }, } -use lightning::events::HTLCDestination as HTLCDestinationImport; -pub(crate) type nativeHTLCDestination = HTLCDestinationImport; +use lightning::events::HTLCHandlingFailureType as HTLCHandlingFailureTypeImport; +pub(crate) type nativeHTLCHandlingFailureType = HTLCHandlingFailureTypeImport; -impl HTLCDestination { +impl HTLCHandlingFailureType { #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeHTLCDestination { + pub(crate) fn to_native(&self) -> nativeHTLCHandlingFailureType { match self { - HTLCDestination::NextHopChannel {ref node_id, ref channel_id, } => { + HTLCHandlingFailureType::Forward {ref node_id, ref channel_id, } => { let mut node_id_nonref = Clone::clone(node_id); let mut local_node_id_nonref = if node_id_nonref.is_null() { None } else { Some( { node_id_nonref.into_rust() }) }; let mut channel_id_nonref = Clone::clone(channel_id); - nativeHTLCDestination::NextHopChannel { + nativeHTLCHandlingFailureType::Forward { node_id: local_node_id_nonref, channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, } }, - HTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { + HTLCHandlingFailureType::UnknownNextHop {ref requested_forward_scid, } => { let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); - nativeHTLCDestination::UnknownNextHop { + nativeHTLCHandlingFailureType::UnknownNextHop { requested_forward_scid: requested_forward_scid_nonref, } }, - HTLCDestination::InvalidForward {ref requested_forward_scid, } => { + HTLCHandlingFailureType::InvalidForward {ref requested_forward_scid, } => { let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); - nativeHTLCDestination::InvalidForward { + nativeHTLCHandlingFailureType::InvalidForward { requested_forward_scid: requested_forward_scid_nonref, } }, - HTLCDestination::InvalidOnion => nativeHTLCDestination::InvalidOnion, - HTLCDestination::FailedPayment {ref payment_hash, } => { + HTLCHandlingFailureType::InvalidOnion => nativeHTLCHandlingFailureType::InvalidOnion, + HTLCHandlingFailureType::Receive {ref payment_hash, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); - nativeHTLCDestination::FailedPayment { + nativeHTLCHandlingFailureType::Receive { payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), } }, } } #[allow(unused)] - pub(crate) fn into_native(self) -> nativeHTLCDestination { + pub(crate) fn into_native(self) -> nativeHTLCHandlingFailureType { match self { - HTLCDestination::NextHopChannel {mut node_id, mut channel_id, } => { + HTLCHandlingFailureType::Forward {mut node_id, mut channel_id, } => { let mut local_node_id = if node_id.is_null() { None } else { Some( { node_id.into_rust() }) }; - nativeHTLCDestination::NextHopChannel { + nativeHTLCHandlingFailureType::Forward { node_id: local_node_id, channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, } }, - HTLCDestination::UnknownNextHop {mut requested_forward_scid, } => { - nativeHTLCDestination::UnknownNextHop { + HTLCHandlingFailureType::UnknownNextHop {mut requested_forward_scid, } => { + nativeHTLCHandlingFailureType::UnknownNextHop { requested_forward_scid: requested_forward_scid, } }, - HTLCDestination::InvalidForward {mut requested_forward_scid, } => { - nativeHTLCDestination::InvalidForward { + HTLCHandlingFailureType::InvalidForward {mut requested_forward_scid, } => { + nativeHTLCHandlingFailureType::InvalidForward { requested_forward_scid: requested_forward_scid, } }, - HTLCDestination::InvalidOnion => nativeHTLCDestination::InvalidOnion, - HTLCDestination::FailedPayment {mut payment_hash, } => { - nativeHTLCDestination::FailedPayment { + HTLCHandlingFailureType::InvalidOnion => nativeHTLCHandlingFailureType::InvalidOnion, + HTLCHandlingFailureType::Receive {mut payment_hash, } => { + nativeHTLCHandlingFailureType::Receive { payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), } }, } } #[allow(unused)] - pub(crate) fn from_native(native: &HTLCDestinationImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeHTLCDestination) }; + pub(crate) fn from_native(native: &HTLCHandlingFailureTypeImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeHTLCHandlingFailureType) }; match native { - nativeHTLCDestination::NextHopChannel {ref node_id, ref channel_id, } => { + nativeHTLCHandlingFailureType::Forward {ref node_id, ref channel_id, } => { let mut node_id_nonref = Clone::clone(node_id); let mut local_node_id_nonref = if node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(node_id_nonref.unwrap())) } }; let mut channel_id_nonref = Clone::clone(channel_id); - HTLCDestination::NextHopChannel { + HTLCHandlingFailureType::Forward { node_id: local_node_id_nonref, channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, } }, - nativeHTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { + nativeHTLCHandlingFailureType::UnknownNextHop {ref requested_forward_scid, } => { let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); - HTLCDestination::UnknownNextHop { + HTLCHandlingFailureType::UnknownNextHop { requested_forward_scid: requested_forward_scid_nonref, } }, - nativeHTLCDestination::InvalidForward {ref requested_forward_scid, } => { + nativeHTLCHandlingFailureType::InvalidForward {ref requested_forward_scid, } => { let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); - HTLCDestination::InvalidForward { + HTLCHandlingFailureType::InvalidForward { requested_forward_scid: requested_forward_scid_nonref, } }, - nativeHTLCDestination::InvalidOnion => HTLCDestination::InvalidOnion, - nativeHTLCDestination::FailedPayment {ref payment_hash, } => { + nativeHTLCHandlingFailureType::InvalidOnion => HTLCHandlingFailureType::InvalidOnion, + nativeHTLCHandlingFailureType::Receive {ref payment_hash, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); - HTLCDestination::FailedPayment { + HTLCHandlingFailureType::Receive { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } }, } } #[allow(unused)] - pub(crate) fn native_into(native: nativeHTLCDestination) -> Self { + pub(crate) fn native_into(native: nativeHTLCHandlingFailureType) -> Self { match native { - nativeHTLCDestination::NextHopChannel {mut node_id, mut channel_id, } => { + nativeHTLCHandlingFailureType::Forward {mut node_id, mut channel_id, } => { 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 { + HTLCHandlingFailureType::Forward { node_id: local_node_id, channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, } }, - nativeHTLCDestination::UnknownNextHop {mut requested_forward_scid, } => { - HTLCDestination::UnknownNextHop { + nativeHTLCHandlingFailureType::UnknownNextHop {mut requested_forward_scid, } => { + HTLCHandlingFailureType::UnknownNextHop { requested_forward_scid: requested_forward_scid, } }, - nativeHTLCDestination::InvalidForward {mut requested_forward_scid, } => { - HTLCDestination::InvalidForward { + nativeHTLCHandlingFailureType::InvalidForward {mut requested_forward_scid, } => { + HTLCHandlingFailureType::InvalidForward { requested_forward_scid: requested_forward_scid, } }, - nativeHTLCDestination::InvalidOnion => HTLCDestination::InvalidOnion, - nativeHTLCDestination::FailedPayment {mut payment_hash, } => { - HTLCDestination::FailedPayment { + nativeHTLCHandlingFailureType::InvalidOnion => HTLCHandlingFailureType::InvalidOnion, + nativeHTLCHandlingFailureType::Receive {mut payment_hash, } => { + HTLCHandlingFailureType::Receive { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, } }, } } } -/// Frees any resources used by the HTLCDestination +/// Frees any resources used by the HTLCHandlingFailureType #[no_mangle] -pub extern "C" fn HTLCDestination_free(this_ptr: HTLCDestination) { } -/// Creates a copy of the HTLCDestination +pub extern "C" fn HTLCHandlingFailureType_free(this_ptr: HTLCHandlingFailureType) { } +/// Creates a copy of the HTLCHandlingFailureType #[no_mangle] -pub extern "C" fn HTLCDestination_clone(orig: &HTLCDestination) -> HTLCDestination { +pub extern "C" fn HTLCHandlingFailureType_clone(orig: &HTLCHandlingFailureType) -> HTLCHandlingFailureType { orig.clone() } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn HTLCDestination_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HTLCDestination)).clone() })) as *mut c_void +pub(crate) extern "C" fn HTLCHandlingFailureType_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HTLCHandlingFailureType)).clone() })) as *mut c_void } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn HTLCDestination_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut HTLCDestination) }; +pub(crate) extern "C" fn HTLCHandlingFailureType_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut HTLCHandlingFailureType) }; } #[no_mangle] -/// Utility method to constructs a new NextHopChannel-variant HTLCDestination -pub extern "C" fn HTLCDestination_next_hop_channel(node_id: crate::c_types::PublicKey, channel_id: crate::lightning::ln::types::ChannelId) -> HTLCDestination { - HTLCDestination::NextHopChannel { +/// Utility method to constructs a new Forward-variant HTLCHandlingFailureType +pub extern "C" fn HTLCHandlingFailureType_forward(node_id: crate::c_types::PublicKey, channel_id: crate::lightning::ln::types::ChannelId) -> HTLCHandlingFailureType { + HTLCHandlingFailureType::Forward { node_id, channel_id, } } #[no_mangle] -/// Utility method to constructs a new UnknownNextHop-variant HTLCDestination -pub extern "C" fn HTLCDestination_unknown_next_hop(requested_forward_scid: u64) -> HTLCDestination { - HTLCDestination::UnknownNextHop { +/// Utility method to constructs a new UnknownNextHop-variant HTLCHandlingFailureType +pub extern "C" fn HTLCHandlingFailureType_unknown_next_hop(requested_forward_scid: u64) -> HTLCHandlingFailureType { + HTLCHandlingFailureType::UnknownNextHop { requested_forward_scid, } } #[no_mangle] -/// Utility method to constructs a new InvalidForward-variant HTLCDestination -pub extern "C" fn HTLCDestination_invalid_forward(requested_forward_scid: u64) -> HTLCDestination { - HTLCDestination::InvalidForward { +/// Utility method to constructs a new InvalidForward-variant HTLCHandlingFailureType +pub extern "C" fn HTLCHandlingFailureType_invalid_forward(requested_forward_scid: u64) -> HTLCHandlingFailureType { + HTLCHandlingFailureType::InvalidForward { requested_forward_scid, } } #[no_mangle] -/// Utility method to constructs a new InvalidOnion-variant HTLCDestination -pub extern "C" fn HTLCDestination_invalid_onion() -> HTLCDestination { - HTLCDestination::InvalidOnion} +/// Utility method to constructs a new InvalidOnion-variant HTLCHandlingFailureType +pub extern "C" fn HTLCHandlingFailureType_invalid_onion() -> HTLCHandlingFailureType { + HTLCHandlingFailureType::InvalidOnion} #[no_mangle] -/// Utility method to constructs a new FailedPayment-variant HTLCDestination -pub extern "C" fn HTLCDestination_failed_payment(payment_hash: crate::c_types::ThirtyTwoBytes) -> HTLCDestination { - HTLCDestination::FailedPayment { +/// Utility method to constructs a new Receive-variant HTLCHandlingFailureType +pub extern "C" fn HTLCHandlingFailureType_receive(payment_hash: crate::c_types::ThirtyTwoBytes) -> HTLCHandlingFailureType { + HTLCHandlingFailureType::Receive { payment_hash, } } -/// Get a string which allows debug introspection of a HTLCDestination object -pub extern "C" fn HTLCDestination_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::HTLCDestination }).into()} -/// Checks if two HTLCDestinations contain equal inner contents. +/// Get a string which allows debug introspection of a HTLCHandlingFailureType object +pub extern "C" fn HTLCHandlingFailureType_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::HTLCHandlingFailureType }).into()} +/// Checks if two HTLCHandlingFailureTypes contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn HTLCHandlingFailureType_eq(a: &HTLCHandlingFailureType, b: &HTLCHandlingFailureType) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +#[no_mangle] +/// Serialize the HTLCHandlingFailureType object into a byte array which can be read by HTLCHandlingFailureType_read +pub extern "C" fn HTLCHandlingFailureType_write(obj: &crate::lightning::events::HTLCHandlingFailureType) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn HTLCHandlingFailureType_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + HTLCHandlingFailureType_write(unsafe { &*(obj as *const HTLCHandlingFailureType) }) +} +#[no_mangle] +/// Read a HTLCHandlingFailureType from a byte array, created by HTLCHandlingFailureType_write +pub extern "C" fn HTLCHandlingFailureType_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_HTLCHandlingFailureTypeZDecodeErrorZ { + let res: Result, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_HTLCHandlingFailureTypeZ::None } else { crate::c_types::derived::COption_HTLCHandlingFailureTypeZ::Some( { crate::lightning::events::HTLCHandlingFailureType::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +/// The reason for HTLC failures in [`Event::HTLCHandlingFailed`]. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum HTLCHandlingFailureReason { + /// The forwarded HTLC was failed back by the downstream node with an encrypted error reason. + Downstream, + /// The HTLC was failed locally by our node. + Local { + /// The reason that our node chose to fail the HTLC. + reason: crate::lightning::ln::onion_utils::LocalHTLCFailureReason, + }, +} +use lightning::events::HTLCHandlingFailureReason as HTLCHandlingFailureReasonImport; +pub(crate) type nativeHTLCHandlingFailureReason = HTLCHandlingFailureReasonImport; + +impl HTLCHandlingFailureReason { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeHTLCHandlingFailureReason { + match self { + HTLCHandlingFailureReason::Downstream => nativeHTLCHandlingFailureReason::Downstream, + HTLCHandlingFailureReason::Local {ref reason, } => { + let mut reason_nonref = Clone::clone(reason); + nativeHTLCHandlingFailureReason::Local { + reason: reason_nonref.into_native(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeHTLCHandlingFailureReason { + match self { + HTLCHandlingFailureReason::Downstream => nativeHTLCHandlingFailureReason::Downstream, + HTLCHandlingFailureReason::Local {mut reason, } => { + nativeHTLCHandlingFailureReason::Local { + reason: reason.into_native(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &HTLCHandlingFailureReasonImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeHTLCHandlingFailureReason) }; + match native { + nativeHTLCHandlingFailureReason::Downstream => HTLCHandlingFailureReason::Downstream, + nativeHTLCHandlingFailureReason::Local {ref reason, } => { + let mut reason_nonref = Clone::clone(reason); + HTLCHandlingFailureReason::Local { + reason: crate::lightning::ln::onion_utils::LocalHTLCFailureReason::native_into(reason_nonref), + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeHTLCHandlingFailureReason) -> Self { + match native { + nativeHTLCHandlingFailureReason::Downstream => HTLCHandlingFailureReason::Downstream, + nativeHTLCHandlingFailureReason::Local {mut reason, } => { + HTLCHandlingFailureReason::Local { + reason: crate::lightning::ln::onion_utils::LocalHTLCFailureReason::native_into(reason), + } + }, + } + } +} +/// Frees any resources used by the HTLCHandlingFailureReason +#[no_mangle] +pub extern "C" fn HTLCHandlingFailureReason_free(this_ptr: HTLCHandlingFailureReason) { } +/// Creates a copy of the HTLCHandlingFailureReason +#[no_mangle] +pub extern "C" fn HTLCHandlingFailureReason_clone(orig: &HTLCHandlingFailureReason) -> HTLCHandlingFailureReason { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HTLCHandlingFailureReason_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HTLCHandlingFailureReason)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HTLCHandlingFailureReason_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut HTLCHandlingFailureReason) }; +} +#[no_mangle] +/// Utility method to constructs a new Downstream-variant HTLCHandlingFailureReason +pub extern "C" fn HTLCHandlingFailureReason_downstream() -> HTLCHandlingFailureReason { + HTLCHandlingFailureReason::Downstream} +#[no_mangle] +/// Utility method to constructs a new Local-variant HTLCHandlingFailureReason +pub extern "C" fn HTLCHandlingFailureReason_local(reason: crate::lightning::ln::onion_utils::LocalHTLCFailureReason) -> HTLCHandlingFailureReason { + HTLCHandlingFailureReason::Local { + reason, + } +} +/// Get a string which allows debug introspection of a HTLCHandlingFailureReason object +pub extern "C" fn HTLCHandlingFailureReason_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::HTLCHandlingFailureReason }).into()} +/// Checks if two HTLCHandlingFailureReasons contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] -pub extern "C" fn HTLCDestination_eq(a: &HTLCDestination, b: &HTLCDestination) -> bool { +pub extern "C" fn HTLCHandlingFailureReason_eq(a: &HTLCHandlingFailureReason, b: &HTLCHandlingFailureReason) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } #[no_mangle] -/// Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read -pub extern "C" fn HTLCDestination_write(obj: &crate::lightning::events::HTLCDestination) -> crate::c_types::derived::CVec_u8Z { +/// Serialize the HTLCHandlingFailureReason object into a byte array which can be read by HTLCHandlingFailureReason_read +pub extern "C" fn HTLCHandlingFailureReason_write(obj: &crate::lightning::events::HTLCHandlingFailureReason) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) } #[allow(unused)] -pub(crate) extern "C" fn HTLCDestination_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - HTLCDestination_write(unsafe { &*(obj as *const HTLCDestination) }) +pub(crate) extern "C" fn HTLCHandlingFailureReason_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + HTLCHandlingFailureReason_write(unsafe { &*(obj as *const HTLCHandlingFailureReason) }) } #[no_mangle] -/// Read a HTLCDestination from a byte array, created by HTLCDestination_write -pub extern "C" fn HTLCDestination_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_HTLCDestinationZDecodeErrorZ { - let res: Result, lightning::ln::msgs::DecodeError> = crate::c_types::maybe_deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_HTLCDestinationZ::None } else { crate::c_types::derived::COption_HTLCDestinationZ::Some( { crate::lightning::events::HTLCDestination::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; +/// Read a HTLCHandlingFailureReason from a byte array, created by HTLCHandlingFailureReason_write +pub extern "C" fn HTLCHandlingFailureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HTLCHandlingFailureReasonDecodeErrorZ { + 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::HTLCHandlingFailureReason::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +#[no_mangle] +/// Build a HTLCHandlingFailureReason from a LocalHTLCFailureReason +pub extern "C" fn HTLCHandlingFailureReason_from_LocalHTLCFailureReason(f: crate::lightning::ln::onion_utils::LocalHTLCFailureReason) -> crate::lightning::events::HTLCHandlingFailureReason { + let from_obj = f.into_native(); + crate::lightning::events::HTLCHandlingFailureReason::native_into((lightning::events::HTLCHandlingFailureReason::from(from_obj))) +} /// The reason the payment failed. Used in [`Event::PaymentFailed`]. #[derive(Clone)] #[must_use] @@ -1509,8 +1725,8 @@ pub enum PaymentFailureReason { /// ///[`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout RetriesExhausted, - /// The payment expired while retrying, based on the provided - /// [`PaymentParameters::expiry_time`]. + /// Either the BOLT 12 invoice was expired by the time we received it or the payment expired while + /// retrying based on the provided [`PaymentParameters::expiry_time`]. /// /// Also used for [`InvoiceRequestExpired`] when downgrading to version prior to 0.0.124. /// @@ -1948,12 +2164,10 @@ pub enum Event { /// Information for claiming this received payment, based on whether the purpose of the /// 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. + /// The `(channel_id, user_channel_id)` pairs over which the payment was received. /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - via_channel_id: crate::lightning::ln::types::ChannelId, - /// The `user_channel_id` indicating over which channel we received the payment. - via_user_channel_id: crate::c_types::derived::COption_U128Z, + /// This will be an incomplete vector for MPP payment events created/serialized using LDK version 0.1.0 and prior. + receiving_channel_ids: crate::c_types::derived::CVec_C2Tuple_ChannelIdCOption_U128ZZZ, /// The block height at which this payment will be failed back and will no longer be /// eligible for claiming. /// @@ -2051,7 +2265,9 @@ pub enum Event { ConnectionNeeded { /// The node id for the node needing a connection. node_id: crate::c_types::PublicKey, - /// Sockets for connecting to the node. + /// Sockets for connecting to the node, if available. We don't require these addresses to be + /// present in case the node id corresponds to a known peer that is offline and can be awoken, + /// such as via the LSPS5 protocol. addresses: crate::c_types::derived::CVec_SocketAddressZ, }, /// Indicates a [`Bolt12Invoice`] in response to an [`InvoiceRequest`] or a [`Refund`] was @@ -2111,9 +2327,17 @@ pub enum Event { /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment payment_hash: crate::c_types::ThirtyTwoBytes, + /// The total amount that was paid, across all paths. + /// + /// Note that, like [`Route::get_total_amount`], this does *not* include the paid fees. + /// + /// This is only `None` for payments initiated on LDK versions prior to 0.2. + /// + /// [`Route::get_total_amount`]: crate::routing::router::Route::get_total_amount + amount_msat: crate::c_types::derived::COption_u64Z, /// The total fee which was spent at intermediate hops in this payment, across all paths. /// - /// Note that, like [`Route::get_total_fees`] this does *not* include any potential + /// Note that, like [`Route::get_total_fees`], this does *not* include any potential /// overpayment to the recipient node. /// /// If the recipient or an intermediate node misbehaves and gives us free money, this may @@ -2123,6 +2347,18 @@ pub enum Event { /// /// [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees fee_paid_msat: crate::c_types::derived::COption_u64Z, + /// The BOLT 12 invoice that was paid. `None` if the payment was a non BOLT 12 payment. + /// + /// The BOLT 12 invoice is useful for proof of payment because it contains the + /// payment hash. A third party can verify that the payment was made by + /// showing the invoice and confirming that the payment hash matches + /// the hash of the payment preimage. + /// + /// However, the [`PaidBolt12Invoice`] can also be of type [`StaticInvoice`], which + /// is a special [`Bolt12Invoice`] where proof of payment is not possible. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + bolt12_invoice: crate::c_types::derived::COption_PaidBolt12InvoiceZ, }, /// Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events /// provide failure information for each path attempt in the payment, including retries. @@ -2181,6 +2417,23 @@ pub enum Event { /// /// May contain a closed channel if the HTLC sent along the path was fulfilled on chain. path: crate::lightning::routing::router::Path, + /// The time that each hop indicated it held the HTLC. + /// + /// The unit in which the hold times are expressed are 100's of milliseconds. So a hop + /// reporting 2 is a hold time that corresponds to between 200 and 299 milliseconds. + /// + /// We expect that at each hop the actual hold time will be strictly greater than the hold + /// time of the following hops, as a node along the path shouldn't have completed the HTLC + /// until the next node has completed it. Note that because hold times are in 100's of ms, + /// hold times as reported are likely to often be equal across hops. + /// + /// If our peer didn't provide attribution data or the HTLC resolved on chain, the list + /// will be empty. + /// + /// Each entry will correspond with one entry in [`Path::hops`], or, thereafter, the + /// [`BlindedTail::trampoline_hops`] in [`Path::blinded_tail`]. Because not all nodes + /// support hold times, the list may be shorter than the number of hops in the path. + hold_times: crate::c_types::derived::CVec_u32Z, }, /// Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to /// handle the HTLC. @@ -2228,6 +2481,23 @@ pub enum Event { /// If this is `Some`, then the corresponding channel should be avoided when the payment is /// retried. May be `None` for older [`Event`] serializations. short_channel_id: crate::c_types::derived::COption_u64Z, + /// The time that each hop indicated it held the HTLC. + /// + /// The unit in which the hold times are expressed are 100's of milliseconds. So a hop + /// reporting 2 is a hold time that corresponds to between 200 and 299 milliseconds. + /// + /// We expect that at each hop the actual hold time will be strictly greater than the hold + /// time of the following hops, as a node along the path shouldn't have completed the HTLC + /// until the next node has completed it. Note that because hold times are in 100's of ms, + /// hold times as reported are likely to often be equal across hops. + /// + /// If our peer didn't provide attribution data or the HTLC resolved on chain, the list + /// will be empty. + /// + /// Each entry will correspond with one entry in [`Path::hops`], or, thereafter, the + /// [`BlindedTail::trampoline_hops`] in [`Path::blinded_tail`]. Because not all nodes + /// support hold times, the list may be shorter than the number of hops in the path. + hold_times: crate::c_types::derived::CVec_u32Z, }, /// Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. /// @@ -2269,21 +2539,6 @@ pub enum Event { /// with channels in the public network graph. short_channel_id: crate::c_types::derived::COption_u64Z, }, - /// Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at - /// a time in the future. - /// - /// # Failure Behavior and Persistence - /// This event will eventually be replayed after failures-to-handle (i.e., the event handler - /// returning `Err(ReplayEvent ())`) and will be regenerated after restarts. - /// - /// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards - PendingHTLCsForwardable { - /// The minimum amount of time that should be waited prior to calling - /// process_pending_htlc_forwards. To increase the effort required to correlate payments, - /// you should wait a random amount of time in roughly the range (now + time_forwardable, - /// now + 5*time_forwardable). - time_forwardable: u64, - }, /// Used to indicate that we've intercepted an HTLC forward. This event will only be generated if /// you've encoded an intercept scid in the receiver's invoice route hints using /// [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. @@ -2376,14 +2631,14 @@ pub enum Event { /// events generated or serialized by versions prior to 0.0.122. next_user_channel_id: crate::c_types::derived::COption_U128Z, /// The node id of the previous node. - /// + /// /// This is only `None` for HTLCs received prior to 0.1 or for events serialized by /// versions prior to 0.1 /// /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None prev_node_id: crate::c_types::PublicKey, /// The node id of the next node. - /// + /// /// This is only `None` for HTLCs received prior to 0.1 or for events serialized by /// versions prior to 0.1 /// @@ -2463,11 +2718,18 @@ pub enum Event { /// /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None channel_type: crate::lightning_types::features::ChannelTypeFeatures, + /// The witness script that is used to lock the channel's funding output to commitment transactions. + /// + /// This field will be `None` for objects serialized with LDK versions prior to 0.2.0. + funding_redeem_script: crate::c_types::derived::COption_CVec_u8ZZ, }, - /// Used to indicate that a channel with the given `channel_id` is ready to - /// be used. This event is emitted either when the funding transaction has been confirmed - /// on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel - /// establishment. + /// Used to indicate that a channel with the given `channel_id` is ready to be used. This event + /// is emitted when + /// - the initial funding transaction has been confirmed on-chain to an acceptable depth + /// according to both parties (i.e., `channel_ready` messages were exchanged), + /// - a splice funding transaction has been confirmed on-chain to an acceptable depth according + /// to both parties (i.e., `splice_locked` messages were exchanged), or, + /// - in case of a 0conf channel, when both parties have confirmed the channel establishment. /// /// # Failure Behavior and Persistence /// This event will eventually be replayed after failures-to-handle (i.e., the event handler @@ -2486,6 +2748,11 @@ pub enum Event { user_channel_id: crate::c_types::U128, /// The `node_id` of the channel counterparty. counterparty_node_id: crate::c_types::PublicKey, + /// The outpoint of the channel's funding transaction. + /// + /// Will be `None` if the channel's funding transaction reached an acceptable depth prior to + /// version 0.2. + funding_txo: crate::c_types::derived::COption_OutPointZ, /// The features that this channel will operate with. channel_type: crate::lightning_types::features::ChannelTypeFeatures, }, @@ -2547,9 +2814,82 @@ pub enum Event { /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances last_local_balance_msat: crate::c_types::derived::COption_u64Z, }, + /// Used to indicate that a splice for the given `channel_id` has been negotiated and its + /// funding transaction has been broadcast. + /// + /// The splice is then considered pending until both parties have seen enough confirmations to + /// consider the funding locked. Once this occurs, an [`Event::ChannelReady`] will be emitted. + /// + /// Any UTXOs spent by the splice cannot be reused except by an RBF attempt for the same channel. + /// + /// # Failure Behavior and Persistence + /// This event will eventually be replayed after failures-to-handle (i.e., the event handler + /// returning `Err(ReplayEvent ())`) and will be persisted across restarts. + SplicePending { + /// The `channel_id` of the channel that has a pending splice funding transaction. + channel_id: crate::lightning::ln::types::ChannelId, + /// 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. + /// + /// [`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, + /// The `node_id` of the channel counterparty. + counterparty_node_id: crate::c_types::PublicKey, + /// The outpoint of the channel's splice funding transaction. + new_funding_txo: crate::lightning::chain::transaction::OutPoint, + /// The features that this channel will operate with. Currently, these will be the same + /// features that the channel was opened with, but in the future splices may change them. + channel_type: crate::lightning_types::features::ChannelTypeFeatures, + /// The witness script that is used to lock the channel's funding output to commitment transactions. + new_funding_redeem_script: crate::c_types::derived::CVec_u8Z, + }, + /// Used to indicate that a splice for the given `channel_id` has failed. + /// + /// This event may be emitted if a splice fails after it has been initiated but prior to signing + /// any negotiated funding transaction. + /// + /// Any UTXOs contributed to be spent by the funding transaction may be reused and will be + /// given in `contributed_inputs`. + /// + /// # Failure Behavior and Persistence + /// This event will eventually be replayed after failures-to-handle (i.e., the event handler + /// returning `Err(ReplayEvent ())`) and will be persisted across restarts. + SpliceFailed { + /// The `channel_id` of the channel for which the splice failed. + channel_id: crate::lightning::ln::types::ChannelId, + /// 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. + /// + /// [`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, + /// The `node_id` of the channel counterparty. + counterparty_node_id: crate::c_types::PublicKey, + /// The outpoint of the channel's splice funding transaction, if one was created. + abandoned_funding_txo: crate::c_types::derived::COption_OutPointZ, + /// The features that this channel will operate with, if available. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + channel_type: crate::lightning_types::features::ChannelTypeFeatures, + /// UTXOs spent as inputs contributed to the splice transaction. + contributed_inputs: crate::c_types::derived::CVec_OutPointZ, + /// Outputs contributed to the splice transaction. + contributed_outputs: crate::c_types::derived::CVec_TxOutZ, + }, /// Used to indicate to the user that they can abandon the funding transaction and recycle the /// inputs for another purpose. /// + /// When splicing, users can expect to receive an event for each negotiated splice transaction + /// that did not become locked. The negotiated splice transaction that became locked can be + /// obtained via [`Event::ChannelReady::funding_txo`]. + /// /// This event is not guaranteed to be generated for channels that are closed due to a restart. /// /// # Failure Behavior and Persistence @@ -2565,8 +2905,8 @@ pub enum Event { /// /// To accept the request (and in the case of a dual-funded channel, not contribute funds), /// 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. + /// To reject the request, call [`ChannelManager::force_close_broadcasting_latest_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. @@ -2576,27 +2916,28 @@ pub enum Event { /// returning `Err(ReplayEvent ())`) and won't be persisted across restarts. /// /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + /// [`ChannelClosed`]: Event::ChannelClosed + /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels OpenChannelRequest { /// The temporary channel ID of the channel requested to be opened. /// /// When responding to the request, the `temporary_channel_id` should be passed /// back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept, - /// or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject. + /// or through [`ChannelManager::force_close_broadcasting_latest_txn`] to reject. /// /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn temporary_channel_id: crate::lightning::ln::types::ChannelId, /// The node_id of the counterparty requesting to open the channel. /// /// When responding to the request, the `counterparty_node_id` should be passed /// back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to - /// accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the - /// request. + /// accept the request, or through [`ChannelManager::force_close_broadcasting_latest_txn`] + /// to reject the request. /// /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel - /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn + /// [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn counterparty_node_id: crate::c_types::PublicKey, /// The channel value of the requested channel. funding_satoshis: u64, @@ -2628,30 +2969,26 @@ pub enum Event { /// Indicates that the HTLC was accepted, but could not be processed when or after attempting to /// forward it. /// - /// Some scenarios where this event may be sent include: - /// * Insufficient capacity in the outbound channel - /// * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes - /// * When an unknown SCID is requested for forwarding a payment. - /// * Expected MPP amount has already been reached - /// * The HTLC has timed out - /// - /// This event, however, does not get generated if an HTLC fails to meet the forwarding - /// requirements (i.e. insufficient fees paid, or a CLTV that is too soon). - /// /// # Failure Behavior and Persistence /// This event will eventually be replayed after failures-to-handle (i.e., the event handler /// returning `Err(ReplayEvent ())`) and will be persisted across restarts. HTLCHandlingFailed { /// The channel over which the HTLC was received. prev_channel_id: crate::lightning::ln::types::ChannelId, - /// Destination of the HTLC that failed to be processed. - failed_next_destination: crate::lightning::events::HTLCDestination, + /// The type of HTLC handling that failed. + failure_type: crate::lightning::events::HTLCHandlingFailureType, + /// The reason that the HTLC failed. + /// + /// This field will be `None` only for objects serialized prior to LDK 0.2.0. + failure_reason: crate::c_types::derived::COption_HTLCHandlingFailureReasonZ, }, /// Indicates that a transaction originating from LDK needs to have its fee bumped. This event /// requires confirmed external funds to be readily available to spend. /// - /// LDK does not currently generate this event unless the - /// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] config flag is set to true. + /// LDK does not currently generate this event unless either the + /// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`] or the + /// [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`] config flags are set to + /// true. /// It is limited to the scope of channels with anchor outputs. /// /// # Failure Behavior and Persistence @@ -2659,6 +2996,7 @@ pub enum Event { /// returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts. /// /// [`ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchors_zero_fee_htlc_tx + /// [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`]: crate::util::config::ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments BumpTransaction( crate::lightning::events::bump_transaction::BumpTransactionEvent), /// We received an onion message that is intended to be forwarded to a peer @@ -2666,6 +3004,12 @@ pub enum Event { /// `OnionMessenger` was initialized with /// [`OnionMessenger::new_with_offline_peer_interception`], see its docs. /// + /// The offline peer should be awoken if possible on receipt of this event, such as via the LSPS5 + /// protocol. + /// + /// Once they connect, you should handle the generated [`Event::OnionMessagePeerConnected`] and + /// provide the stored message. + /// /// # Failure Behavior and Persistence /// This event will eventually be replayed after failures-to-handle (i.e., the event handler /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts. @@ -2677,22 +3021,158 @@ pub enum Event { /// The onion message intended to be forwarded to `peer_node_id`. message: crate::lightning::ln::msgs::OnionMessage, }, - /// Indicates that an onion message supporting peer has come online and it may - /// be time to forward any onion messages that were previously intercepted for - /// them. This event will only be generated if the `OnionMessenger` was - /// initialized with + /// Indicates that an onion message supporting peer has come online and any messages previously + /// stored for them (from [`Event::OnionMessageIntercepted`]s) should be forwarded to them by + /// calling [`OnionMessenger::forward_onion_message`]. + /// + /// This event will only be generated if the `OnionMessenger` was initialized with /// [`OnionMessenger::new_with_offline_peer_interception`], see its docs. /// /// # Failure Behavior and Persistence /// This event will eventually be replayed after failures-to-handle (i.e., the event handler /// returning `Err(ReplayEvent ())`), but won't be persisted across restarts. /// + /// [`OnionMessenger::forward_onion_message`]: crate::onion_message::messenger::OnionMessenger::forward_onion_message /// [`OnionMessenger::new_with_offline_peer_interception`]: crate::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception OnionMessagePeerConnected { /// The node id of the peer we just connected to, who advertises support for /// onion messages. peer_node_id: crate::c_types::PublicKey, }, + /// As a static invoice server, we received a [`StaticInvoice`] from an async recipient that wants + /// us to serve the invoice to payers on their behalf when they are offline. This event will only + /// be generated if we previously created paths using + /// [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with + /// them via [`ChannelManager::set_paths_to_static_invoice_server`]. + /// + /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + /// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server + PersistStaticInvoice { + /// The invoice that should be persisted and later provided to payers when handling a future + /// [`Event::StaticInvoiceRequested`]. + invoice: crate::lightning::offers::static_invoice::StaticInvoice, + /// The path to where invoice requests will be forwarded. If we receive an invoice + /// request, we'll forward it to the async recipient over this path in case the + /// recipient is online to provide a new invoice. This path should be persisted and + /// later provided to [`ChannelManager::respond_to_static_invoice_request`]. + /// + /// This path's [`BlindedMessagePath::introduction_node`] MUST be set to our node or one of our + /// peers. This is because, for DoS protection, invoice requests forwarded over this path are + /// treated by our node like any other onion message forward and will not generate + /// [`Event::ConnectionNeeded`] if the first hop in the path is not our peer. + /// + /// If the next-hop peer in the path is offline, if configured to do so we will generate an + /// [`Event::OnionMessageIntercepted`] for the invoice request. + /// + /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + invoice_request_path: crate::lightning::blinded_path::message::BlindedMessagePath, + /// Useful for the recipient to replace a specific invoice stored by us as the static invoice + /// server. + /// + /// When this invoice and its metadata are persisted, this slot number should be included so if + /// we receive another [`Event::PersistStaticInvoice`] containing the same slot number we can + /// swap the existing invoice out for the new one. + invoice_slot: u16, + /// An identifier for the recipient, originally provided to + /// [`ChannelManager::blinded_paths_for_async_recipient`]. + /// + /// When an [`Event::StaticInvoiceRequested`] comes in for the invoice, this id will be surfaced + /// and can be used alongside the `invoice_slot` to retrieve the invoice from the database. + /// + ///[`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + recipient_id: crate::c_types::derived::CVec_u8Z, + /// Once the [`StaticInvoice`] and `invoice_slot` are persisted, + /// [`ChannelManager::static_invoice_persisted`] should be called with this responder to confirm + /// to the recipient that their [`Offer`] is ready to be used for async payments. + /// + /// [`ChannelManager::static_invoice_persisted`]: crate::ln::channelmanager::ChannelManager::static_invoice_persisted + /// [`Offer`]: crate::offers::offer::Offer + invoice_persisted_path: crate::lightning::onion_message::messenger::Responder, + }, + /// As a static invoice server, we received an [`InvoiceRequest`] on behalf of an often-offline + /// recipient for whom we are serving [`StaticInvoice`]s. + /// + /// This event will only be generated if we previously created paths using + /// [`ChannelManager::blinded_paths_for_async_recipient`] and the recipient was configured with + /// them via [`ChannelManager::set_paths_to_static_invoice_server`]. + /// + /// If we previously persisted a [`StaticInvoice`] from an [`Event::PersistStaticInvoice`] that + /// matches the below `recipient_id` and `invoice_slot`, that invoice should be retrieved now + /// and forwarded to the payer via [`ChannelManager::respond_to_static_invoice_request`]. + /// The invoice request path previously persisted from [`Event::PersistStaticInvoice`] should + /// also be provided in [`ChannelManager::respond_to_static_invoice_request`]. + /// + /// [`ChannelManager::blinded_paths_for_async_recipient`]: crate::ln::channelmanager::ChannelManager::blinded_paths_for_async_recipient + /// [`ChannelManager::set_paths_to_static_invoice_server`]: crate::ln::channelmanager::ChannelManager::set_paths_to_static_invoice_server + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + StaticInvoiceRequested { + /// An identifier for the recipient previously surfaced in + /// [`Event::PersistStaticInvoice::recipient_id`]. Useful when paired with the `invoice_slot` to + /// retrieve the [`StaticInvoice`] requested by the payer. + recipient_id: crate::c_types::derived::CVec_u8Z, + /// The slot number for the invoice being requested, previously surfaced in + /// [`Event::PersistStaticInvoice::invoice_slot`]. Useful when paired with the `recipient_id` to + /// retrieve the [`StaticInvoice`] requested by the payer. + invoice_slot: u16, + /// The path over which the [`StaticInvoice`] will be sent to the payer, which should be + /// provided to [`ChannelManager::respond_to_static_invoice_request`] along with the invoice. + /// + /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + reply_path: crate::lightning::onion_message::messenger::Responder, + /// The invoice request that will be forwarded to the async recipient to give the + /// recipient a chance to provide an invoice in case it is online. It should be + /// provided to [`ChannelManager::respond_to_static_invoice_request`]. + /// + /// [`ChannelManager::respond_to_static_invoice_request`]: crate::ln::channelmanager::ChannelManager::respond_to_static_invoice_request + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, + }, + /// Indicates that a channel funding transaction constructed interactively is ready to be + /// signed. This event will only be triggered if at least one input was contributed. + /// + /// The transaction contains all inputs and outputs provided by both parties including the + /// channel's funding output and a change output if applicable. + /// + /// No part of the transaction should be changed before signing as the content of the transaction + /// has already been negotiated with the counterparty. + /// + /// Each signature MUST use the `SIGHASH_ALL` flag to avoid invalidation of the initial commitment and + /// hence possible loss of funds. + /// + /// After signing, call [`ChannelManager::funding_transaction_signed`] with the (partially) signed + /// funding transaction. + /// + /// Generated in [`ChannelManager`] message handling. + /// + /// # Failure Behavior and Persistence + /// This event will eventually be replayed after failures-to-handle (i.e., the event handler + /// returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts. + /// + /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + /// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + FundingTransactionReadyForSigning { + /// The `channel_id` of the channel which you'll need to pass back into + /// [`ChannelManager::funding_transaction_signed`]. + /// + /// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + channel_id: crate::lightning::ln::types::ChannelId, + /// The counterparty's `node_id`, which you'll need to pass back into + /// [`ChannelManager::funding_transaction_signed`]. + /// + /// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + counterparty_node_id: crate::c_types::PublicKey, + /// The `user_channel_id` value passed in for outbound channels, or for inbound channels if + /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + /// `user_channel_id` will be randomized for inbound channels. + /// + /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + user_channel_id: crate::c_types::U128, + /// The unsigned transaction to be signed and passed back to + /// [`ChannelManager::funding_transaction_signed`]. + /// + /// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed + unsigned_transaction: crate::c_types::Transaction, + }, } use lightning::events::Event as EventImport; pub(crate) type nativeEvent = EventImport; @@ -2729,7 +3209,7 @@ impl Event { former_temporary_channel_id: *unsafe { Box::from_raw(former_temporary_channel_id_nonref.take_inner()) }, } }, - Event::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, ref payment_id, } => { + Event::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref receiving_channel_ids, ref claim_deadline, ref payment_id, } => { 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); @@ -2738,10 +3218,8 @@ impl Event { let mut amount_msat_nonref = Clone::clone(amount_msat); 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.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(via_channel_id_nonref.take_inner()) } }) }; - 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 receiving_channel_ids_nonref = Clone::clone(receiving_channel_ids); + let mut local_receiving_channel_ids_nonref = Vec::new(); for mut item in receiving_channel_ids_nonref.into_rust().drain(..) { local_receiving_channel_ids_nonref.push( { let (mut orig_receiving_channel_ids_nonref_0_0, mut orig_receiving_channel_ids_nonref_0_1) = item.to_rust(); let mut local_orig_receiving_channel_ids_nonref_0_1 = { /*orig_receiving_channel_ids_nonref_0_1*/ let orig_receiving_channel_ids_nonref_0_1_opt = orig_receiving_channel_ids_nonref_0_1; if orig_receiving_channel_ids_nonref_0_1_opt.is_none() { None } else { Some({ { { orig_receiving_channel_ids_nonref_0_1_opt.take() }.into() }})} }; let mut local_receiving_channel_ids_nonref_0 = (*unsafe { Box::from_raw(orig_receiving_channel_ids_nonref_0_0.take_inner()) }, local_orig_receiving_channel_ids_nonref_0_1); local_receiving_channel_ids_nonref_0 }); }; let mut claim_deadline_nonref = Clone::clone(claim_deadline); let mut local_claim_deadline_nonref = if claim_deadline_nonref.is_some() { Some( { claim_deadline_nonref.take() }) } else { None }; let mut payment_id_nonref = Clone::clone(payment_id); @@ -2753,8 +3231,7 @@ impl Event { amount_msat: amount_msat_nonref, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat_nonref, purpose: purpose_nonref.into_native(), - via_channel_id: local_via_channel_id_nonref, - via_user_channel_id: local_via_user_channel_id_nonref, + receiving_channel_ids: local_receiving_channel_ids_nonref, claim_deadline: local_claim_deadline_nonref, payment_id: local_payment_id_nonref, } @@ -2807,18 +3284,24 @@ impl Event { responder: local_responder_nonref, } }, - Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { + Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref amount_msat, ref fee_paid_msat, ref bolt12_invoice, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = { /*payment_id_nonref*/ let payment_id_nonref_opt = payment_id_nonref; if payment_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_nonref_opt.take() }.data) }})} }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut amount_msat_nonref = Clone::clone(amount_msat); + let mut local_amount_msat_nonref = if amount_msat_nonref.is_some() { Some( { amount_msat_nonref.take() }) } else { None }; let mut fee_paid_msat_nonref = Clone::clone(fee_paid_msat); let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_some() { Some( { fee_paid_msat_nonref.take() }) } else { None }; + let mut bolt12_invoice_nonref = Clone::clone(bolt12_invoice); + let mut local_bolt12_invoice_nonref = { /*bolt12_invoice_nonref*/ let bolt12_invoice_nonref_opt = bolt12_invoice_nonref; if bolt12_invoice_nonref_opt.is_none() { None } else { Some({ { { bolt12_invoice_nonref_opt.take() }.into_native() }})} }; nativeEvent::PaymentSent { payment_id: local_payment_id_nonref, payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_nonref.data), payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), + amount_msat: local_amount_msat_nonref, fee_paid_msat: local_fee_paid_msat_nonref, + bolt12_invoice: local_bolt12_invoice_nonref, } }, Event::PaymentFailed {ref payment_id, ref payment_hash, ref reason, } => { @@ -2833,18 +3316,21 @@ impl Event { reason: local_reason_nonref, } }, - Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { + Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, ref hold_times, } => { 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::types::payment::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; let mut path_nonref = Clone::clone(path); + let mut hold_times_nonref = Clone::clone(hold_times); + let mut local_hold_times_nonref = Vec::new(); for mut item in hold_times_nonref.into_rust().drain(..) { local_hold_times_nonref.push( { item }); }; nativeEvent::PaymentPathSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: local_payment_hash_nonref, path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, + hold_times: local_hold_times_nonref, } }, - Event::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref failure, ref path, ref short_channel_id, } => { + Event::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref failure, ref path, ref short_channel_id, ref hold_times, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = { /*payment_id_nonref*/ let payment_id_nonref_opt = payment_id_nonref; if payment_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_nonref_opt.take() }.data) }})} }; let mut payment_hash_nonref = Clone::clone(payment_hash); @@ -2853,6 +3339,8 @@ impl Event { let mut path_nonref = Clone::clone(path); let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_some() { Some( { short_channel_id_nonref.take() }) } else { None }; + let mut hold_times_nonref = Clone::clone(hold_times); + let mut local_hold_times_nonref = Vec::new(); for mut item in hold_times_nonref.into_rust().drain(..) { local_hold_times_nonref.push( { item }); }; nativeEvent::PaymentPathFailed { payment_id: local_payment_id_nonref, payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), @@ -2860,6 +3348,7 @@ impl Event { failure: failure_nonref.into_native(), path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, short_channel_id: local_short_channel_id_nonref, + hold_times: local_hold_times_nonref, } }, Event::ProbeSuccessful {ref payment_id, ref payment_hash, ref path, } => { @@ -2885,12 +3374,6 @@ impl Event { short_channel_id: local_short_channel_id_nonref, } }, - Event::PendingHTLCsForwardable {ref time_forwardable, } => { - let mut time_forwardable_nonref = Clone::clone(time_forwardable); - nativeEvent::PendingHTLCsForwardable { - time_forwardable: core::time::Duration::from_secs(time_forwardable_nonref), - } - }, Event::HTLCIntercepted {ref intercept_id, ref requested_next_hop_scid, ref payment_hash, ref inbound_amount_msat, ref expected_outbound_amount_msat, } => { let mut intercept_id_nonref = Clone::clone(intercept_id); let mut requested_next_hop_scid_nonref = Clone::clone(requested_next_hop_scid); @@ -2948,7 +3431,7 @@ impl Event { outbound_amount_forwarded_msat: local_outbound_amount_forwarded_msat_nonref, } }, - Event::ChannelPending {ref channel_id, ref user_channel_id, ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, } => { + Event::ChannelPending {ref channel_id, ref user_channel_id, ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, ref funding_redeem_script, } => { 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); @@ -2957,6 +3440,8 @@ impl Event { let mut funding_txo_nonref = Clone::clone(funding_txo); let mut channel_type_nonref = Clone::clone(channel_type); let mut local_channel_type_nonref = if channel_type_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_nonref.take_inner()) } }) }; + let mut funding_redeem_script_nonref = Clone::clone(funding_redeem_script); + let mut local_funding_redeem_script_nonref = { /*funding_redeem_script_nonref*/ let funding_redeem_script_nonref_opt = funding_redeem_script_nonref; if funding_redeem_script_nonref_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ funding_redeem_script_nonref_opt.take() }.into_rust()) }})} }; nativeEvent::ChannelPending { channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, user_channel_id: user_channel_id_nonref.into(), @@ -2964,17 +3449,21 @@ impl Event { counterparty_node_id: counterparty_node_id_nonref.into_rust(), funding_txo: crate::c_types::C_to_bitcoin_outpoint(funding_txo_nonref), channel_type: local_channel_type_nonref, + funding_redeem_script: local_funding_redeem_script_nonref, } }, - Event::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref channel_type, } => { + Event::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut funding_txo_nonref = Clone::clone(funding_txo); + let mut local_funding_txo_nonref = { /*funding_txo_nonref*/ let funding_txo_nonref_opt = funding_txo_nonref; if funding_txo_nonref_opt.is_none() { None } else { Some({ { crate::c_types::C_to_bitcoin_outpoint({ funding_txo_nonref_opt.take() }) }})} }; let mut channel_type_nonref = Clone::clone(channel_type); nativeEvent::ChannelReady { channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, user_channel_id: user_channel_id_nonref.into(), counterparty_node_id: counterparty_node_id_nonref.into_rust(), + funding_txo: local_funding_txo_nonref, channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, } }, @@ -3000,6 +3489,44 @@ impl Event { last_local_balance_msat: local_last_local_balance_msat_nonref, } }, + Event::SplicePending {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref new_funding_txo, ref channel_type, ref new_funding_redeem_script, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut new_funding_txo_nonref = Clone::clone(new_funding_txo); + let mut channel_type_nonref = Clone::clone(channel_type); + let mut new_funding_redeem_script_nonref = Clone::clone(new_funding_redeem_script); + nativeEvent::SplicePending { + channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: counterparty_node_id_nonref.into_rust(), + new_funding_txo: crate::c_types::C_to_bitcoin_outpoint(new_funding_txo_nonref), + channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, + new_funding_redeem_script: ::bitcoin::script::ScriptBuf::from(new_funding_redeem_script_nonref.into_rust()), + } + }, + Event::SpliceFailed {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref abandoned_funding_txo, ref channel_type, ref contributed_inputs, ref contributed_outputs, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut abandoned_funding_txo_nonref = Clone::clone(abandoned_funding_txo); + let mut local_abandoned_funding_txo_nonref = { /*abandoned_funding_txo_nonref*/ let abandoned_funding_txo_nonref_opt = abandoned_funding_txo_nonref; if abandoned_funding_txo_nonref_opt.is_none() { None } else { Some({ { crate::c_types::C_to_bitcoin_outpoint({ abandoned_funding_txo_nonref_opt.take() }) }})} }; + let mut channel_type_nonref = Clone::clone(channel_type); + let mut local_channel_type_nonref = if channel_type_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_nonref.take_inner()) } }) }; + let mut contributed_inputs_nonref = Clone::clone(contributed_inputs); + let mut local_contributed_inputs_nonref = Vec::new(); for mut item in contributed_inputs_nonref.into_rust().drain(..) { local_contributed_inputs_nonref.push( { crate::c_types::C_to_bitcoin_outpoint(item) }); }; + let mut contributed_outputs_nonref = Clone::clone(contributed_outputs); + let mut local_contributed_outputs_nonref = Vec::new(); for mut item in contributed_outputs_nonref.into_rust().drain(..) { local_contributed_outputs_nonref.push( { item.into_rust() }); }; + nativeEvent::SpliceFailed { + channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: counterparty_node_id_nonref.into_rust(), + abandoned_funding_txo: local_abandoned_funding_txo_nonref, + channel_type: local_channel_type_nonref, + contributed_inputs: local_contributed_inputs_nonref, + contributed_outputs: local_contributed_outputs_nonref, + } + }, Event::DiscardFunding {ref channel_id, ref funding_info, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut funding_info_nonref = Clone::clone(funding_info); @@ -3026,12 +3553,15 @@ impl Event { params: *unsafe { Box::from_raw(params_nonref.take_inner()) }, } }, - Event::HTLCHandlingFailed {ref prev_channel_id, ref failed_next_destination, } => { + Event::HTLCHandlingFailed {ref prev_channel_id, ref failure_type, ref failure_reason, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); - let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); + let mut failure_type_nonref = Clone::clone(failure_type); + let mut failure_reason_nonref = Clone::clone(failure_reason); + let mut local_failure_reason_nonref = { /*failure_reason_nonref*/ let failure_reason_nonref_opt = failure_reason_nonref; if failure_reason_nonref_opt.is_none() { None } else { Some({ { { failure_reason_nonref_opt.take() }.into_native() }})} }; nativeEvent::HTLCHandlingFailed { prev_channel_id: *unsafe { Box::from_raw(prev_channel_id_nonref.take_inner()) }, - failed_next_destination: failed_next_destination_nonref.into_native(), + failure_type: failure_type_nonref.into_native(), + failure_reason: local_failure_reason_nonref, } }, Event::BumpTransaction (ref a, ) => { @@ -3054,14 +3584,54 @@ impl Event { peer_node_id: peer_node_id_nonref.into_rust(), } }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeEvent { - 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: *unsafe { Box::from_raw(temporary_channel_id.take_inner()) }, + Event::PersistStaticInvoice {ref invoice, ref invoice_request_path, ref invoice_slot, ref recipient_id, ref invoice_persisted_path, } => { + let mut invoice_nonref = Clone::clone(invoice); + let mut invoice_request_path_nonref = Clone::clone(invoice_request_path); + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_persisted_path_nonref = Clone::clone(invoice_persisted_path); + nativeEvent::PersistStaticInvoice { + invoice: *unsafe { Box::from_raw(invoice_nonref.take_inner()) }, + invoice_request_path: *unsafe { Box::from_raw(invoice_request_path_nonref.take_inner()) }, + invoice_slot: invoice_slot_nonref, + recipient_id: local_recipient_id_nonref, + invoice_persisted_path: *unsafe { Box::from_raw(invoice_persisted_path_nonref.take_inner()) }, + } + }, + Event::StaticInvoiceRequested {ref recipient_id, ref invoice_slot, ref reply_path, ref invoice_request, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut reply_path_nonref = Clone::clone(reply_path); + let mut invoice_request_nonref = Clone::clone(invoice_request); + nativeEvent::StaticInvoiceRequested { + recipient_id: local_recipient_id_nonref, + invoice_slot: invoice_slot_nonref, + reply_path: *unsafe { Box::from_raw(reply_path_nonref.take_inner()) }, + invoice_request: *unsafe { Box::from_raw(invoice_request_nonref.take_inner()) }, + } + }, + Event::FundingTransactionReadyForSigning {ref channel_id, ref counterparty_node_id, ref user_channel_id, ref unsigned_transaction, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut unsigned_transaction_nonref = Clone::clone(unsigned_transaction); + nativeEvent::FundingTransactionReadyForSigning { + channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, + counterparty_node_id: counterparty_node_id_nonref.into_rust(), + user_channel_id: user_channel_id_nonref.into(), + unsigned_transaction: unsigned_transaction_nonref.into_bitcoin(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeEvent { + 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: *unsafe { Box::from_raw(temporary_channel_id.take_inner()) }, counterparty_node_id: counterparty_node_id.into_rust(), channel_value_satoshis: channel_value_satoshis, output_script: ::bitcoin::script::ScriptBuf::from(output_script.into_rust()), @@ -3077,11 +3647,10 @@ impl Event { former_temporary_channel_id: *unsafe { Box::from_raw(former_temporary_channel_id.take_inner()) }, } }, - 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, mut payment_id, } => { + Event::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut receiving_channel_ids, mut claim_deadline, mut payment_id, } => { 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.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(via_channel_id.take_inner()) } }) }; - 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_receiving_channel_ids = Vec::new(); for mut item in receiving_channel_ids.into_rust().drain(..) { local_receiving_channel_ids.push( { let (mut orig_receiving_channel_ids_0_0, mut orig_receiving_channel_ids_0_1) = item.to_rust(); let mut local_orig_receiving_channel_ids_0_1 = { /*orig_receiving_channel_ids_0_1*/ let orig_receiving_channel_ids_0_1_opt = orig_receiving_channel_ids_0_1; if orig_receiving_channel_ids_0_1_opt.is_none() { None } else { Some({ { { orig_receiving_channel_ids_0_1_opt.take() }.into() }})} }; let mut local_receiving_channel_ids_0 = (*unsafe { Box::from_raw(orig_receiving_channel_ids_0_0.take_inner()) }, local_orig_receiving_channel_ids_0_1); local_receiving_channel_ids_0 }); }; let mut local_claim_deadline = if claim_deadline.is_some() { Some( { claim_deadline.take() }) } else { None }; let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} }; nativeEvent::PaymentClaimable { @@ -3091,8 +3660,7 @@ impl Event { amount_msat: amount_msat, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat, purpose: purpose.into_native(), - via_channel_id: local_via_channel_id, - via_user_channel_id: local_via_user_channel_id, + receiving_channel_ids: local_receiving_channel_ids, claim_deadline: local_claim_deadline, payment_id: local_payment_id, } @@ -3131,14 +3699,18 @@ impl Event { responder: local_responder, } }, - Event::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => { + Event::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut amount_msat, mut fee_paid_msat, mut bolt12_invoice, } => { let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} }; + let mut local_amount_msat = if amount_msat.is_some() { Some( { amount_msat.take() }) } else { None }; let mut local_fee_paid_msat = if fee_paid_msat.is_some() { Some( { fee_paid_msat.take() }) } else { None }; + let mut local_bolt12_invoice = { /*bolt12_invoice*/ let bolt12_invoice_opt = bolt12_invoice; if bolt12_invoice_opt.is_none() { None } else { Some({ { { bolt12_invoice_opt.take() }.into_native() }})} }; nativeEvent::PaymentSent { payment_id: local_payment_id, payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage.data), payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), + amount_msat: local_amount_msat, fee_paid_msat: local_fee_paid_msat, + bolt12_invoice: local_bolt12_invoice, } }, Event::PaymentFailed {mut payment_id, mut payment_hash, mut reason, } => { @@ -3150,17 +3722,20 @@ impl Event { reason: local_reason, } }, - Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => { + Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, mut hold_times, } => { let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_hold_times = Vec::new(); for mut item in hold_times.into_rust().drain(..) { local_hold_times.push( { item }); }; nativeEvent::PaymentPathSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: local_payment_hash, path: *unsafe { Box::from_raw(path.take_inner()) }, + hold_times: local_hold_times, } }, - Event::PaymentPathFailed {mut payment_id, mut payment_hash, mut payment_failed_permanently, mut failure, mut path, mut short_channel_id, } => { + Event::PaymentPathFailed {mut payment_id, mut payment_hash, mut payment_failed_permanently, mut failure, mut path, mut short_channel_id, mut hold_times, } => { let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} }; let mut local_short_channel_id = if short_channel_id.is_some() { Some( { short_channel_id.take() }) } else { None }; + let mut local_hold_times = Vec::new(); for mut item in hold_times.into_rust().drain(..) { local_hold_times.push( { item }); }; nativeEvent::PaymentPathFailed { payment_id: local_payment_id, payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), @@ -3168,6 +3743,7 @@ impl Event { failure: failure.into_native(), path: *unsafe { Box::from_raw(path.take_inner()) }, short_channel_id: local_short_channel_id, + hold_times: local_hold_times, } }, Event::ProbeSuccessful {mut payment_id, mut payment_hash, mut path, } => { @@ -3186,11 +3762,6 @@ impl Event { short_channel_id: local_short_channel_id, } }, - Event::PendingHTLCsForwardable {mut time_forwardable, } => { - nativeEvent::PendingHTLCsForwardable { - time_forwardable: core::time::Duration::from_secs(time_forwardable), - } - }, Event::HTLCIntercepted {mut intercept_id, mut requested_next_hop_scid, mut payment_hash, mut inbound_amount_msat, mut expected_outbound_amount_msat, } => { nativeEvent::HTLCIntercepted { intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id.data), @@ -3231,9 +3802,10 @@ impl Event { outbound_amount_forwarded_msat: local_outbound_amount_forwarded_msat, } }, - Event::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, } => { + Event::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, mut funding_redeem_script, } => { let mut local_former_temporary_channel_id = if former_temporary_channel_id.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(former_temporary_channel_id.take_inner()) } }) }; let mut local_channel_type = if channel_type.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type.take_inner()) } }) }; + let mut local_funding_redeem_script = { /*funding_redeem_script*/ let funding_redeem_script_opt = funding_redeem_script; if funding_redeem_script_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ funding_redeem_script_opt.take() }.into_rust()) }})} }; nativeEvent::ChannelPending { channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, user_channel_id: user_channel_id.into(), @@ -3241,13 +3813,16 @@ impl Event { counterparty_node_id: counterparty_node_id.into_rust(), funding_txo: crate::c_types::C_to_bitcoin_outpoint(funding_txo), channel_type: local_channel_type, + funding_redeem_script: local_funding_redeem_script, } }, - Event::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { + Event::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, } => { + let mut local_funding_txo = { /*funding_txo*/ let funding_txo_opt = funding_txo; if funding_txo_opt.is_none() { None } else { Some({ { crate::c_types::C_to_bitcoin_outpoint({ funding_txo_opt.take() }) }})} }; nativeEvent::ChannelReady { channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, user_channel_id: user_channel_id.into(), counterparty_node_id: counterparty_node_id.into_rust(), + funding_txo: local_funding_txo, channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, } }, @@ -3266,6 +3841,31 @@ impl Event { last_local_balance_msat: local_last_local_balance_msat, } }, + Event::SplicePending {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut new_funding_txo, mut channel_type, mut new_funding_redeem_script, } => { + nativeEvent::SplicePending { + channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, + user_channel_id: user_channel_id.into(), + counterparty_node_id: counterparty_node_id.into_rust(), + new_funding_txo: crate::c_types::C_to_bitcoin_outpoint(new_funding_txo), + channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, + new_funding_redeem_script: ::bitcoin::script::ScriptBuf::from(new_funding_redeem_script.into_rust()), + } + }, + Event::SpliceFailed {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut abandoned_funding_txo, mut channel_type, mut contributed_inputs, mut contributed_outputs, } => { + let mut local_abandoned_funding_txo = { /*abandoned_funding_txo*/ let abandoned_funding_txo_opt = abandoned_funding_txo; if abandoned_funding_txo_opt.is_none() { None } else { Some({ { crate::c_types::C_to_bitcoin_outpoint({ abandoned_funding_txo_opt.take() }) }})} }; + let mut local_channel_type = if channel_type.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type.take_inner()) } }) }; + let mut local_contributed_inputs = Vec::new(); for mut item in contributed_inputs.into_rust().drain(..) { local_contributed_inputs.push( { crate::c_types::C_to_bitcoin_outpoint(item) }); }; + let mut local_contributed_outputs = Vec::new(); for mut item in contributed_outputs.into_rust().drain(..) { local_contributed_outputs.push( { item.into_rust() }); }; + nativeEvent::SpliceFailed { + channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, + user_channel_id: user_channel_id.into(), + counterparty_node_id: counterparty_node_id.into_rust(), + abandoned_funding_txo: local_abandoned_funding_txo, + channel_type: local_channel_type, + contributed_inputs: local_contributed_inputs, + contributed_outputs: local_contributed_outputs, + } + }, Event::DiscardFunding {mut channel_id, mut funding_info, } => { nativeEvent::DiscardFunding { channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, @@ -3283,10 +3883,12 @@ impl Event { params: *unsafe { Box::from_raw(params.take_inner()) }, } }, - Event::HTLCHandlingFailed {mut prev_channel_id, mut failed_next_destination, } => { + Event::HTLCHandlingFailed {mut prev_channel_id, mut failure_type, mut failure_reason, } => { + let mut local_failure_reason = { /*failure_reason*/ let failure_reason_opt = failure_reason; if failure_reason_opt.is_none() { None } else { Some({ { { failure_reason_opt.take() }.into_native() }})} }; nativeEvent::HTLCHandlingFailed { prev_channel_id: *unsafe { Box::from_raw(prev_channel_id.take_inner()) }, - failed_next_destination: failed_next_destination.into_native(), + failure_type: failure_type.into_native(), + failure_reason: local_failure_reason, } }, Event::BumpTransaction (mut a, ) => { @@ -3305,6 +3907,33 @@ impl Event { peer_node_id: peer_node_id.into_rust(), } }, + Event::PersistStaticInvoice {mut invoice, mut invoice_request_path, mut invoice_slot, mut recipient_id, mut invoice_persisted_path, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + nativeEvent::PersistStaticInvoice { + invoice: *unsafe { Box::from_raw(invoice.take_inner()) }, + invoice_request_path: *unsafe { Box::from_raw(invoice_request_path.take_inner()) }, + invoice_slot: invoice_slot, + recipient_id: local_recipient_id, + invoice_persisted_path: *unsafe { Box::from_raw(invoice_persisted_path.take_inner()) }, + } + }, + Event::StaticInvoiceRequested {mut recipient_id, mut invoice_slot, mut reply_path, mut invoice_request, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + nativeEvent::StaticInvoiceRequested { + recipient_id: local_recipient_id, + invoice_slot: invoice_slot, + reply_path: *unsafe { Box::from_raw(reply_path.take_inner()) }, + invoice_request: *unsafe { Box::from_raw(invoice_request.take_inner()) }, + } + }, + Event::FundingTransactionReadyForSigning {mut channel_id, mut counterparty_node_id, mut user_channel_id, mut unsigned_transaction, } => { + nativeEvent::FundingTransactionReadyForSigning { + channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, + counterparty_node_id: counterparty_node_id.into_rust(), + user_channel_id: user_channel_id.into(), + unsigned_transaction: unsigned_transaction.into_bitcoin(), + } + }, } } #[allow(unused)] @@ -3339,7 +3968,7 @@ impl Event { former_temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(former_temporary_channel_id_nonref), is_owned: true }, } }, - nativeEvent::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, ref payment_id, } => { + nativeEvent::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref receiving_channel_ids, ref claim_deadline, ref payment_id, } => { 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); @@ -3348,10 +3977,8 @@ impl Event { let mut amount_msat_nonref = Clone::clone(amount_msat); 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 = crate::lightning::ln::types::ChannelId { inner: if via_channel_id_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((via_channel_id_nonref.unwrap())) } }, is_owned: true }; - 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 receiving_channel_ids_nonref = Clone::clone(receiving_channel_ids); + let mut local_receiving_channel_ids_nonref = Vec::new(); for mut item in receiving_channel_ids_nonref.drain(..) { local_receiving_channel_ids_nonref.push( { let (mut orig_receiving_channel_ids_nonref_0_0, mut orig_receiving_channel_ids_nonref_0_1) = item; let mut local_orig_receiving_channel_ids_nonref_0_1 = if orig_receiving_channel_ids_nonref_0_1.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { orig_receiving_channel_ids_nonref_0_1.unwrap().into() }) }; let mut local_receiving_channel_ids_nonref_0 = (crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_receiving_channel_ids_nonref_0_0), is_owned: true }, local_orig_receiving_channel_ids_nonref_0_1).into(); local_receiving_channel_ids_nonref_0 }); }; 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() }) }; let mut payment_id_nonref = Clone::clone(payment_id); @@ -3363,8 +3990,7 @@ impl Event { amount_msat: amount_msat_nonref, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat_nonref, purpose: crate::lightning::events::PaymentPurpose::native_into(purpose_nonref), - via_channel_id: local_via_channel_id_nonref, - via_user_channel_id: local_via_user_channel_id_nonref, + receiving_channel_ids: local_receiving_channel_ids_nonref.into(), claim_deadline: local_claim_deadline_nonref, payment_id: local_payment_id_nonref, } @@ -3417,18 +4043,24 @@ impl Event { responder: local_responder_nonref, } }, - nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { + nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref amount_msat, ref fee_paid_msat, ref bolt12_invoice, } => { 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_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 amount_msat_nonref = Clone::clone(amount_msat); + let mut local_amount_msat_nonref = if amount_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { amount_msat_nonref.unwrap() }) }; let mut fee_paid_msat_nonref = Clone::clone(fee_paid_msat); let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat_nonref.unwrap() }) }; + let mut bolt12_invoice_nonref = Clone::clone(bolt12_invoice); + let mut local_bolt12_invoice_nonref = if bolt12_invoice_nonref.is_none() { crate::c_types::derived::COption_PaidBolt12InvoiceZ::None } else { crate::c_types::derived::COption_PaidBolt12InvoiceZ::Some( { crate::lightning::events::PaidBolt12Invoice::native_into(bolt12_invoice_nonref.unwrap()) }) }; Event::PaymentSent { payment_id: local_payment_id_nonref, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, + amount_msat: local_amount_msat_nonref, fee_paid_msat: local_fee_paid_msat_nonref, + bolt12_invoice: local_bolt12_invoice_nonref, } }, nativeEvent::PaymentFailed {ref payment_id, ref payment_hash, ref reason, } => { @@ -3443,18 +4075,21 @@ impl Event { reason: local_reason_nonref, } }, - nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { + nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, ref hold_times, } => { 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_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); + let mut hold_times_nonref = Clone::clone(hold_times); + let mut local_hold_times_nonref = Vec::new(); for mut item in hold_times_nonref.drain(..) { local_hold_times_nonref.push( { item }); }; Event::PaymentPathSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, payment_hash: local_payment_hash_nonref, path: crate::lightning::routing::router::Path { inner: ObjOps::heap_alloc(path_nonref), is_owned: true }, + hold_times: local_hold_times_nonref.into(), } }, - nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref failure, ref path, ref short_channel_id, } => { + nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref failure, ref path, ref short_channel_id, ref hold_times, } => { 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_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); @@ -3463,6 +4098,8 @@ impl Event { let mut path_nonref = Clone::clone(path); let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id_nonref.unwrap() }) }; + let mut hold_times_nonref = Clone::clone(hold_times); + let mut local_hold_times_nonref = Vec::new(); for mut item in hold_times_nonref.drain(..) { local_hold_times_nonref.push( { item }); }; Event::PaymentPathFailed { payment_id: local_payment_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, @@ -3470,6 +4107,7 @@ impl Event { failure: crate::lightning::events::PathFailure::native_into(failure_nonref), path: crate::lightning::routing::router::Path { inner: ObjOps::heap_alloc(path_nonref), is_owned: true }, short_channel_id: local_short_channel_id_nonref, + hold_times: local_hold_times_nonref.into(), } }, nativeEvent::ProbeSuccessful {ref payment_id, ref payment_hash, ref path, } => { @@ -3495,12 +4133,6 @@ impl Event { short_channel_id: local_short_channel_id_nonref, } }, - nativeEvent::PendingHTLCsForwardable {ref time_forwardable, } => { - let mut time_forwardable_nonref = Clone::clone(time_forwardable); - Event::PendingHTLCsForwardable { - time_forwardable: time_forwardable_nonref.as_secs(), - } - }, nativeEvent::HTLCIntercepted {ref intercept_id, ref requested_next_hop_scid, ref payment_hash, ref inbound_amount_msat, ref expected_outbound_amount_msat, } => { let mut intercept_id_nonref = Clone::clone(intercept_id); let mut requested_next_hop_scid_nonref = Clone::clone(requested_next_hop_scid); @@ -3558,7 +4190,7 @@ impl Event { outbound_amount_forwarded_msat: local_outbound_amount_forwarded_msat_nonref, } }, - nativeEvent::ChannelPending {ref channel_id, ref user_channel_id, ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, } => { + nativeEvent::ChannelPending {ref channel_id, ref user_channel_id, ref former_temporary_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, ref funding_redeem_script, } => { 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); @@ -3567,6 +4199,8 @@ impl Event { let mut funding_txo_nonref = Clone::clone(funding_txo); let mut channel_type_nonref = Clone::clone(channel_type); let mut local_channel_type_nonref = crate::lightning_types::features::ChannelTypeFeatures { inner: if channel_type_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_type_nonref.unwrap())) } }, is_owned: true }; + let mut funding_redeem_script_nonref = Clone::clone(funding_redeem_script); + let mut local_funding_redeem_script_nonref = if funding_redeem_script_nonref.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { funding_redeem_script_nonref.unwrap().to_bytes().into() }) }; Event::ChannelPending { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, user_channel_id: user_channel_id_nonref.into(), @@ -3574,17 +4208,21 @@ impl Event { counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), funding_txo: crate::c_types::bitcoin_to_C_outpoint(&funding_txo_nonref), channel_type: local_channel_type_nonref, + funding_redeem_script: local_funding_redeem_script_nonref, } }, - nativeEvent::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref channel_type, } => { + nativeEvent::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref funding_txo, ref channel_type, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut user_channel_id_nonref = Clone::clone(user_channel_id); let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut funding_txo_nonref = Clone::clone(funding_txo); + let mut local_funding_txo_nonref = if funding_txo_nonref.is_none() { crate::c_types::derived::COption_OutPointZ::None } else { crate::c_types::derived::COption_OutPointZ::Some( { crate::c_types::bitcoin_to_C_outpoint(&funding_txo_nonref.unwrap()) }) }; let mut channel_type_nonref = Clone::clone(channel_type); Event::ChannelReady { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, user_channel_id: user_channel_id_nonref.into(), counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), + funding_txo: local_funding_txo_nonref, channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, } }, @@ -3610,6 +4248,44 @@ impl Event { last_local_balance_msat: local_last_local_balance_msat_nonref, } }, + nativeEvent::SplicePending {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref new_funding_txo, ref channel_type, ref new_funding_redeem_script, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut new_funding_txo_nonref = Clone::clone(new_funding_txo); + let mut channel_type_nonref = Clone::clone(channel_type); + let mut new_funding_redeem_script_nonref = Clone::clone(new_funding_redeem_script); + Event::SplicePending { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), + new_funding_txo: crate::c_types::bitcoin_to_C_outpoint(&new_funding_txo_nonref), + channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, + new_funding_redeem_script: new_funding_redeem_script_nonref.to_bytes().into(), + } + }, + nativeEvent::SpliceFailed {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref abandoned_funding_txo, ref channel_type, ref contributed_inputs, ref contributed_outputs, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut abandoned_funding_txo_nonref = Clone::clone(abandoned_funding_txo); + let mut local_abandoned_funding_txo_nonref = if abandoned_funding_txo_nonref.is_none() { crate::c_types::derived::COption_OutPointZ::None } else { crate::c_types::derived::COption_OutPointZ::Some( { crate::c_types::bitcoin_to_C_outpoint(&abandoned_funding_txo_nonref.unwrap()) }) }; + let mut channel_type_nonref = Clone::clone(channel_type); + let mut local_channel_type_nonref = crate::lightning_types::features::ChannelTypeFeatures { inner: if channel_type_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_type_nonref.unwrap())) } }, is_owned: true }; + let mut contributed_inputs_nonref = Clone::clone(contributed_inputs); + let mut local_contributed_inputs_nonref = Vec::new(); for mut item in contributed_inputs_nonref.drain(..) { local_contributed_inputs_nonref.push( { crate::c_types::bitcoin_to_C_outpoint(&item) }); }; + let mut contributed_outputs_nonref = Clone::clone(contributed_outputs); + let mut local_contributed_outputs_nonref = Vec::new(); for mut item in contributed_outputs_nonref.drain(..) { local_contributed_outputs_nonref.push( { crate::c_types::TxOut::from_rust(&item) }); }; + Event::SpliceFailed { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), + abandoned_funding_txo: local_abandoned_funding_txo_nonref, + channel_type: local_channel_type_nonref, + contributed_inputs: local_contributed_inputs_nonref.into(), + contributed_outputs: local_contributed_outputs_nonref.into(), + } + }, nativeEvent::DiscardFunding {ref channel_id, ref funding_info, } => { let mut channel_id_nonref = Clone::clone(channel_id); let mut funding_info_nonref = Clone::clone(funding_info); @@ -3636,12 +4312,15 @@ impl Event { params: crate::lightning::ln::msgs::ChannelParameters { inner: ObjOps::heap_alloc(params_nonref), is_owned: true }, } }, - nativeEvent::HTLCHandlingFailed {ref prev_channel_id, ref failed_next_destination, } => { + nativeEvent::HTLCHandlingFailed {ref prev_channel_id, ref failure_type, ref failure_reason, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); - let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); + let mut failure_type_nonref = Clone::clone(failure_type); + let mut failure_reason_nonref = Clone::clone(failure_reason); + let mut local_failure_reason_nonref = if failure_reason_nonref.is_none() { crate::c_types::derived::COption_HTLCHandlingFailureReasonZ::None } else { crate::c_types::derived::COption_HTLCHandlingFailureReasonZ::Some( { crate::lightning::events::HTLCHandlingFailureReason::native_into(failure_reason_nonref.unwrap()) }) }; Event::HTLCHandlingFailed { prev_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(prev_channel_id_nonref), is_owned: true }, - failed_next_destination: crate::lightning::events::HTLCDestination::native_into(failed_next_destination_nonref), + failure_type: crate::lightning::events::HTLCHandlingFailureType::native_into(failure_type_nonref), + failure_reason: local_failure_reason_nonref, } }, nativeEvent::BumpTransaction (ref a, ) => { @@ -3664,6 +4343,46 @@ impl Event { peer_node_id: crate::c_types::PublicKey::from_rust(&peer_node_id_nonref), } }, + nativeEvent::PersistStaticInvoice {ref invoice, ref invoice_request_path, ref invoice_slot, ref recipient_id, ref invoice_persisted_path, } => { + let mut invoice_nonref = Clone::clone(invoice); + let mut invoice_request_path_nonref = Clone::clone(invoice_request_path); + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_persisted_path_nonref = Clone::clone(invoice_persisted_path); + Event::PersistStaticInvoice { + invoice: crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(invoice_nonref), is_owned: true }, + invoice_request_path: crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(invoice_request_path_nonref), is_owned: true }, + invoice_slot: invoice_slot_nonref, + recipient_id: local_recipient_id_nonref.into(), + invoice_persisted_path: crate::lightning::onion_message::messenger::Responder { inner: ObjOps::heap_alloc(invoice_persisted_path_nonref), is_owned: true }, + } + }, + nativeEvent::StaticInvoiceRequested {ref recipient_id, ref invoice_slot, ref reply_path, ref invoice_request, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut reply_path_nonref = Clone::clone(reply_path); + let mut invoice_request_nonref = Clone::clone(invoice_request); + Event::StaticInvoiceRequested { + recipient_id: local_recipient_id_nonref.into(), + invoice_slot: invoice_slot_nonref, + reply_path: crate::lightning::onion_message::messenger::Responder { inner: ObjOps::heap_alloc(reply_path_nonref), is_owned: true }, + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(invoice_request_nonref), is_owned: true }, + } + }, + nativeEvent::FundingTransactionReadyForSigning {ref channel_id, ref counterparty_node_id, ref user_channel_id, ref unsigned_transaction, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut unsigned_transaction_nonref = Clone::clone(unsigned_transaction); + Event::FundingTransactionReadyForSigning { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), + user_channel_id: user_channel_id_nonref.into(), + unsigned_transaction: crate::c_types::Transaction::from_bitcoin(&unsigned_transaction_nonref), + } + }, } } #[allow(unused)] @@ -3687,11 +4406,10 @@ impl Event { former_temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(former_temporary_channel_id), is_owned: true }, } }, - 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, mut payment_id, } => { + nativeEvent::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut receiving_channel_ids, mut claim_deadline, mut payment_id, } => { 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 = crate::lightning::ln::types::ChannelId { inner: if via_channel_id.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((via_channel_id.unwrap())) } }, is_owned: true }; - 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_receiving_channel_ids = Vec::new(); for mut item in receiving_channel_ids.drain(..) { local_receiving_channel_ids.push( { let (mut orig_receiving_channel_ids_0_0, mut orig_receiving_channel_ids_0_1) = item; let mut local_orig_receiving_channel_ids_0_1 = if orig_receiving_channel_ids_0_1.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { orig_receiving_channel_ids_0_1.unwrap().into() }) }; let mut local_receiving_channel_ids_0 = (crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_receiving_channel_ids_0_0), is_owned: true }, local_orig_receiving_channel_ids_0_1).into(); local_receiving_channel_ids_0 }); }; 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() }) }; 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 } }) }; Event::PaymentClaimable { @@ -3701,8 +4419,7 @@ impl Event { amount_msat: amount_msat, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat, purpose: crate::lightning::events::PaymentPurpose::native_into(purpose), - via_channel_id: local_via_channel_id, - via_user_channel_id: local_via_user_channel_id, + receiving_channel_ids: local_receiving_channel_ids.into(), claim_deadline: local_claim_deadline, payment_id: local_payment_id, } @@ -3741,14 +4458,18 @@ impl Event { responder: local_responder, } }, - nativeEvent::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut fee_paid_msat, } => { + nativeEvent::PaymentSent {mut payment_id, mut payment_preimage, mut payment_hash, mut amount_msat, mut fee_paid_msat, mut bolt12_invoice, } => { 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_amount_msat = if amount_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { amount_msat.unwrap() }) }; 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() }) }; + let mut local_bolt12_invoice = if bolt12_invoice.is_none() { crate::c_types::derived::COption_PaidBolt12InvoiceZ::None } else { crate::c_types::derived::COption_PaidBolt12InvoiceZ::Some( { crate::lightning::events::PaidBolt12Invoice::native_into(bolt12_invoice.unwrap()) }) }; Event::PaymentSent { payment_id: local_payment_id, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, + amount_msat: local_amount_msat, fee_paid_msat: local_fee_paid_msat, + bolt12_invoice: local_bolt12_invoice, } }, nativeEvent::PaymentFailed {mut payment_id, mut payment_hash, mut reason, } => { @@ -3760,17 +4481,20 @@ impl Event { reason: local_reason, } }, - nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => { + nativeEvent::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, mut hold_times, } => { 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 } }) }; + let mut local_hold_times = Vec::new(); for mut item in hold_times.drain(..) { local_hold_times.push( { item }); }; Event::PaymentPathSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, payment_hash: local_payment_hash, path: crate::lightning::routing::router::Path { inner: ObjOps::heap_alloc(path), is_owned: true }, + hold_times: local_hold_times.into(), } }, - nativeEvent::PaymentPathFailed {mut payment_id, mut payment_hash, mut payment_failed_permanently, mut failure, mut path, mut short_channel_id, } => { + nativeEvent::PaymentPathFailed {mut payment_id, mut payment_hash, mut payment_failed_permanently, mut failure, mut path, mut short_channel_id, mut hold_times, } => { 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() }) }; + let mut local_hold_times = Vec::new(); for mut item in hold_times.drain(..) { local_hold_times.push( { item }); }; Event::PaymentPathFailed { payment_id: local_payment_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, @@ -3778,6 +4502,7 @@ impl Event { failure: crate::lightning::events::PathFailure::native_into(failure), path: crate::lightning::routing::router::Path { inner: ObjOps::heap_alloc(path), is_owned: true }, short_channel_id: local_short_channel_id, + hold_times: local_hold_times.into(), } }, nativeEvent::ProbeSuccessful {mut payment_id, mut payment_hash, mut path, } => { @@ -3796,11 +4521,6 @@ impl Event { short_channel_id: local_short_channel_id, } }, - nativeEvent::PendingHTLCsForwardable {mut time_forwardable, } => { - Event::PendingHTLCsForwardable { - time_forwardable: time_forwardable.as_secs(), - } - }, nativeEvent::HTLCIntercepted {mut intercept_id, mut requested_next_hop_scid, mut payment_hash, mut inbound_amount_msat, mut expected_outbound_amount_msat, } => { Event::HTLCIntercepted { intercept_id: crate::c_types::ThirtyTwoBytes { data: intercept_id.0 }, @@ -3841,9 +4561,10 @@ impl Event { outbound_amount_forwarded_msat: local_outbound_amount_forwarded_msat, } }, - nativeEvent::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, } => { + nativeEvent::ChannelPending {mut channel_id, mut user_channel_id, mut former_temporary_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, mut funding_redeem_script, } => { let mut local_former_temporary_channel_id = crate::lightning::ln::types::ChannelId { inner: if former_temporary_channel_id.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((former_temporary_channel_id.unwrap())) } }, is_owned: true }; let mut local_channel_type = crate::lightning_types::features::ChannelTypeFeatures { inner: if channel_type.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_type.unwrap())) } }, is_owned: true }; + let mut local_funding_redeem_script = if funding_redeem_script.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { funding_redeem_script.unwrap().to_bytes().into() }) }; Event::ChannelPending { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, user_channel_id: user_channel_id.into(), @@ -3851,13 +4572,16 @@ impl Event { counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), funding_txo: crate::c_types::bitcoin_to_C_outpoint(&funding_txo), channel_type: local_channel_type, + funding_redeem_script: local_funding_redeem_script, } }, - nativeEvent::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { + nativeEvent::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut funding_txo, mut channel_type, } => { + let mut local_funding_txo = if funding_txo.is_none() { crate::c_types::derived::COption_OutPointZ::None } else { crate::c_types::derived::COption_OutPointZ::Some( { crate::c_types::bitcoin_to_C_outpoint(&funding_txo.unwrap()) }) }; Event::ChannelReady { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, user_channel_id: user_channel_id.into(), counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), + funding_txo: local_funding_txo, channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, } }, @@ -3876,6 +4600,31 @@ impl Event { last_local_balance_msat: local_last_local_balance_msat, } }, + nativeEvent::SplicePending {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut new_funding_txo, mut channel_type, mut new_funding_redeem_script, } => { + Event::SplicePending { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, + user_channel_id: user_channel_id.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), + new_funding_txo: crate::c_types::bitcoin_to_C_outpoint(&new_funding_txo), + channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, + new_funding_redeem_script: new_funding_redeem_script.to_bytes().into(), + } + }, + nativeEvent::SpliceFailed {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut abandoned_funding_txo, mut channel_type, mut contributed_inputs, mut contributed_outputs, } => { + let mut local_abandoned_funding_txo = if abandoned_funding_txo.is_none() { crate::c_types::derived::COption_OutPointZ::None } else { crate::c_types::derived::COption_OutPointZ::Some( { crate::c_types::bitcoin_to_C_outpoint(&abandoned_funding_txo.unwrap()) }) }; + let mut local_channel_type = crate::lightning_types::features::ChannelTypeFeatures { inner: if channel_type.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_type.unwrap())) } }, is_owned: true }; + let mut local_contributed_inputs = Vec::new(); for mut item in contributed_inputs.drain(..) { local_contributed_inputs.push( { crate::c_types::bitcoin_to_C_outpoint(&item) }); }; + let mut local_contributed_outputs = Vec::new(); for mut item in contributed_outputs.drain(..) { local_contributed_outputs.push( { crate::c_types::TxOut::from_rust(&item) }); }; + Event::SpliceFailed { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, + user_channel_id: user_channel_id.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), + abandoned_funding_txo: local_abandoned_funding_txo, + channel_type: local_channel_type, + contributed_inputs: local_contributed_inputs.into(), + contributed_outputs: local_contributed_outputs.into(), + } + }, nativeEvent::DiscardFunding {mut channel_id, mut funding_info, } => { Event::DiscardFunding { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, @@ -3893,10 +4642,12 @@ impl Event { params: crate::lightning::ln::msgs::ChannelParameters { inner: ObjOps::heap_alloc(params), is_owned: true }, } }, - nativeEvent::HTLCHandlingFailed {mut prev_channel_id, mut failed_next_destination, } => { + nativeEvent::HTLCHandlingFailed {mut prev_channel_id, mut failure_type, mut failure_reason, } => { + let mut local_failure_reason = if failure_reason.is_none() { crate::c_types::derived::COption_HTLCHandlingFailureReasonZ::None } else { crate::c_types::derived::COption_HTLCHandlingFailureReasonZ::Some( { crate::lightning::events::HTLCHandlingFailureReason::native_into(failure_reason.unwrap()) }) }; Event::HTLCHandlingFailed { prev_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(prev_channel_id), is_owned: true }, - failed_next_destination: crate::lightning::events::HTLCDestination::native_into(failed_next_destination), + failure_type: crate::lightning::events::HTLCHandlingFailureType::native_into(failure_type), + failure_reason: local_failure_reason, } }, nativeEvent::BumpTransaction (mut a, ) => { @@ -3915,6 +4666,33 @@ impl Event { peer_node_id: crate::c_types::PublicKey::from_rust(&peer_node_id), } }, + nativeEvent::PersistStaticInvoice {mut invoice, mut invoice_request_path, mut invoice_slot, mut recipient_id, mut invoice_persisted_path, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + Event::PersistStaticInvoice { + invoice: crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(invoice), is_owned: true }, + invoice_request_path: crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(invoice_request_path), is_owned: true }, + invoice_slot: invoice_slot, + recipient_id: local_recipient_id.into(), + invoice_persisted_path: crate::lightning::onion_message::messenger::Responder { inner: ObjOps::heap_alloc(invoice_persisted_path), is_owned: true }, + } + }, + nativeEvent::StaticInvoiceRequested {mut recipient_id, mut invoice_slot, mut reply_path, mut invoice_request, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + Event::StaticInvoiceRequested { + recipient_id: local_recipient_id.into(), + invoice_slot: invoice_slot, + reply_path: crate::lightning::onion_message::messenger::Responder { inner: ObjOps::heap_alloc(reply_path), is_owned: true }, + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(invoice_request), is_owned: true }, + } + }, + nativeEvent::FundingTransactionReadyForSigning {mut channel_id, mut counterparty_node_id, mut user_channel_id, mut unsigned_transaction, } => { + Event::FundingTransactionReadyForSigning { + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), + user_channel_id: user_channel_id.into(), + unsigned_transaction: crate::c_types::Transaction::from_bitcoin(&unsigned_transaction), + } + }, } } } @@ -3960,7 +4738,7 @@ pub extern "C" fn Event_funding_tx_broadcast_safe(channel_id: crate::lightning:: } #[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::lightning::ln::types::ChannelId, via_user_channel_id: crate::c_types::derived::COption_U128Z, claim_deadline: crate::c_types::derived::COption_u32Z, payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> 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, receiving_channel_ids: crate::c_types::derived::CVec_C2Tuple_ChannelIdCOption_U128ZZZ, claim_deadline: crate::c_types::derived::COption_u32Z, payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Event { Event::PaymentClaimable { receiver_node_id, payment_hash, @@ -3968,8 +4746,7 @@ pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::Publ amount_msat, counterparty_skimmed_fee_msat, purpose, - via_channel_id, - via_user_channel_id, + receiving_channel_ids, claim_deadline, payment_id, } @@ -4008,12 +4785,14 @@ pub extern "C" fn Event_invoice_received(payment_id: crate::c_types::ThirtyTwoBy } #[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_ThirtyTwoBytesZ, 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, amount_msat: crate::c_types::derived::COption_u64Z, fee_paid_msat: crate::c_types::derived::COption_u64Z, bolt12_invoice: crate::c_types::derived::COption_PaidBolt12InvoiceZ) -> Event { Event::PaymentSent { payment_id, payment_preimage, payment_hash, + amount_msat, fee_paid_msat, + bolt12_invoice, } } #[no_mangle] @@ -4027,16 +4806,17 @@ 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_ThirtyTwoBytesZ, 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, hold_times: crate::c_types::derived::CVec_u32Z) -> Event { Event::PaymentPathSuccessful { payment_id, payment_hash, path, + hold_times, } } #[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_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 { +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, hold_times: crate::c_types::derived::CVec_u32Z) -> Event { Event::PaymentPathFailed { payment_id, payment_hash, @@ -4044,6 +4824,7 @@ pub extern "C" fn Event_payment_path_failed(payment_id: crate::c_types::derived: failure, path, short_channel_id, + hold_times, } } #[no_mangle] @@ -4066,13 +4847,6 @@ pub extern "C" fn Event_probe_failed(payment_id: crate::c_types::ThirtyTwoBytes, } } #[no_mangle] -/// Utility method to constructs a new PendingHTLCsForwardable-variant Event -pub extern "C" fn Event_pending_htlcs_forwardable(time_forwardable: u64) -> Event { - Event::PendingHTLCsForwardable { - time_forwardable, - } -} -#[no_mangle] /// Utility method to constructs a new HTLCIntercepted-variant Event pub extern "C" fn Event_htlcintercepted(intercept_id: crate::c_types::ThirtyTwoBytes, requested_next_hop_scid: u64, payment_hash: crate::c_types::ThirtyTwoBytes, inbound_amount_msat: u64, expected_outbound_amount_msat: u64) -> Event { Event::HTLCIntercepted { @@ -4109,7 +4883,7 @@ pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::lightning::ln: } #[no_mangle] /// Utility method to constructs a new ChannelPending-variant Event -pub extern "C" fn Event_channel_pending(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, former_temporary_channel_id: crate::lightning::ln::types::ChannelId, counterparty_node_id: crate::c_types::PublicKey, funding_txo: crate::lightning::chain::transaction::OutPoint, channel_type: crate::lightning_types::features::ChannelTypeFeatures) -> Event { +pub extern "C" fn Event_channel_pending(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, former_temporary_channel_id: crate::lightning::ln::types::ChannelId, counterparty_node_id: crate::c_types::PublicKey, funding_txo: crate::lightning::chain::transaction::OutPoint, channel_type: crate::lightning_types::features::ChannelTypeFeatures, funding_redeem_script: crate::c_types::derived::COption_CVec_u8ZZ) -> Event { Event::ChannelPending { channel_id, user_channel_id, @@ -4117,15 +4891,17 @@ pub extern "C" fn Event_channel_pending(channel_id: crate::lightning::ln::types: counterparty_node_id, funding_txo, channel_type, + funding_redeem_script, } } #[no_mangle] /// Utility method to constructs a new ChannelReady-variant Event -pub extern "C" fn Event_channel_ready(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, counterparty_node_id: crate::c_types::PublicKey, channel_type: crate::lightning_types::features::ChannelTypeFeatures) -> Event { +pub extern "C" fn Event_channel_ready(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, counterparty_node_id: crate::c_types::PublicKey, funding_txo: crate::c_types::derived::COption_OutPointZ, channel_type: crate::lightning_types::features::ChannelTypeFeatures) -> Event { Event::ChannelReady { channel_id, user_channel_id, counterparty_node_id, + funding_txo, channel_type, } } @@ -4143,6 +4919,31 @@ pub extern "C" fn Event_channel_closed(channel_id: crate::lightning::ln::types:: } } #[no_mangle] +/// Utility method to constructs a new SplicePending-variant Event +pub extern "C" fn Event_splice_pending(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, counterparty_node_id: crate::c_types::PublicKey, new_funding_txo: crate::lightning::chain::transaction::OutPoint, channel_type: crate::lightning_types::features::ChannelTypeFeatures, new_funding_redeem_script: crate::c_types::derived::CVec_u8Z) -> Event { + Event::SplicePending { + channel_id, + user_channel_id, + counterparty_node_id, + new_funding_txo, + channel_type, + new_funding_redeem_script, + } +} +#[no_mangle] +/// Utility method to constructs a new SpliceFailed-variant Event +pub extern "C" fn Event_splice_failed(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, counterparty_node_id: crate::c_types::PublicKey, abandoned_funding_txo: crate::c_types::derived::COption_OutPointZ, channel_type: crate::lightning_types::features::ChannelTypeFeatures, contributed_inputs: crate::c_types::derived::CVec_OutPointZ, contributed_outputs: crate::c_types::derived::CVec_TxOutZ) -> Event { + Event::SpliceFailed { + channel_id, + user_channel_id, + counterparty_node_id, + abandoned_funding_txo, + channel_type, + contributed_inputs, + contributed_outputs, + } +} +#[no_mangle] /// Utility method to constructs a new DiscardFunding-variant Event pub extern "C" fn Event_discard_funding(channel_id: crate::lightning::ln::types::ChannelId, funding_info: crate::lightning::events::FundingInfo) -> Event { Event::DiscardFunding { @@ -4165,10 +4966,11 @@ pub extern "C" fn Event_open_channel_request(temporary_channel_id: crate::lightn } #[no_mangle] /// Utility method to constructs a new HTLCHandlingFailed-variant Event -pub extern "C" fn Event_htlchandling_failed(prev_channel_id: crate::lightning::ln::types::ChannelId, failed_next_destination: crate::lightning::events::HTLCDestination) -> Event { +pub extern "C" fn Event_htlchandling_failed(prev_channel_id: crate::lightning::ln::types::ChannelId, failure_type: crate::lightning::events::HTLCHandlingFailureType, failure_reason: crate::c_types::derived::COption_HTLCHandlingFailureReasonZ) -> Event { Event::HTLCHandlingFailed { prev_channel_id, - failed_next_destination, + failure_type, + failure_reason, } } #[no_mangle] @@ -4191,6 +4993,37 @@ pub extern "C" fn Event_onion_message_peer_connected(peer_node_id: crate::c_type peer_node_id, } } +#[no_mangle] +/// Utility method to constructs a new PersistStaticInvoice-variant Event +pub extern "C" fn Event_persist_static_invoice(invoice: crate::lightning::offers::static_invoice::StaticInvoice, invoice_request_path: crate::lightning::blinded_path::message::BlindedMessagePath, invoice_slot: u16, recipient_id: crate::c_types::derived::CVec_u8Z, invoice_persisted_path: crate::lightning::onion_message::messenger::Responder) -> Event { + Event::PersistStaticInvoice { + invoice, + invoice_request_path, + invoice_slot, + recipient_id, + invoice_persisted_path, + } +} +#[no_mangle] +/// Utility method to constructs a new StaticInvoiceRequested-variant Event +pub extern "C" fn Event_static_invoice_requested(recipient_id: crate::c_types::derived::CVec_u8Z, invoice_slot: u16, reply_path: crate::lightning::onion_message::messenger::Responder, invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest) -> Event { + Event::StaticInvoiceRequested { + recipient_id, + invoice_slot, + reply_path, + invoice_request, + } +} +#[no_mangle] +/// Utility method to constructs a new FundingTransactionReadyForSigning-variant Event +pub extern "C" fn Event_funding_transaction_ready_for_signing(channel_id: crate::lightning::ln::types::ChannelId, counterparty_node_id: crate::c_types::PublicKey, user_channel_id: crate::c_types::U128, unsigned_transaction: crate::c_types::Transaction) -> Event { + Event::FundingTransactionReadyForSigning { + channel_id, + counterparty_node_id, + user_channel_id, + unsigned_transaction, + } +} /// Get a string which allows debug introspection of a Event object pub extern "C" fn Event_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::Event }).into()} @@ -4216,1737 +5049,52 @@ pub extern "C" fn Event_read(ser: crate::c_types::u8slice) -> crate::c_types::de let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_EventZ::None } else { crate::c_types::derived::COption_EventZ::Some( { crate::lightning::events::Event::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } -/// An event generated by ChannelManager which indicates a message should be sent to a peer (or -/// broadcast to most peers). -/// These events are handled by PeerManager::process_events if you are using a PeerManager. -#[derive(Clone)] -#[must_use] +/// A trait indicating an object may generate events. +/// +/// Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. +/// +/// Implementations of this trait may also feature an async version of event handling, as shown with +/// [`ChannelManager::process_pending_events_async`] and +/// [`ChainMonitor::process_pending_events_async`]. +/// +/// # Requirements +/// +/// When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending +/// event since the last invocation. +/// +/// In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s +/// and replay any unhandled events on startup. An [`Event`] is considered handled when +/// [`process_pending_events`] returns `Ok(())`, thus handlers MUST fully handle [`Event`]s and +/// persist any relevant changes to disk *before* returning `Ok(())`. In case of an error (e.g., +/// persistence failure) implementors should return `Err(ReplayEvent())`, signalling to the +/// [`EventsProvider`] to replay unhandled events on the next invocation (generally immediately). +/// Note that some events might not be replayed, please refer to the documentation for +/// the individual [`Event`] variants for more detail. +/// +/// Further, because an application may crash between an [`Event`] being handled and the +/// implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in +/// effect, [`Event`]s may be replayed. +/// +/// Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to +/// consult the provider's documentation on the implication of processing events and how a handler +/// may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and +/// [`ChainMonitor::process_pending_events`]). +/// +/// (C-not implementable) As there is likely no reason for a user to implement this trait on their +/// own type(s). +/// +/// [`process_pending_events`]: Self::process_pending_events +/// [`handle_event`]: EventHandler::handle_event +/// [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events +/// [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events +/// [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async +/// [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async #[repr(C)] -pub enum MessageSendEvent { - /// Used to indicate that we've accepted a channel open and should send the accept_channel - /// message provided to the given peer. - SendAcceptChannel { - /// 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::AcceptChannel, - }, - /// Used to indicate that we've accepted a V2 channel open and should send the accept_channel2 - /// message provided to the given peer. - SendAcceptChannelV2 { - /// 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::AcceptChannelV2, - }, - /// Used to indicate that we've initiated a channel open and should send the open_channel - /// message provided to the given peer. - SendOpenChannel { - /// 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::OpenChannel, - }, - /// Used to indicate that we've initiated a V2 channel open and should send the open_channel2 - /// message provided to the given peer. - SendOpenChannelV2 { - /// 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::OpenChannelV2, - }, - /// Used to indicate that a funding_created message should be sent to the peer with the given node_id. - SendFundingCreated { - /// 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::FundingCreated, - }, - /// Used to indicate that a funding_signed message should be sent to the peer with the given node_id. - SendFundingSigned { - /// 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::FundingSigned, - }, - /// Used to indicate that a stfu message should be sent to the peer with the given node id. - SendStfu { - /// 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::Stfu, - }, - /// Used to indicate that a splice_init message should be sent to the peer with the given node id. - SendSpliceInit { - /// 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::SpliceInit, - }, - /// Used to indicate that a splice_ack message should be sent to the peer with the given node id. - SendSpliceAck { - /// 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::SpliceAck, - }, - /// Used to indicate that a splice_locked message should be sent to the peer with the given node id. - SendSpliceLocked { - /// 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::SpliceLocked, - }, - /// Used to indicate that a tx_add_input message should be sent to the peer with the given node_id. - SendTxAddInput { - /// 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, - }, - /// Used to indicate that a tx_add_output message should be sent to the peer with the given node_id. - SendTxAddOutput { - /// 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::TxAddOutput, - }, - /// Used to indicate that a tx_remove_input message should be sent to the peer with the given node_id. - SendTxRemoveInput { - /// 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::TxRemoveInput, - }, - /// Used to indicate that a tx_remove_output message should be sent to the peer with the given node_id. - SendTxRemoveOutput { - /// 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::TxRemoveOutput, - }, - /// Used to indicate that a tx_complete message should be sent to the peer with the given node_id. - SendTxComplete { - /// 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::TxComplete, - }, - /// Used to indicate that a tx_signatures message should be sent to the peer with the given node_id. - SendTxSignatures { - /// 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::TxSignatures, - }, - /// Used to indicate that a tx_init_rbf message should be sent to the peer with the given node_id. - SendTxInitRbf { - /// 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::TxInitRbf, - }, - /// Used to indicate that a tx_ack_rbf message should be sent to the peer with the given node_id. - SendTxAckRbf { - /// 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::TxAckRbf, - }, - /// Used to indicate that a tx_abort message should be sent to the peer with the given node_id. - SendTxAbort { - /// 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::TxAbort, - }, - /// Used to indicate that a channel_ready message should be sent to the peer with the given node_id. - SendChannelReady { - /// The node_id of the node which should receive these message(s) - node_id: crate::c_types::PublicKey, - /// The channel_ready message which should be sent. - msg: crate::lightning::ln::msgs::ChannelReady, - }, - /// Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. - SendAnnouncementSignatures { - /// The node_id of the node which should receive these message(s) - node_id: crate::c_types::PublicKey, - /// The announcement_signatures message which should be sent. - msg: crate::lightning::ln::msgs::AnnouncementSignatures, - }, - /// Used to indicate that a series of HTLC update messages, as well as a commitment_signed - /// message should be sent to the peer with the given node_id. - UpdateHTLCs { - /// The node_id of the node which should receive these message(s) - node_id: crate::c_types::PublicKey, - /// The update messages which should be sent. ALL messages in the struct should be sent! - updates: crate::lightning::ln::msgs::CommitmentUpdate, - }, - /// Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. - SendRevokeAndACK { - /// 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::RevokeAndACK, - }, - /// Used to indicate that a closing_signed message should be sent to the peer with the given node_id. - SendClosingSigned { - /// 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::ClosingSigned, - }, - /// Used to indicate that a shutdown message should be sent to the peer with the given node_id. - SendShutdown { - /// 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::Shutdown, - }, - /// Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. - SendChannelReestablish { - /// 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::ChannelReestablish, - }, - /// Used to send a channel_announcement and channel_update to a specific peer, likely on - /// initial connection to ensure our peers know about our channels. - SendChannelAnnouncement { - /// The node_id of the node which should receive this message - node_id: crate::c_types::PublicKey, - /// The channel_announcement which should be sent. - msg: crate::lightning::ln::msgs::ChannelAnnouncement, - /// The followup channel_update which should be sent. - update_msg: crate::lightning::ln::msgs::ChannelUpdate, - }, - /// Used to indicate that a channel_announcement and channel_update should be broadcast to all - /// peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). - /// - /// Note that after doing so, you very likely (unless you did so very recently) want to - /// broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This - /// ensures that any nodes which see our channel_announcement also have a relevant - /// node_announcement, including relevant feature flags which may be important for routing - /// through or to us. - /// - /// [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement - BroadcastChannelAnnouncement { - /// The channel_announcement which should be sent. - msg: crate::lightning::ln::msgs::ChannelAnnouncement, - /// The followup channel_update which should be sent. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - update_msg: crate::lightning::ln::msgs::ChannelUpdate, - }, - /// Used to indicate that a channel_update should be broadcast to all peers. - BroadcastChannelUpdate { - /// The channel_update which should be sent. - msg: crate::lightning::ln::msgs::ChannelUpdate, - }, - /// Used to indicate that a node_announcement should be broadcast to all peers. - BroadcastNodeAnnouncement { - /// The node_announcement which should be sent. - msg: crate::lightning::ln::msgs::NodeAnnouncement, - }, - /// Used to indicate that a channel_update should be sent to a single peer. - /// In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a - /// private channel and we shouldn't be informing all of our peers of channel parameters. - SendChannelUpdate { - /// The node_id of the node which should receive this message - node_id: crate::c_types::PublicKey, - /// The channel_update which should be sent. - msg: crate::lightning::ln::msgs::ChannelUpdate, - }, - /// Broadcast an error downstream to be handled - HandleError { - /// The node_id of the node which should receive this message - node_id: crate::c_types::PublicKey, - /// The action which should be taken. - action: crate::lightning::ln::msgs::ErrorAction, - }, - /// Query a peer for channels with funding transaction UTXOs in a block range. - SendChannelRangeQuery { - /// The node_id of this message recipient - node_id: crate::c_types::PublicKey, - /// The query_channel_range which should be sent. - msg: crate::lightning::ln::msgs::QueryChannelRange, - }, - /// Request routing gossip messages from a peer for a list of channels identified by - /// their short_channel_ids. - SendShortIdsQuery { - /// The node_id of this message recipient - node_id: crate::c_types::PublicKey, - /// The query_short_channel_ids which should be sent. - msg: crate::lightning::ln::msgs::QueryShortChannelIds, - }, - /// Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events - /// emitted during processing of the query. - SendReplyChannelRange { - /// The node_id of this message recipient - node_id: crate::c_types::PublicKey, - /// The reply_channel_range which should be sent. - msg: crate::lightning::ln::msgs::ReplyChannelRange, - }, - /// Sends a timestamp filter for inbound gossip. This should be sent on each new connection to - /// enable receiving gossip messages from the peer. - SendGossipTimestampFilter { - /// The node_id of this message recipient - node_id: crate::c_types::PublicKey, - /// The gossip_timestamp_filter which should be sent. - msg: crate::lightning::ln::msgs::GossipTimestampFilter, - }, -} -use lightning::events::MessageSendEvent as MessageSendEventImport; -pub(crate) type nativeMessageSendEvent = MessageSendEventImport; - -impl MessageSendEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeMessageSendEvent { - match self { - MessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendAcceptChannel { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendAcceptChannelV2 {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendAcceptChannelV2 { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendOpenChannel { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendOpenChannelV2 {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendOpenChannelV2 { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendFundingCreated { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendFundingSigned { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendStfu {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendStfu { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceInit {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendSpliceInit { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceAck {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendSpliceAck { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceLocked {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendSpliceLocked { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxAddInput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxAddInput { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxAddOutput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxAddOutput { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxRemoveInput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxRemoveInput { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxRemoveOutput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxRemoveOutput { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxComplete {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxComplete { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxSignatures { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxInitRbf {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxInitRbf { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxAckRbf {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxAckRbf { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendTxAbort {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendTxAbort { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendChannelReady { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendAnnouncementSignatures { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::UpdateHTLCs {ref node_id, ref updates, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut updates_nonref = Clone::clone(updates); - nativeMessageSendEvent::UpdateHTLCs { - node_id: node_id_nonref.into_rust(), - updates: *unsafe { Box::from_raw(updates_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendRevokeAndACK { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendClosingSigned { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendShutdown {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendShutdown { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendChannelReestablish { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - let mut update_msg_nonref = Clone::clone(update_msg); - nativeMessageSendEvent::SendChannelAnnouncement { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - update_msg: *unsafe { Box::from_raw(update_msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { - let mut msg_nonref = Clone::clone(msg); - let mut update_msg_nonref = Clone::clone(update_msg); - let mut local_update_msg_nonref = if update_msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_msg_nonref.take_inner()) } }) }; - nativeMessageSendEvent::BroadcastChannelAnnouncement { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - update_msg: local_update_msg_nonref, - } - }, - MessageSendEvent::BroadcastChannelUpdate {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::BroadcastChannelUpdate { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::BroadcastNodeAnnouncement {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::BroadcastNodeAnnouncement { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendChannelUpdate { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::HandleError {ref node_id, ref action, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut action_nonref = Clone::clone(action); - nativeMessageSendEvent::HandleError { - node_id: node_id_nonref.into_rust(), - action: action_nonref.into_native(), - } - }, - MessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendChannelRangeQuery { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendShortIdsQuery { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendReplyChannelRange { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - MessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - nativeMessageSendEvent::SendGossipTimestampFilter { - node_id: node_id_nonref.into_rust(), - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeMessageSendEvent { - match self { - MessageSendEvent::SendAcceptChannel {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendAcceptChannel { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendAcceptChannelV2 {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendAcceptChannelV2 { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendOpenChannel {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendOpenChannel { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendOpenChannelV2 {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendOpenChannelV2 { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendFundingCreated {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendFundingCreated { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendFundingSigned {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendFundingSigned { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendStfu {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendStfu { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceInit {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendSpliceInit { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceAck {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendSpliceAck { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendSpliceLocked {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendSpliceLocked { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxAddInput {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxAddInput { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxAddOutput {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxAddOutput { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxRemoveInput {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxRemoveInput { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxRemoveOutput {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxRemoveOutput { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxComplete {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxComplete { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxSignatures {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxSignatures { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxInitRbf {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxInitRbf { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxAckRbf {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxAckRbf { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendTxAbort {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendTxAbort { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendChannelReady {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendChannelReady { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendAnnouncementSignatures { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::UpdateHTLCs {mut node_id, mut updates, } => { - nativeMessageSendEvent::UpdateHTLCs { - node_id: node_id.into_rust(), - updates: *unsafe { Box::from_raw(updates.take_inner()) }, - } - }, - MessageSendEvent::SendRevokeAndACK {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendRevokeAndACK { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendClosingSigned {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendClosingSigned { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendShutdown {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendShutdown { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendChannelReestablish {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendChannelReestablish { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendChannelAnnouncement {mut node_id, mut msg, mut update_msg, } => { - nativeMessageSendEvent::SendChannelAnnouncement { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - update_msg: *unsafe { Box::from_raw(update_msg.take_inner()) }, - } - }, - MessageSendEvent::BroadcastChannelAnnouncement {mut msg, mut update_msg, } => { - let mut local_update_msg = if update_msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_msg.take_inner()) } }) }; - nativeMessageSendEvent::BroadcastChannelAnnouncement { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - update_msg: local_update_msg, - } - }, - MessageSendEvent::BroadcastChannelUpdate {mut msg, } => { - nativeMessageSendEvent::BroadcastChannelUpdate { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::BroadcastNodeAnnouncement {mut msg, } => { - nativeMessageSendEvent::BroadcastNodeAnnouncement { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendChannelUpdate { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::HandleError {mut node_id, mut action, } => { - nativeMessageSendEvent::HandleError { - node_id: node_id.into_rust(), - action: action.into_native(), - } - }, - MessageSendEvent::SendChannelRangeQuery {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendChannelRangeQuery { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendShortIdsQuery {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendShortIdsQuery { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendReplyChannelRange { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - MessageSendEvent::SendGossipTimestampFilter {mut node_id, mut msg, } => { - nativeMessageSendEvent::SendGossipTimestampFilter { - node_id: node_id.into_rust(), - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &MessageSendEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeMessageSendEvent) }; - match native { - nativeMessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendAcceptChannel { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendAcceptChannelV2 {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendAcceptChannelV2 { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::AcceptChannelV2 { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendOpenChannel { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendOpenChannelV2 {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendOpenChannelV2 { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::OpenChannelV2 { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendFundingCreated { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendFundingSigned { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendStfu {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendStfu { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::Stfu { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceInit {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendSpliceInit { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::SpliceInit { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceAck {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendSpliceAck { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::SpliceAck { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceLocked {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendSpliceLocked { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::SpliceLocked { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAddInput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxAddInput { - 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 }, - } - }, - nativeMessageSendEvent::SendTxAddOutput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxAddOutput { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxAddOutput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxRemoveInput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxRemoveInput { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxRemoveInput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxRemoveOutput {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxRemoveOutput { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxRemoveOutput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxComplete {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxComplete { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxComplete { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxSignatures { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxSignatures { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxInitRbf {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxInitRbf { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxInitRbf { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAckRbf {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendTxAckRbf { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::TxAckRbf { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAbort {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - 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::TxAbort { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendChannelReady { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendAnnouncementSignatures { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::UpdateHTLCs {ref node_id, ref updates, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut updates_nonref = Clone::clone(updates); - MessageSendEvent::UpdateHTLCs { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - updates: crate::lightning::ln::msgs::CommitmentUpdate { inner: ObjOps::heap_alloc(updates_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendRevokeAndACK { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendClosingSigned { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendShutdown {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendShutdown { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendChannelReestablish { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - let mut update_msg_nonref = Clone::clone(update_msg); - MessageSendEvent::SendChannelAnnouncement { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - update_msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(update_msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { - let mut msg_nonref = Clone::clone(msg); - let mut update_msg_nonref = Clone::clone(update_msg); - let mut local_update_msg_nonref = crate::lightning::ln::msgs::ChannelUpdate { inner: if update_msg_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((update_msg_nonref.unwrap())) } }, is_owned: true }; - MessageSendEvent::BroadcastChannelAnnouncement { - msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - update_msg: local_update_msg_nonref, - } - }, - nativeMessageSendEvent::BroadcastChannelUpdate {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::BroadcastChannelUpdate { - msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::BroadcastNodeAnnouncement {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::BroadcastNodeAnnouncement { - msg: crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendChannelUpdate { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::HandleError {ref node_id, ref action, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut action_nonref = Clone::clone(action); - MessageSendEvent::HandleError { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - action: crate::lightning::ln::msgs::ErrorAction::native_into(action_nonref), - } - }, - nativeMessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendChannelRangeQuery { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendShortIdsQuery { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendReplyChannelRange { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - nativeMessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { - let mut node_id_nonref = Clone::clone(node_id); - let mut msg_nonref = Clone::clone(msg); - MessageSendEvent::SendGossipTimestampFilter { - node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), - msg: crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeMessageSendEvent) -> Self { - match native { - nativeMessageSendEvent::SendAcceptChannel {mut node_id, mut msg, } => { - MessageSendEvent::SendAcceptChannel { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendAcceptChannelV2 {mut node_id, mut msg, } => { - MessageSendEvent::SendAcceptChannelV2 { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::AcceptChannelV2 { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendOpenChannel {mut node_id, mut msg, } => { - MessageSendEvent::SendOpenChannel { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendOpenChannelV2 {mut node_id, mut msg, } => { - MessageSendEvent::SendOpenChannelV2 { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::OpenChannelV2 { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendFundingCreated {mut node_id, mut msg, } => { - MessageSendEvent::SendFundingCreated { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendFundingSigned {mut node_id, mut msg, } => { - MessageSendEvent::SendFundingSigned { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendStfu {mut node_id, mut msg, } => { - MessageSendEvent::SendStfu { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::Stfu { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceInit {mut node_id, mut msg, } => { - MessageSendEvent::SendSpliceInit { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::SpliceInit { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceAck {mut node_id, mut msg, } => { - MessageSendEvent::SendSpliceAck { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::SpliceAck { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendSpliceLocked {mut node_id, mut msg, } => { - MessageSendEvent::SendSpliceLocked { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::SpliceLocked { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAddInput {mut node_id, mut msg, } => { - MessageSendEvent::SendTxAddInput { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxAddInput { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAddOutput {mut node_id, mut msg, } => { - MessageSendEvent::SendTxAddOutput { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxAddOutput { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxRemoveInput {mut node_id, mut msg, } => { - MessageSendEvent::SendTxRemoveInput { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxRemoveInput { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxRemoveOutput {mut node_id, mut msg, } => { - MessageSendEvent::SendTxRemoveOutput { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxRemoveOutput { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxComplete {mut node_id, mut msg, } => { - MessageSendEvent::SendTxComplete { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxComplete { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxSignatures {mut node_id, mut msg, } => { - MessageSendEvent::SendTxSignatures { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxSignatures { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxInitRbf {mut node_id, mut msg, } => { - MessageSendEvent::SendTxInitRbf { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxInitRbf { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAckRbf {mut node_id, mut msg, } => { - MessageSendEvent::SendTxAckRbf { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxAckRbf { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendTxAbort {mut node_id, mut msg, } => { - MessageSendEvent::SendTxAbort { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::TxAbort { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelReady {mut node_id, mut msg, } => { - MessageSendEvent::SendChannelReady { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => { - MessageSendEvent::SendAnnouncementSignatures { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::UpdateHTLCs {mut node_id, mut updates, } => { - MessageSendEvent::UpdateHTLCs { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - updates: crate::lightning::ln::msgs::CommitmentUpdate { inner: ObjOps::heap_alloc(updates), is_owned: true }, - } - }, - nativeMessageSendEvent::SendRevokeAndACK {mut node_id, mut msg, } => { - MessageSendEvent::SendRevokeAndACK { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendClosingSigned {mut node_id, mut msg, } => { - MessageSendEvent::SendClosingSigned { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendShutdown {mut node_id, mut msg, } => { - MessageSendEvent::SendShutdown { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelReestablish {mut node_id, mut msg, } => { - MessageSendEvent::SendChannelReestablish { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelAnnouncement {mut node_id, mut msg, mut update_msg, } => { - MessageSendEvent::SendChannelAnnouncement { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, - update_msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(update_msg), is_owned: true }, - } - }, - nativeMessageSendEvent::BroadcastChannelAnnouncement {mut msg, mut update_msg, } => { - let mut local_update_msg = crate::lightning::ln::msgs::ChannelUpdate { inner: if update_msg.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((update_msg.unwrap())) } }, is_owned: true }; - MessageSendEvent::BroadcastChannelAnnouncement { - msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, - update_msg: local_update_msg, - } - }, - nativeMessageSendEvent::BroadcastChannelUpdate {mut msg, } => { - MessageSendEvent::BroadcastChannelUpdate { - msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::BroadcastNodeAnnouncement {mut msg, } => { - MessageSendEvent::BroadcastNodeAnnouncement { - msg: crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { - MessageSendEvent::SendChannelUpdate { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::HandleError {mut node_id, mut action, } => { - MessageSendEvent::HandleError { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - action: crate::lightning::ln::msgs::ErrorAction::native_into(action), - } - }, - nativeMessageSendEvent::SendChannelRangeQuery {mut node_id, mut msg, } => { - MessageSendEvent::SendChannelRangeQuery { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendShortIdsQuery {mut node_id, mut msg, } => { - MessageSendEvent::SendShortIdsQuery { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => { - MessageSendEvent::SendReplyChannelRange { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - nativeMessageSendEvent::SendGossipTimestampFilter {mut node_id, mut msg, } => { - MessageSendEvent::SendGossipTimestampFilter { - node_id: crate::c_types::PublicKey::from_rust(&node_id), - msg: crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(msg), is_owned: true }, - } - }, - } - } -} -/// Frees any resources used by the MessageSendEvent -#[no_mangle] -pub extern "C" fn MessageSendEvent_free(this_ptr: MessageSendEvent) { } -/// Creates a copy of the MessageSendEvent -#[no_mangle] -pub extern "C" fn MessageSendEvent_clone(orig: &MessageSendEvent) -> MessageSendEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn MessageSendEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MessageSendEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn MessageSendEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut MessageSendEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_accept_channel(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AcceptChannel) -> MessageSendEvent { - MessageSendEvent::SendAcceptChannel { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_accept_channel_v2(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AcceptChannelV2) -> MessageSendEvent { - MessageSendEvent::SendAcceptChannelV2 { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendOpenChannel-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_open_channel(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::OpenChannel) -> MessageSendEvent { - MessageSendEvent::SendOpenChannel { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_open_channel_v2(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::OpenChannelV2) -> MessageSendEvent { - MessageSendEvent::SendOpenChannelV2 { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendFundingCreated-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_funding_created(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::FundingCreated) -> MessageSendEvent { - MessageSendEvent::SendFundingCreated { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendFundingSigned-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_funding_signed(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::FundingSigned) -> MessageSendEvent { - MessageSendEvent::SendFundingSigned { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendStfu-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_stfu(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::Stfu) -> MessageSendEvent { - MessageSendEvent::SendStfu { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendSpliceInit-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_splice_init(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceInit) -> MessageSendEvent { - MessageSendEvent::SendSpliceInit { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendSpliceAck-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_splice_ack(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceAck) -> MessageSendEvent { - MessageSendEvent::SendSpliceAck { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_splice_locked(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceLocked) -> MessageSendEvent { - MessageSendEvent::SendSpliceLocked { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxAddInput-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_add_input(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAddInput) -> MessageSendEvent { - MessageSendEvent::SendTxAddInput { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_add_output(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAddOutput) -> MessageSendEvent { - MessageSendEvent::SendTxAddOutput { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_remove_input(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxRemoveInput) -> MessageSendEvent { - MessageSendEvent::SendTxRemoveInput { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_remove_output(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxRemoveOutput) -> MessageSendEvent { - MessageSendEvent::SendTxRemoveOutput { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxComplete-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_complete(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxComplete) -> MessageSendEvent { - MessageSendEvent::SendTxComplete { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxSignatures-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_signatures(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxSignatures) -> MessageSendEvent { - MessageSendEvent::SendTxSignatures { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_init_rbf(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxInitRbf) -> MessageSendEvent { - MessageSendEvent::SendTxInitRbf { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_tx_ack_rbf(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAckRbf) -> MessageSendEvent { - MessageSendEvent::SendTxAckRbf { - node_id, - msg, - } -} -#[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::TxAbort) -> MessageSendEvent { - MessageSendEvent::SendTxAbort { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendChannelReady-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_channel_ready(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelReady) -> MessageSendEvent { - MessageSendEvent::SendChannelReady { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_announcement_signatures(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AnnouncementSignatures) -> MessageSendEvent { - MessageSendEvent::SendAnnouncementSignatures { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_update_htlcs(node_id: crate::c_types::PublicKey, updates: crate::lightning::ln::msgs::CommitmentUpdate) -> MessageSendEvent { - MessageSendEvent::UpdateHTLCs { - node_id, - updates, - } -} -#[no_mangle] -/// Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_revoke_and_ack(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::RevokeAndACK) -> MessageSendEvent { - MessageSendEvent::SendRevokeAndACK { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendClosingSigned-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_closing_signed(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ClosingSigned) -> MessageSendEvent { - MessageSendEvent::SendClosingSigned { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendShutdown-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_shutdown(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::Shutdown) -> MessageSendEvent { - MessageSendEvent::SendShutdown { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_channel_reestablish(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelReestablish) -> MessageSendEvent { - MessageSendEvent::SendChannelReestablish { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_channel_announcement(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelAnnouncement, update_msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { - MessageSendEvent::SendChannelAnnouncement { - node_id, - msg, - update_msg, - } -} -#[no_mangle] -/// Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_broadcast_channel_announcement(msg: crate::lightning::ln::msgs::ChannelAnnouncement, update_msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { - MessageSendEvent::BroadcastChannelAnnouncement { - msg, - update_msg, - } -} -#[no_mangle] -/// Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_broadcast_channel_update(msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { - MessageSendEvent::BroadcastChannelUpdate { - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_broadcast_node_announcement(msg: crate::lightning::ln::msgs::NodeAnnouncement) -> MessageSendEvent { - MessageSendEvent::BroadcastNodeAnnouncement { - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_channel_update(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { - MessageSendEvent::SendChannelUpdate { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new HandleError-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_handle_error(node_id: crate::c_types::PublicKey, action: crate::lightning::ln::msgs::ErrorAction) -> MessageSendEvent { - MessageSendEvent::HandleError { - node_id, - action, - } -} -#[no_mangle] -/// Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_channel_range_query(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryChannelRange) -> MessageSendEvent { - MessageSendEvent::SendChannelRangeQuery { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_short_ids_query(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> MessageSendEvent { - MessageSendEvent::SendShortIdsQuery { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_reply_channel_range(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ReplyChannelRange) -> MessageSendEvent { - MessageSendEvent::SendReplyChannelRange { - node_id, - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent -pub extern "C" fn MessageSendEvent_send_gossip_timestamp_filter(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::GossipTimestampFilter) -> MessageSendEvent { - MessageSendEvent::SendGossipTimestampFilter { - node_id, - msg, - } -} -/// Get a string which allows debug introspection of a MessageSendEvent object -pub extern "C" fn MessageSendEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::MessageSendEvent }).into()} -/// A trait indicating an object may generate message send events -#[repr(C)] -pub struct MessageSendEventsProvider { - /// 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, - /// Gets the list of pending events which were generated by previous actions, clearing the list - /// in the process. - pub get_and_clear_pending_msg_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ, - /// 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 MessageSendEventsProvider {} -unsafe impl Sync for MessageSendEventsProvider {} -#[allow(unused)] -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), - free: Clone::clone(&orig.free), - } -} - -use lightning::events::MessageSendEventsProvider as rustMessageSendEventsProvider; -impl rustMessageSendEventsProvider for MessageSendEventsProvider { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.get_and_clear_pending_msg_events)(self.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; - local_ret - } -} - -pub struct MessageSendEventsProviderRef(MessageSendEventsProvider); -impl rustMessageSendEventsProvider for MessageSendEventsProviderRef { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.0.get_and_clear_pending_msg_events)(self.0.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; - 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 MessageSendEventsProvider { - type Target = MessageSendEventsProviderRef; - fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const MessageSendEventsProviderRef) } - } -} -impl core::ops::DerefMut for MessageSendEventsProvider { - fn deref_mut(&mut self) -> &mut MessageSendEventsProviderRef { - unsafe { &mut *(self as *mut _ as *mut MessageSendEventsProviderRef) } - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn MessageSendEventsProvider_free(this_ptr: MessageSendEventsProvider) { } -impl Drop for MessageSendEventsProvider { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} -/// A trait indicating an object may generate events. -/// -/// Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. -/// -/// Implementations of this trait may also feature an async version of event handling, as shown with -/// [`ChannelManager::process_pending_events_async`] and -/// [`ChainMonitor::process_pending_events_async`]. -/// -/// # Requirements -/// -/// When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending -/// event since the last invocation. -/// -/// In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s -/// and replay any unhandled events on startup. An [`Event`] is considered handled when -/// [`process_pending_events`] returns `Ok(())`, thus handlers MUST fully handle [`Event`]s and -/// persist any relevant changes to disk *before* returning `Ok(())`. In case of an error (e.g., -/// persistence failure) implementors should return `Err(ReplayEvent())`, signalling to the -/// [`EventsProvider`] to replay unhandled events on the next invocation (generally immediately). -/// Note that some events might not be replayed, please refer to the documentation for -/// the individual [`Event`] variants for more detail. -/// -/// Further, because an application may crash between an [`Event`] being handled and the -/// implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in -/// effect, [`Event`]s may be replayed. -/// -/// Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to -/// consult the provider's documentation on the implication of processing events and how a handler -/// may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and -/// [`ChainMonitor::process_pending_events`]). -/// -/// (C-not implementable) As there is likely no reason for a user to implement this trait on their -/// own type(s). -/// -/// [`process_pending_events`]: Self::process_pending_events -/// [`handle_event`]: EventHandler::handle_event -/// [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events -/// [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events -/// [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async -/// [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async -#[repr(C)] -pub struct EventsProvider { - /// 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, - /// Processes any events generated since the last call using the given event handler. +pub struct EventsProvider { + /// 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, + /// Processes any events generated since the last call using the given event handler. /// /// See the trait-level documentation for requirements. pub process_pending_events: extern "C" fn (this_arg: *const c_void, handler: crate::lightning::events::EventHandler), @@ -6051,7 +5199,7 @@ impl Clone for ReplayEvent { fn clone(&self) -> Self { Self { inner: if <*mut nativeReplayEvent>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -6059,12 +5207,12 @@ impl Clone for ReplayEvent { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReplayEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReplayEvent)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReplayEvent) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ReplayEvent pub extern "C" fn ReplayEvent_clone(orig: &ReplayEvent) -> ReplayEvent { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ReplayEvent object pub extern "C" fn ReplayEvent_debug_str_void(o: *const c_void) -> Str { @@ -6139,3 +5287,149 @@ impl Drop for EventHandler { } } } +/// The BOLT 12 invoice that was paid, surfaced in [`Event::PaymentSent::bolt12_invoice`]. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum PaidBolt12Invoice { + /// The BOLT 12 invoice specified by the BOLT 12 specification, + /// allowing the user to perform proof of payment. + Bolt12Invoice( + crate::lightning::offers::invoice::Bolt12Invoice), + /// The Static invoice, used in the async payment specification update proposal, + /// where the user cannot perform proof of payment. + StaticInvoice( + crate::lightning::offers::static_invoice::StaticInvoice), +} +use lightning::events::PaidBolt12Invoice as PaidBolt12InvoiceImport; +pub(crate) type nativePaidBolt12Invoice = PaidBolt12InvoiceImport; + +impl PaidBolt12Invoice { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativePaidBolt12Invoice { + match self { + PaidBolt12Invoice::Bolt12Invoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativePaidBolt12Invoice::Bolt12Invoice ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + PaidBolt12Invoice::StaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativePaidBolt12Invoice::StaticInvoice ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativePaidBolt12Invoice { + match self { + PaidBolt12Invoice::Bolt12Invoice (mut a, ) => { + nativePaidBolt12Invoice::Bolt12Invoice ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + PaidBolt12Invoice::StaticInvoice (mut a, ) => { + nativePaidBolt12Invoice::StaticInvoice ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &PaidBolt12InvoiceImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativePaidBolt12Invoice) }; + match native { + nativePaidBolt12Invoice::Bolt12Invoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + PaidBolt12Invoice::Bolt12Invoice ( + crate::lightning::offers::invoice::Bolt12Invoice { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativePaidBolt12Invoice::StaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + PaidBolt12Invoice::StaticInvoice ( + crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativePaidBolt12Invoice) -> Self { + match native { + nativePaidBolt12Invoice::Bolt12Invoice (mut a, ) => { + PaidBolt12Invoice::Bolt12Invoice ( + crate::lightning::offers::invoice::Bolt12Invoice { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativePaidBolt12Invoice::StaticInvoice (mut a, ) => { + PaidBolt12Invoice::StaticInvoice ( + crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + } + } +} +/// Frees any resources used by the PaidBolt12Invoice +#[no_mangle] +pub extern "C" fn PaidBolt12Invoice_free(this_ptr: PaidBolt12Invoice) { } +/// Creates a copy of the PaidBolt12Invoice +#[no_mangle] +pub extern "C" fn PaidBolt12Invoice_clone(orig: &PaidBolt12Invoice) -> PaidBolt12Invoice { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaidBolt12Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaidBolt12Invoice)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PaidBolt12Invoice_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut PaidBolt12Invoice) }; +} +#[no_mangle] +/// Utility method to constructs a new Bolt12Invoice-variant PaidBolt12Invoice +pub extern "C" fn PaidBolt12Invoice_bolt12_invoice(a: crate::lightning::offers::invoice::Bolt12Invoice) -> PaidBolt12Invoice { + PaidBolt12Invoice::Bolt12Invoice(a, ) +} +#[no_mangle] +/// Utility method to constructs a new StaticInvoice-variant PaidBolt12Invoice +pub extern "C" fn PaidBolt12Invoice_static_invoice(a: crate::lightning::offers::static_invoice::StaticInvoice) -> PaidBolt12Invoice { + PaidBolt12Invoice::StaticInvoice(a, ) +} +/// Get a string which allows debug introspection of a PaidBolt12Invoice object +pub extern "C" fn PaidBolt12Invoice_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::PaidBolt12Invoice }).into()} +/// Checks if two PaidBolt12Invoices contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn PaidBolt12Invoice_eq(a: &PaidBolt12Invoice, b: &PaidBolt12Invoice) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +/// Generates a non-cryptographic 64-bit hash of the PaidBolt12Invoice. +#[no_mangle] +pub extern "C" fn PaidBolt12Invoice_hash(o: &PaidBolt12Invoice) -> 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) +} +#[no_mangle] +/// Serialize the PaidBolt12Invoice object into a byte array which can be read by PaidBolt12Invoice_read +pub extern "C" fn PaidBolt12Invoice_write(obj: &crate::lightning::events::PaidBolt12Invoice) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn PaidBolt12Invoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + PaidBolt12Invoice_write(unsafe { &*(obj as *const PaidBolt12Invoice) }) +} +#[no_mangle] +/// Read a PaidBolt12Invoice from a byte array, created by PaidBolt12Invoice_write +pub extern "C" fn PaidBolt12Invoice_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PaidBolt12InvoiceDecodeErrorZ { + 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::PaidBolt12Invoice::native_into(o) }).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/ln/bolt11_payment.rs b/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs deleted file mode 100644 index 75abcb2c..00000000 --- a/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs +++ /dev/null @@ -1,56 +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. - -//! 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; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -/// Builds the necessary parameters to pay or pre-flight probe the given variable-amount -/// (also known as 'zero-amount') [`Bolt11Invoice`] using -/// [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. -/// -/// Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the -/// same [`PaymentHash`] has never been paid before. -/// -/// Will always succeed unless the invoice has an amount specified, in which case -/// [`payment_parameters_from_invoice`] should be used. -/// -/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment -/// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes -#[no_mangle] -pub extern "C" fn payment_parameters_from_variable_amount_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msat: u64) -> crate::c_types::derived::CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - let mut ret = lightning::ln::bolt11_payment::payment_parameters_from_variable_amount_invoice(invoice.get_native_ref(), amount_msat); - 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, mut orig_ret_0_2) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }, crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(orig_ret_0_2), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} - -/// Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using -/// [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. -/// -/// Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the -/// same [`PaymentHash`] has never been paid before. -/// -/// Will always succeed unless the invoice has no amount specified, in which case -/// [`payment_parameters_from_variable_amount_invoice`] should be used. -/// -/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment -/// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes -#[no_mangle] -pub extern "C" fn payment_parameters_from_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - let mut ret = lightning::ln::bolt11_payment::payment_parameters_from_invoice(invoice.get_native_ref()); - 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, mut orig_ret_0_2) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }, crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(orig_ret_0_2), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} - diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index 89c8f65b..50ab9ec6 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -18,18 +18,25 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -/// Maximum number of one-way in-flight HTLC (protocol-level value). - +/// Maximum number of in-flight HTLCs in each direction allowed by the lightning protocol. +/// +/// 483 for non-zero-fee-commitment channels and 114 for zero-fee-commitment channels. +/// +/// Actual maximums can be set equal to or below this value by each channel participant. #[no_mangle] -pub static MAX_HTLCS: u16 = lightning::ln::chan_utils::MAX_HTLCS; -/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, non-anchor variant. +pub extern "C" fn max_htlcs(channel_type: &crate::lightning_types::features::ChannelTypeFeatures) -> u16 { + let mut ret = lightning::ln::chan_utils::max_htlcs(channel_type.get_native_ref()); + ret +} + +/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, non-anchor and p2a anchor variant. #[no_mangle] pub static OFFERED_HTLC_SCRIPT_WEIGHT: usize = lightning::ln::chan_utils::OFFERED_HTLC_SCRIPT_WEIGHT; -/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, anchor variant. +/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, keyed anchor variant. #[no_mangle] -pub static OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS: usize = lightning::ln::chan_utils::OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; +pub static OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS: usize = lightning::ln::chan_utils::OFFERED_HTLC_SCRIPT_WEIGHT_KEYED_ANCHORS; /// The weight of a BIP141 witnessScript for a BOLT3's \"received HTLC output\" can vary in function of its CLTV argument value. /// We define a range that encompasses both its non-anchors and anchors variants. /// This is the maximum post-anchor value. @@ -40,16 +47,52 @@ pub static MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT: usize = lightning::ln::chan_utils::M #[no_mangle] pub static ANCHOR_INPUT_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::ANCHOR_INPUT_WITNESS_WEIGHT; -/// The upper bound weight of an HTLC timeout input from a commitment transaction with anchor -/// outputs. +/// The weight of an empty witness; used to spend a P2A output. + +#[no_mangle] +pub static EMPTY_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::EMPTY_WITNESS_WEIGHT; +/// The maximum value of a P2A anchor. + +#[no_mangle] +pub static P2A_MAX_VALUE: u64 = lightning::ln::chan_utils::P2A_MAX_VALUE; +/// The maximum weight of a TRUC transaction, see BIP431. + +#[no_mangle] +pub static TRUC_MAX_WEIGHT: u64 = lightning::ln::chan_utils::TRUC_MAX_WEIGHT; +/// The maximum weight of a TRUC transaction with an unconfirmed TRUC ancestor, see BIP431. + +#[no_mangle] +pub static TRUC_CHILD_MAX_WEIGHT: u64 = lightning::ln::chan_utils::TRUC_CHILD_MAX_WEIGHT; +/// The upper bound weight of an HTLC timeout input from a commitment transaction with keyed anchor outputs. + +#[no_mangle] +pub static HTLC_TIMEOUT_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_TIMEOUT_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT; +/// The upper bound weight of an HTLC timeout input from a commitment transaction with a p2a anchor output. +/// Note the corresponding outputs no longer have the 1 CSV lock. + +#[no_mangle] +pub static HTLC_TIMEOUT_INPUT_P2A_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_TIMEOUT_INPUT_P2A_ANCHOR_WITNESS_WEIGHT; +/// The upper bound weight of an HTLC success input from a commitment transaction with keyed anchor outputs. + +#[no_mangle] +pub static HTLC_SUCCESS_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_SUCCESS_INPUT_KEYED_ANCHOR_WITNESS_WEIGHT; +/// The upper bound weight of an HTLC success input from a commitment transaction with a p2a anchor output. +/// Note the corresponding outputs no longer have the 1 CSV lock. #[no_mangle] -pub static HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_TIMEOUT_INPUT_ANCHOR_WITNESS_WEIGHT; -/// The upper bound weight of an HTLC success input from a commitment transaction with anchor -/// outputs. +pub static HTLC_SUCCESS_INPUT_P2A_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_SUCCESS_INPUT_P2A_ANCHOR_WITNESS_WEIGHT; +/// The weight of a funding transaction input (2-of-2 P2WSH). +/// +/// Unlike in the [spec], 72 WU is used for the max signature size since 73 WU signatures are +/// non-standard. +/// +/// Note: If you have the `grind_signatures` feature enabled, this will be at least 1 byte +/// shorter. +/// +/// [spec]: https://github.com/lightning/bolts/blob/master/03-transactions.md#expected-weight-of-the-commitment-transaction #[no_mangle] -pub static HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::HTLC_SUCCESS_INPUT_ANCHOR_WITNESS_WEIGHT; +pub static FUNDING_TRANSACTION_WITNESS_WEIGHT: u64 = lightning::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT; /// Gets the weight for an HTLC-Success transaction. #[no_mangle] pub extern "C" fn htlc_success_tx_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 { @@ -57,6 +100,13 @@ pub extern "C" fn htlc_success_tx_weight(channel_type_features: &crate::lightnin ret } +/// Gets the weight of a single input-output pair in externally funded HTLC-success transactions +#[no_mangle] +pub extern "C" fn aggregated_htlc_success_input_output_pair_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 { + let mut ret = lightning::ln::chan_utils::aggregated_htlc_success_input_output_pair_weight(channel_type_features.get_native_ref()); + ret +} + /// Gets the weight for an HTLC-Timeout transaction. #[no_mangle] pub extern "C" fn htlc_timeout_tx_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 { @@ -64,6 +114,13 @@ pub extern "C" fn htlc_timeout_tx_weight(channel_type_features: &crate::lightnin ret } +/// Gets the weight of a single input-output pair in externally funded HTLC-timeout transactions +#[no_mangle] +pub extern "C" fn aggregated_htlc_timeout_input_output_pair_weight(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> u64 { + let mut ret = lightning::ln::chan_utils::aggregated_htlc_timeout_input_output_pair_weight(channel_type_features.get_native_ref()); + ret +} + /// Describes the type of HTLC claim as determined by analyzing the witness. #[derive(Clone)] #[must_use] @@ -258,7 +315,7 @@ impl Clone for CounterpartyCommitmentSecrets { fn clone(&self) -> Self { Self { inner: if <*mut nativeCounterpartyCommitmentSecrets>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -266,12 +323,12 @@ impl Clone for CounterpartyCommitmentSecrets { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyCommitmentSecrets_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyCommitmentSecrets)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCounterpartyCommitmentSecrets) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CounterpartyCommitmentSecrets pub extern "C" fn CounterpartyCommitmentSecrets_clone(orig: &CounterpartyCommitmentSecrets) -> CounterpartyCommitmentSecrets { - orig.clone() + Clone::clone(orig) } /// Creates a new empty `CounterpartyCommitmentSecrets` structure. #[must_use] @@ -421,7 +478,7 @@ impl TxCreationKeys { /// The broadcaster's per-commitment public key which was used to derive the other keys. #[no_mangle] pub extern "C" fn TxCreationKeys_get_per_commitment_point(this_ptr: &TxCreationKeys) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point; + let mut inner_val = &mut TxCreationKeys::get_native_mut_ref(this_ptr).per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The broadcaster's per-commitment public key which was used to derive the other keys. @@ -434,7 +491,7 @@ pub extern "C" fn TxCreationKeys_set_per_commitment_point(this_ptr: &mut TxCreat /// an old state. #[no_mangle] pub extern "C" fn TxCreationKeys_get_revocation_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::RevocationKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_key; + let mut inner_val = &mut TxCreationKeys::get_native_mut_ref(this_ptr).revocation_key; crate::lightning::ln::channel_keys::RevocationKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::RevocationKey<>) as *mut _) }, is_owned: false } } /// The revocation key which is used to allow the broadcaster of the commitment @@ -447,7 +504,7 @@ pub extern "C" fn TxCreationKeys_set_revocation_key(this_ptr: &mut TxCreationKey /// Broadcaster's HTLC Key #[no_mangle] pub extern "C" fn TxCreationKeys_get_broadcaster_htlc_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::HtlcKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_htlc_key; + let mut inner_val = &mut TxCreationKeys::get_native_mut_ref(this_ptr).broadcaster_htlc_key; crate::lightning::ln::channel_keys::HtlcKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcKey<>) as *mut _) }, is_owned: false } } /// Broadcaster's HTLC Key @@ -458,7 +515,7 @@ pub extern "C" fn TxCreationKeys_set_broadcaster_htlc_key(this_ptr: &mut TxCreat /// Countersignatory's HTLC Key #[no_mangle] pub extern "C" fn TxCreationKeys_get_countersignatory_htlc_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::HtlcKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().countersignatory_htlc_key; + let mut inner_val = &mut TxCreationKeys::get_native_mut_ref(this_ptr).countersignatory_htlc_key; crate::lightning::ln::channel_keys::HtlcKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcKey<>) as *mut _) }, is_owned: false } } /// Countersignatory's HTLC Key @@ -469,7 +526,7 @@ pub extern "C" fn TxCreationKeys_set_countersignatory_htlc_key(this_ptr: &mut Tx /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) #[no_mangle] pub extern "C" fn TxCreationKeys_get_broadcaster_delayed_payment_key(this_ptr: &TxCreationKeys) -> crate::lightning::ln::channel_keys::DelayedPaymentKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().broadcaster_delayed_payment_key; + let mut inner_val = &mut TxCreationKeys::get_native_mut_ref(this_ptr).broadcaster_delayed_payment_key; crate::lightning::ln::channel_keys::DelayedPaymentKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::DelayedPaymentKey<>) as *mut _) }, is_owned: false } } /// Broadcaster's Payment Key (which isn't allowed to be spent from for some delay) @@ -502,7 +559,7 @@ impl Clone for TxCreationKeys { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxCreationKeys>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -510,12 +567,12 @@ impl Clone for TxCreationKeys { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxCreationKeys_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxCreationKeys)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxCreationKeys) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxCreationKeys pub extern "C" fn TxCreationKeys_clone(orig: &TxCreationKeys) -> TxCreationKeys { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxCreationKeys object pub extern "C" fn TxCreationKeys_debug_str_void(o: *const c_void) -> Str { @@ -600,7 +657,7 @@ impl ChannelPublicKeys { /// on-chain channel lock-in 2-of-2 multisig output. #[no_mangle] pub extern "C" fn ChannelPublicKeys_get_funding_pubkey(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey; + let mut inner_val = &mut ChannelPublicKeys::get_native_mut_ref(this_ptr).funding_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The public key which is used to sign all commitment transactions, as it appears in the @@ -615,7 +672,7 @@ pub extern "C" fn ChannelPublicKeys_set_funding_pubkey(this_ptr: &mut ChannelPub /// states. #[no_mangle] pub extern "C" fn ChannelPublicKeys_get_revocation_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::RevocationBasepoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint; + let mut inner_val = &mut ChannelPublicKeys::get_native_mut_ref(this_ptr).revocation_basepoint; crate::lightning::ln::channel_keys::RevocationBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::RevocationBasepoint<>) as *mut _) }, is_owned: false } } /// The base point which is used (with [`RevocationKey::from_basepoint`]) to derive per-commitment @@ -631,7 +688,7 @@ pub extern "C" fn ChannelPublicKeys_set_revocation_basepoint(this_ptr: &mut Chan /// static across every commitment transaction. #[no_mangle] pub extern "C" fn ChannelPublicKeys_get_payment_point(this_ptr: &ChannelPublicKeys) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_point; + let mut inner_val = &mut ChannelPublicKeys::get_native_mut_ref(this_ptr).payment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The public key on which the non-broadcaster (ie the countersignatory) receives an immediately @@ -646,7 +703,7 @@ pub extern "C" fn ChannelPublicKeys_set_payment_point(this_ptr: &mut ChannelPubl /// after some delay (or can be claimed via the revocation path). #[no_mangle] pub extern "C" fn ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::DelayedPaymentBasepoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint; + let mut inner_val = &mut ChannelPublicKeys::get_native_mut_ref(this_ptr).delayed_payment_basepoint; crate::lightning::ln::channel_keys::DelayedPaymentBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::DelayedPaymentBasepoint<>) as *mut _) }, is_owned: false } } /// The base point which is used (with derive_public_key) to derive a per-commitment payment @@ -660,7 +717,7 @@ pub extern "C" fn ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr: &mut /// which is used to encumber HTLC-in-flight outputs. #[no_mangle] pub extern "C" fn ChannelPublicKeys_get_htlc_basepoint(this_ptr: &ChannelPublicKeys) -> crate::lightning::ln::channel_keys::HtlcBasepoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint; + let mut inner_val = &mut ChannelPublicKeys::get_native_mut_ref(this_ptr).htlc_basepoint; crate::lightning::ln::channel_keys::HtlcBasepoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::HtlcBasepoint<>) as *mut _) }, is_owned: false } } /// The base point which is used (with derive_public_key) to derive a per-commitment public key @@ -685,7 +742,7 @@ impl Clone for ChannelPublicKeys { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelPublicKeys>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -693,12 +750,12 @@ impl Clone for ChannelPublicKeys { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelPublicKeys_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelPublicKeys)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelPublicKeys) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelPublicKeys pub extern "C" fn ChannelPublicKeys_clone(orig: &ChannelPublicKeys) -> ChannelPublicKeys { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelPublicKeys object pub extern "C" fn ChannelPublicKeys_debug_str_void(o: *const c_void) -> Str { @@ -769,11 +826,11 @@ pub extern "C" fn get_revokeable_redeemscript(revocation_key: &crate::lightning: ret.to_bytes().into() } -/// Returns the script for the counterparty's output on a holder's commitment transaction based on -/// the channel type. +/// Returns the script for the countersigner's (i.e. non-broadcaster's) output on a commitment +/// transaction based on the channel type. #[no_mangle] -pub extern "C" fn get_counterparty_payment_script(channel_type_features: &crate::lightning_types::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()); +pub extern "C" fn get_countersigner_payment_script(channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures, mut payment_key: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::get_countersigner_payment_script(channel_type_features.get_native_ref(), &payment_key.into_rust()); ret.to_bytes().into() } @@ -843,7 +900,7 @@ impl HTLCOutputInCommitment { /// the counterparty or our own. #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_get_offered(this_ptr: &HTLCOutputInCommitment) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().offered; + let mut inner_val = &mut HTLCOutputInCommitment::get_native_mut_ref(this_ptr).offered; *inner_val } /// Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction). @@ -858,7 +915,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_offered(this_ptr: &mut HTLCOutputIn /// this divided by 1000. #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_get_amount_msat(this_ptr: &HTLCOutputInCommitment) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + let mut inner_val = &mut HTLCOutputInCommitment::get_native_mut_ref(this_ptr).amount_msat; *inner_val } /// The value, in msat, of the HTLC. The value as it appears in the commitment transaction is @@ -870,7 +927,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_amount_msat(this_ptr: &mut HTLCOutp /// The CLTV lock-time at which this HTLC expires. #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_get_cltv_expiry(this_ptr: &HTLCOutputInCommitment) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + let mut inner_val = &mut HTLCOutputInCommitment::get_native_mut_ref(this_ptr).cltv_expiry; *inner_val } /// The CLTV lock-time at which this HTLC expires. @@ -881,7 +938,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_cltv_expiry(this_ptr: &mut HTLCOutp /// The hash of the preimage which unlocks this HTLC. #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_get_payment_hash(this_ptr: &HTLCOutputInCommitment) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut HTLCOutputInCommitment::get_native_mut_ref(this_ptr).payment_hash; &inner_val.0 } /// The hash of the preimage which unlocks this HTLC. @@ -894,7 +951,7 @@ pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOut /// value is spent to additional transaction fees). #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_get_transaction_output_index(this_ptr: &HTLCOutputInCommitment) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().transaction_output_index; + let mut inner_val = &mut HTLCOutputInCommitment::get_native_mut_ref(this_ptr).transaction_output_index; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -923,7 +980,7 @@ impl Clone for HTLCOutputInCommitment { fn clone(&self) -> Self { Self { inner: if <*mut nativeHTLCOutputInCommitment>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -931,12 +988,12 @@ impl Clone for HTLCOutputInCommitment { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HTLCOutputInCommitment_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCOutputInCommitment)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHTLCOutputInCommitment) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HTLCOutputInCommitment pub extern "C" fn HTLCOutputInCommitment_clone(orig: &HTLCOutputInCommitment) -> HTLCOutputInCommitment { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HTLCOutputInCommitment object pub extern "C" fn HTLCOutputInCommitment_debug_str_void(o: *const c_void) -> Str { @@ -1015,27 +1072,37 @@ pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSAS /// Gets the witnessScript for the to_remote output when anchors are enabled. #[no_mangle] -pub extern "C" fn get_to_countersignatory_with_anchors_redeemscript(mut payment_point: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { - let mut ret = lightning::ln::chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point.into_rust()); +pub extern "C" fn get_to_countersigner_keyed_anchor_redeemscript(mut payment_point: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::get_to_countersigner_keyed_anchor_redeemscript(&payment_point.into_rust()); ret.to_bytes().into() } -/// Gets the witnessScript for an anchor output from the funding public key. +/// Gets the script_pubkey for a shared anchor +#[no_mangle] +pub extern "C" fn shared_anchor_script_pubkey() -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::shared_anchor_script_pubkey(); + ret.to_bytes().into() +} + +/// Gets the witnessScript for a keyed anchor (non-zero-fee-commitments) output from the funding +/// public key. +/// /// The witness in the spending input must be: /// /// After 16 blocks of confirmation, an alternative satisfying witness could be: /// <> /// (empty vector required to satisfy compliance with MINIMALIF-standard rule) #[no_mangle] -pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { - let mut ret = lightning::ln::chan_utils::get_anchor_redeemscript(&funding_pubkey.into_rust()); +pub extern "C" fn get_keyed_anchor_redeemscript(mut funding_pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::get_keyed_anchor_redeemscript(&funding_pubkey.into_rust()); ret.to_bytes().into() } -/// Returns the witness required to satisfy and spend an anchor input. +/// Returns the witness required to satisfy and spend a keyed anchor (non-zero-fee-commitments) +/// input. #[no_mangle] -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()); +pub extern "C" fn build_keyed_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_keyed_anchor_input_witness(&funding_key.into_rust(), &funding_sig.into_rust()); crate::c_types::Witness::from_bitcoin(&ret) } @@ -1106,7 +1173,7 @@ impl ChannelTransactionParameters { /// Holder public keys #[no_mangle] pub extern "C" fn ChannelTransactionParameters_get_holder_pubkeys(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { - let mut inner_val = &mut this_ptr.get_native_mut_ref().holder_pubkeys; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).holder_pubkeys; crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } /// Holder public keys @@ -1117,7 +1184,7 @@ pub extern "C" fn ChannelTransactionParameters_set_holder_pubkeys(this_ptr: &mut /// The contest delay selected by the holder, which applies to counterparty-broadcast transactions #[no_mangle] pub extern "C" fn ChannelTransactionParameters_get_holder_selected_contest_delay(this_ptr: &ChannelTransactionParameters) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().holder_selected_contest_delay; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).holder_selected_contest_delay; *inner_val } /// The contest delay selected by the holder, which applies to counterparty-broadcast transactions @@ -1129,7 +1196,7 @@ pub extern "C" fn ChannelTransactionParameters_set_holder_selected_contest_delay /// This is an input to the commitment number obscure factor computation. #[no_mangle] pub extern "C" fn ChannelTransactionParameters_get_is_outbound_from_holder(this_ptr: &ChannelTransactionParameters) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_outbound_from_holder; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).is_outbound_from_holder; *inner_val } /// Whether the holder is the initiator of this channel. @@ -1144,7 +1211,7 @@ pub extern "C" fn ChannelTransactionParameters_set_is_outbound_from_holder(this_ /// 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 ChannelTransactionParameters_get_counterparty_parameters(this_ptr: &ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_parameters; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).counterparty_parameters; let mut local_inner_val = crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters { 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::CounterpartyChannelTransactionParameters<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1162,7 +1229,7 @@ pub extern "C" fn ChannelTransactionParameters_set_counterparty_parameters(this_ /// 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 ChannelTransactionParameters_get_funding_outpoint(this_ptr: &ChannelTransactionParameters) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_outpoint; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).funding_outpoint; let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1174,11 +1241,42 @@ pub extern "C" fn ChannelTransactionParameters_set_funding_outpoint(this_ptr: &m 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) }.funding_outpoint = local_val; } +/// The parent funding txid for a channel that has been spliced. +/// +/// If a channel was funded with transaction A, and later spliced with transaction B, this field +/// tracks the txid of transaction A. +/// +/// See [`compute_funding_key_tweak`] and [`ChannelSigner::new_funding_pubkey`] for more context +/// on how this may be used. +/// +/// [`compute_funding_key_tweak`]: crate::sign::compute_funding_key_tweak +/// [`ChannelSigner::new_funding_pubkey`]: crate::sign::ChannelSigner::new_funding_pubkey +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_get_splice_parent_funding_txid(this_ptr: &ChannelTransactionParameters) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).splice_parent_funding_txid; + 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().as_ref() } }) }; + local_inner_val +} +/// The parent funding txid for a channel that has been spliced. +/// +/// If a channel was funded with transaction A, and later spliced with transaction B, this field +/// tracks the txid of transaction A. +/// +/// See [`compute_funding_key_tweak`] and [`ChannelSigner::new_funding_pubkey`] for more context +/// on how this may be used. +/// +/// [`compute_funding_key_tweak`]: crate::sign::compute_funding_key_tweak +/// [`ChannelSigner::new_funding_pubkey`]: crate::sign::ChannelSigner::new_funding_pubkey +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_set_splice_parent_funding_txid(this_ptr: &mut ChannelTransactionParameters, 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) }.splice_parent_funding_txid = local_val; +} /// This channel's type, as negotiated during channel open. For old objects where this field /// wasn't serialized, it will default to static_remote_key at deserialization. #[no_mangle] pub extern "C" fn ChannelTransactionParameters_get_channel_type_features(this_ptr: &ChannelTransactionParameters) -> crate::lightning_types::features::ChannelTypeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type_features; + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).channel_type_features; crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false } } /// This channel's type, as negotiated during channel open. For old objects where this field @@ -1187,29 +1285,43 @@ pub extern "C" fn ChannelTransactionParameters_get_channel_type_features(this_pt pub extern "C" fn ChannelTransactionParameters_set_channel_type_features(this_ptr: &mut ChannelTransactionParameters, mut val: crate::lightning_types::features::ChannelTypeFeatures) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_type_features = *unsafe { Box::from_raw(val.take_inner()) }; } +/// The value locked in the channel, denominated in satoshis. +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_get_channel_value_satoshis(this_ptr: &ChannelTransactionParameters) -> u64 { + let mut inner_val = &mut ChannelTransactionParameters::get_native_mut_ref(this_ptr).channel_value_satoshis; + *inner_val +} +/// The value locked in the channel, denominated in satoshis. +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_set_channel_value_satoshis(this_ptr: &mut ChannelTransactionParameters, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; +} /// 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_types::features::ChannelTypeFeatures) -> ChannelTransactionParameters { +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 splice_parent_funding_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut channel_type_features_arg: crate::lightning_types::features::ChannelTypeFeatures, mut channel_value_satoshis_arg: u64) -> ChannelTransactionParameters { let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) }; let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) }; + let mut local_splice_parent_funding_txid_arg = { /*splice_parent_funding_txid_arg*/ let splice_parent_funding_txid_arg_opt = splice_parent_funding_txid_arg; if splice_parent_funding_txid_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ splice_parent_funding_txid_arg_opt.take() }.data[..]).unwrap() }})} }; ChannelTransactionParameters { inner: ObjOps::heap_alloc(nativeChannelTransactionParameters { holder_pubkeys: *unsafe { Box::from_raw(holder_pubkeys_arg.take_inner()) }, holder_selected_contest_delay: holder_selected_contest_delay_arg, is_outbound_from_holder: is_outbound_from_holder_arg, counterparty_parameters: local_counterparty_parameters_arg, funding_outpoint: local_funding_outpoint_arg, + splice_parent_funding_txid: local_splice_parent_funding_txid_arg, channel_type_features: *unsafe { Box::from_raw(channel_type_features_arg.take_inner()) }, + channel_value_satoshis: channel_value_satoshis_arg, }), is_owned: true } } impl Clone for ChannelTransactionParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelTransactionParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1217,12 +1329,12 @@ impl Clone for ChannelTransactionParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelTransactionParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelTransactionParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelTransactionParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelTransactionParameters pub extern "C" fn ChannelTransactionParameters_clone(orig: &ChannelTransactionParameters) -> ChannelTransactionParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelTransactionParameters object pub extern "C" fn ChannelTransactionParameters_debug_str_void(o: *const c_void) -> Str { @@ -1309,7 +1421,7 @@ impl CounterpartyChannelTransactionParameters { /// Counter-party public keys #[no_mangle] pub extern "C" fn CounterpartyChannelTransactionParameters_get_pubkeys(this_ptr: &CounterpartyChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { - let mut inner_val = &mut this_ptr.get_native_mut_ref().pubkeys; + let mut inner_val = &mut CounterpartyChannelTransactionParameters::get_native_mut_ref(this_ptr).pubkeys; crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } /// Counter-party public keys @@ -1320,7 +1432,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_set_pubkeys(this_ptr: /// The contest delay selected by the counterparty, which applies to holder-broadcast transactions #[no_mangle] pub extern "C" fn CounterpartyChannelTransactionParameters_get_selected_contest_delay(this_ptr: &CounterpartyChannelTransactionParameters) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().selected_contest_delay; + let mut inner_val = &mut CounterpartyChannelTransactionParameters::get_native_mut_ref(this_ptr).selected_contest_delay; *inner_val } /// The contest delay selected by the counterparty, which applies to holder-broadcast transactions @@ -1341,7 +1453,7 @@ impl Clone for CounterpartyChannelTransactionParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeCounterpartyChannelTransactionParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1349,12 +1461,12 @@ impl Clone for CounterpartyChannelTransactionParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyChannelTransactionParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCounterpartyChannelTransactionParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CounterpartyChannelTransactionParameters pub extern "C" fn CounterpartyChannelTransactionParameters_clone(orig: &CounterpartyChannelTransactionParameters) -> CounterpartyChannelTransactionParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CounterpartyChannelTransactionParameters object pub extern "C" fn CounterpartyChannelTransactionParameters_debug_str_void(o: *const c_void) -> Str { @@ -1408,6 +1520,17 @@ pub extern "C" fn ChannelTransactionParameters_as_counterparty_broadcastable(thi crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Returns the counterparty's pubkeys. +/// +/// 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 ChannelTransactionParameters_counterparty_pubkeys(this_arg: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_pubkeys(); + 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 +} + #[no_mangle] /// Serialize the CounterpartyChannelTransactionParameters object into a byte array which can be read by CounterpartyChannelTransactionParameters_read pub extern "C" fn CounterpartyChannelTransactionParameters_write(obj: &crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> crate::c_types::derived::CVec_u8Z { @@ -1435,8 +1558,10 @@ pub(crate) extern "C" fn ChannelTransactionParameters_write_void(obj: *const c_v } #[no_mangle] /// Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write -pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTransactionParametersDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); +pub extern "C" fn ChannelTransactionParameters_read(ser: crate::c_types::u8slice, arg: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_ChannelTransactionParametersDecodeErrorZ { + let mut local_arg = if arg.is_some() { Some( { arg.take() }) } else { None }; + let arg_conv = local_arg; + let res: Result = crate::c_types::deserialize_obj_arg(ser, arg_conv); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::ChannelTransactionParameters { 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 } @@ -1548,7 +1673,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_funding_outpoint(this_arg crate::c_types::bitcoin_to_C_outpoint(&ret) } -/// Whether to use anchors for this channel +/// The type of channel these parameters are for #[must_use] #[no_mangle] pub extern "C" fn DirectedChannelTransactionParameters_channel_type_features(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning_types::features::ChannelTypeFeatures { @@ -1556,6 +1681,14 @@ pub extern "C" fn DirectedChannelTransactionParameters_channel_type_features(thi crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _) }, is_owned: false } } +/// The value locked in the channel, denominated in satoshis. +#[must_use] +#[no_mangle] +pub extern "C" fn DirectedChannelTransactionParameters_channel_value_satoshis(this_arg: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_value_satoshis(); + ret +} + use lightning::ln::chan_utils::HolderCommitmentTransaction as nativeHolderCommitmentTransactionImport; pub(crate) type nativeHolderCommitmentTransaction = nativeHolderCommitmentTransactionImport; @@ -1621,7 +1754,7 @@ 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::ECDSASignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig; + let mut inner_val = &mut HolderCommitmentTransaction::get_native_mut_ref(this_ptr).counterparty_sig; crate::c_types::ECDSASignature::from_rust(&inner_val) } /// Our counterparty's signature for the transaction @@ -1634,7 +1767,7 @@ pub extern "C" fn HolderCommitmentTransaction_set_counterparty_sig(this_ptr: &mu /// 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_ECDSASignatureZ { - let mut inner_val = this_ptr.get_native_mut_ref().counterparty_htlc_sigs.clone(); + let mut inner_val = HolderCommitmentTransaction::get_native_mut_ref(this_ptr).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::ECDSASignature::from_rust(&item) }); }; local_inner_val.into() } @@ -1648,7 +1781,7 @@ impl Clone for HolderCommitmentTransaction { fn clone(&self) -> Self { Self { inner: if <*mut nativeHolderCommitmentTransaction>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1656,12 +1789,12 @@ impl Clone for HolderCommitmentTransaction { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HolderCommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHolderCommitmentTransaction)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHolderCommitmentTransaction) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HolderCommitmentTransaction pub extern "C" fn HolderCommitmentTransaction_clone(orig: &HolderCommitmentTransaction) -> HolderCommitmentTransaction { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HolderCommitmentTransaction object pub extern "C" fn HolderCommitmentTransaction_debug_str_void(o: *const c_void) -> Str { @@ -1755,7 +1888,7 @@ impl BuiltCommitmentTransaction { /// The commitment transaction #[no_mangle] pub extern "C" fn BuiltCommitmentTransaction_get_transaction(this_ptr: &BuiltCommitmentTransaction) -> crate::c_types::Transaction { - let mut inner_val = &mut this_ptr.get_native_mut_ref().transaction; + let mut inner_val = &mut BuiltCommitmentTransaction::get_native_mut_ref(this_ptr).transaction; crate::c_types::Transaction::from_bitcoin(inner_val) } /// The commitment transaction @@ -1769,7 +1902,7 @@ pub extern "C" fn BuiltCommitmentTransaction_set_transaction(this_ptr: &mut Buil /// multiple times. #[no_mangle] pub extern "C" fn BuiltCommitmentTransaction_get_txid(this_ptr: &BuiltCommitmentTransaction) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().txid; + let mut inner_val = &mut BuiltCommitmentTransaction::get_native_mut_ref(this_ptr).txid; inner_val.as_ref() } /// The txid for the commitment transaction. @@ -1793,7 +1926,7 @@ impl Clone for BuiltCommitmentTransaction { fn clone(&self) -> Self { Self { inner: if <*mut nativeBuiltCommitmentTransaction>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1801,12 +1934,12 @@ impl Clone for BuiltCommitmentTransaction { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BuiltCommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBuiltCommitmentTransaction)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBuiltCommitmentTransaction) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BuiltCommitmentTransaction pub extern "C" fn BuiltCommitmentTransaction_clone(orig: &BuiltCommitmentTransaction) -> BuiltCommitmentTransaction { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BuiltCommitmentTransaction object pub extern "C" fn BuiltCommitmentTransaction_debug_str_void(o: *const c_void) -> Str { @@ -1921,7 +2054,7 @@ impl Clone for ClosingTransaction { fn clone(&self) -> Self { Self { inner: if <*mut nativeClosingTransaction>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1929,12 +2062,12 @@ impl Clone for ClosingTransaction { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingTransaction)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClosingTransaction) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ClosingTransaction pub extern "C" fn ClosingTransaction_clone(orig: &ClosingTransaction) -> ClosingTransaction { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the ClosingTransaction. #[no_mangle] @@ -2183,7 +2316,7 @@ impl Clone for CommitmentTransaction { fn clone(&self) -> Self { Self { inner: if <*mut nativeCommitmentTransaction>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2191,12 +2324,12 @@ impl Clone for CommitmentTransaction { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommitmentTransaction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentTransaction)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCommitmentTransaction) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CommitmentTransaction pub extern "C" fn CommitmentTransaction_clone(orig: &CommitmentTransaction) -> CommitmentTransaction { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CommitmentTransaction object pub extern "C" fn CommitmentTransaction_debug_str_void(o: *const c_void) -> Str { @@ -2217,6 +2350,19 @@ pub extern "C" fn CommitmentTransaction_read(ser: crate::c_types::u8slice) -> cr let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::CommitmentTransaction { 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 } +/// Constructs a new `CommitmentTransaction` from the list of HTLCs and the direct balances. +/// +/// All HTLCs MUST be above the dust limit for the channel. +/// The broadcaster and countersignatory amounts MUST be either 0 or above dust. If the amount +/// is 0, the corresponding output will be omitted from the transaction. +#[must_use] +#[no_mangle] +pub extern "C" fn CommitmentTransaction_new(mut commitment_number: u64, mut per_commitment_point: crate::c_types::PublicKey, mut to_broadcaster_value_sat: u64, mut to_countersignatory_value_sat: u64, mut feerate_per_kw: u32, mut nondust_htlcs: crate::c_types::derived::CVec_HTLCOutputInCommitmentZ, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::lightning::ln::chan_utils::CommitmentTransaction { + let mut local_nondust_htlcs = Vec::new(); for mut item in nondust_htlcs.into_rust().drain(..) { local_nondust_htlcs.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::ln::chan_utils::CommitmentTransaction::new(commitment_number, &per_commitment_point.into_rust(), to_broadcaster_value_sat, to_countersignatory_value_sat, feerate_per_kw, local_nondust_htlcs, channel_parameters.get_native_ref(), secp256k1::global::SECP256K1); + crate::lightning::ln::chan_utils::CommitmentTransaction { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// The backwards-counting commitment number #[must_use] #[no_mangle] @@ -2249,11 +2395,14 @@ pub extern "C" fn CommitmentTransaction_to_countersignatory_value_sat(this_arg: ret } -/// The feerate paid per 1000-weight-unit in this commitment transaction. +/// The feerate paid per 1000-weight-unit we negotiated with our +/// peer for this commitment transaction. Note that the actual +/// feerate of the commitment transaction may be higher than the +/// negotiated feerate. #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_feerate_per_kw(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u32 { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.feerate_per_kw(); +pub extern "C" fn CommitmentTransaction_negotiated_feerate_per_kw(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction) -> u32 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.negotiated_feerate_per_kw(); ret } @@ -2278,8 +2427,8 @@ pub extern "C" fn CommitmentTransaction_trust(this_arg: &crate::lightning::ln::c /// or using the built transaction. #[must_use] #[no_mangle] -pub extern "C" fn CommitmentTransaction_verify(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TrustedCommitmentTransactionNoneZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(channel_parameters.get_native_ref(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::global::SECP256K1); +pub extern "C" fn CommitmentTransaction_verify(this_arg: &crate::lightning::ln::chan_utils::CommitmentTransaction, channel_parameters: &crate::lightning::ln::chan_utils::DirectedChannelTransactionParameters) -> crate::c_types::derived::CResult_TrustedCommitmentTransactionNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify(channel_parameters.get_native_ref(), secp256k1::global::SECP256K1); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TrustedCommitmentTransaction { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/ln/channel_keys.rs b/lightning-c-bindings/src/lightning/ln/channel_keys.rs index a713ef02..364d9491 100644 --- a/lightning-c-bindings/src/lightning/ln/channel_keys.rs +++ b/lightning-c-bindings/src/lightning/ln/channel_keys.rs @@ -84,7 +84,7 @@ impl DelayedPaymentBasepoint { } #[no_mangle] pub extern "C" fn DelayedPaymentBasepoint_get_a(this_ptr: &DelayedPaymentBasepoint) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut DelayedPaymentBasepoint::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -112,7 +112,7 @@ impl Clone for DelayedPaymentBasepoint { fn clone(&self) -> Self { Self { inner: if <*mut nativeDelayedPaymentBasepoint>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -120,12 +120,12 @@ impl Clone for DelayedPaymentBasepoint { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DelayedPaymentBasepoint_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDelayedPaymentBasepoint)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDelayedPaymentBasepoint) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DelayedPaymentBasepoint pub extern "C" fn DelayedPaymentBasepoint_clone(orig: &DelayedPaymentBasepoint) -> DelayedPaymentBasepoint { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DelayedPaymentBasepoint object pub extern "C" fn DelayedPaymentBasepoint_debug_str_void(o: *const c_void) -> Str { @@ -156,6 +156,12 @@ pub extern "C" fn DelayedPaymentBasepoint_derive_add_tweak(this_arg: &crate::lig crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() } } +#[no_mangle] +/// Build a DelayedPaymentBasepoint from a PublicKey +pub extern "C" fn DelayedPaymentBasepoint_from_PublicKey(f: crate::c_types::PublicKey) -> crate::lightning::ln::channel_keys::DelayedPaymentBasepoint { + let from_obj = f.into_rust(); + crate::lightning::ln::channel_keys::DelayedPaymentBasepoint { inner: ObjOps::heap_alloc((lightning::ln::channel_keys::DelayedPaymentBasepoint::from(from_obj))), is_owned: true } +} #[no_mangle] /// Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read pub extern "C" fn DelayedPaymentBasepoint_write(obj: &crate::lightning::ln::channel_keys::DelayedPaymentBasepoint) -> crate::c_types::derived::CVec_u8Z { @@ -242,7 +248,7 @@ impl DelayedPaymentKey { } #[no_mangle] pub extern "C" fn DelayedPaymentKey_get_a(this_ptr: &DelayedPaymentKey) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut DelayedPaymentKey::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -270,7 +276,7 @@ impl Clone for DelayedPaymentKey { fn clone(&self) -> Self { Self { inner: if <*mut nativeDelayedPaymentKey>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -278,12 +284,12 @@ impl Clone for DelayedPaymentKey { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DelayedPaymentKey_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDelayedPaymentKey)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDelayedPaymentKey) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DelayedPaymentKey pub extern "C" fn DelayedPaymentKey_clone(orig: &DelayedPaymentKey) -> DelayedPaymentKey { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DelayedPaymentKey object pub extern "C" fn DelayedPaymentKey_debug_str_void(o: *const c_void) -> Str { @@ -394,7 +400,7 @@ impl HtlcBasepoint { } #[no_mangle] pub extern "C" fn HtlcBasepoint_get_a(this_ptr: &HtlcBasepoint) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut HtlcBasepoint::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -422,7 +428,7 @@ impl Clone for HtlcBasepoint { fn clone(&self) -> Self { Self { inner: if <*mut nativeHtlcBasepoint>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -430,12 +436,12 @@ impl Clone for HtlcBasepoint { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HtlcBasepoint_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHtlcBasepoint)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHtlcBasepoint) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HtlcBasepoint pub extern "C" fn HtlcBasepoint_clone(orig: &HtlcBasepoint) -> HtlcBasepoint { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HtlcBasepoint object pub extern "C" fn HtlcBasepoint_debug_str_void(o: *const c_void) -> Str { @@ -466,6 +472,12 @@ pub extern "C" fn HtlcBasepoint_derive_add_tweak(this_arg: &crate::lightning::ln crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() } } +#[no_mangle] +/// Build a HtlcBasepoint from a PublicKey +pub extern "C" fn HtlcBasepoint_from_PublicKey(f: crate::c_types::PublicKey) -> crate::lightning::ln::channel_keys::HtlcBasepoint { + let from_obj = f.into_rust(); + crate::lightning::ln::channel_keys::HtlcBasepoint { inner: ObjOps::heap_alloc((lightning::ln::channel_keys::HtlcBasepoint::from(from_obj))), is_owned: true } +} #[no_mangle] /// Serialize the HtlcBasepoint object into a byte array which can be read by HtlcBasepoint_read pub extern "C" fn HtlcBasepoint_write(obj: &crate::lightning::ln::channel_keys::HtlcBasepoint) -> crate::c_types::derived::CVec_u8Z { @@ -552,7 +564,7 @@ impl HtlcKey { } #[no_mangle] pub extern "C" fn HtlcKey_get_a(this_ptr: &HtlcKey) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut HtlcKey::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -580,7 +592,7 @@ impl Clone for HtlcKey { fn clone(&self) -> Self { Self { inner: if <*mut nativeHtlcKey>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -588,12 +600,12 @@ impl Clone for HtlcKey { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HtlcKey_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHtlcKey)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHtlcKey) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HtlcKey pub extern "C" fn HtlcKey_clone(orig: &HtlcKey) -> HtlcKey { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HtlcKey object pub extern "C" fn HtlcKey_debug_str_void(o: *const c_void) -> Str { @@ -710,7 +722,7 @@ impl RevocationBasepoint { } #[no_mangle] pub extern "C" fn RevocationBasepoint_get_a(this_ptr: &RevocationBasepoint) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut RevocationBasepoint::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -738,7 +750,7 @@ impl Clone for RevocationBasepoint { fn clone(&self) -> Self { Self { inner: if <*mut nativeRevocationBasepoint>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -746,12 +758,12 @@ impl Clone for RevocationBasepoint { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RevocationBasepoint_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRevocationBasepoint)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRevocationBasepoint) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RevocationBasepoint pub extern "C" fn RevocationBasepoint_clone(orig: &RevocationBasepoint) -> RevocationBasepoint { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RevocationBasepoint object pub extern "C" fn RevocationBasepoint_debug_str_void(o: *const c_void) -> Str { @@ -774,6 +786,12 @@ pub extern "C" fn RevocationBasepoint_to_public_key(this_arg: &crate::lightning: crate::c_types::PublicKey::from_rust(&ret) } +#[no_mangle] +/// Build a RevocationBasepoint from a PublicKey +pub extern "C" fn RevocationBasepoint_from_PublicKey(f: crate::c_types::PublicKey) -> crate::lightning::ln::channel_keys::RevocationBasepoint { + let from_obj = f.into_rust(); + crate::lightning::ln::channel_keys::RevocationBasepoint { inner: ObjOps::heap_alloc((lightning::ln::channel_keys::RevocationBasepoint::from(from_obj))), is_owned: true } +} #[no_mangle] /// Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read pub extern "C" fn RevocationBasepoint_write(obj: &crate::lightning::ln::channel_keys::RevocationBasepoint) -> crate::c_types::derived::CVec_u8Z { @@ -859,7 +877,7 @@ impl RevocationKey { } #[no_mangle] pub extern "C" fn RevocationKey_get_a(this_ptr: &RevocationKey) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut RevocationKey::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -887,7 +905,7 @@ impl Clone for RevocationKey { fn clone(&self) -> Self { Self { inner: if <*mut nativeRevocationKey>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -895,12 +913,12 @@ impl Clone for RevocationKey { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RevocationKey_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRevocationKey)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRevocationKey) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RevocationKey pub extern "C" fn RevocationKey_clone(orig: &RevocationKey) -> RevocationKey { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RevocationKey object pub extern "C" fn RevocationKey_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/ln/channel_state.rs b/lightning-c-bindings/src/lightning/ln/channel_state.rs index e960eb0e..28a43c68 100644 --- a/lightning-c-bindings/src/lightning/ln/channel_state.rs +++ b/lightning-c-bindings/src/lightning/ln/channel_state.rs @@ -215,7 +215,7 @@ impl InboundHTLCDetails { /// and not part of any commitment transaction. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_htlc_id(this_ptr: &InboundHTLCDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).htlc_id; *inner_val } /// The HTLC ID. @@ -229,7 +229,7 @@ pub extern "C" fn InboundHTLCDetails_set_htlc_id(this_ptr: &mut InboundHTLCDetai /// The amount in msat. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_amount_msat(this_ptr: &InboundHTLCDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).amount_msat; *inner_val } /// The amount in msat. @@ -240,7 +240,7 @@ pub extern "C" fn InboundHTLCDetails_set_amount_msat(this_ptr: &mut InboundHTLCD /// The block height at which this HTLC expires. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_cltv_expiry(this_ptr: &InboundHTLCDetails) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).cltv_expiry; *inner_val } /// The block height at which this HTLC expires. @@ -251,7 +251,7 @@ pub extern "C" fn InboundHTLCDetails_set_cltv_expiry(this_ptr: &mut InboundHTLCD /// The payment hash. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_payment_hash(this_ptr: &InboundHTLCDetails) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).payment_hash; &inner_val.0 } /// The payment hash. @@ -270,7 +270,7 @@ pub extern "C" fn InboundHTLCDetails_set_payment_hash(this_ptr: &mut InboundHTLC /// states may result in `None` here. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_state(this_ptr: &InboundHTLCDetails) -> crate::c_types::derived::COption_InboundHTLCStateDetailsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().state; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).state; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_InboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_InboundHTLCStateDetailsZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::channel_state::InboundHTLCStateDetails::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } @@ -301,7 +301,7 @@ pub extern "C" fn InboundHTLCDetails_set_state(this_ptr: &mut InboundHTLCDetails /// commitment transaction but not for the counterparty's commitment transaction and vice versa. #[no_mangle] pub extern "C" fn InboundHTLCDetails_get_is_dust(this_ptr: &InboundHTLCDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_dust; + let mut inner_val = &mut InboundHTLCDetails::get_native_mut_ref(this_ptr).is_dust; *inner_val } /// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed @@ -337,7 +337,7 @@ impl Clone for InboundHTLCDetails { fn clone(&self) -> Self { Self { inner: if <*mut nativeInboundHTLCDetails>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -345,12 +345,12 @@ impl Clone for InboundHTLCDetails { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InboundHTLCDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInboundHTLCDetails)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInboundHTLCDetails) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InboundHTLCDetails pub extern "C" fn InboundHTLCDetails_clone(orig: &InboundHTLCDetails) -> InboundHTLCDetails { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InboundHTLCDetails object pub extern "C" fn InboundHTLCDetails_debug_str_void(o: *const c_void) -> Str { @@ -568,7 +568,7 @@ impl OutboundHTLCDetails { /// Not present when we are awaiting a remote revocation and the HTLC is not added yet. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_htlc_id(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).htlc_id; 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 } @@ -586,7 +586,7 @@ pub extern "C" fn OutboundHTLCDetails_set_htlc_id(this_ptr: &mut OutboundHTLCDet /// The amount in msat. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_amount_msat(this_ptr: &OutboundHTLCDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).amount_msat; *inner_val } /// The amount in msat. @@ -597,7 +597,7 @@ pub extern "C" fn OutboundHTLCDetails_set_amount_msat(this_ptr: &mut OutboundHTL /// The block height at which this HTLC expires. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_cltv_expiry(this_ptr: &OutboundHTLCDetails) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).cltv_expiry; *inner_val } /// The block height at which this HTLC expires. @@ -608,7 +608,7 @@ pub extern "C" fn OutboundHTLCDetails_set_cltv_expiry(this_ptr: &mut OutboundHTL /// The payment hash. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_payment_hash(this_ptr: &OutboundHTLCDetails) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).payment_hash; &inner_val.0 } /// The payment hash. @@ -627,7 +627,7 @@ pub extern "C" fn OutboundHTLCDetails_set_payment_hash(this_ptr: &mut OutboundHT /// states may result in `None` here. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_state(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_OutboundHTLCStateDetailsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().state; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).state; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_OutboundHTLCStateDetailsZ::None } else { crate::c_types::derived::COption_OutboundHTLCStateDetailsZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::lightning::ln::channel_state::OutboundHTLCStateDetails::native_into((*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } @@ -648,7 +648,7 @@ pub extern "C" fn OutboundHTLCDetails_set_state(this_ptr: &mut OutboundHTLCDetai /// The extra fee being skimmed off the top of this HTLC. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_skimmed_fee_msat(this_ptr: &OutboundHTLCDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().skimmed_fee_msat; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).skimmed_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 } @@ -671,7 +671,7 @@ pub extern "C" fn OutboundHTLCDetails_set_skimmed_fee_msat(this_ptr: &mut Outbou /// commitment transaction but not for the counterparty's commitment transaction and vice versa. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_get_is_dust(this_ptr: &OutboundHTLCDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_dust; + let mut inner_val = &mut OutboundHTLCDetails::get_native_mut_ref(this_ptr).is_dust; *inner_val } /// Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed @@ -710,7 +710,7 @@ impl Clone for OutboundHTLCDetails { fn clone(&self) -> Self { Self { inner: if <*mut nativeOutboundHTLCDetails>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -718,12 +718,12 @@ impl Clone for OutboundHTLCDetails { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OutboundHTLCDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOutboundHTLCDetails)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOutboundHTLCDetails) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OutboundHTLCDetails pub extern "C" fn OutboundHTLCDetails_clone(orig: &OutboundHTLCDetails) -> OutboundHTLCDetails { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a OutboundHTLCDetails object pub extern "C" fn OutboundHTLCDetails_debug_str_void(o: *const c_void) -> Str { @@ -807,7 +807,7 @@ impl CounterpartyForwardingInfo { /// Base routing fee in millisatoshis. #[no_mangle] pub extern "C" fn CounterpartyForwardingInfo_get_fee_base_msat(this_ptr: &CounterpartyForwardingInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; + let mut inner_val = &mut CounterpartyForwardingInfo::get_native_mut_ref(this_ptr).fee_base_msat; *inner_val } /// Base routing fee in millisatoshis. @@ -818,7 +818,7 @@ pub extern "C" fn CounterpartyForwardingInfo_set_fee_base_msat(this_ptr: &mut Co /// Amount in millionths of a satoshi the channel will charge per transferred satoshi. #[no_mangle] pub extern "C" fn CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr: &CounterpartyForwardingInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; + let mut inner_val = &mut CounterpartyForwardingInfo::get_native_mut_ref(this_ptr).fee_proportional_millionths; *inner_val } /// Amount in millionths of a satoshi the channel will charge per transferred satoshi. @@ -831,7 +831,7 @@ pub extern "C" fn CounterpartyForwardingInfo_set_fee_proportional_millionths(thi /// `cltv_expiry_delta` for more details. #[no_mangle] pub extern "C" fn CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr: &CounterpartyForwardingInfo) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut CounterpartyForwardingInfo::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart, @@ -855,7 +855,7 @@ impl Clone for CounterpartyForwardingInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeCounterpartyForwardingInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -863,12 +863,12 @@ impl Clone for CounterpartyForwardingInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyForwardingInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCounterpartyForwardingInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCounterpartyForwardingInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CounterpartyForwardingInfo pub extern "C" fn CounterpartyForwardingInfo_clone(orig: &CounterpartyForwardingInfo) -> CounterpartyForwardingInfo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CounterpartyForwardingInfo object pub extern "C" fn CounterpartyForwardingInfo_debug_str_void(o: *const c_void) -> Str { @@ -953,7 +953,7 @@ impl ChannelCounterparty { /// The node_id of our counterparty #[no_mangle] pub extern "C" fn ChannelCounterparty_get_node_id(this_ptr: &ChannelCounterparty) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// The node_id of our counterparty @@ -966,7 +966,7 @@ pub extern "C" fn ChannelCounterparty_set_node_id(this_ptr: &mut ChannelCounterp /// many routing-relevant features are present in the init context. #[no_mangle] pub extern "C" fn ChannelCounterparty_get_features(this_ptr: &ChannelCounterparty) -> crate::lightning_types::features::InitFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::InitFeatures<>) as *mut _) }, is_owned: false } } /// The Features the channel counterparty provided upon last connection. @@ -985,7 +985,7 @@ pub extern "C" fn ChannelCounterparty_set_features(this_ptr: &mut ChannelCounter /// [`inbound_capacity_msat`]: ChannelDetails::inbound_capacity_msat #[no_mangle] pub extern "C" fn ChannelCounterparty_get_unspendable_punishment_reserve(this_ptr: &ChannelCounterparty) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).unspendable_punishment_reserve; *inner_val } /// The value, in satoshis, that must always be held in the channel for our counterparty. This @@ -1005,7 +1005,7 @@ pub extern "C" fn ChannelCounterparty_set_unspendable_punishment_reserve(this_pt /// 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 ChannelCounterparty_get_forwarding_info(this_ptr: &ChannelCounterparty) -> crate::lightning::ln::channel_state::CounterpartyForwardingInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_info; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).forwarding_info; let mut local_inner_val = crate::lightning::ln::channel_state::CounterpartyForwardingInfo { 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::channel_state::CounterpartyForwardingInfo<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1023,7 +1023,7 @@ pub extern "C" fn ChannelCounterparty_set_forwarding_info(this_ptr: &mut Channel /// from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. #[no_mangle] pub extern "C" fn ChannelCounterparty_get_outbound_htlc_minimum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_minimum_msat; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).outbound_htlc_minimum_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 } @@ -1038,7 +1038,7 @@ pub extern "C" fn ChannelCounterparty_set_outbound_htlc_minimum_msat(this_ptr: & /// The largest value HTLC (in msat) the remote peer currently will accept, for this channel. #[no_mangle] pub extern "C" fn ChannelCounterparty_get_outbound_htlc_maximum_msat(this_ptr: &ChannelCounterparty) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_htlc_maximum_msat; + let mut inner_val = &mut ChannelCounterparty::get_native_mut_ref(this_ptr).outbound_htlc_maximum_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 } @@ -1070,7 +1070,7 @@ impl Clone for ChannelCounterparty { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelCounterparty>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1078,12 +1078,12 @@ impl Clone for ChannelCounterparty { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelCounterparty_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelCounterparty)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelCounterparty) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelCounterparty pub extern "C" fn ChannelCounterparty_clone(orig: &ChannelCounterparty) -> ChannelCounterparty { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelCounterparty object pub extern "C" fn ChannelCounterparty_debug_str_void(o: *const c_void) -> Str { @@ -1114,6 +1114,10 @@ pub(crate) type nativeChannelDetails = nativeChannelDetailsImport; /// [`ChannelMonitor::get_claimable_balances`], calculated with respect to the corresponding on-chain /// transactions. /// +/// When a channel is spliced, most fields continue to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). See individual fields for details. +/// /// [`ChannelManager::list_channels`]: crate::ln::channelmanager::ChannelManager::list_channels /// [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances @@ -1173,17 +1177,19 @@ impl ChannelDetails { Self { inner: self.inner, is_owned: false } } } -/// 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). +/// The channel's ID (prior to initial channel setup this is a random 32 bytes, thereafter it is +/// derived from channel funding or key material). +/// /// Note that this means this value is *not* persistent - it can change once during the /// lifetime of the channel. #[no_mangle] pub extern "C" fn ChannelDetails_get_channel_id(this_ptr: &ChannelDetails) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// 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). +/// The channel's ID (prior to initial channel setup this is a random 32 bytes, thereafter it is +/// derived from channel funding or key material). +/// /// Note that this means this value is *not* persistent - it can change once during the /// lifetime of the channel. #[no_mangle] @@ -1193,7 +1199,7 @@ pub extern "C" fn ChannelDetails_set_channel_id(this_ptr: &mut ChannelDetails, m /// Parameters which apply to our counterparty. See individual fields for more information. #[no_mangle] pub extern "C" fn ChannelDetails_get_counterparty(this_ptr: &ChannelDetails) -> crate::lightning::ln::channel_state::ChannelCounterparty { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).counterparty; crate::lightning::ln::channel_state::ChannelCounterparty { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_state::ChannelCounterparty<>) as *mut _) }, is_owned: false } } /// Parameters which apply to our counterparty. See individual fields for more information. @@ -1204,16 +1210,24 @@ pub extern "C" fn ChannelDetails_set_counterparty(this_ptr: &mut ChannelDetails, /// The Channel's funding transaction output, if we've negotiated the funding transaction with /// our counterparty already. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// 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 ChannelDetails_get_funding_txo(this_ptr: &ChannelDetails) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txo; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).funding_txo; let mut local_inner_val = crate::lightning::chain::transaction::OutPoint { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::chain::transaction::OutPoint<>) as *mut _ }, is_owned: false }; local_inner_val } /// The Channel's funding transaction output, if we've negotiated the funding transaction with /// our counterparty already. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, mut val: crate::lightning::chain::transaction::OutPoint) { @@ -1224,10 +1238,14 @@ pub extern "C" fn ChannelDetails_set_funding_txo(this_ptr: &mut ChannelDetails, /// /// `None` until negotiation completes and the channel type is finalized. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// 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 ChannelDetails_get_channel_type(this_ptr: &ChannelDetails) -> crate::lightning_types::features::ChannelTypeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).channel_type; let mut local_inner_val = crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1235,6 +1253,10 @@ pub extern "C" fn ChannelDetails_get_channel_type(this_ptr: &ChannelDetails) -> /// /// `None` until negotiation completes and the channel type is finalized. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, mut val: crate::lightning_types::features::ChannelTypeFeatures) { @@ -1250,6 +1272,10 @@ pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, /// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may /// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// [`inbound_scid_alias`]: Self::inbound_scid_alias /// [`outbound_scid_alias`]: Self::outbound_scid_alias /// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid @@ -1257,7 +1283,7 @@ pub extern "C" fn ChannelDetails_set_channel_type(this_ptr: &mut ChannelDetails, /// [`confirmations_required`]: Self::confirmations_required #[no_mangle] pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).short_channel_id; 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 } @@ -1270,6 +1296,10 @@ pub extern "C" fn ChannelDetails_get_short_channel_id(this_ptr: &ChannelDetails) /// For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may /// be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// [`inbound_scid_alias`]: Self::inbound_scid_alias /// [`outbound_scid_alias`]: Self::outbound_scid_alias /// [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid @@ -1287,11 +1317,15 @@ pub extern "C" fn ChannelDetails_set_short_channel_id(this_ptr: &mut ChannelDeta /// /// This will be `None` as long as the channel is not available for routing outbound payments. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// [`short_channel_id`]: Self::short_channel_id /// [`confirmations_required`]: Self::confirmations_required #[no_mangle] pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_scid_alias; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).outbound_scid_alias; 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 } @@ -1302,6 +1336,10 @@ pub extern "C" fn ChannelDetails_get_outbound_scid_alias(this_ptr: &ChannelDetai /// /// This will be `None` as long as the channel is not available for routing outbound payments. /// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). +/// /// [`short_channel_id`]: Self::short_channel_id /// [`confirmations_required`]: Self::confirmations_required #[no_mangle] @@ -1320,7 +1358,7 @@ pub extern "C" fn ChannelDetails_set_outbound_scid_alias(this_ptr: &mut ChannelD /// [`short_channel_id`]: Self::short_channel_id #[no_mangle] pub extern "C" fn ChannelDetails_get_inbound_scid_alias(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_scid_alias; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).inbound_scid_alias; 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 } @@ -1339,12 +1377,20 @@ pub extern "C" fn ChannelDetails_set_inbound_scid_alias(this_ptr: &mut ChannelDe unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inbound_scid_alias = local_val; } /// The value, in satoshis, of this channel as appears in the funding output +/// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). #[no_mangle] pub extern "C" fn ChannelDetails_get_channel_value_satoshis(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).channel_value_satoshis; *inner_val } /// The value, in satoshis, of this channel as appears in the funding output +/// +/// When a channel is spliced, this continues to refer to the original pre-splice channel +/// state until the splice transaction reaches sufficient confirmations to be locked (and we +/// exchange `splice_locked` messages with our peer). #[no_mangle] pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut ChannelDetails, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; @@ -1360,7 +1406,7 @@ pub extern "C" fn ChannelDetails_set_channel_value_satoshis(this_ptr: &mut Chann /// [`outbound_capacity_msat`]: ChannelDetails::outbound_capacity_msat #[no_mangle] pub extern "C" fn ChannelDetails_get_unspendable_punishment_reserve(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().unspendable_punishment_reserve; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).unspendable_punishment_reserve; 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 } @@ -1389,7 +1435,7 @@ pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &m /// [`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; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).user_channel_id; inner_val.into() } /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound @@ -1411,7 +1457,7 @@ pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetai /// This value will be `None` for objects serialized with LDK versions prior to 0.0.115. #[no_mangle] pub extern "C" fn ChannelDetails_get_feerate_sat_per_1000_weight(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).feerate_sat_per_1000_weight; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -1434,7 +1480,7 @@ pub extern "C" fn ChannelDetails_set_feerate_sat_per_1000_weight(this_ptr: &mut /// should be able to spend nearly this amount. #[no_mangle] pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outbound_capacity_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).outbound_capacity_msat; *inner_val } /// The available outbound capacity for sending HTLCs to the remote peer. This does not include @@ -1458,7 +1504,7 @@ pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut Chann /// [`ChannelDetails::outbound_capacity_msat`]. #[no_mangle] pub extern "C" fn ChannelDetails_get_next_outbound_htlc_limit_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_limit_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).next_outbound_htlc_limit_msat; *inner_val } /// The available outbound capacity for sending a single HTLC to the remote peer. This is @@ -1478,7 +1524,7 @@ pub extern "C" fn ChannelDetails_set_next_outbound_htlc_limit_msat(this_ptr: &mu /// route which is valid. #[no_mangle] pub extern "C" fn ChannelDetails_get_next_outbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_minimum_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).next_outbound_htlc_minimum_msat; *inner_val } /// The minimum value for sending a single HTLC to the remote peer. This is the equivalent of @@ -1500,7 +1546,7 @@ pub extern "C" fn ChannelDetails_set_next_outbound_htlc_minimum_msat(this_ptr: & /// However, our counterparty should be able to spend nearly this amount. #[no_mangle] pub extern "C" fn ChannelDetails_get_inbound_capacity_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_capacity_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).inbound_capacity_msat; *inner_val } /// The available inbound capacity for the remote peer to send HTLCs to us. This does not @@ -1529,7 +1575,7 @@ pub extern "C" fn ChannelDetails_set_inbound_capacity_msat(this_ptr: &mut Channe /// [`ChannelHandshakeLimits::max_minimum_depth`]: crate::util::config::ChannelHandshakeLimits::max_minimum_depth #[no_mangle] pub extern "C" fn ChannelDetails_get_confirmations_required(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations_required; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).confirmations_required; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -1554,7 +1600,7 @@ pub extern "C" fn ChannelDetails_set_confirmations_required(this_ptr: &mut Chann /// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. #[no_mangle] pub extern "C" fn ChannelDetails_get_confirmations(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).confirmations; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -1575,7 +1621,7 @@ pub extern "C" fn ChannelDetails_set_confirmations(this_ptr: &mut ChannelDetails /// This value will be `None` for outbound channels until the counterparty accepts the channel. #[no_mangle] pub extern "C" fn ChannelDetails_get_force_close_spend_delay(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u16Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_spend_delay; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).force_close_spend_delay; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -1594,7 +1640,7 @@ pub extern "C" fn ChannelDetails_set_force_close_spend_delay(this_ptr: &mut Chan /// True if the channel was initiated (and thus funded) by us. #[no_mangle] pub extern "C" fn ChannelDetails_get_is_outbound(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_outbound; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).is_outbound; *inner_val } /// True if the channel was initiated (and thus funded) by us. @@ -1611,7 +1657,7 @@ pub extern "C" fn ChannelDetails_set_is_outbound(this_ptr: &mut ChannelDetails, /// [`confirmations_required`]: ChannelDetails::confirmations_required #[no_mangle] pub extern "C" fn ChannelDetails_get_is_channel_ready(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_channel_ready; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).is_channel_ready; *inner_val } /// True if the channel is confirmed, channel_ready messages have been exchanged, and the @@ -1631,7 +1677,7 @@ pub extern "C" fn ChannelDetails_set_is_channel_ready(this_ptr: &mut ChannelDeta /// Returns a copy of the field. #[no_mangle] pub extern "C" fn ChannelDetails_get_channel_shutdown_state(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_ChannelShutdownStateZ { - let mut inner_val = this_ptr.get_native_mut_ref().channel_shutdown_state.clone(); + let mut inner_val = ChannelDetails::get_native_mut_ref(this_ptr).channel_shutdown_state.clone(); let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ChannelShutdownStateZ::None } else { crate::c_types::derived::COption_ChannelShutdownStateZ::Some( { crate::lightning::ln::channel_state::ChannelShutdownState::native_into(inner_val.unwrap()) }) }; local_inner_val } @@ -1648,7 +1694,7 @@ pub extern "C" fn ChannelDetails_set_channel_shutdown_state(this_ptr: &mut Chann /// This is a strict superset of `is_channel_ready`. #[no_mangle] pub extern "C" fn ChannelDetails_get_is_usable(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_usable; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).is_usable; *inner_val } /// True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) @@ -1662,7 +1708,7 @@ pub extern "C" fn ChannelDetails_set_is_usable(this_ptr: &mut ChannelDetails, mu /// True if this channel is (or will be) publicly-announced. #[no_mangle] pub extern "C" fn ChannelDetails_get_is_announced(this_ptr: &ChannelDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_announced; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).is_announced; *inner_val } /// True if this channel is (or will be) publicly-announced. @@ -1674,7 +1720,7 @@ pub extern "C" fn ChannelDetails_set_is_announced(this_ptr: &mut ChannelDetails, /// is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 #[no_mangle] pub extern "C" fn ChannelDetails_get_inbound_htlc_minimum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_minimum_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).inbound_htlc_minimum_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 } @@ -1688,7 +1734,7 @@ pub extern "C" fn ChannelDetails_set_inbound_htlc_minimum_msat(this_ptr: &mut Ch /// The largest value HTLC (in msat) we currently will accept, for this channel. #[no_mangle] pub extern "C" fn ChannelDetails_get_inbound_htlc_maximum_msat(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_htlc_maximum_msat; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).inbound_htlc_maximum_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 } @@ -1705,7 +1751,7 @@ pub extern "C" fn ChannelDetails_set_inbound_htlc_maximum_msat(this_ptr: &mut Ch /// 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 ChannelDetails_get_config(this_ptr: &ChannelDetails) -> crate::lightning::util::config::ChannelConfig { - let mut inner_val = &mut this_ptr.get_native_mut_ref().config; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).config; let mut local_inner_val = crate::lightning::util::config::ChannelConfig { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelConfig<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1724,7 +1770,7 @@ pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut v /// This field is empty for objects serialized with LDK versions prior to 0.0.122. #[no_mangle] pub extern "C" fn ChannelDetails_get_pending_inbound_htlcs(this_ptr: &ChannelDetails) -> crate::c_types::derived::CVec_InboundHTLCDetailsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().pending_inbound_htlcs; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).pending_inbound_htlcs; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::InboundHTLCDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::InboundHTLCDetails<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -1741,7 +1787,7 @@ pub extern "C" fn ChannelDetails_set_pending_inbound_htlcs(this_ptr: &mut Channe /// This field is empty for objects serialized with LDK versions prior to 0.0.122. #[no_mangle] pub extern "C" fn ChannelDetails_get_pending_outbound_htlcs(this_ptr: &ChannelDetails) -> crate::c_types::derived::CVec_OutboundHTLCDetailsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().pending_outbound_htlcs; + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).pending_outbound_htlcs; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::OutboundHTLCDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::OutboundHTLCDetails<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -1753,6 +1799,33 @@ pub extern "C" fn ChannelDetails_set_pending_outbound_htlcs(this_ptr: &mut Chann 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) }.pending_outbound_htlcs = local_val; } +/// The witness script that is used to lock the channel's funding output to commitment +/// transactions. +/// +/// When a channel is spliced, this continues to refer to the original funding output (which +/// was spent by the splice transaction) until the splice transaction reached sufficient +/// confirmations to be locked (and we exchange `splice_locked` messages with our peer). +/// +/// This field will be `None` for objects serialized with LDK versions prior to 0.2.0. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_funding_redeem_script(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_CVec_u8ZZ { + let mut inner_val = &mut ChannelDetails::get_native_mut_ref(this_ptr).funding_redeem_script; + 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().to_bytes().into() }) }; + local_inner_val +} +/// The witness script that is used to lock the channel's funding output to commitment +/// transactions. +/// +/// When a channel is spliced, this continues to refer to the original funding output (which +/// was spent by the splice transaction) until the splice transaction reached sufficient +/// confirmations to be locked (and we exchange `splice_locked` messages with our peer). +/// +/// This field will be `None` for objects serialized with LDK versions prior to 0.2.0. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_funding_redeem_script(this_ptr: &mut ChannelDetails, 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::script::ScriptBuf::from({ val_opt.take() }.into_rust()) }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_redeem_script = 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 @@ -1760,7 +1833,7 @@ pub extern "C" fn ChannelDetails_set_pending_outbound_htlcs(this_ptr: &mut Chann /// 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::lightning::ln::types::ChannelId, mut counterparty_arg: crate::lightning::ln::channel_state::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning_types::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 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_announced_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, mut pending_inbound_htlcs_arg: crate::c_types::derived::CVec_InboundHTLCDetailsZ, mut pending_outbound_htlcs_arg: crate::c_types::derived::CVec_OutboundHTLCDetailsZ) -> ChannelDetails { +pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut counterparty_arg: crate::lightning::ln::channel_state::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning_types::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 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_announced_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, mut pending_inbound_htlcs_arg: crate::c_types::derived::CVec_InboundHTLCDetailsZ, mut pending_outbound_htlcs_arg: crate::c_types::derived::CVec_OutboundHTLCDetailsZ, mut funding_redeem_script_arg: crate::c_types::derived::COption_CVec_u8ZZ) -> ChannelDetails { let mut local_funding_txo_arg = if funding_txo_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_txo_arg.take_inner()) } }) }; 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_short_channel_id_arg = if short_channel_id_arg.is_some() { Some( { short_channel_id_arg.take() }) } else { None }; @@ -1777,6 +1850,7 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::t let mut local_config_arg = if config_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(config_arg.take_inner()) } }) }; let mut local_pending_inbound_htlcs_arg = Vec::new(); for mut item in pending_inbound_htlcs_arg.into_rust().drain(..) { local_pending_inbound_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; let mut local_pending_outbound_htlcs_arg = Vec::new(); for mut item in pending_outbound_htlcs_arg.into_rust().drain(..) { local_pending_outbound_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_funding_redeem_script_arg = { /*funding_redeem_script_arg*/ let funding_redeem_script_arg_opt = funding_redeem_script_arg; if funding_redeem_script_arg_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ funding_redeem_script_arg_opt.take() }.into_rust()) }})} }; ChannelDetails { inner: ObjOps::heap_alloc(nativeChannelDetails { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, counterparty: *unsafe { Box::from_raw(counterparty_arg.take_inner()) }, @@ -1806,13 +1880,14 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::t config: local_config_arg, pending_inbound_htlcs: local_pending_inbound_htlcs_arg, pending_outbound_htlcs: local_pending_outbound_htlcs_arg, + funding_redeem_script: local_funding_redeem_script_arg, }), is_owned: true } } impl Clone for ChannelDetails { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelDetails>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1820,12 +1895,12 @@ impl Clone for ChannelDetails { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDetails)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelDetails) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelDetails pub extern "C" fn ChannelDetails_clone(orig: &ChannelDetails) -> ChannelDetails { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelDetails object pub extern "C" fn ChannelDetails_debug_str_void(o: *const c_void) -> Str { @@ -1860,6 +1935,19 @@ pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lig local_ret } +/// Gets the funding output for this channel, if available. +/// +/// When a channel is spliced, this continues to refer to the original funding output (which +/// was spent by the splice transaction) until the splice transaction reaches sufficient +/// confirmations to be locked (and we exchange `splice_locked` messages with our peer). +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelDetails_get_funding_output(this_arg: &crate::lightning::ln::channel_state::ChannelDetails) -> crate::c_types::derived::COption_TxOutZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_funding_output(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_TxOutZ::None } else { crate::c_types::derived::COption_TxOutZ::Some( { crate::c_types::TxOut::from_rust(&ret.unwrap()) }) }; + local_ret +} + #[no_mangle] /// Serialize the ChannelDetails object into a byte array which can be read by ChannelDetails_read pub extern "C" fn ChannelDetails_write(obj: &crate::lightning::ln::channel_state::ChannelDetails) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/ln/channelmanager.rs b/lightning-c-bindings/src/lightning/ln/channelmanager.rs index 7f7c8f25..a5006d02 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -47,6 +47,28 @@ pub enum PendingHTLCRouting { blinded: crate::lightning::ln::channelmanager::BlindedForward, /// The absolute CLTV of the inbound HTLC incoming_cltv_expiry: crate::c_types::derived::COption_u32Z, + /// Whether this HTLC should be held by our node until we receive a corresponding + /// [`ReleaseHeldHtlc`] onion message. + hold_htlc: crate::c_types::derived::COption_NoneZ, + }, + /// An HTLC which should be forwarded on to another Trampoline node. + TrampolineForward { + /// The onion shared secret we build with the sender (or the preceding Trampoline node) used + /// to decrypt the onion. + /// + /// This is later used to encrypt failure packets in the event that the HTLC is failed. + incoming_shared_secret: crate::c_types::ThirtyTwoBytes, + /// The onion which should be included in the forwarded HTLC, telling the next hop what to + /// do with the HTLC. + onion_packet: crate::lightning::ln::msgs::TrampolineOnionPacket, + /// The node ID of the Trampoline node which we need to route this HTLC to. + node_id: crate::c_types::PublicKey, + /// Set if this HTLC is being forwarded within a blinded path. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + blinded: crate::lightning::ln::channelmanager::BlindedForward, + /// The absolute CLTV of the inbound HTLC + incoming_cltv_expiry: u32, }, /// The onion indicates that this is a payment for an invoice (supposedly) generated by us. /// @@ -120,8 +142,17 @@ pub enum PendingHTLCRouting { requires_blinded_error: bool, /// Set if we are receiving a keysend to a blinded path, meaning we created the /// [`PaymentSecret`] and should verify it using our - /// [`NodeSigner::get_inbound_payment_key`]. + /// [`NodeSigner::get_expanded_key`]. has_recipient_created_payment_secret: bool, + /// The [`InvoiceRequest`] associated with the [`Offer`] corresponding to this payment. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, + /// The context of the payment included by the recipient in a blinded path, or `None` if a + /// blinded path was not used. + /// + /// Used in part to determine the [`events::PaymentPurpose`]. + payment_context: crate::c_types::derived::COption_PaymentContextZ, }, } use lightning::ln::channelmanager::PendingHTLCRouting as PendingHTLCRoutingImport; @@ -131,18 +162,36 @@ impl PendingHTLCRouting { #[allow(unused)] pub(crate) fn to_native(&self) -> nativePendingHTLCRouting { match self { - PendingHTLCRouting::Forward {ref onion_packet, ref short_channel_id, ref blinded, ref incoming_cltv_expiry, } => { + PendingHTLCRouting::Forward {ref onion_packet, ref short_channel_id, ref blinded, ref incoming_cltv_expiry, ref hold_htlc, } => { let mut onion_packet_nonref = Clone::clone(onion_packet); let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut blinded_nonref = Clone::clone(blinded); let mut local_blinded_nonref = if blinded_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(blinded_nonref.take_inner()) } }) }; let mut incoming_cltv_expiry_nonref = Clone::clone(incoming_cltv_expiry); let mut local_incoming_cltv_expiry_nonref = if incoming_cltv_expiry_nonref.is_some() { Some( { incoming_cltv_expiry_nonref.take() }) } else { None }; + let mut hold_htlc_nonref = Clone::clone(hold_htlc); + let mut local_hold_htlc_nonref = if hold_htlc_nonref.is_some() { Some( { () /*hold_htlc_nonref.take()*/ }) } else { None }; nativePendingHTLCRouting::Forward { onion_packet: *unsafe { Box::from_raw(onion_packet_nonref.take_inner()) }, short_channel_id: short_channel_id_nonref, blinded: local_blinded_nonref, incoming_cltv_expiry: local_incoming_cltv_expiry_nonref, + hold_htlc: local_hold_htlc_nonref, + } + }, + PendingHTLCRouting::TrampolineForward {ref incoming_shared_secret, ref onion_packet, ref node_id, ref blinded, ref incoming_cltv_expiry, } => { + let mut incoming_shared_secret_nonref = Clone::clone(incoming_shared_secret); + let mut onion_packet_nonref = Clone::clone(onion_packet); + let mut node_id_nonref = Clone::clone(node_id); + let mut blinded_nonref = Clone::clone(blinded); + let mut local_blinded_nonref = if blinded_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(blinded_nonref.take_inner()) } }) }; + let mut incoming_cltv_expiry_nonref = Clone::clone(incoming_cltv_expiry); + nativePendingHTLCRouting::TrampolineForward { + incoming_shared_secret: incoming_shared_secret_nonref.data, + onion_packet: *unsafe { Box::from_raw(onion_packet_nonref.take_inner()) }, + node_id: node_id_nonref.into_rust(), + blinded: local_blinded_nonref, + incoming_cltv_expiry: incoming_cltv_expiry_nonref, } }, PendingHTLCRouting::Receive {ref payment_data, ref payment_metadata, ref payment_context, ref incoming_cltv_expiry, ref phantom_shared_secret, ref custom_tlvs, ref requires_blinded_error, } => { @@ -167,7 +216,7 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error_nonref, } }, - PendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, } => { + PendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, ref invoice_request, ref payment_context, } => { let mut payment_data_nonref = Clone::clone(payment_data); let mut local_payment_data_nonref = if payment_data_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payment_data_nonref.take_inner()) } }) }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); @@ -178,6 +227,10 @@ impl PendingHTLCRouting { let mut local_custom_tlvs_nonref = Vec::new(); for mut item in custom_tlvs_nonref.into_rust().drain(..) { local_custom_tlvs_nonref.push( { let (mut orig_custom_tlvs_nonref_0_0, mut orig_custom_tlvs_nonref_0_1) = item.to_rust(); let mut local_orig_custom_tlvs_nonref_0_1 = Vec::new(); for mut item in orig_custom_tlvs_nonref_0_1.into_rust().drain(..) { local_orig_custom_tlvs_nonref_0_1.push( { item }); }; let mut local_custom_tlvs_nonref_0 = (orig_custom_tlvs_nonref_0_0, local_orig_custom_tlvs_nonref_0_1); local_custom_tlvs_nonref_0 }); }; let mut requires_blinded_error_nonref = Clone::clone(requires_blinded_error); let mut has_recipient_created_payment_secret_nonref = Clone::clone(has_recipient_created_payment_secret); + let mut invoice_request_nonref = Clone::clone(invoice_request); + let mut local_invoice_request_nonref = if invoice_request_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(invoice_request_nonref.take_inner()) } }) }; + let mut payment_context_nonref = Clone::clone(payment_context); + let mut local_payment_context_nonref = { /*payment_context_nonref*/ let payment_context_nonref_opt = payment_context_nonref; if payment_context_nonref_opt.is_none() { None } else { Some({ { { payment_context_nonref_opt.take() }.into_native() }})} }; nativePendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data_nonref, payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_nonref.data), @@ -186,6 +239,8 @@ impl PendingHTLCRouting { custom_tlvs: local_custom_tlvs_nonref, requires_blinded_error: requires_blinded_error_nonref, has_recipient_created_payment_secret: has_recipient_created_payment_secret_nonref, + invoice_request: local_invoice_request_nonref, + payment_context: local_payment_context_nonref, } }, } @@ -193,14 +248,26 @@ impl PendingHTLCRouting { #[allow(unused)] pub(crate) fn into_native(self) -> nativePendingHTLCRouting { match self { - PendingHTLCRouting::Forward {mut onion_packet, mut short_channel_id, mut blinded, mut incoming_cltv_expiry, } => { + PendingHTLCRouting::Forward {mut onion_packet, mut short_channel_id, mut blinded, mut incoming_cltv_expiry, mut hold_htlc, } => { let mut local_blinded = if blinded.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(blinded.take_inner()) } }) }; let mut local_incoming_cltv_expiry = if incoming_cltv_expiry.is_some() { Some( { incoming_cltv_expiry.take() }) } else { None }; + let mut local_hold_htlc = if hold_htlc.is_some() { Some( { () /*hold_htlc.take()*/ }) } else { None }; nativePendingHTLCRouting::Forward { onion_packet: *unsafe { Box::from_raw(onion_packet.take_inner()) }, short_channel_id: short_channel_id, blinded: local_blinded, incoming_cltv_expiry: local_incoming_cltv_expiry, + hold_htlc: local_hold_htlc, + } + }, + PendingHTLCRouting::TrampolineForward {mut incoming_shared_secret, mut onion_packet, mut node_id, mut blinded, mut incoming_cltv_expiry, } => { + let mut local_blinded = if blinded.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(blinded.take_inner()) } }) }; + nativePendingHTLCRouting::TrampolineForward { + incoming_shared_secret: incoming_shared_secret.data, + onion_packet: *unsafe { Box::from_raw(onion_packet.take_inner()) }, + node_id: node_id.into_rust(), + blinded: local_blinded, + incoming_cltv_expiry: incoming_cltv_expiry, } }, PendingHTLCRouting::Receive {mut payment_data, mut payment_metadata, mut payment_context, mut incoming_cltv_expiry, mut phantom_shared_secret, mut custom_tlvs, mut requires_blinded_error, } => { @@ -218,10 +285,12 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error, } }, - PendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, } => { + PendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, mut invoice_request, mut payment_context, } => { let mut local_payment_data = if payment_data.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payment_data.take_inner()) } }) }; let mut local_payment_metadata = { /*payment_metadata*/ let payment_metadata_opt = payment_metadata; if payment_metadata_opt.is_none() { None } else { Some({ { let mut local_payment_metadata_0 = Vec::new(); for mut item in { payment_metadata_opt.take() }.into_rust().drain(..) { local_payment_metadata_0.push( { item }); }; local_payment_metadata_0 }})} }; 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 local_invoice_request = if invoice_request.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(invoice_request.take_inner()) } }) }; + let mut local_payment_context = { /*payment_context*/ let payment_context_opt = payment_context; if payment_context_opt.is_none() { None } else { Some({ { { payment_context_opt.take() }.into_native() }})} }; nativePendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data, payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage.data), @@ -230,6 +299,8 @@ impl PendingHTLCRouting { custom_tlvs: local_custom_tlvs, requires_blinded_error: requires_blinded_error, has_recipient_created_payment_secret: has_recipient_created_payment_secret, + invoice_request: local_invoice_request, + payment_context: local_payment_context, } }, } @@ -238,18 +309,36 @@ impl PendingHTLCRouting { pub(crate) fn from_native(native: &PendingHTLCRoutingImport) -> Self { let native = unsafe { &*(native as *const _ as *const c_void as *const nativePendingHTLCRouting) }; match native { - nativePendingHTLCRouting::Forward {ref onion_packet, ref short_channel_id, ref blinded, ref incoming_cltv_expiry, } => { + nativePendingHTLCRouting::Forward {ref onion_packet, ref short_channel_id, ref blinded, ref incoming_cltv_expiry, ref hold_htlc, } => { let mut onion_packet_nonref = Clone::clone(onion_packet); let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut blinded_nonref = Clone::clone(blinded); let mut local_blinded_nonref = crate::lightning::ln::channelmanager::BlindedForward { inner: if blinded_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((blinded_nonref.unwrap())) } }, is_owned: true }; let mut incoming_cltv_expiry_nonref = Clone::clone(incoming_cltv_expiry); let mut local_incoming_cltv_expiry_nonref = if incoming_cltv_expiry_nonref.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { incoming_cltv_expiry_nonref.unwrap() }) }; + let mut hold_htlc_nonref = Clone::clone(hold_htlc); + let mut local_hold_htlc_nonref = if hold_htlc_nonref.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; PendingHTLCRouting::Forward { onion_packet: crate::lightning::ln::msgs::OnionPacket { inner: ObjOps::heap_alloc(onion_packet_nonref), is_owned: true }, short_channel_id: short_channel_id_nonref, blinded: local_blinded_nonref, incoming_cltv_expiry: local_incoming_cltv_expiry_nonref, + hold_htlc: local_hold_htlc_nonref, + } + }, + nativePendingHTLCRouting::TrampolineForward {ref incoming_shared_secret, ref onion_packet, ref node_id, ref blinded, ref incoming_cltv_expiry, } => { + let mut incoming_shared_secret_nonref = Clone::clone(incoming_shared_secret); + let mut onion_packet_nonref = Clone::clone(onion_packet); + let mut node_id_nonref = Clone::clone(node_id); + let mut blinded_nonref = Clone::clone(blinded); + let mut local_blinded_nonref = crate::lightning::ln::channelmanager::BlindedForward { inner: if blinded_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((blinded_nonref.unwrap())) } }, is_owned: true }; + let mut incoming_cltv_expiry_nonref = Clone::clone(incoming_cltv_expiry); + PendingHTLCRouting::TrampolineForward { + incoming_shared_secret: crate::c_types::ThirtyTwoBytes { data: incoming_shared_secret_nonref }, + onion_packet: crate::lightning::ln::msgs::TrampolineOnionPacket { inner: ObjOps::heap_alloc(onion_packet_nonref), is_owned: true }, + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + blinded: local_blinded_nonref, + incoming_cltv_expiry: incoming_cltv_expiry_nonref, } }, nativePendingHTLCRouting::Receive {ref payment_data, ref payment_metadata, ref payment_context, ref incoming_cltv_expiry, ref phantom_shared_secret, ref custom_tlvs, ref requires_blinded_error, } => { @@ -274,7 +363,7 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error_nonref, } }, - nativePendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, } => { + nativePendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, ref invoice_request, ref payment_context, } => { let mut payment_data_nonref = Clone::clone(payment_data); let mut local_payment_data_nonref = crate::lightning::ln::msgs::FinalOnionHopData { inner: if payment_data_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((payment_data_nonref.unwrap())) } }, is_owned: true }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); @@ -285,6 +374,10 @@ impl PendingHTLCRouting { let mut local_custom_tlvs_nonref = Vec::new(); for mut item in custom_tlvs_nonref.drain(..) { local_custom_tlvs_nonref.push( { let (mut orig_custom_tlvs_nonref_0_0, mut orig_custom_tlvs_nonref_0_1) = item; let mut local_orig_custom_tlvs_nonref_0_1 = Vec::new(); for mut item in orig_custom_tlvs_nonref_0_1.drain(..) { local_orig_custom_tlvs_nonref_0_1.push( { item }); }; let mut local_custom_tlvs_nonref_0 = (orig_custom_tlvs_nonref_0_0, local_orig_custom_tlvs_nonref_0_1.into()).into(); local_custom_tlvs_nonref_0 }); }; let mut requires_blinded_error_nonref = Clone::clone(requires_blinded_error); let mut has_recipient_created_payment_secret_nonref = Clone::clone(has_recipient_created_payment_secret); + let mut invoice_request_nonref = Clone::clone(invoice_request); + let mut local_invoice_request_nonref = crate::lightning::offers::invoice_request::InvoiceRequest { inner: if invoice_request_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((invoice_request_nonref.unwrap())) } }, is_owned: true }; + let mut payment_context_nonref = Clone::clone(payment_context); + let mut local_payment_context_nonref = if payment_context_nonref.is_none() { crate::c_types::derived::COption_PaymentContextZ::None } else { crate::c_types::derived::COption_PaymentContextZ::Some( { crate::lightning::blinded_path::payment::PaymentContext::native_into(payment_context_nonref.unwrap()) }) }; PendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data_nonref, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.0 }, @@ -293,6 +386,8 @@ impl PendingHTLCRouting { custom_tlvs: local_custom_tlvs_nonref.into(), requires_blinded_error: requires_blinded_error_nonref, has_recipient_created_payment_secret: has_recipient_created_payment_secret_nonref, + invoice_request: local_invoice_request_nonref, + payment_context: local_payment_context_nonref, } }, } @@ -300,14 +395,26 @@ impl PendingHTLCRouting { #[allow(unused)] pub(crate) fn native_into(native: nativePendingHTLCRouting) -> Self { match native { - nativePendingHTLCRouting::Forward {mut onion_packet, mut short_channel_id, mut blinded, mut incoming_cltv_expiry, } => { + nativePendingHTLCRouting::Forward {mut onion_packet, mut short_channel_id, mut blinded, mut incoming_cltv_expiry, mut hold_htlc, } => { let mut local_blinded = crate::lightning::ln::channelmanager::BlindedForward { inner: if blinded.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((blinded.unwrap())) } }, is_owned: true }; let mut local_incoming_cltv_expiry = if incoming_cltv_expiry.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { incoming_cltv_expiry.unwrap() }) }; + let mut local_hold_htlc = if hold_htlc.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; PendingHTLCRouting::Forward { onion_packet: crate::lightning::ln::msgs::OnionPacket { inner: ObjOps::heap_alloc(onion_packet), is_owned: true }, short_channel_id: short_channel_id, blinded: local_blinded, incoming_cltv_expiry: local_incoming_cltv_expiry, + hold_htlc: local_hold_htlc, + } + }, + nativePendingHTLCRouting::TrampolineForward {mut incoming_shared_secret, mut onion_packet, mut node_id, mut blinded, mut incoming_cltv_expiry, } => { + let mut local_blinded = crate::lightning::ln::channelmanager::BlindedForward { inner: if blinded.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((blinded.unwrap())) } }, is_owned: true }; + PendingHTLCRouting::TrampolineForward { + incoming_shared_secret: crate::c_types::ThirtyTwoBytes { data: incoming_shared_secret }, + onion_packet: crate::lightning::ln::msgs::TrampolineOnionPacket { inner: ObjOps::heap_alloc(onion_packet), is_owned: true }, + node_id: crate::c_types::PublicKey::from_rust(&node_id), + blinded: local_blinded, + incoming_cltv_expiry: incoming_cltv_expiry, } }, nativePendingHTLCRouting::Receive {mut payment_data, mut payment_metadata, mut payment_context, mut incoming_cltv_expiry, mut phantom_shared_secret, mut custom_tlvs, mut requires_blinded_error, } => { @@ -325,10 +432,12 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error, } }, - nativePendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, } => { + nativePendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, mut invoice_request, mut payment_context, } => { let mut local_payment_data = crate::lightning::ln::msgs::FinalOnionHopData { inner: if payment_data.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((payment_data.unwrap())) } }, is_owned: true }; let mut local_payment_metadata = if payment_metadata.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { let mut local_payment_metadata_0 = Vec::new(); for mut item in payment_metadata.unwrap().drain(..) { local_payment_metadata_0.push( { item }); }; local_payment_metadata_0.into() }) }; let mut local_custom_tlvs = Vec::new(); for mut item in custom_tlvs.drain(..) { local_custom_tlvs.push( { let (mut orig_custom_tlvs_0_0, mut orig_custom_tlvs_0_1) = item; let mut local_orig_custom_tlvs_0_1 = Vec::new(); for mut item in orig_custom_tlvs_0_1.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.into()).into(); local_custom_tlvs_0 }); }; + let mut local_invoice_request = crate::lightning::offers::invoice_request::InvoiceRequest { inner: if invoice_request.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((invoice_request.unwrap())) } }, is_owned: true }; + let mut local_payment_context = if payment_context.is_none() { crate::c_types::derived::COption_PaymentContextZ::None } else { crate::c_types::derived::COption_PaymentContextZ::Some( { crate::lightning::blinded_path::payment::PaymentContext::native_into(payment_context.unwrap()) }) }; PendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 }, @@ -337,6 +446,8 @@ impl PendingHTLCRouting { custom_tlvs: local_custom_tlvs.into(), requires_blinded_error: requires_blinded_error, has_recipient_created_payment_secret: has_recipient_created_payment_secret, + invoice_request: local_invoice_request, + payment_context: local_payment_context, } }, } @@ -362,12 +473,24 @@ pub(crate) extern "C" fn PendingHTLCRouting_free_void(this_ptr: *mut c_void) { } #[no_mangle] /// Utility method to constructs a new Forward-variant PendingHTLCRouting -pub extern "C" fn PendingHTLCRouting_forward(onion_packet: crate::lightning::ln::msgs::OnionPacket, short_channel_id: u64, blinded: crate::lightning::ln::channelmanager::BlindedForward, incoming_cltv_expiry: crate::c_types::derived::COption_u32Z) -> PendingHTLCRouting { +pub extern "C" fn PendingHTLCRouting_forward(onion_packet: crate::lightning::ln::msgs::OnionPacket, short_channel_id: u64, blinded: crate::lightning::ln::channelmanager::BlindedForward, incoming_cltv_expiry: crate::c_types::derived::COption_u32Z, hold_htlc: crate::c_types::derived::COption_NoneZ) -> PendingHTLCRouting { PendingHTLCRouting::Forward { onion_packet, short_channel_id, blinded, incoming_cltv_expiry, + hold_htlc, + } +} +#[no_mangle] +/// Utility method to constructs a new TrampolineForward-variant PendingHTLCRouting +pub extern "C" fn PendingHTLCRouting_trampoline_forward(incoming_shared_secret: crate::c_types::ThirtyTwoBytes, onion_packet: crate::lightning::ln::msgs::TrampolineOnionPacket, node_id: crate::c_types::PublicKey, blinded: crate::lightning::ln::channelmanager::BlindedForward, incoming_cltv_expiry: u32) -> PendingHTLCRouting { + PendingHTLCRouting::TrampolineForward { + incoming_shared_secret, + onion_packet, + node_id, + blinded, + incoming_cltv_expiry, } } #[no_mangle] @@ -385,7 +508,7 @@ pub extern "C" fn PendingHTLCRouting_receive(payment_data: crate::lightning::ln: } #[no_mangle] /// Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting -pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightning::ln::msgs::FinalOnionHopData, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_metadata: crate::c_types::derived::COption_CVec_u8ZZ, incoming_cltv_expiry: u32, custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ, requires_blinded_error: bool, has_recipient_created_payment_secret: bool) -> PendingHTLCRouting { +pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightning::ln::msgs::FinalOnionHopData, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_metadata: crate::c_types::derived::COption_CVec_u8ZZ, incoming_cltv_expiry: u32, custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ, requires_blinded_error: bool, has_recipient_created_payment_secret: bool, invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, payment_context: crate::c_types::derived::COption_PaymentContextZ) -> PendingHTLCRouting { PendingHTLCRouting::ReceiveKeysend { payment_data, payment_preimage, @@ -394,6 +517,8 @@ pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightn custom_tlvs, requires_blinded_error, has_recipient_created_payment_secret, + invoice_request, + payment_context, } } @@ -461,7 +586,7 @@ impl BlindedForward { /// [`msgs::UpdateAddHTLC::blinding_point`]. #[no_mangle] pub extern "C" fn BlindedForward_get_inbound_blinding_point(this_ptr: &BlindedForward) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inbound_blinding_point; + let mut inner_val = &mut BlindedForward::get_native_mut_ref(this_ptr).inbound_blinding_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The `blinding_point` that was set in the inbound [`msgs::UpdateAddHTLC`], or in the inbound @@ -475,7 +600,7 @@ pub extern "C" fn BlindedForward_set_inbound_blinding_point(this_ptr: &mut Blind /// the introduction node. #[no_mangle] pub extern "C" fn BlindedForward_get_failure(this_ptr: &BlindedForward) -> crate::lightning::ln::channelmanager::BlindedFailure { - let mut inner_val = &mut this_ptr.get_native_mut_ref().failure; + let mut inner_val = &mut BlindedForward::get_native_mut_ref(this_ptr).failure; crate::lightning::ln::channelmanager::BlindedFailure::from_native(inner_val) } /// If needed, this determines how this HTLC should be failed backwards, based on whether we are @@ -488,10 +613,12 @@ pub extern "C" fn BlindedForward_set_failure(this_ptr: &mut BlindedForward, mut /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that /// starts at the next hop. /// +/// [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath +/// /// 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 BlindedForward_get_next_blinding_override(this_ptr: &BlindedForward) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_blinding_override; + let mut inner_val = &mut BlindedForward::get_native_mut_ref(this_ptr).next_blinding_override; let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; local_inner_val } @@ -499,6 +626,8 @@ pub extern "C" fn BlindedForward_get_next_blinding_override(this_ptr: &BlindedFo /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that /// starts at the next hop. /// +/// [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath +/// /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] pub extern "C" fn BlindedForward_set_next_blinding_override(this_ptr: &mut BlindedForward, mut val: crate::c_types::PublicKey) { @@ -522,7 +651,7 @@ impl Clone for BlindedForward { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedForward>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -530,12 +659,12 @@ impl Clone for BlindedForward { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedForward_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedForward)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedForward) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedForward pub extern "C" fn BlindedForward_clone(orig: &BlindedForward) -> BlindedForward { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedForward object pub extern "C" fn BlindedForward_debug_str_void(o: *const c_void) -> Str { @@ -623,7 +752,7 @@ impl PendingHTLCInfo { /// Further routing details based on whether the HTLC is being forwarded or received. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_routing(this_ptr: &PendingHTLCInfo) -> crate::lightning::ln::channelmanager::PendingHTLCRouting { - let mut inner_val = &mut this_ptr.get_native_mut_ref().routing; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).routing; crate::lightning::ln::channelmanager::PendingHTLCRouting::from_native(inner_val) } /// Further routing details based on whether the HTLC is being forwarded or received. @@ -636,7 +765,7 @@ pub extern "C" fn PendingHTLCInfo_set_routing(this_ptr: &mut PendingHTLCInfo, mu /// This is later used to encrypt failure packets in the event that the HTLC is failed. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_incoming_shared_secret(this_ptr: &PendingHTLCInfo) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().incoming_shared_secret; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).incoming_shared_secret; inner_val } /// The onion shared secret we build with the sender used to decrypt the onion. @@ -649,7 +778,7 @@ pub extern "C" fn PendingHTLCInfo_set_incoming_shared_secret(this_ptr: &mut Pend /// Hash of the payment preimage, to lock the payment until the receiver releases the preimage. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_payment_hash(this_ptr: &PendingHTLCInfo) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).payment_hash; &inner_val.0 } /// Hash of the payment preimage, to lock the payment until the receiver releases the preimage. @@ -663,7 +792,7 @@ pub extern "C" fn PendingHTLCInfo_set_payment_hash(this_ptr: &mut PendingHTLCInf /// versions. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_incoming_amt_msat(this_ptr: &PendingHTLCInfo) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().incoming_amt_msat; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).incoming_amt_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 } @@ -689,7 +818,7 @@ pub extern "C" fn PendingHTLCInfo_set_incoming_amt_msat(this_ptr: &mut PendingHT /// [`Self::outgoing_amt_msat`]. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_outgoing_amt_msat(this_ptr: &PendingHTLCInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outgoing_amt_msat; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).outgoing_amt_msat; *inner_val } /// The amount the sender indicated should be forwarded on to the next hop or amount the sender @@ -711,7 +840,7 @@ pub extern "C" fn PendingHTLCInfo_set_outgoing_amt_msat(this_ptr: &mut PendingHT /// should have been set on the received HTLC for received payments). #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_outgoing_cltv_value(this_ptr: &PendingHTLCInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outgoing_cltv_value; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).outgoing_cltv_value; *inner_val } /// The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated @@ -731,7 +860,7 @@ pub extern "C" fn PendingHTLCInfo_set_outgoing_cltv_value(this_ptr: &mut Pending /// shoulder them. #[no_mangle] pub extern "C" fn PendingHTLCInfo_get_skimmed_fee_msat(this_ptr: &PendingHTLCInfo) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().skimmed_fee_msat; + let mut inner_val = &mut PendingHTLCInfo::get_native_mut_ref(this_ptr).skimmed_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 } @@ -769,7 +898,7 @@ impl Clone for PendingHTLCInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativePendingHTLCInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -777,12 +906,12 @@ impl Clone for PendingHTLCInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PendingHTLCInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePendingHTLCInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePendingHTLCInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PendingHTLCInfo pub extern "C" fn PendingHTLCInfo_clone(orig: &PendingHTLCInfo) -> PendingHTLCInfo { - orig.clone() + Clone::clone(orig) } /// Whether this blinded HTLC is being failed backwards by the introduction node or a blinded node, /// which determines the failure message that should be used. @@ -791,10 +920,11 @@ pub extern "C" fn PendingHTLCInfo_clone(orig: &PendingHTLCInfo) -> PendingHTLCIn #[repr(C)] pub enum BlindedFailure { /// This HTLC is being failed backwards by the introduction node, and thus should be failed with - /// [`msgs::UpdateFailHTLC`] and error code `0x8000|0x4000|24`. + /// [`msgs::UpdateFailHTLC`] and error code [`LocalHTLCFailureReason::InvalidOnionBlinding`]. FromIntroductionNode, /// This HTLC is being failed backwards by a blinded node within the path, and thus should be - /// failed with [`msgs::UpdateFailMalformedHTLC`] and error code `0x8000|0x4000|24`. + /// failed with [`msgs::UpdateFailMalformedHTLC`] and error code + /// [`LocalHTLCFailureReason::InvalidOnionBlinding`]. FromBlindedNode, } use lightning::ln::channelmanager::BlindedFailure as BlindedFailureImport; @@ -982,6 +1112,146 @@ extern "C" fn UnauthenticatedReceiveTlvs_Verification_verify_for_offer_payment(t local_ret } + +use lightning::ln::channelmanager::OptionalOfferPaymentParams as nativeOptionalOfferPaymentParamsImport; +pub(crate) type nativeOptionalOfferPaymentParams = nativeOptionalOfferPaymentParamsImport; + +/// Optional arguments to [`ChannelManager::pay_for_offer`] +///and [`ChannelManager::pay_for_offer_from_human_readable_name`] +/// . +/// +/// These fields will often not need to be set, and the provided [`Self::default`] can be used. +#[must_use] +#[repr(C)] +pub struct OptionalOfferPaymentParams { + /// 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 nativeOptionalOfferPaymentParams, + /// 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 core::ops::Deref for OptionalOfferPaymentParams { + type Target = nativeOptionalOfferPaymentParams; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OptionalOfferPaymentParams { } +unsafe impl core::marker::Sync for OptionalOfferPaymentParams { } +impl Drop for OptionalOfferPaymentParams { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOptionalOfferPaymentParams>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OptionalOfferPaymentParams, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_free(this_obj: OptionalOfferPaymentParams) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OptionalOfferPaymentParams_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOptionalOfferPaymentParams) }; +} +#[allow(unused)] +impl OptionalOfferPaymentParams { + pub(crate) fn get_native_ref(&self) -> &'static nativeOptionalOfferPaymentParams { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOptionalOfferPaymentParams { + 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 nativeOptionalOfferPaymentParams { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// A note that is communicated to the recipient about this payment via +/// [`InvoiceRequest::payer_note`]. +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_get_payer_note(this_ptr: &OptionalOfferPaymentParams) -> crate::c_types::derived::COption_StrZ { + let mut inner_val = &mut OptionalOfferPaymentParams::get_native_mut_ref(this_ptr).payer_note; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into() }) }; + local_inner_val +} +/// A note that is communicated to the recipient about this payment via +/// [`InvoiceRequest::payer_note`]. +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_set_payer_note(this_ptr: &mut OptionalOfferPaymentParams, mut val: crate::c_types::derived::COption_StrZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_string() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payer_note = local_val; +} +/// Pathfinding options which tweak how the path is constructed to the recipient. +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_get_route_params_config(this_ptr: &OptionalOfferPaymentParams) -> crate::lightning::routing::router::RouteParametersConfig { + let mut inner_val = &mut OptionalOfferPaymentParams::get_native_mut_ref(this_ptr).route_params_config; + crate::lightning::routing::router::RouteParametersConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::router::RouteParametersConfig<>) as *mut _) }, is_owned: false } +} +/// Pathfinding options which tweak how the path is constructed to the recipient. +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_set_route_params_config(this_ptr: &mut OptionalOfferPaymentParams, mut val: crate::lightning::routing::router::RouteParametersConfig) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.route_params_config = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The number of tries or time during which we'll retry this payment if some paths to the +/// recipient fail. +/// +/// Once the retry limit is reached, further path failures will not be retried and the payment +/// will ultimately fail once all pending paths have failed (generating an +/// [`Event::PaymentFailed`]). +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_get_retry_strategy(this_ptr: &OptionalOfferPaymentParams) -> crate::lightning::ln::outbound_payment::Retry { + let mut inner_val = &mut OptionalOfferPaymentParams::get_native_mut_ref(this_ptr).retry_strategy; + crate::lightning::ln::outbound_payment::Retry::from_native(inner_val) +} +/// The number of tries or time during which we'll retry this payment if some paths to the +/// recipient fail. +/// +/// Once the retry limit is reached, further path failures will not be retried and the payment +/// will ultimately fail once all pending paths have failed (generating an +/// [`Event::PaymentFailed`]). +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_set_retry_strategy(this_ptr: &mut OptionalOfferPaymentParams, mut val: crate::lightning::ln::outbound_payment::Retry) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.retry_strategy = val.into_native(); +} +/// Constructs a new OptionalOfferPaymentParams given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_new(mut payer_note_arg: crate::c_types::derived::COption_StrZ, mut route_params_config_arg: crate::lightning::routing::router::RouteParametersConfig, mut retry_strategy_arg: crate::lightning::ln::outbound_payment::Retry) -> OptionalOfferPaymentParams { + let mut local_payer_note_arg = { /*payer_note_arg*/ let payer_note_arg_opt = payer_note_arg; if payer_note_arg_opt.is_none() { None } else { Some({ { { payer_note_arg_opt.take() }.into_string() }})} }; + OptionalOfferPaymentParams { inner: ObjOps::heap_alloc(nativeOptionalOfferPaymentParams { + payer_note: local_payer_note_arg, + route_params_config: *unsafe { Box::from_raw(route_params_config_arg.take_inner()) }, + retry_strategy: retry_strategy_arg.into_native(), + }), is_owned: true } +} +/// Creates a "default" OptionalOfferPaymentParams. See struct and individual field documentaiton for details on which values are used. +#[must_use] +#[no_mangle] +pub extern "C" fn OptionalOfferPaymentParams_default() -> OptionalOfferPaymentParams { + OptionalOfferPaymentParams { inner: ObjOps::heap_alloc(Default::default()), is_owned: true } +} +mod fuzzy_channelmanager { + +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}; + +} /// 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`]. /// @@ -1131,7 +1401,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport)>::read(&mut reader, args)?; @@ -1221,7 +1491,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport { /// if !is_trusted(counterparty_node_id) { -/// match channel_manager.force_close_without_broadcasting_txn( +/// match channel_manager.force_close_broadcasting_latest_txn( /// &temporary_channel_id, &counterparty_node_id, error_message.to_string() /// ) { /// Ok(()) => println!(\"Rejecting channel {}\", temporary_channel_id), @@ -1371,7 +1641,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport println!(\"Accepting channel {}\", temporary_channel_id), /// Err(e) => println!(\"Error accepting channel {}: {:?}\", temporary_channel_id, e), @@ -1501,26 +1771,24 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( -/// # channel_manager: T, payment_hash: PaymentHash, recipient_onion: RecipientOnionFields, -/// # route_params: RouteParameters, retry: Retry +/// # channel_manager: T, invoice: &Bolt11Invoice, route_params_config: RouteParametersConfig, +/// # retry: Retry /// # ) { /// # let channel_manager = channel_manager.get_cm(); -/// // let (payment_hash, recipient_onion, route_params) = -/// // payment::payment_parameters_from_invoice(&invoice); -/// let payment_id = PaymentId([42; 32]); -/// match channel_manager.send_payment( -/// payment_hash, recipient_onion, payment_id, route_params, retry +/// # let payment_id = PaymentId([42; 32]); +/// # let payment_hash = PaymentHash((*invoice.payment_hash()).to_byte_array()); +/// match channel_manager.pay_for_bolt11_invoice( +/// invoice, payment_id, None, route_params_config, retry /// ) { /// Ok(()) => println!(\"Sending payment with hash {}\", payment_hash), /// Err(e) => println!(\"Failed sending payment with hash {}: {:?}\", payment_hash, e), @@ -1566,12 +1834,12 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport(channel_manager: T) -> Result<(), Bolt12SemanticError> { /// # let channel_manager = channel_manager.get_cm(); -/// # let absolute_expiry = None; /// let offer = channel_manager -/// .create_offer_builder(absolute_expiry)? +/// .create_offer_builder()? /// # ; /// # // Needed for compiling for c_bindings /// # let builder: lightning::offers::offer::OfferBuilder<_, _> = offer.into(); @@ -1612,17 +1880,15 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( -/// # channel_manager: T, offer: &Offer, quantity: Option, amount_msats: Option, -/// # payer_note: Option, retry: Retry, max_total_routing_fee_msat: Option +/// # channel_manager: T, offer: &Offer, amount_msats: Option, /// # ) { /// # let channel_manager = channel_manager.get_cm(); /// let payment_id = PaymentId([42; 32]); /// match channel_manager.pay_for_offer( -/// offer, quantity, amount_msats, payer_note, payment_id, retry, max_total_routing_fee_msat +/// offer, amount_msats, payment_id, Default::default(), /// ) { /// Ok(()) => println!(\"Requesting invoice for offer\"), /// Err(e) => println!(\"Unable to request invoice for offer: {:?}\", e), @@ -1671,16 +1937,17 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( /// # channel_manager: T, amount_msats: u64, absolute_expiry: Duration, retry: Retry, -/// # max_total_routing_fee_msat: Option +/// # route_params_config: RouteParametersConfig /// # ) -> Result<(), Bolt12SemanticError> { /// # let channel_manager = channel_manager.get_cm(); /// let payment_id = PaymentId([42; 32]); /// let refund = channel_manager /// .create_refund_builder( -/// amount_msats, absolute_expiry, payment_id, retry, max_total_routing_fee_msat +/// amount_msats, absolute_expiry, payment_id, retry, route_params_config /// )? /// # ; /// # // Needed for compiling for c_bindings @@ -1823,12 +2090,11 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport crate::bitcoin::network::Network { - let mut inner_val = &mut this_ptr.get_native_mut_ref().network; + let mut inner_val = &mut ChainParameters::get_native_mut_ref(this_ptr).network; crate::bitcoin::network::Network::from_bitcoin(inner_val) } /// The network for determining the `chain_hash` in Lightning messages. @@ -1993,7 +2258,7 @@ pub extern "C" fn ChainParameters_set_network(this_ptr: &mut ChainParameters, mu /// Used to track on-chain channel funding outputs and send payments with reliable timelocks. #[no_mangle] pub extern "C" fn ChainParameters_get_best_block(this_ptr: &ChainParameters) -> crate::lightning::chain::BestBlock { - let mut inner_val = &mut this_ptr.get_native_mut_ref().best_block; + let mut inner_val = &mut ChainParameters::get_native_mut_ref(this_ptr).best_block; crate::lightning::chain::BestBlock { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::BestBlock<>) as *mut _) }, is_owned: false } } /// The hash and height of the latest block successfully connected. @@ -2016,7 +2281,7 @@ impl Clone for ChainParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeChainParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2024,12 +2289,12 @@ impl Clone for ChainParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChainParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChainParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChainParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChainParameters pub extern "C" fn ChainParameters_clone(orig: &ChainParameters) -> ChainParameters { - orig.clone() + Clone::clone(orig) } /// The amount of time in blocks we require our counterparty wait to claim their money (ie time /// between when we, or our watchtower, must check for them having broadcast a theft transaction). @@ -2041,7 +2306,7 @@ pub extern "C" fn ChainParameters_clone(orig: &ChainParameters) -> ChainParamete #[no_mangle] pub static BREAKDOWN_TIMEOUT: u16 = lightning::ln::channelmanager::BREAKDOWN_TIMEOUT; /// The minimum number of blocks between an inbound HTLC's CLTV and the corresponding outbound -/// HTLC's CLTV. The current default represents roughly seven hours of blocks at six blocks/hour. +/// HTLC's CLTV. The current default represents roughly eight hours of blocks at six blocks/hour. /// /// This can be increased (but not decreased) through [`ChannelConfig::cltv_expiry_delta`] /// @@ -2370,7 +2635,7 @@ impl PhantomRouteHints { /// The list of channels to be included in the invoice route hints. #[no_mangle] pub extern "C" fn PhantomRouteHints_get_channels(this_ptr: &PhantomRouteHints) -> crate::c_types::derived::CVec_ChannelDetailsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channels; + let mut inner_val = &mut PhantomRouteHints::get_native_mut_ref(this_ptr).channels; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -2384,7 +2649,7 @@ pub extern "C" fn PhantomRouteHints_set_channels(this_ptr: &mut PhantomRouteHint /// route hints. #[no_mangle] pub extern "C" fn PhantomRouteHints_get_phantom_scid(this_ptr: &PhantomRouteHints) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().phantom_scid; + let mut inner_val = &mut PhantomRouteHints::get_native_mut_ref(this_ptr).phantom_scid; *inner_val } /// A fake scid used for representing the phantom node's fake channel in generating the invoice @@ -2396,7 +2661,7 @@ pub extern "C" fn PhantomRouteHints_set_phantom_scid(this_ptr: &mut PhantomRoute /// The pubkey of the real backing node that would ultimately receive the payment. #[no_mangle] pub extern "C" fn PhantomRouteHints_get_real_node_pubkey(this_ptr: &PhantomRouteHints) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().real_node_pubkey; + let mut inner_val = &mut PhantomRouteHints::get_native_mut_ref(this_ptr).real_node_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The pubkey of the real backing node that would ultimately receive the payment. @@ -2419,7 +2684,7 @@ impl Clone for PhantomRouteHints { fn clone(&self) -> Self { Self { inner: if <*mut nativePhantomRouteHints>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2427,12 +2692,12 @@ impl Clone for PhantomRouteHints { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PhantomRouteHints_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePhantomRouteHints)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePhantomRouteHints) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PhantomRouteHints pub extern "C" fn PhantomRouteHints_clone(orig: &PhantomRouteHints) -> PhantomRouteHints { - orig.clone() + Clone::clone(orig) } /// Constructs a new `ChannelManager` to hold several channels and route between them. /// @@ -2444,12 +2709,12 @@ pub extern "C" fn PhantomRouteHints_clone(orig: &PhantomRouteHints) -> PhantomRo /// Non-proportional fees are fixed according to our risk using the provided fee estimator. /// /// Users need to notify the new `ChannelManager` when a new block is connected or -/// disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting +/// disconnected using its [`block_connected`] and [`blocks_disconnected`] methods, starting /// from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for /// more details. /// /// [`block_connected`]: chain::Listen::block_connected -/// [`block_disconnected`]: chain::Listen::block_disconnected +/// [`blocks_disconnected`]: chain::Listen::blocks_disconnected /// [`params.best_block.block_hash`]: chain::BestBlock::block_hash #[must_use] #[no_mangle] @@ -2458,12 +2723,20 @@ pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chain crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Gets the current configuration applied to all new channels. +/// Gets the current [`UserConfig`] which controls some global behavior and includes the +/// default configuration applied to all new channels. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::util::config::UserConfig { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_current_default_configuration(); - crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::util::config::UserConfig<>) as *mut _) }, is_owned: false } +pub extern "C" fn ChannelManager_get_current_config(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::util::config::UserConfig { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_current_config(); + crate::lightning::util::config::UserConfig { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Updates the current [`UserConfig`] which controls some global behavior and includes the +/// default configuration applied to all new channels. +#[no_mangle] +pub extern "C" fn ChannelManager_set_current_config(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut new_config: crate::lightning::util::config::UserConfig) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.set_current_config(*unsafe { Box::from_raw(new_config.take_inner()) }) } /// Creates a new outbound channel to the given remote node and with the given value. @@ -2582,7 +2855,7 @@ pub extern "C" fn ChannelManager_list_recent_payments(this_arg: &crate::lightnin /// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis /// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum /// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee -/// [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown +/// [`SendShutdown`]: MessageSendEvent::SendShutdown #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ { @@ -2607,7 +2880,7 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln:: /// /// The `shutdown_script` provided will be used as the `scriptPubKey` for the closing transaction. /// Will fail if a shutdown script has already been set for this channel by -/// ['ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must +/// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]. The given shutdown script must /// also be compatible with our and the counterparty's features. /// /// May generate a [`SendShutdown`] message event on success, which should be relayed. @@ -2619,7 +2892,8 @@ pub extern "C" fn ChannelManager_close_channel(this_arg: &crate::lightning::ln:: /// /// [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis /// [`NonAnchorChannelFee`]: crate::chain::chaininterface::ConfirmationTarget::NonAnchorChannelFee -/// [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown +/// [`ChannelHandshakeConfig::commit_upfront_shutdown_pubkey`]: crate::util::config::ChannelHandshakeConfig::commit_upfront_shutdown_pubkey +/// [`SendShutdown`]: MessageSendEvent::SendShutdown /// /// Note that shutdown_script (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] @@ -2648,24 +2922,6 @@ pub extern "C" fn ChannelManager_force_close_broadcasting_latest_txn(this_arg: & local_ret } -/// Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting -/// the latest local transaction(s). -/// -/// The provided `error_message` is sent to connected peers for closing channels and should -/// be a human-readable description of what went wrong. -/// -/// Fails if `channel_id` is unknown to the manager, or if the -/// `counterparty_node_id` isn't the counterparty of the corresponding channel. -/// You can always broadcast the latest local transaction(s) via -/// [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. -#[must_use] -#[no_mangle] -pub extern "C" fn ChannelManager_force_close_without_broadcasting_txn(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey, mut error_message: crate::c_types::Str) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_without_broadcasting_txn(channel_id.get_native_ref(), &counterparty_node_id.into_rust(), error_message.into_string()); - 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 -} - /// Force close all channels, immediately broadcasting the latest local commitment transaction /// for each to the chain and rejecting new HTLCs on each. /// @@ -2676,14 +2932,43 @@ pub extern "C" fn ChannelManager_force_close_all_channels_broadcasting_latest_tx unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_all_channels_broadcasting_latest_txn(error_message.into_string()) } -/// Force close all channels rejecting new HTLCs on each but without broadcasting the latest -/// local transaction(s). +/// Initiate a splice in order to add value to (splice-in) or remove value from (splice-out) +/// the channel. This will spend the channel's funding transaction output, effectively replacing +/// it with a new one. +/// +/// # Arguments +/// +/// Provide a `contribution` to determine if value is spliced in or out. The splice initiator is +/// responsible for paying fees for common fields, shared inputs, and shared outputs along with +/// any contributed inputs and outputs. Fees are determined using `funding_feerate_per_kw` and +/// must be covered by the supplied inputs for splice-in or the channel balance for splice-out. +/// +/// An optional `locktime` for the funding transaction may be specified. If not given, the +/// current best block height is used. +/// +/// # Events +/// +/// Once the funding transaction has been constructed, an [`Event::SplicePending`] will be +/// emitted. At this point, any inputs contributed to the splice can only be re-spent if an +/// [`Event::DiscardFunding`] is seen. +/// +/// After initial signatures have been exchanged, [`Event::FundingTransactionReadyForSigning`] +/// will be generated and [`ChannelManager::funding_transaction_signed`] should be called. +/// +/// If any failures occur while negotiating the funding transaction, an [`Event::SpliceFailed`] +/// will be emitted. Any contributed inputs no longer used will be included here and thus can +/// be re-spent. /// -/// The provided `error_message` is sent to connected peers for closing channels and -/// should be a human-readable description of what went wrong. +/// Once the splice has been locked by both counterparties, an [`Event::ChannelReady`] will be +/// emitted with the new funding output. At this point, a new splice can be negotiated by +/// calling `splice_channel` again on this channel. +#[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_txn(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut error_message: crate::c_types::Str) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_all_channels_without_broadcasting_txn(error_message.into_string()) +pub extern "C" fn ChannelManager_splice_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey, mut contribution: crate::lightning::ln::funding::SpliceContribution, mut funding_feerate_per_kw: u32, mut locktime: crate::c_types::derived::COption_u32Z) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut local_locktime = if locktime.is_some() { Some( { locktime.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.splice_channel(channel_id.get_native_ref(), &counterparty_node_id.into_rust(), contribution.into_native(), funding_feerate_per_kw, local_locktime); + 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 } /// Sends a payment along a given route. See [`Self::send_payment`] for more info. @@ -2701,6 +2986,9 @@ pub extern "C" fn ChannelManager_send_payment_with_route(this_arg: &crate::light /// Sends a payment to the route found using the provided [`RouteParameters`], retrying failed /// payment paths based on the provided `Retry`. /// +/// You should likely prefer [`Self::pay_for_bolt11_invoice`] or [`Self::pay_for_offer`] in +/// general, however this method may allow for slightly more customization. +/// /// May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via /// [`PeerManager::process_events`]). /// @@ -2729,7 +3017,7 @@ pub extern "C" fn ChannelManager_send_payment_with_route(this_arg: &crate::light /// /// [`Event::PaymentSent`]: events::Event::PaymentSent /// [`Event::PaymentFailed`]: events::Event::PaymentFailed -/// [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs +/// [`UpdateHTLCs`]: MessageSendEvent::UpdateHTLCs /// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress #[must_use] @@ -2740,6 +3028,31 @@ pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::c local_ret } +/// Pays a [`Bolt11Invoice`] associated with the `payment_id`. See [`Self::send_payment`] for more info. +/// +/// # Payment Id +/// The invoice's `payment_hash().0` serves as a reliable choice for the `payment_id`. +/// +/// # Handling Invoice Amounts +/// Some invoices include a specific amount, while others require you to specify one. +/// - If the invoice **includes** an amount, user may provide an amount greater or equal to it +/// to allow for overpayments. +/// - If the invoice **doesn't include** an amount, you'll need to specify `amount_msats`. +/// +/// If these conditions aren’t met, the function will return [`Bolt11PaymentError::InvalidAmount`]. +/// +/// # Custom Routing Parameters +/// Users can customize routing parameters via [`RouteParametersConfig`]. +/// To use default settings, call the function with [`RouteParametersConfig::default`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_pay_for_bolt11_invoice(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, invoice: &crate::lightning_invoice::Bolt11Invoice, mut payment_id: crate::c_types::ThirtyTwoBytes, mut amount_msats: crate::c_types::derived::COption_u64Z, mut route_params_config: crate::lightning::routing::router::RouteParametersConfig, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_NoneBolt11PaymentErrorZ { + let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_bolt11_invoice(invoice.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data), local_amount_msats, *unsafe { Box::from_raw(route_params_config.take_inner()) }, retry_strategy.into_native()); + 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::outbound_payment::Bolt11PaymentError::native_into(e) }).into() }; + local_ret +} + /// Pays the [`Bolt12Invoice`] associated with the `payment_id` encoded in its `payer_metadata`. /// /// The invoice's `payer_metadata` is used to authenticate that the invoice was indeed requested @@ -2769,6 +3082,25 @@ pub extern "C" fn ChannelManager_send_payment_for_bolt12_invoice(this_arg: &crat local_ret } +/// Should be called after handling an [`Event::PersistStaticInvoice`], where the `Responder` +/// comes from [`Event::PersistStaticInvoice::invoice_persisted_path`]. +#[no_mangle] +pub extern "C" fn ChannelManager_static_invoice_persisted(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut invoice_persisted_path: crate::lightning::onion_message::messenger::Responder) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.static_invoice_persisted(*unsafe { Box::from_raw(invoice_persisted_path.take_inner()) }) +} + +/// Forwards a [`StaticInvoice`] to a payer in response to an +/// [`Event::StaticInvoiceRequested`]. Also forwards the payer's [`InvoiceRequest`] to the +/// async recipient, in case the recipient is online to provide the payer with a fresh +/// [`Bolt12Invoice`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_respond_to_static_invoice_request(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut invoice: crate::lightning::offers::static_invoice::StaticInvoice, mut responder: crate::lightning::onion_message::messenger::Responder, mut invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, mut invoice_request_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_to_static_invoice_request(*unsafe { Box::from_raw(invoice.take_inner()) }, *unsafe { Box::from_raw(responder.take_inner()) }, *unsafe { Box::from_raw(invoice_request.take_inner()) }, *unsafe { Box::from_raw(invoice_request_path.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + /// 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. @@ -2945,6 +3277,40 @@ pub extern "C" fn ChannelManager_unsafe_manual_funding_transaction_generated(thi local_ret } +/// Call this upon creation of a funding transaction for the given channel. +/// +/// This method executes the same checks as [`ChannelManager::funding_transaction_generated`], +/// but it does not automatically broadcast the funding transaction. +/// +/// Call this in response to a [`Event::FundingGenerationReady`] event, only in a context where you want to manually +/// control the broadcast of the funding transaction. +/// +/// The associated [`ChannelMonitor`] likewise avoids broadcasting holder commitment or CPFP +/// transactions until the funding has been observed on chain. This +/// prevents attempting to broadcast unconfirmable commitment transactions before the channel's +/// funding exists in a block. +/// +/// If HTLCs would otherwise approach timeout while the funding transaction has not yet appeared +/// on chain, the monitor avoids broadcasting force-close transactions in manual-broadcast +/// mode until the funding is seen. It may still close the channel off-chain (emitting a +/// `ChannelClosed` event) to avoid accepting further updates. Ensure your application either +/// broadcasts the funding transaction in a timely manner or avoids forwarding HTLCs that could +/// approach timeout during this interim state. +/// +/// See also [`ChannelMonitor::broadcast_latest_holder_commitment_txn`]. For channels using +/// manual-broadcast, calling that method has no effect until the funding has been observed +/// on-chain. +/// +/// [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated +/// [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_funding_transaction_generated_manual_broadcast(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut temporary_channel_id: crate::lightning::ln::types::ChannelId, 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_manual_broadcast(*unsafe { Box::from_raw(temporary_channel_id.take_inner()) }, 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 @@ -2964,6 +3330,52 @@ pub extern "C" fn ChannelManager_batch_funding_transaction_generated(this_arg: & local_ret } +/// Handles a signed funding transaction generated by interactive transaction construction and +/// provided by the client. Should only be called in response to a [`FundingTransactionReadyForSigning`] +/// event. +/// +/// Do NOT broadcast the funding transaction yourself. When we have safely received our +/// counterparty's signature(s) the funding transaction will automatically be broadcast via the +/// [`BroadcasterInterface`] provided when this `ChannelManager` was constructed. +/// +/// `SIGHASH_ALL` MUST be used for all signatures when providing signatures, otherwise your +/// funds can be held hostage! +/// +/// LDK checks the following: +/// * Each input spends an output that is one of P2WPKH, P2WSH, or P2TR. +/// These were already checked by LDK when the inputs to be contributed were provided. +/// * All signatures use the `SIGHASH_ALL` sighash type. +/// * P2WPKH and P2TR key path spends are valid (verifies signatures) +/// +/// NOTE: +/// * When checking P2WSH spends, LDK tries to decode 70-72 byte witness elements as ECDSA +/// signatures with a sighash flag. If the internal DER-decoding fails, then LDK just +/// assumes it wasn't a signature and carries with checks. If the element can be decoded +/// as an ECDSA signature, the the sighash flag must be `SIGHASH_ALL`. +/// * When checking P2TR script-path spends, LDK assumes all elements of exactly 65 bytes +/// with the last byte matching any valid sighash flag byte are schnorr signatures and checks +/// that the sighash type is `SIGHASH_ALL`. If the last byte is not any valid sighash flag, the +/// element is assumed not to be a signature and is ignored. Elements of 64 bytes are not +/// checked because if they were schnorr signatures then they would implicitly be `SIGHASH_DEFAULT` +/// which is an alias of `SIGHASH_ALL`. +/// +/// Returns [`ChannelUnavailable`] when a channel is not found or an incorrect +/// `counterparty_node_id` is provided. +/// +/// Returns [`APIMisuseError`] when a channel is not in a state where it is expecting funding +/// signatures or if any of the checks described above fail. +/// +/// [`FundingTransactionReadyForSigning`]: events::Event::FundingTransactionReadyForSigning +/// [`ChannelUnavailable`]: APIError::ChannelUnavailable +/// [`APIMisuseError`]: APIError::APIMisuseError +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_funding_transaction_signed(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey, mut transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_transaction_signed(channel_id.get_native_ref(), &counterparty_node_id.into_rust(), 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 +} + /// Atomically applies partial updates to the [`ChannelConfig`] of the given channels. /// /// Once the updates are applied, each eligible channel (advertised with a known short channel @@ -2982,7 +3394,7 @@ pub extern "C" fn ChannelManager_batch_funding_transaction_generated(this_arg: & /// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths /// [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat /// [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta -/// [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate +/// [`BroadcastChannelUpdate`]: MessageSendEvent::BroadcastChannelUpdate /// [`ChannelUpdate`]: msgs::ChannelUpdate /// [`ChannelUnavailable`]: APIError::ChannelUnavailable /// [`APIMisuseError`]: APIError::APIMisuseError @@ -3013,7 +3425,7 @@ pub extern "C" fn ChannelManager_update_partial_channel_config(this_arg: &crate: /// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths /// [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat /// [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta -/// [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate +/// [`BroadcastChannelUpdate`]: MessageSendEvent::BroadcastChannelUpdate /// [`ChannelUpdate`]: msgs::ChannelUpdate /// [`ChannelUnavailable`]: APIError::ChannelUnavailable /// [`APIMisuseError`]: APIError::APIMisuseError @@ -3072,10 +3484,21 @@ pub extern "C" fn ChannelManager_fail_intercepted_htlc(this_arg: &crate::lightni local_ret } +/// Returns whether we have pending HTLC forwards that need to be processed via +/// [`Self::process_pending_htlc_forwards`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_needs_pending_htlc_processing(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.needs_pending_htlc_processing(); + ret +} + /// Processes HTLCs which are pending waiting on random forward delay. /// -/// Should only really ever be called in response to a PendingHTLCsForwardable event. -/// Will likely generate further events. +/// Will be regularly called by LDK's background processor. +/// +/// Users implementing their own background processing logic should call this in irregular, +/// randomly-distributed intervals. #[no_mangle] pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_pending_htlc_forwards() @@ -3205,10 +3628,13 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &crate::lightning::ln /// /// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id +/// +/// Note that config_overrides (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: &crate::lightning::ln::types::ChannelId, 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(temporary_channel_id.get_native_ref(), &counterparty_node_id.into_rust(), user_channel_id.into()); +pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128, mut config_overrides: crate::lightning::util::config::ChannelConfigOverrides) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut local_config_overrides = if config_overrides.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(config_overrides.take_inner()) } }) }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(temporary_channel_id.get_native_ref(), &counterparty_node_id.into_rust(), user_channel_id.into(), local_config_overrides); 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 } @@ -3231,10 +3657,13 @@ pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightn /// /// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id +/// +/// Note that config_overrides (or a relevant inner pointer) may be NULL or all-0s to represent None #[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: &crate::lightning::ln::types::ChannelId, 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(temporary_channel_id.get_native_ref(), &counterparty_node_id.into_rust(), user_channel_id.into()); +pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128, mut config_overrides: crate::lightning::util::config::ChannelConfigOverrides) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut local_config_overrides = if config_overrides.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(config_overrides.take_inner()) } }) }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(temporary_channel_id.get_native_ref(), &counterparty_node_id.into_rust(), user_channel_id.into(), local_config_overrides); 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 } @@ -3329,7 +3758,7 @@ impl Bolt11InvoiceParameters { /// The amount for the invoice, if any. #[no_mangle] pub extern "C" fn Bolt11InvoiceParameters_get_amount_msats(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msats; + let mut inner_val = &mut Bolt11InvoiceParameters::get_native_mut_ref(this_ptr).amount_msats; 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 } @@ -3342,7 +3771,7 @@ pub extern "C" fn Bolt11InvoiceParameters_set_amount_msats(this_ptr: &mut Bolt11 /// The description for what the invoice is for, or hash of such description. #[no_mangle] pub extern "C" fn Bolt11InvoiceParameters_get_description(this_ptr: &Bolt11InvoiceParameters) -> crate::lightning_invoice::Bolt11InvoiceDescription { - let mut inner_val = &mut this_ptr.get_native_mut_ref().description; + let mut inner_val = &mut Bolt11InvoiceParameters::get_native_mut_ref(this_ptr).description; crate::lightning_invoice::Bolt11InvoiceDescription::from_native(inner_val) } /// The description for what the invoice is for, or hash of such description. @@ -3358,7 +3787,7 @@ pub extern "C" fn Bolt11InvoiceParameters_set_description(this_ptr: &mut Bolt11I /// enough expiry to account for the average block time. #[no_mangle] pub extern "C" fn Bolt11InvoiceParameters_get_invoice_expiry_delta_secs(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().invoice_expiry_delta_secs; + let mut inner_val = &mut Bolt11InvoiceParameters::get_native_mut_ref(this_ptr).invoice_expiry_delta_secs; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -3380,7 +3809,7 @@ pub extern "C" fn Bolt11InvoiceParameters_set_invoice_expiry_delta_secs(this_ptr /// added as well to allow for up to a few new block confirmations during routing. #[no_mangle] pub extern "C" fn Bolt11InvoiceParameters_get_min_final_cltv_expiry_delta(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u16Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_final_cltv_expiry_delta; + let mut inner_val = &mut Bolt11InvoiceParameters::get_native_mut_ref(this_ptr).min_final_cltv_expiry_delta; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -3402,7 +3831,7 @@ pub extern "C" fn Bolt11InvoiceParameters_set_min_final_cltv_expiry_delta(this_p /// lightning. #[no_mangle] pub extern "C" fn Bolt11InvoiceParameters_get_payment_hash(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut Bolt11InvoiceParameters::get_native_mut_ref(this_ptr).payment_hash; 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 } @@ -3445,29 +3874,46 @@ pub extern "C" fn Bolt11InvoiceParameters_default() -> Bolt11InvoiceParameters { /// /// # Privacy /// -/// Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the offer based on the given -/// `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for -/// privacy implications as well as those of the parameterized [`Router`], which implements -/// [`MessageRouter`]. +/// Uses [`MessageRouter`] provided at construction to construct a [`BlindedMessagePath`] for +/// the offer. See the documentation of the selected [`MessageRouter`] for details on how it +/// selects blinded paths including privacy implications and reliability tradeoffs. /// /// Also, uses a derived signing pubkey in the offer for recipient privacy. /// /// # Limitations /// -/// Requires a direct connection to the introduction node in the responding [`InvoiceRequest`]'s -/// reply path. +/// See [`OffersMessageFlow::create_offer_builder`] for limitations on the offer builder. /// /// # Errors /// -/// Errors if the parameterized [`Router`] is unable to create a blinded path for the offer. +/// Errors if the parameterized [`MessageRouter`] is unable to create a blinded path for the offer. +/// +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath +/// [`Offer`]: crate::offers::offer::Offer +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_create_offer_builder(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_offer_builder(); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Same as [`Self::create_offer_builder`], but allows specifying a custom [`MessageRouter`] +/// instead of using the [`MessageRouter`] provided to the [`ChannelManager`] at construction. +/// +/// This gives users full control over how the [`BlindedMessagePath`] is constructed, +/// including the option to omit it entirely. /// +/// See [`Self::create_offer_builder`] for more details on usage. +/// +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath /// [`Offer`]: crate::offers::offer::Offer /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_offer_builder(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut absolute_expiry: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { - let mut local_absolute_expiry = { /*absolute_expiry*/ let absolute_expiry_opt = absolute_expiry; if absolute_expiry_opt.is_none() { None } else { Some({ { core::time::Duration::from_secs({ absolute_expiry_opt.take() }) }})} }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_offer_builder(local_absolute_expiry); +pub extern "C" fn ChannelManager_create_offer_builder_using_router(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut router: crate::lightning::onion_message::messenger::MessageRouter) -> crate::c_types::derived::CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_offer_builder_using_router(router); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::offer::OfferWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -3494,18 +3940,12 @@ pub extern "C" fn ChannelManager_create_offer_builder(this_arg: &crate::lightnin /// /// # Privacy /// -/// Uses [`MessageRouter`] to construct a [`BlindedMessagePath`] for the refund based on the given -/// `absolute_expiry` according to [`MAX_SHORT_LIVED_RELATIVE_EXPIRY`]. See those docs for -/// privacy implications as well as those of the parameterized [`Router`], which implements -/// [`MessageRouter`]. +/// Uses [`MessageRouter`] provided at construction to construct a [`BlindedMessagePath`] for +/// the refund. See the documentation of the selected [`MessageRouter`] for details on how it +/// selects blinded paths including privacy implications and reliability tradeoffs. /// /// Also, uses a derived payer id in the refund for payer privacy. /// -/// # Limitations -/// -/// Requires a direct connection to an introduction node in the responding -/// [`Bolt12Invoice::payment_paths`]. -/// /// # Errors /// /// Errors if: @@ -3516,30 +3956,82 @@ pub extern "C" fn ChannelManager_create_offer_builder(this_arg: &crate::lightnin /// [`Refund`]: crate::offers::refund::Refund /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_refund_builder(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut amount_msats: u64, mut absolute_expiry: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { - let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_refund_builder(amount_msats, core::time::Duration::from_secs(absolute_expiry), ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat); +pub extern "C" fn ChannelManager_create_refund_builder(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut amount_msats: u64, mut absolute_expiry: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut route_params_config: crate::lightning::routing::router::RouteParametersConfig) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_refund_builder(amount_msats, core::time::Duration::from_secs(absolute_expiry), ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), *unsafe { Box::from_raw(route_params_config.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Same as [`Self::create_refund_builder`], but allows specifying a custom [`MessageRouter`] +/// instead of using the one provided during [`ChannelManager`] construction for +/// [`BlindedMessagePath`] creation. +/// +/// This gives users full control over how the [`BlindedMessagePath`] is constructed for the +/// refund, including the option to omit it entirely. This is useful for testing or when +/// alternative privacy strategies are needed. +/// +/// See [`Self::create_refund_builder`] for more details on usage. +/// +/// # Errors +/// +/// In addition to the errors in [`Self::create_refund_builder`], this returns an error if +/// the provided [`MessageRouter`] fails to construct a valid [`BlindedMessagePath`] for the refund. +/// +/// [`Refund`]: crate::offers::refund::Refund +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_create_refund_builder_using_router(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut router: crate::lightning::onion_message::messenger::MessageRouter, mut amount_msats: u64, mut absolute_expiry: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut route_params_config: crate::lightning::routing::router::RouteParametersConfig) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_refund_builder_using_router(router, amount_msats, core::time::Duration::from_secs(absolute_expiry), ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), *unsafe { Box::from_raw(route_params_config.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } +/// Retrieve an [`Offer`] for receiving async payments as an often-offline recipient. Will only +/// return an offer if [`Self::set_paths_to_static_invoice_server`] was called and we succeeded in +/// interactively building a [`StaticInvoice`] with the static invoice server. +/// +/// Useful for posting offers to receive payments later, such as posting an offer on a website. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_get_async_receive_offer(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::c_types::derived::CResult_OfferNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_async_receive_offer(); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::offer::Offer { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build +/// [`Offer`]s with a static invoice server, so the server can serve [`StaticInvoice`]s to payers +/// on our behalf when we're offline. +/// +/// This method only needs to be called once when the server first takes on the recipient as a +/// client, or when the paths change, e.g. if the paths are set to expire at a particular time. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_set_paths_to_static_invoice_server(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut paths_to_static_invoice_server: crate::c_types::derived::CVec_BlindedMessagePathZ) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut local_paths_to_static_invoice_server = Vec::new(); for mut item in paths_to_static_invoice_server.into_rust().drain(..) { local_paths_to_static_invoice_server.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.set_paths_to_static_invoice_server(local_paths_to_static_invoice_server); + 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 +} + /// Pays for an [`Offer`] using the given parameters by creating an [`InvoiceRequest`] and /// enqueuing it to be sent via an onion message. [`ChannelManager`] will pay the actual /// [`Bolt12Invoice`] once it is received. /// /// Uses [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is recognized by /// the [`ChannelManager`] when handling a [`Bolt12Invoice`] message in response to the request. -/// The optional parameters are used in the builder, if `Some`: -/// - `quantity` for [`InvoiceRequest::quantity`] which must be set if -/// [`Offer::expects_quantity`] is `true`. -/// - `amount_msats` if overpaying what is required for the given `quantity` is desired, and -/// - `payer_note` for [`InvoiceRequest::payer_note`]. /// -/// If `max_total_routing_fee_msat` is not specified, The default from -/// [`RouteParameters::from_payment_params_and_value`] is applied. +/// `amount_msats` allows you to overpay what is required to satisfy the offer, or may be +/// required if the offer does not require a specific amount. +/// +/// If the [`Offer`] was built from a human readable name resolved using BIP 353, you *must* +/// instead call [`Self::pay_for_offer_from_hrn`]. /// /// # Payment /// @@ -3554,14 +4046,16 @@ pub extern "C" fn ChannelManager_create_refund_builder(this_arg: &crate::lightni /// # Privacy /// /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] -/// to construct a [`BlindedMessagePath`] for the reply path. For further privacy implications, see the -/// docs of the parameterized [`Router`], which implements [`MessageRouter`]. +/// to construct a [`BlindedMessagePath`] for the reply path. /// -/// # Limitations +/// # Note /// -/// Requires a direct connection to an introduction node in [`Offer::paths`] or to -/// [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to the responding -/// [`Bolt12Invoice::payment_paths`]. +/// If the offer resolves to an async payment, and the HTLC is neither claimed nor failed by +/// our next-hop peer, we will not force-close the channel to resolve the payment for 4 +/// weeks. This avoids an issue for often-offline nodes where channels are force-closed on +/// startup during chain sync prior to connecting to peers. If you want to resolve such a +/// timed-out payment more urgently, you can manually force-close the channel which will, +/// after some transaction confirmation(s), result in an [`Event::PaymentFailed`]. /// /// # Errors /// @@ -3573,20 +4067,50 @@ pub extern "C" fn ChannelManager_create_refund_builder(this_arg: &crate::lightni /// request. /// /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest -/// [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity -/// [`InvoiceRequest::payer_note`]: crate::offers::invoice_request::InvoiceRequest::payer_note /// [`InvoiceRequestBuilder`]: crate::offers::invoice_request::InvoiceRequestBuilder /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath /// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::Offer, mut quantity: crate::c_types::derived::COption_u64Z, mut amount_msats: crate::c_types::derived::COption_u64Z, mut payer_note: crate::c_types::derived::COption_StrZ, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { - let mut local_quantity = if quantity.is_some() { Some( { quantity.take() }) } else { None }; +pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::Offer, mut amount_msats: crate::c_types::derived::COption_u64Z, mut payment_id: crate::c_types::ThirtyTwoBytes, mut optional_params: crate::lightning::ln::channelmanager::OptionalOfferPaymentParams) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None }; - let mut local_payer_note = { /*payer_note*/ let payer_note_opt = payer_note; if payer_note_opt.is_none() { None } else { Some({ { { payer_note_opt.take() }.into_string() }})} }; - let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer(offer.get_native_ref(), local_quantity, local_amount_msats, local_payer_note, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer(offer.get_native_ref(), local_amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(optional_params.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Pays for an [`Offer`] which was built by resolving a human readable name. It is otherwise +/// identical to [`Self::pay_for_offer`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_pay_for_offer_from_hrn(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::OfferFromHrn, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut optional_params: crate::lightning::ln::channelmanager::OptionalOfferPaymentParams) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer_from_hrn(offer.get_native_ref(), amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(optional_params.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Pays for an [`Offer`] using the given parameters, including a `quantity`, by creating an +/// [`InvoiceRequest`] and enqueuing it to be sent via an onion message. [`ChannelManager`] will +/// pay the actual [`Bolt12Invoice`] once it is received. +/// +/// This method is identical to [`Self::pay_for_offer`] with the one exception that it allows +/// you to specify the [`InvoiceRequest::quantity`]. We expect this to be rather seldomly used, +/// as the \"quantity\" feature of offers doesn't line up with common payment flows today. +/// +/// This method is otherwise identical to [`Self::pay_for_offer`] but will additionally fail if +/// the provided `quantity` does not meet the requirements described by +/// [`Offer::supported_quantity`]. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +/// [`InvoiceRequest::quantity`]: crate::offers::invoice_request::InvoiceRequest::quantity +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_pay_for_offer_with_quantity(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, offer: &crate::lightning::offers::offer::Offer, mut amount_msats: crate::c_types::derived::COption_u64Z, mut payment_id: crate::c_types::ThirtyTwoBytes, mut optional_params: crate::lightning::ln::channelmanager::OptionalOfferPaymentParams, mut quantity: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer_with_quantity(offer.get_native_ref(), local_amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(optional_params.take_inner()) }, quantity); 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -3612,6 +4136,7 @@ pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln:: /// - the parameterized [`Router`] is unable to create a blinded payment path or reply path for /// the invoice. /// +/// [`BlindedPaymentPath`]: crate::blinded_path::payment::BlindedPaymentPath /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice #[must_use] #[no_mangle] @@ -3622,15 +4147,12 @@ pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightn } /// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS -/// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32. +/// resolver(s) at `dns_resolvers` which resolve names according to [bLIP 32]. /// -/// If the wallet supports paying on-chain schemes, you should instead use -/// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by -/// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to -/// your normal URI handling. -/// -/// If `max_total_routing_fee_msat` is not specified, the default from -/// [`RouteParameters::from_payment_params_and_value`] is applied. +/// Because most wallets support on-chain or other payment schemes beyond only offers, this is +/// deprecated in favor of the [`bitcoin-payment-instructions`] crate, which can be used to +/// build an [`OfferFromHrn`] and call [`Self::pay_for_offer_from_hrn`]. Thus, this method is +/// deprecated. /// /// # Payment /// @@ -3640,33 +4162,32 @@ pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightn /// /// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the /// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the -/// payment will fail with an [`Event::InvoiceRequestFailed`]. +/// payment will fail with an [`PaymentFailureReason::UserAbandoned`] or +/// [`PaymentFailureReason::InvoiceRequestExpired`], respectively. /// /// # Privacy /// /// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] -/// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the -/// docs of the parameterized [`Router`], which implements [`MessageRouter`]. -/// -/// # Limitations -/// -/// Requires a direct connection to the given [`Destination`] as well as an introduction node in -/// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to -/// the responding [`Bolt12Invoice::payment_paths`]. +/// to construct a [`BlindedMessagePath`] for the reply path. /// /// # Errors /// -/// Errors if: -/// - a duplicate `payment_id` is provided given the caveats in the aforementioned link, +/// Errors if a duplicate `payment_id` is provided given the caveats in the aforementioned link. /// -/// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths +/// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki +/// [bLIP 32]: https://github.com/lightning/blips/blob/master/blip-0032.md +/// [`OMNameResolver::resolve_name`]: crate::onion_message::dns_resolution::OMNameResolver::resolve_name +/// [`OMNameResolver::handle_dnssec_proof_for_uri`]: crate::onion_message::dns_resolution::OMNameResolver::handle_dnssec_proof_for_uri +/// [`bitcoin-payment-instructions`]: https://docs.rs/bitcoin-payment-instructions/ /// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath +/// [`PaymentFailureReason::UserAbandoned`]: crate::events::PaymentFailureReason::UserAbandoned +/// [`PaymentFailureReason::InvoiceRequestRejected`]: crate::events::PaymentFailureReason::InvoiceRequestRejected #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_pay_for_offer_from_human_readable_name(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut name: crate::lightning::onion_message::dns_resolution::HumanReadableName, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z, mut dns_resolvers: crate::c_types::derived::CVec_DestinationZ) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None }; +pub extern "C" fn ChannelManager_pay_for_offer_from_human_readable_name(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut name: crate::lightning::onion_message::dns_resolution::HumanReadableName, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut optional_params: crate::lightning::ln::channelmanager::OptionalOfferPaymentParams, mut dns_resolvers: crate::c_types::derived::CVec_DestinationZ) -> crate::c_types::derived::CResult_NoneNoneZ { let mut local_dns_resolvers = Vec::new(); for mut item in dns_resolvers.into_rust().drain(..) { local_dns_resolvers.push( { item.into_native() }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer_from_human_readable_name(*unsafe { Box::from_raw(name.take_inner()) }, amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat, local_dns_resolvers); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer_from_human_readable_name(*unsafe { Box::from_raw(name.take_inner()) }, amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(optional_params.take_inner()) }, local_dns_resolvers); 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 } @@ -3779,6 +4300,36 @@ pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &crate::lightnin local_ret } +/// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively +/// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments. +/// +/// ## Usage +/// 1. Static invoice server calls [`Self::blinded_paths_for_async_recipient`] +/// 2. Static invoice server communicates the resulting paths out-of-band to the async recipient, +/// who calls [`Self::set_paths_to_static_invoice_server`] to configure themselves with these +/// paths +/// 3. Async recipient automatically sends [`OfferPathsRequest`]s over the configured paths, and +/// uses the resulting paths from the server's [`OfferPaths`] response to build their async +/// receive offer +/// +/// If `relative_expiry` is unset, the [`BlindedMessagePath`]s will never expire. +/// +/// Returns the paths that the recipient should be configured with via +/// [`Self::set_paths_to_static_invoice_server`]. +/// +/// The provided `recipient_id` must uniquely identify the recipient, and will be surfaced later +/// when the recipient provides us with a static invoice to persist and serve to payers on their +/// behalf. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_blinded_paths_for_async_recipient(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut recipient_id: crate::c_types::derived::CVec_u8Z, mut relative_expiry: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + let mut local_relative_expiry = { /*relative_expiry*/ let relative_expiry_opt = relative_expiry; if relative_expiry_opt.is_none() { None } else { Some({ { core::time::Duration::from_secs({ relative_expiry_opt.take() }) }})} }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.blinded_paths_for_async_recipient(local_recipient_id, local_relative_expiry); + 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::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + /// Gets a fake short channel id for use in receiving [phantom node payments]. These fake scids /// are used when constructing the phantom invoice's route hints. /// @@ -3822,33 +4373,56 @@ pub extern "C" fn ChannelManager_compute_inflight_htlcs(this_arg: &crate::lightn crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } } -impl From for crate::lightning::events::MessageSendEventsProvider { +impl From for crate::lightning::ln::msgs::BaseMessageHandler { fn from(obj: nativeChannelManager) -> Self { let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = ChannelManager_as_MessageSendEventsProvider(&rust_obj); + let mut ret = ChannelManager_as_BaseMessageHandler(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); ret.free = Some(ChannelManager_free_void); ret } } -/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is #[no_mangle] -pub extern "C" fn ChannelManager_as_MessageSendEventsProvider(this_arg: &ChannelManager) -> crate::lightning::events::MessageSendEventsProvider { - crate::lightning::events::MessageSendEventsProvider { +pub extern "C" fn ChannelManager_as_BaseMessageHandler(this_arg: &ChannelManager) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: ChannelManager_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: ChannelManager_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ChannelManager_BaseMessageHandler_peer_disconnected, + provided_node_features: ChannelManager_BaseMessageHandler_provided_node_features, + provided_init_features: ChannelManager_BaseMessageHandler_provided_init_features, + peer_connected: ChannelManager_BaseMessageHandler_peer_connected, } } #[must_use] -extern "C" fn ChannelManager_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { - let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::events::MessageSendEvent::native_into(item) }); }; +extern "C" fn ChannelManager_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; local_ret.into() } +extern "C" fn ChannelManager_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn ChannelManager_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ChannelManager_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ChannelManager_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} impl From for crate::lightning::events::EventsProvider { fn from(obj: nativeChannelManager) -> Self { @@ -3894,7 +4468,7 @@ pub extern "C" fn ChannelManager_as_Listen(this_arg: &ChannelManager) -> crate:: free: None, filtered_block_connected: ChannelManager_Listen_filtered_block_connected, block_connected: ChannelManager_Listen_block_connected, - block_disconnected: ChannelManager_Listen_block_disconnected, + blocks_disconnected: ChannelManager_Listen_blocks_disconnected, } } @@ -3905,8 +4479,8 @@ extern "C" fn ChannelManager_Listen_filtered_block_connected(this_arg: *const c_ extern "C" fn ChannelManager_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) { ::block_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height) } -extern "C" fn ChannelManager_Listen_block_disconnected(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) { - ::block_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) +extern "C" fn ChannelManager_Listen_blocks_disconnected(this_arg: *const c_void, mut fork_point_block: crate::lightning::chain::BestBlock) { + ::blocks_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(fork_point_block.take_inner()) }) } impl From for crate::lightning::chain::Confirm { @@ -4045,9 +4619,14 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelMana handle_funding_created: ChannelManager_ChannelMessageHandler_handle_funding_created, handle_funding_signed: ChannelManager_ChannelMessageHandler_handle_funding_signed, handle_channel_ready: ChannelManager_ChannelMessageHandler_handle_channel_ready, + handle_peer_storage: ChannelManager_ChannelMessageHandler_handle_peer_storage, + handle_peer_storage_retrieval: ChannelManager_ChannelMessageHandler_handle_peer_storage_retrieval, handle_shutdown: ChannelManager_ChannelMessageHandler_handle_shutdown, handle_closing_signed: ChannelManager_ChannelMessageHandler_handle_closing_signed, handle_stfu: ChannelManager_ChannelMessageHandler_handle_stfu, + handle_splice_init: ChannelManager_ChannelMessageHandler_handle_splice_init, + handle_splice_ack: ChannelManager_ChannelMessageHandler_handle_splice_ack, + handle_splice_locked: ChannelManager_ChannelMessageHandler_handle_splice_locked, handle_tx_add_input: ChannelManager_ChannelMessageHandler_handle_tx_add_input, handle_tx_add_output: ChannelManager_ChannelMessageHandler_handle_tx_add_output, handle_tx_remove_input: ChannelManager_ChannelMessageHandler_handle_tx_remove_input, @@ -4062,22 +4641,23 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelMana handle_update_fail_htlc: ChannelManager_ChannelMessageHandler_handle_update_fail_htlc, handle_update_fail_malformed_htlc: ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_htlc, handle_commitment_signed: ChannelManager_ChannelMessageHandler_handle_commitment_signed, + handle_commitment_signed_batch: ChannelManager_ChannelMessageHandler_handle_commitment_signed_batch, handle_revoke_and_ack: ChannelManager_ChannelMessageHandler_handle_revoke_and_ack, handle_update_fee: ChannelManager_ChannelMessageHandler_handle_update_fee, handle_announcement_signatures: ChannelManager_ChannelMessageHandler_handle_announcement_signatures, - peer_disconnected: ChannelManager_ChannelMessageHandler_peer_disconnected, - peer_connected: ChannelManager_ChannelMessageHandler_peer_connected, handle_channel_reestablish: ChannelManager_ChannelMessageHandler_handle_channel_reestablish, handle_channel_update: ChannelManager_ChannelMessageHandler_handle_channel_update, handle_error: ChannelManager_ChannelMessageHandler_handle_error, - provided_node_features: ChannelManager_ChannelMessageHandler_provided_node_features, - provided_init_features: ChannelManager_ChannelMessageHandler_provided_init_features, get_chain_hashes: ChannelManager_ChannelMessageHandler_get_chain_hashes, message_received: ChannelManager_ChannelMessageHandler_message_received, - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: ChannelManager_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: ChannelManager_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ChannelManager_BaseMessageHandler_peer_disconnected, + provided_node_features: ChannelManager_BaseMessageHandler_provided_node_features, + provided_init_features: ChannelManager_BaseMessageHandler_provided_init_features, + peer_connected: ChannelManager_BaseMessageHandler_peer_connected, }, } } @@ -4103,6 +4683,12 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_ar extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) { ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ChannelManager_ChannelMessageHandler_handle_peer_storage(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::PeerStorage) { + ::handle_peer_storage(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) +} +extern "C" fn ChannelManager_ChannelMessageHandler_handle_peer_storage_retrieval(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::PeerStorageRetrieval) { + ::handle_peer_storage_retrieval(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) +} extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Shutdown) { ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -4112,6 +4698,15 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_closing_signed(this_ar extern "C" fn ChannelManager_ChannelMessageHandler_handle_stfu(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu) { ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ChannelManager_ChannelMessageHandler_handle_splice_init(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceInit) { + ::handle_splice_init(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ChannelManager_ChannelMessageHandler_handle_splice_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceAck) { + ::handle_splice_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ChannelManager_ChannelMessageHandler_handle_splice_locked(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceLocked) { + ::handle_splice_locked(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) +} extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_add_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput) { ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -4142,8 +4737,8 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_abort(this_arg: *co extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC) { ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } -extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC) { - ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) +extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::UpdateFulfillHTLC) { + ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC) { ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) @@ -4154,6 +4749,10 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_ extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned) { ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed_batch(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut channel_id: crate::lightning::ln::types::ChannelId, mut batch: crate::c_types::derived::CVec_CommitmentSignedZ) { + let mut local_batch = Vec::new(); for mut item in batch.into_rust().drain(..) { local_batch.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + ::handle_commitment_signed_batch(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), *unsafe { Box::from_raw(channel_id.take_inner()) }, local_batch) +} extern "C" fn ChannelManager_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK) { ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -4163,15 +4762,6 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fee(this_arg: * extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) { ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } -extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()) -} -#[must_use] -extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); - 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 -} extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) { ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -4182,16 +4772,6 @@ extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const ::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } #[must_use] -extern "C" fn ChannelManager_ChannelMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn ChannelManager_ChannelMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] extern "C" fn ChannelManager_ChannelMessageHandler_get_chain_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { let mut ret = ::get_chain_hashes(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); 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.as_ref() } }); }; local_ret_0.into() }) }; @@ -4255,6 +4835,10 @@ pub extern "C" fn ChannelManager_as_AsyncPaymentsMessageHandler(this_arg: &Chann crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, + handle_offer_paths_request: ChannelManager_AsyncPaymentsMessageHandler_handle_offer_paths_request, + handle_offer_paths: ChannelManager_AsyncPaymentsMessageHandler_handle_offer_paths, + handle_serve_static_invoice: ChannelManager_AsyncPaymentsMessageHandler_handle_serve_static_invoice, + handle_static_invoice_persisted: ChannelManager_AsyncPaymentsMessageHandler_handle_static_invoice_persisted, handle_held_htlc_available: ChannelManager_AsyncPaymentsMessageHandler_handle_held_htlc_available, handle_release_held_htlc: ChannelManager_AsyncPaymentsMessageHandler_handle_release_held_htlc, release_pending_messages: ChannelManager_AsyncPaymentsMessageHandler_release_pending_messages, @@ -4262,9 +4846,30 @@ pub extern "C" fn ChannelManager_as_AsyncPaymentsMessageHandler(this_arg: &Chann } #[must_use] -extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_offer_paths_request(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::OfferPathsRequest, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_offer_paths_request(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +#[must_use] +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_offer_paths(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::OfferPaths, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; - let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut ret = ::handle_offer_paths(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_serve_static_invoice(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ServeStaticInvoice, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + ::handle_serve_static_invoice(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder) +} +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_static_invoice_persisted(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::StaticInvoicePersisted, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) { + ::handle_static_invoice_persisted(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native()) +} +#[must_use] +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; local_ret } @@ -4471,9 +5076,13 @@ pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImpor /// This is important if you have replayed a nontrivial number of blocks in step (4), allowing /// you to avoid having to replay the same blocks if you shut down quickly after startup. It is /// otherwise not required. +/// /// Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you /// will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in /// the next step. +/// +/// If you wish to avoid this for performance reasons, use +/// [`ChainMonitor::load_existing_monitor`]. /// 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a /// [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`]. /// @@ -4488,6 +5097,7 @@ pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImpor /// which you've already broadcasted the transaction. /// /// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor +/// [`ChainMonitor::load_existing_monitor`]: crate::chain::chainmonitor::ChainMonitor::load_existing_monitor #[must_use] #[repr(C)] pub struct ChannelManagerReadArgs { @@ -4546,7 +5156,7 @@ impl ChannelManagerReadArgs { /// A cryptographically secure source of entropy. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_entropy_source(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::sign::EntropySource { - let mut inner_val = &mut this_ptr.get_native_mut_ref().entropy_source; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).entropy_source; inner_val } /// A cryptographically secure source of entropy. @@ -4557,7 +5167,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_entropy_source(this_ptr: &mut Chann /// A signer that is able to perform node-scoped cryptographic operations. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_node_signer(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::sign::NodeSigner { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_signer; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).node_signer; inner_val } /// A signer that is able to perform node-scoped cryptographic operations. @@ -4566,16 +5176,16 @@ pub extern "C" fn ChannelManagerReadArgs_set_node_signer(this_ptr: &mut ChannelM unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_signer = val; } /// The keys provider which will give us relevant keys. Some keys will be loaded during -/// deserialization and KeysInterface::read_chan_signer will be used to read per-Channel -/// signing data. +/// deserialization and [`SignerProvider::derive_channel_signer`] will be used to derive +/// per-Channel signing data. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_signer_provider(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::sign::SignerProvider { - let mut inner_val = &mut this_ptr.get_native_mut_ref().signer_provider; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).signer_provider; inner_val } /// The keys provider which will give us relevant keys. Some keys will be loaded during -/// deserialization and KeysInterface::read_chan_signer will be used to read per-Channel -/// signing data. +/// deserialization and [`SignerProvider::derive_channel_signer`] will be used to derive +/// per-Channel signing data. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_set_signer_provider(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::sign::SignerProvider) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signer_provider = val; @@ -4585,7 +5195,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_signer_provider(this_ptr: &mut Chan /// No calls to the FeeEstimator will be made during deserialization. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_fee_estimator(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::FeeEstimator { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_estimator; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).fee_estimator; inner_val } /// The fee_estimator for use in the ChannelManager in the future. @@ -4602,7 +5212,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_fee_estimator(this_ptr: &mut Channe /// chain::Watch after deserializing this ChannelManager. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_chain_monitor(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::Watch { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_monitor; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).chain_monitor; inner_val } /// The chain::Watch for use in the ChannelManager in the future. @@ -4619,7 +5229,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_chain_monitor(this_ptr: &mut Channe /// force-closed during deserialization. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_tx_broadcaster(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::chain::chaininterface::BroadcasterInterface { - let mut inner_val = &mut this_ptr.get_native_mut_ref().tx_broadcaster; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).tx_broadcaster; inner_val } /// The BroadcasterInterface which will be used in the ChannelManager in the future and may be @@ -4635,7 +5245,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_tx_broadcaster(this_ptr: &mut Chann /// No calls to the router will be made during deserialization. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_router(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::routing::router::Router { - let mut inner_val = &mut this_ptr.get_native_mut_ref().router; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).router; inner_val } /// The router which will be used in the ChannelManager in the future for finding routes @@ -4648,13 +5258,17 @@ pub extern "C" fn ChannelManagerReadArgs_set_router(this_ptr: &mut ChannelManage } /// The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, /// [`Refund`]s, and any reply paths. +/// +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_message_router(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::onion_message::messenger::MessageRouter { - let mut inner_val = &mut this_ptr.get_native_mut_ref().message_router; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).message_router; inner_val } /// The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, /// [`Refund`]s, and any reply paths. +/// +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_set_message_router(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::onion_message::messenger::MessageRouter) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message_router = val; @@ -4663,7 +5277,7 @@ pub extern "C" fn ChannelManagerReadArgs_set_message_router(this_ptr: &mut Chann /// deserialization. #[no_mangle] pub extern "C" fn ChannelManagerReadArgs_get_logger(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::util::logger::Logger { - let mut inner_val = &mut this_ptr.get_native_mut_ref().logger; + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).logger; inner_val } /// The Logger for use in the ChannelManager and which may be used to log information during @@ -4675,24 +5289,24 @@ pub extern "C" fn ChannelManagerReadArgs_set_logger(this_ptr: &mut ChannelManage /// Default settings used for new channels. Any existing channels will continue to use the /// runtime settings which were stored when the ChannelManager was serialized. #[no_mangle] -pub extern "C" fn ChannelManagerReadArgs_get_default_config(this_ptr: &ChannelManagerReadArgs) -> crate::lightning::util::config::UserConfig { - let mut inner_val = &mut this_ptr.get_native_mut_ref().default_config; +pub extern "C" fn ChannelManagerReadArgs_get_config(this_ptr: &ChannelManagerReadArgs) -> crate::lightning::util::config::UserConfig { + let mut inner_val = &mut ChannelManagerReadArgs::get_native_mut_ref(this_ptr).config; crate::lightning::util::config::UserConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::UserConfig<>) as *mut _) }, is_owned: false } } /// Default settings used for new channels. Any existing channels will continue to use the /// runtime settings which were stored when the ChannelManager was serialized. #[no_mangle] -pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::util::config::UserConfig) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.default_config = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn ChannelManagerReadArgs_set_config(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::util::config::UserConfig) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.config = *unsafe { Box::from_raw(val.take_inner()) }; } /// Simple utility function to create a ChannelManagerReadArgs which creates the monitor /// HashMap for you. This is primarily useful for C bindings where it is not practical to /// populate a HashMap directly from C. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut logger: crate::lightning::util::logger::Logger, mut default_config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> crate::lightning::ln::channelmanager::ChannelManagerReadArgs { +pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut logger: crate::lightning::util::logger::Logger, mut config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> crate::lightning::ln::channelmanager::ChannelManagerReadArgs { let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { item.get_native_ref() }); }; - let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, *unsafe { Box::from_raw(default_config.take_inner()) }, local_channel_monitors); + let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, *unsafe { Box::from_raw(config.take_inner()) }, local_channel_monitors); crate::lightning::ln::channelmanager::ChannelManagerReadArgs { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning/ln/funding.rs b/lightning-c-bindings/src/lightning/ln/funding.rs new file mode 100644 index 00000000..aed28714 --- /dev/null +++ b/lightning-c-bindings/src/lightning/ln/funding.rs @@ -0,0 +1,388 @@ +// 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. + +//! Types pertaining to funding channels. + +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}; + +/// The components of a splice's funding transaction that are contributed by one party. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum SpliceContribution { + /// When funds are added to a channel. + SpliceIn { + /// The amount to contribute to the splice. + value: u64, + /// The inputs included in the splice's funding transaction to meet the contributed amount + /// plus fees. Any excess amount will be sent to a change output. + inputs: crate::c_types::derived::CVec_FundingTxInputZ, + /// An optional change output script. This will be used if needed or, when not set, + /// generated using [`SignerProvider::get_destination_script`]. + /// + /// [`SignerProvider::get_destination_script`]: crate::sign::SignerProvider::get_destination_script + change_script: crate::c_types::derived::COption_CVec_u8ZZ, + }, + /// When funds are removed from a channel. + SpliceOut { + /// The outputs to include in the splice's funding transaction. The total value of all + /// outputs plus fees will be the amount that is removed. + outputs: crate::c_types::derived::CVec_TxOutZ, + }, +} +use lightning::ln::funding::SpliceContribution as SpliceContributionImport; +pub(crate) type nativeSpliceContribution = SpliceContributionImport; + +impl SpliceContribution { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeSpliceContribution { + match self { + SpliceContribution::SpliceIn {ref value, ref inputs, ref change_script, } => { + let mut value_nonref = Clone::clone(value); + let mut inputs_nonref = Clone::clone(inputs); + let mut local_inputs_nonref = Vec::new(); for mut item in inputs_nonref.into_rust().drain(..) { local_inputs_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut change_script_nonref = Clone::clone(change_script); + let mut local_change_script_nonref = { /*change_script_nonref*/ let change_script_nonref_opt = change_script_nonref; if change_script_nonref_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ change_script_nonref_opt.take() }.into_rust()) }})} }; + nativeSpliceContribution::SpliceIn { + value: ::bitcoin::amount::Amount::from_sat(value_nonref), + inputs: local_inputs_nonref, + change_script: local_change_script_nonref, + } + }, + SpliceContribution::SpliceOut {ref outputs, } => { + 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_rust() }); }; + nativeSpliceContribution::SpliceOut { + outputs: local_outputs_nonref, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeSpliceContribution { + match self { + SpliceContribution::SpliceIn {mut value, mut inputs, mut change_script, } => { + let mut local_inputs = Vec::new(); for mut item in inputs.into_rust().drain(..) { local_inputs.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_change_script = { /*change_script*/ let change_script_opt = change_script; if change_script_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ change_script_opt.take() }.into_rust()) }})} }; + nativeSpliceContribution::SpliceIn { + value: ::bitcoin::amount::Amount::from_sat(value), + inputs: local_inputs, + change_script: local_change_script, + } + }, + SpliceContribution::SpliceOut {mut outputs, } => { + let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_rust() }); }; + nativeSpliceContribution::SpliceOut { + outputs: local_outputs, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &SpliceContributionImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSpliceContribution) }; + match native { + nativeSpliceContribution::SpliceIn {ref value, ref inputs, ref change_script, } => { + let mut value_nonref = Clone::clone(value); + let mut inputs_nonref = Clone::clone(inputs); + let mut local_inputs_nonref = Vec::new(); for mut item in inputs_nonref.drain(..) { local_inputs_nonref.push( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut change_script_nonref = Clone::clone(change_script); + let mut local_change_script_nonref = if change_script_nonref.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { change_script_nonref.unwrap().to_bytes().into() }) }; + SpliceContribution::SpliceIn { + value: value_nonref.to_sat(), + inputs: local_inputs_nonref.into(), + change_script: local_change_script_nonref, + } + }, + nativeSpliceContribution::SpliceOut {ref outputs, } => { + 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::c_types::TxOut::from_rust(&item) }); }; + SpliceContribution::SpliceOut { + outputs: local_outputs_nonref.into(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeSpliceContribution) -> Self { + match native { + nativeSpliceContribution::SpliceIn {mut value, mut inputs, mut change_script, } => { + let mut local_inputs = Vec::new(); for mut item in inputs.drain(..) { local_inputs.push( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + let mut local_change_script = if change_script.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { change_script.unwrap().to_bytes().into() }) }; + SpliceContribution::SpliceIn { + value: value.to_sat(), + inputs: local_inputs.into(), + change_script: local_change_script, + } + }, + nativeSpliceContribution::SpliceOut {mut outputs, } => { + let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::c_types::TxOut::from_rust(&item) }); }; + SpliceContribution::SpliceOut { + outputs: local_outputs.into(), + } + }, + } + } +} +/// Frees any resources used by the SpliceContribution +#[no_mangle] +pub extern "C" fn SpliceContribution_free(this_ptr: SpliceContribution) { } +/// Creates a copy of the SpliceContribution +#[no_mangle] +pub extern "C" fn SpliceContribution_clone(orig: &SpliceContribution) -> SpliceContribution { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SpliceContribution_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SpliceContribution)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SpliceContribution_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut SpliceContribution) }; +} +#[no_mangle] +/// Utility method to constructs a new SpliceIn-variant SpliceContribution +pub extern "C" fn SpliceContribution_splice_in(value: u64, inputs: crate::c_types::derived::CVec_FundingTxInputZ, change_script: crate::c_types::derived::COption_CVec_u8ZZ) -> SpliceContribution { + SpliceContribution::SpliceIn { + value, + inputs, + change_script, + } +} +#[no_mangle] +/// Utility method to constructs a new SpliceOut-variant SpliceContribution +pub extern "C" fn SpliceContribution_splice_out(outputs: crate::c_types::derived::CVec_TxOutZ) -> SpliceContribution { + SpliceContribution::SpliceOut { + outputs, + } +} +/// Get a string which allows debug introspection of a SpliceContribution object +pub extern "C" fn SpliceContribution_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::funding::SpliceContribution }).into()} + +use lightning::ln::funding::FundingTxInput as nativeFundingTxInputImport; +pub(crate) type nativeFundingTxInput = nativeFundingTxInputImport; + +/// An input to contribute to a channel's funding transaction either when using the v2 channel +/// establishment protocol or when splicing. +#[must_use] +#[repr(C)] +pub struct FundingTxInput { + /// 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 nativeFundingTxInput, + /// 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 core::ops::Deref for FundingTxInput { + type Target = nativeFundingTxInput; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for FundingTxInput { } +unsafe impl core::marker::Sync for FundingTxInput { } +impl Drop for FundingTxInput { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeFundingTxInput>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the FundingTxInput, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn FundingTxInput_free(this_obj: FundingTxInput) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn FundingTxInput_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingTxInput) }; +} +#[allow(unused)] +impl FundingTxInput { + pub(crate) fn get_native_ref(&self) -> &'static nativeFundingTxInput { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingTxInput { + 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 nativeFundingTxInput { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Get a string which allows debug introspection of a FundingTxInput object +pub extern "C" fn FundingTxInput_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::funding::FundingTxInput }).into()} +impl Clone for FundingTxInput { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeFundingTxInput>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 FundingTxInput_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFundingTxInput) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the FundingTxInput +pub extern "C" fn FundingTxInput_clone(orig: &FundingTxInput) -> FundingTxInput { + Clone::clone(orig) +} +#[no_mangle] +/// Serialize the FundingTxInput object into a byte array which can be read by FundingTxInput_read +pub extern "C" fn FundingTxInput_write(obj: &crate::lightning::ln::funding::FundingTxInput) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn FundingTxInput_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::funding::nativeFundingTxInput) }) +} +#[no_mangle] +/// Read a FundingTxInput from a byte array, created by FundingTxInput_write +pub extern "C" fn FundingTxInput_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingTxInputDecodeErrorZ { + 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::funding::FundingTxInput { 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 +} +/// Creates an input spending a P2WPKH output from the given `prevtx` at index `vout`. +/// +/// Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden +/// by [`set_sequence`]. +/// +/// Returns `Err` if no such output exists in `prevtx` at index `vout`. +/// +/// [`TxIn::sequence`]: bitcoin::TxIn::sequence +/// [`set_sequence`]: Self::set_sequence +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_new_p2wpkh(mut prevtx: crate::c_types::Transaction, mut vout: u32) -> crate::c_types::derived::CResult_FundingTxInputNoneZ { + let mut ret = lightning::ln::funding::FundingTxInput::new_p2wpkh(prevtx.into_bitcoin(), vout); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Creates an input spending a P2WSH output from the given `prevtx` at index `vout`. +/// +/// Requires passing the weight of witness needed to satisfy the output's script. +/// +/// Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden +/// by [`set_sequence`]. +/// +/// Returns `Err` if no such output exists in `prevtx` at index `vout`. +/// +/// [`TxIn::sequence`]: bitcoin::TxIn::sequence +/// [`set_sequence`]: Self::set_sequence +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_new_p2wsh(mut prevtx: crate::c_types::Transaction, mut vout: u32, mut witness_weight: u64) -> crate::c_types::derived::CResult_FundingTxInputNoneZ { + let mut ret = lightning::ln::funding::FundingTxInput::new_p2wsh(prevtx.into_bitcoin(), vout, ::bitcoin::Weight::from_wu(witness_weight)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Creates an input spending a P2TR output from the given `prevtx` at index `vout`. +/// +/// This is meant for inputs spending a taproot output using the key path. See +/// [`new_p2tr_script_spend`] for when spending using a script path. +/// +/// Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden +/// by [`set_sequence`]. +/// +/// Returns `Err` if no such output exists in `prevtx` at index `vout`. +/// +/// [`new_p2tr_script_spend`]: Self::new_p2tr_script_spend +/// +/// [`TxIn::sequence`]: bitcoin::TxIn::sequence +/// [`set_sequence`]: Self::set_sequence +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_new_p2tr_key_spend(mut prevtx: crate::c_types::Transaction, mut vout: u32) -> crate::c_types::derived::CResult_FundingTxInputNoneZ { + let mut ret = lightning::ln::funding::FundingTxInput::new_p2tr_key_spend(prevtx.into_bitcoin(), vout); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Creates an input spending a P2TR output from the given `prevtx` at index `vout`. +/// +/// Requires passing the weight of witness needed to satisfy a script path of the taproot +/// output. See [`new_p2tr_key_spend`] for when spending using the key path. +/// +/// Uses [`Sequence::ENABLE_RBF_NO_LOCKTIME`] as the [`TxIn::sequence`], which can be overridden +/// by [`set_sequence`]. +/// +/// Returns `Err` if no such output exists in `prevtx` at index `vout`. +/// +/// [`new_p2tr_key_spend`]: Self::new_p2tr_key_spend +/// +/// [`TxIn::sequence`]: bitcoin::TxIn::sequence +/// [`set_sequence`]: Self::set_sequence +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_new_p2tr_script_spend(mut prevtx: crate::c_types::Transaction, mut vout: u32, mut witness_weight: u64) -> crate::c_types::derived::CResult_FundingTxInputNoneZ { + let mut ret = lightning::ln::funding::FundingTxInput::new_p2tr_script_spend(prevtx.into_bitcoin(), vout, ::bitcoin::Weight::from_wu(witness_weight)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::funding::FundingTxInput { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// The outpoint of the UTXO being spent. +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_outpoint(this_arg: &crate::lightning::ln::funding::FundingTxInput) -> crate::lightning::chain::transaction::OutPoint { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.outpoint(); + crate::c_types::bitcoin_to_C_outpoint(&ret) +} + +/// The sequence number to use in the [`TxIn`]. +/// +/// [`TxIn`]: bitcoin::TxIn +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_sequence(this_arg: &crate::lightning::ln::funding::FundingTxInput) -> u32 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.sequence(); + ret.0 +} + +/// Sets the sequence number to use in the [`TxIn`]. +/// +/// [`TxIn`]: bitcoin::TxIn +#[no_mangle] +pub extern "C" fn FundingTxInput_set_sequence(this_arg: &mut crate::lightning::ln::funding::FundingTxInput, mut sequence: u32) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::funding::nativeFundingTxInput)) }.set_sequence(::bitcoin::Sequence(sequence)) +} + +/// Converts the [`FundingTxInput`] into a [`Utxo`] for coin selection. +#[must_use] +#[no_mangle] +pub extern "C" fn FundingTxInput_into_utxo(mut this_arg: crate::lightning::ln::funding::FundingTxInput) -> crate::lightning::events::bump_transaction::Utxo { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_utxo(); + crate::lightning::events::bump_transaction::Utxo { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + diff --git a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs index 3503b23c..b436d25e 100644 --- a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs @@ -21,9 +21,9 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::ln::inbound_payment::ExpandedKey as nativeExpandedKeyImport; pub(crate) type nativeExpandedKey = nativeExpandedKeyImport; -/// A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_inbound_payment_key`]. +/// A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_expanded_key`]. /// -/// [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key +/// [`NodeSigner::get_expanded_key`]: crate::sign::NodeSigner::get_expanded_key #[must_use] #[repr(C)] pub struct ExpandedKey { @@ -93,7 +93,7 @@ impl Clone for ExpandedKey { fn clone(&self) -> Self { Self { inner: if <*mut nativeExpandedKey>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -101,12 +101,12 @@ impl Clone for ExpandedKey { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ExpandedKey_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeExpandedKey)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeExpandedKey) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ExpandedKey pub extern "C" fn ExpandedKey_clone(orig: &ExpandedKey) -> ExpandedKey { - orig.clone() + Clone::clone(orig) } /// Checks if two ExpandedKeys contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -134,7 +134,7 @@ pub extern "C" fn ExpandedKey_new(mut key_material: crate::c_types::ThirtyTwoByt /// `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without /// a `ChannelManager`. /// -/// `keys` is generated by calling [`NodeSigner::get_inbound_payment_key`]. It is recommended to +/// `keys` is generated by calling [`NodeSigner::get_expanded_key`]. It is recommended to /// cache this value and not regenerate it for each new inbound payment. /// /// `current_time` is a Unix timestamp representing the current time. @@ -143,7 +143,7 @@ pub extern "C" fn ExpandedKey_new(mut key_material: crate::c_types::ThirtyTwoByt /// on versions of LDK prior to 0.0.114. /// /// [phantom node payments]: crate::sign::PhantomKeysManager -/// [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key +/// [`NodeSigner::get_expanded_key`]: crate::sign::NodeSigner::get_expanded_key #[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_ThirtyTwoBytesThirtyTwoBytesZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; diff --git a/lightning-c-bindings/src/lightning/ln/invoice_utils.rs b/lightning-c-bindings/src/lightning/ln/invoice_utils.rs index 87148638..35c7281a 100644 --- a/lightning-c-bindings/src/lightning/ln/invoice_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/invoice_utils.rs @@ -115,82 +115,3 @@ pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: cra local_ret } -/// Utility to construct an invoice. Generally, unless you want to do something like a custom -/// cltv_expiry, this is what you should be using to create an invoice. The reason being, this -/// method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user -/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify -/// that the payment secret is valid when the invoice is paid. -/// -/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for -/// in excess of the current time. -/// -/// You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to -/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. -/// Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block -/// confirmations during routing. -/// -/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA -#[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> 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_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::invoice_utils::create_invoice_from_channelmanager::(channelmanager.get_native_ref(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; - local_ret -} - -/// Utility to construct an invoice. Generally, unless you want to do something like a custom -/// cltv_expiry, this is what you should be using to create an invoice. The reason being, this -/// method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user -/// doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify -/// that the payment secret is valid when the invoice is paid. -/// Use this variant if you want to pass the `description_hash` to the invoice. -/// -/// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for -/// in excess of the current time. -/// -/// You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to -/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. -/// Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block -/// confirmations during routing. -/// -/// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA -#[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> 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_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::invoice_utils::create_invoice_from_channelmanager_with_description_hash::(channelmanager.get_native_ref(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; - local_ret -} - -/// See [`create_invoice_from_channelmanager`]. -/// -/// This version allows for providing custom [`PaymentHash`] and description hash for the invoice. -/// -/// This may be useful if you're building an on-chain swap or involving another protocol where -/// the payment hash is also involved outside the scope of lightning and want to set the -/// description hash. -#[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> 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_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::invoice_utils::create_invoice_from_channelmanager_with_description_hash_and_payment_hash::(channelmanager.get_native_ref(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs, ::lightning::types::payment::PaymentHash(payment_hash.data), local_min_final_cltv_expiry_delta); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; - local_ret -} - -/// See [`create_invoice_from_channelmanager`]. -/// -/// This version allows for providing a custom [`PaymentHash`] for the invoice. -/// This may be useful if you're building an on-chain swap or involving another protocol where -/// the payment hash is also involved outside the scope of lightning. -#[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_with_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> 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_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::invoice_utils::create_invoice_from_channelmanager_with_payment_hash::(channelmanager.get_native_ref(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs, ::lightning::types::payment::PaymentHash(payment_hash.data), local_min_final_cltv_expiry_delta); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; - local_ret -} - diff --git a/lightning-c-bindings/src/lightning/ln/mod.rs b/lightning-c-bindings/src/lightning/ln/mod.rs index e8b24075..b87d495f 100644 --- a/lightning-c-bindings/src/lightning/ln/mod.rs +++ b/lightning-c-bindings/src/lightning/ln/mod.rs @@ -17,18 +17,20 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod onion_payment; -pub mod channelmanager; +pub mod chan_utils; pub mod channel_keys; pub mod channel_state; +pub mod channelmanager; +pub mod funding; pub mod inbound_payment; pub mod msgs; +pub mod onion_payment; +pub mod our_peer_storage; pub mod peer_handler; -pub mod chan_utils; pub mod script; pub mod types; pub mod invoice_utils; -pub mod bolt11_payment; +pub mod onion_utils; pub mod outbound_payment; pub mod wire; mod features { @@ -190,18 +192,6 @@ use crate::c_types::*; 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; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - } mod interactivetxs { diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index 69209013..263c8274 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -279,7 +279,7 @@ impl Init { /// The relevant features which the sender supports. #[no_mangle] pub extern "C" fn Init_get_features(this_ptr: &Init) -> crate::lightning_types::features::InitFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut Init::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::InitFeatures<>) as *mut _) }, is_owned: false } } /// The relevant features which the sender supports. @@ -294,7 +294,7 @@ 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_ThirtyTwoBytesZZ { - let mut inner_val = this_ptr.get_native_mut_ref().networks.clone(); + let mut inner_val = Init::get_native_mut_ref(this_ptr).networks.clone(); 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.as_ref() } }); }; local_inner_val_0.into() }) }; local_inner_val } @@ -314,7 +314,7 @@ pub extern "C" fn Init_set_networks(this_ptr: &mut Init, mut val: crate::c_types /// the new address. #[no_mangle] 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 inner_val = &mut Init::get_native_mut_ref(this_ptr).remote_network_address; 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 } @@ -345,7 +345,7 @@ impl Clone for Init { fn clone(&self) -> Self { Self { inner: if <*mut nativeInit>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -353,12 +353,12 @@ impl Clone for Init { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Init_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInit)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInit) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Init pub extern "C" fn Init_clone(orig: &Init) -> Init { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Init object pub extern "C" fn Init_debug_str_void(o: *const c_void) -> Str { @@ -450,7 +450,7 @@ impl ErrorMessage { /// with the sending peer should be closed. #[no_mangle] pub extern "C" fn ErrorMessage_get_channel_id(this_ptr: &ErrorMessage) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ErrorMessage::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID involved in the error. @@ -468,7 +468,7 @@ pub extern "C" fn ErrorMessage_set_channel_id(this_ptr: &mut ErrorMessage, mut v /// the terminal emulator or the logging subsystem. #[no_mangle] pub extern "C" fn ErrorMessage_get_data(this_ptr: &ErrorMessage) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().data; + let mut inner_val = &mut ErrorMessage::get_native_mut_ref(this_ptr).data; inner_val.as_str().into() } /// A possibly human-readable error description. @@ -493,7 +493,7 @@ impl Clone for ErrorMessage { fn clone(&self) -> Self { Self { inner: if <*mut nativeErrorMessage>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -501,12 +501,12 @@ impl Clone for ErrorMessage { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ErrorMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeErrorMessage)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeErrorMessage) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ErrorMessage pub extern "C" fn ErrorMessage_clone(orig: &ErrorMessage) -> ErrorMessage { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ErrorMessage object pub extern "C" fn ErrorMessage_debug_str_void(o: *const c_void) -> Str { @@ -597,7 +597,7 @@ impl WarningMessage { /// All-0s indicates a warning unrelated to a specific channel. #[no_mangle] pub extern "C" fn WarningMessage_get_channel_id(this_ptr: &WarningMessage) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut WarningMessage::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID involved in the warning. @@ -614,7 +614,7 @@ pub extern "C" fn WarningMessage_set_channel_id(this_ptr: &mut WarningMessage, m /// the terminal emulator or the logging subsystem. #[no_mangle] pub extern "C" fn WarningMessage_get_data(this_ptr: &WarningMessage) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().data; + let mut inner_val = &mut WarningMessage::get_native_mut_ref(this_ptr).data; inner_val.as_str().into() } /// A possibly human-readable warning description. @@ -639,7 +639,7 @@ impl Clone for WarningMessage { fn clone(&self) -> Self { Self { inner: if <*mut nativeWarningMessage>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -647,12 +647,12 @@ impl Clone for WarningMessage { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn WarningMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeWarningMessage)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeWarningMessage) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the WarningMessage pub extern "C" fn WarningMessage_clone(orig: &WarningMessage) -> WarningMessage { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a WarningMessage object pub extern "C" fn WarningMessage_debug_str_void(o: *const c_void) -> Str { @@ -741,7 +741,7 @@ impl Ping { /// The desired response length. #[no_mangle] pub extern "C" fn Ping_get_ponglen(this_ptr: &Ping) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().ponglen; + let mut inner_val = &mut Ping::get_native_mut_ref(this_ptr).ponglen; *inner_val } /// The desired response length. @@ -754,7 +754,7 @@ pub extern "C" fn Ping_set_ponglen(this_ptr: &mut Ping, mut val: u16) { /// This field is not sent on the wire. byteslen zeros are sent. #[no_mangle] pub extern "C" fn Ping_get_byteslen(this_ptr: &Ping) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().byteslen; + let mut inner_val = &mut Ping::get_native_mut_ref(this_ptr).byteslen; *inner_val } /// The ping packet size. @@ -777,7 +777,7 @@ impl Clone for Ping { fn clone(&self) -> Self { Self { inner: if <*mut nativePing>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -785,12 +785,12 @@ impl Clone for Ping { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Ping_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePing)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePing) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Ping pub extern "C" fn Ping_clone(orig: &Ping) -> Ping { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Ping object pub extern "C" fn Ping_debug_str_void(o: *const c_void) -> Str { @@ -881,7 +881,7 @@ impl Pong { /// This field is not sent on the wire. byteslen zeros are sent. #[no_mangle] pub extern "C" fn Pong_get_byteslen(this_ptr: &Pong) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().byteslen; + let mut inner_val = &mut Pong::get_native_mut_ref(this_ptr).byteslen; *inner_val } /// The pong packet size. @@ -903,7 +903,7 @@ impl Clone for Pong { fn clone(&self) -> Self { Self { inner: if <*mut nativePong>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -911,12 +911,12 @@ impl Clone for Pong { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Pong_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePong)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePong) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Pong pub extern "C" fn Pong_clone(orig: &Pong) -> Pong { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Pong object pub extern "C" fn Pong_debug_str_void(o: *const c_void) -> Str { @@ -1006,7 +1006,7 @@ impl CommonOpenChannelFields { /// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_chain_hash(this_ptr: &CommonOpenChannelFields) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).chain_hash; inner_val.as_ref() } /// The genesis hash of the blockchain where the channel is to be opened @@ -1019,7 +1019,7 @@ pub extern "C" fn CommonOpenChannelFields_set_chain_hash(this_ptr: &mut CommonOp /// For V1 channels: a temporary channel ID, until the funding outpoint is announced #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_temporary_channel_id(this_ptr: &CommonOpenChannelFields) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).temporary_channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// A temporary channel ID @@ -1033,7 +1033,7 @@ pub extern "C" fn CommonOpenChannelFields_set_temporary_channel_id(this_ptr: &mu /// For V2 channels: Part of the channel value contributed by the channel initiator #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_funding_satoshis(this_ptr: &CommonOpenChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_satoshis; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).funding_satoshis; *inner_val } /// For V1 channels: The channel value @@ -1046,7 +1046,7 @@ pub extern "C" fn CommonOpenChannelFields_set_funding_satoshis(this_ptr: &mut Co /// omitted #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_dust_limit_satoshis(this_ptr: &CommonOpenChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().dust_limit_satoshis; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).dust_limit_satoshis; *inner_val } /// The threshold below which outputs on transactions broadcast by the channel initiator will be @@ -1058,7 +1058,7 @@ pub extern "C" fn CommonOpenChannelFields_set_dust_limit_satoshis(this_ptr: &mut /// The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_max_htlc_value_in_flight_msat(this_ptr: &CommonOpenChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_value_in_flight_msat; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).max_htlc_value_in_flight_msat; *inner_val } /// The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi @@ -1069,7 +1069,7 @@ pub extern "C" fn CommonOpenChannelFields_set_max_htlc_value_in_flight_msat(this /// The minimum HTLC size incoming to channel initiator, in milli-satoshi #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_htlc_minimum_msat(this_ptr: &CommonOpenChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum HTLC size incoming to channel initiator, in milli-satoshi @@ -1081,7 +1081,7 @@ pub extern "C" fn CommonOpenChannelFields_set_htlc_minimum_msat(this_ptr: &mut C /// [`UpdateFee`] #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_commitment_feerate_sat_per_1000_weight(this_ptr: &CommonOpenChannelFields) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_feerate_sat_per_1000_weight; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).commitment_feerate_sat_per_1000_weight; *inner_val } /// The feerate for the commitment transaction set by the channel initiator until updated by @@ -1094,7 +1094,7 @@ pub extern "C" fn CommonOpenChannelFields_set_commitment_feerate_sat_per_1000_we /// broadcast a commitment transaction #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_to_self_delay(this_ptr: &CommonOpenChannelFields) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).to_self_delay; *inner_val } /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they @@ -1106,7 +1106,7 @@ pub extern "C" fn CommonOpenChannelFields_set_to_self_delay(this_ptr: &mut Commo /// The maximum number of inbound HTLCs towards channel initiator #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_max_accepted_htlcs(this_ptr: &CommonOpenChannelFields) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_accepted_htlcs; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).max_accepted_htlcs; *inner_val } /// The maximum number of inbound HTLCs towards channel initiator @@ -1117,7 +1117,7 @@ pub extern "C" fn CommonOpenChannelFields_set_max_accepted_htlcs(this_ptr: &mut /// The channel initiator's key controlling the funding transaction #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_funding_pubkey(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).funding_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The channel initiator's key controlling the funding transaction @@ -1128,7 +1128,7 @@ pub extern "C" fn CommonOpenChannelFields_set_funding_pubkey(this_ptr: &mut Comm /// Used to derive a revocation key for transactions broadcast by counterparty #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_revocation_basepoint(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).revocation_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive a revocation key for transactions broadcast by counterparty @@ -1139,7 +1139,7 @@ pub extern "C" fn CommonOpenChannelFields_set_revocation_basepoint(this_ptr: &mu /// A payment key to channel initiator for transactions broadcast by counterparty #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_payment_basepoint(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_basepoint; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).payment_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// A payment key to channel initiator for transactions broadcast by counterparty @@ -1151,7 +1151,7 @@ pub extern "C" fn CommonOpenChannelFields_set_payment_basepoint(this_ptr: &mut C /// initiator #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_delayed_payment_basepoint(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).delayed_payment_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive a payment key to channel initiator for transactions broadcast by channel @@ -1163,7 +1163,7 @@ pub extern "C" fn CommonOpenChannelFields_set_delayed_payment_basepoint(this_ptr /// Used to derive an HTLC payment key to channel initiator #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_htlc_basepoint(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).htlc_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive an HTLC payment key to channel initiator @@ -1174,7 +1174,7 @@ pub extern "C" fn CommonOpenChannelFields_set_htlc_basepoint(this_ptr: &mut Comm /// The first to-be-broadcast-by-channel-initiator transaction's per commitment point #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_first_per_commitment_point(this_ptr: &CommonOpenChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().first_per_commitment_point; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).first_per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The first to-be-broadcast-by-channel-initiator transaction's per commitment point @@ -1185,7 +1185,7 @@ pub extern "C" fn CommonOpenChannelFields_set_first_per_commitment_point(this_pt /// The channel flags to be used #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_channel_flags(this_ptr: &CommonOpenChannelFields) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_flags; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).channel_flags; *inner_val } /// The channel flags to be used @@ -1197,7 +1197,7 @@ pub extern "C" fn CommonOpenChannelFields_set_channel_flags(this_ptr: &mut Commo /// collaboratively close #[no_mangle] pub extern "C" fn CommonOpenChannelFields_get_shutdown_scriptpubkey(this_ptr: &CommonOpenChannelFields) -> crate::c_types::derived::COption_CVec_u8ZZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).shutdown_scriptpubkey; 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().to_bytes().into() }) }; local_inner_val } @@ -1208,22 +1208,18 @@ pub extern "C" fn CommonOpenChannelFields_set_shutdown_scriptpubkey(this_ptr: &m let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } -/// The channel type that this channel will represent -/// -/// If this is `None`, we derive the channel type from the intersection of our -/// feature bits with our counterparty's feature bits from the [`Init`] message. +/// The channel type that this channel will represent. As defined in the latest +/// specification, this field is required. However, it is an `Option` for legacy reasons. /// /// 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 CommonOpenChannelFields_get_channel_type(this_ptr: &CommonOpenChannelFields) -> crate::lightning_types::features::ChannelTypeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type; + let mut inner_val = &mut CommonOpenChannelFields::get_native_mut_ref(this_ptr).channel_type; let mut local_inner_val = crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; local_inner_val } -/// The channel type that this channel will represent -/// -/// If this is `None`, we derive the channel type from the intersection of our -/// feature bits with our counterparty's feature bits from the [`Init`] message. +/// The channel type that this channel will represent. As defined in the latest +/// specification, this field is required. However, it is an `Option` for legacy reasons. /// /// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] @@ -1264,7 +1260,7 @@ impl Clone for CommonOpenChannelFields { fn clone(&self) -> Self { Self { inner: if <*mut nativeCommonOpenChannelFields>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1272,12 +1268,12 @@ impl Clone for CommonOpenChannelFields { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommonOpenChannelFields_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommonOpenChannelFields)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCommonOpenChannelFields) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CommonOpenChannelFields pub extern "C" fn CommonOpenChannelFields_clone(orig: &CommonOpenChannelFields) -> CommonOpenChannelFields { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CommonOpenChannelFields object pub extern "C" fn CommonOpenChannelFields_debug_str_void(o: *const c_void) -> Str { @@ -1374,7 +1370,7 @@ impl ChannelParameters { /// omitted. #[no_mangle] pub extern "C" fn ChannelParameters_get_dust_limit_satoshis(this_ptr: &ChannelParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().dust_limit_satoshis; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).dust_limit_satoshis; *inner_val } /// The threshold below which outputs on transactions broadcast by the channel initiator will be @@ -1386,7 +1382,7 @@ pub extern "C" fn ChannelParameters_set_dust_limit_satoshis(this_ptr: &mut Chann /// The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi #[no_mangle] pub extern "C" fn ChannelParameters_get_max_htlc_value_in_flight_msat(this_ptr: &ChannelParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_value_in_flight_msat; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).max_htlc_value_in_flight_msat; *inner_val } /// The maximum inbound HTLC value in flight towards channel initiator, in milli-satoshi @@ -1397,7 +1393,7 @@ pub extern "C" fn ChannelParameters_set_max_htlc_value_in_flight_msat(this_ptr: /// The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi #[no_mangle] pub extern "C" fn ChannelParameters_get_htlc_minimum_msat(this_ptr: &ChannelParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum HTLC size for HTLCs towards the channel initiator, in milli-satoshi @@ -1409,7 +1405,7 @@ pub extern "C" fn ChannelParameters_set_htlc_minimum_msat(this_ptr: &mut Channel /// [`UpdateFee`] #[no_mangle] pub extern "C" fn ChannelParameters_get_commitment_feerate_sat_per_1000_weight(this_ptr: &ChannelParameters) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_feerate_sat_per_1000_weight; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).commitment_feerate_sat_per_1000_weight; *inner_val } /// The feerate for the commitment transaction set by the channel initiator until updated by @@ -1422,7 +1418,7 @@ pub extern "C" fn ChannelParameters_set_commitment_feerate_sat_per_1000_weight(t /// funds if they broadcast a commitment transaction. #[no_mangle] pub extern "C" fn ChannelParameters_get_to_self_delay(this_ptr: &ChannelParameters) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).to_self_delay; *inner_val } /// The number of blocks which the non-channel-initator will have to wait to claim on-chain @@ -1434,7 +1430,7 @@ pub extern "C" fn ChannelParameters_set_to_self_delay(this_ptr: &mut ChannelPara /// The maximum number of pending HTLCs towards the channel initiator. #[no_mangle] pub extern "C" fn ChannelParameters_get_max_accepted_htlcs(this_ptr: &ChannelParameters) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_accepted_htlcs; + let mut inner_val = &mut ChannelParameters::get_native_mut_ref(this_ptr).max_accepted_htlcs; *inner_val } /// The maximum number of pending HTLCs towards the channel initiator. @@ -1459,7 +1455,7 @@ impl Clone for ChannelParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1467,12 +1463,12 @@ impl Clone for ChannelParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelParameters pub extern "C" fn ChannelParameters_clone(orig: &ChannelParameters) -> ChannelParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelParameters object pub extern "C" fn ChannelParameters_debug_str_void(o: *const c_void) -> Str { @@ -1563,7 +1559,7 @@ impl OpenChannel { /// Common fields of `open_channel(2)`-like messages #[no_mangle] pub extern "C" fn OpenChannel_get_common_fields(this_ptr: &OpenChannel) -> crate::lightning::ln::msgs::CommonOpenChannelFields { - let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields; + let mut inner_val = &mut OpenChannel::get_native_mut_ref(this_ptr).common_fields; crate::lightning::ln::msgs::CommonOpenChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonOpenChannelFields<>) as *mut _) }, is_owned: false } } /// Common fields of `open_channel(2)`-like messages @@ -1574,7 +1570,7 @@ pub extern "C" fn OpenChannel_set_common_fields(this_ptr: &mut OpenChannel, mut /// The amount to push to the counterparty as part of the open, in milli-satoshi #[no_mangle] pub extern "C" fn OpenChannel_get_push_msat(this_ptr: &OpenChannel) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().push_msat; + let mut inner_val = &mut OpenChannel::get_native_mut_ref(this_ptr).push_msat; *inner_val } /// The amount to push to the counterparty as part of the open, in milli-satoshi @@ -1585,7 +1581,7 @@ pub extern "C" fn OpenChannel_set_push_msat(this_ptr: &mut OpenChannel, mut val: /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel #[no_mangle] pub extern "C" fn OpenChannel_get_channel_reserve_satoshis(this_ptr: &OpenChannel) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_reserve_satoshis; + let mut inner_val = &mut OpenChannel::get_native_mut_ref(this_ptr).channel_reserve_satoshis; *inner_val } /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel @@ -1607,7 +1603,7 @@ impl Clone for OpenChannel { fn clone(&self) -> Self { Self { inner: if <*mut nativeOpenChannel>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1615,12 +1611,12 @@ impl Clone for OpenChannel { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OpenChannel_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOpenChannel)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOpenChannel) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OpenChannel pub extern "C" fn OpenChannel_clone(orig: &OpenChannel) -> OpenChannel { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a OpenChannel object pub extern "C" fn OpenChannel_debug_str_void(o: *const c_void) -> Str { @@ -1711,7 +1707,7 @@ impl OpenChannelV2 { /// Common fields of `open_channel(2)`-like messages #[no_mangle] pub extern "C" fn OpenChannelV2_get_common_fields(this_ptr: &OpenChannelV2) -> crate::lightning::ln::msgs::CommonOpenChannelFields { - let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields; + let mut inner_val = &mut OpenChannelV2::get_native_mut_ref(this_ptr).common_fields; crate::lightning::ln::msgs::CommonOpenChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonOpenChannelFields<>) as *mut _) }, is_owned: false } } /// Common fields of `open_channel(2)`-like messages @@ -1722,7 +1718,7 @@ pub extern "C" fn OpenChannelV2_set_common_fields(this_ptr: &mut OpenChannelV2, /// The feerate for the funding transaction set by the channel initiator #[no_mangle] pub extern "C" fn OpenChannelV2_get_funding_feerate_sat_per_1000_weight(this_ptr: &OpenChannelV2) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_feerate_sat_per_1000_weight; + let mut inner_val = &mut OpenChannelV2::get_native_mut_ref(this_ptr).funding_feerate_sat_per_1000_weight; *inner_val } /// The feerate for the funding transaction set by the channel initiator @@ -1733,7 +1729,7 @@ pub extern "C" fn OpenChannelV2_set_funding_feerate_sat_per_1000_weight(this_ptr /// The locktime for the funding transaction #[no_mangle] pub extern "C" fn OpenChannelV2_get_locktime(this_ptr: &OpenChannelV2) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime; + let mut inner_val = &mut OpenChannelV2::get_native_mut_ref(this_ptr).locktime; *inner_val } /// The locktime for the funding transaction @@ -1744,7 +1740,7 @@ pub extern "C" fn OpenChannelV2_set_locktime(this_ptr: &mut OpenChannelV2, mut v /// The second to-be-broadcast-by-channel-initiator transaction's per commitment point #[no_mangle] pub extern "C" fn OpenChannelV2_get_second_per_commitment_point(this_ptr: &OpenChannelV2) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().second_per_commitment_point; + let mut inner_val = &mut OpenChannelV2::get_native_mut_ref(this_ptr).second_per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The second to-be-broadcast-by-channel-initiator transaction's per commitment point @@ -1755,7 +1751,7 @@ pub extern "C" fn OpenChannelV2_set_second_per_commitment_point(this_ptr: &mut O /// Optionally, a requirement that only confirmed inputs can be added #[no_mangle] pub extern "C" fn OpenChannelV2_get_require_confirmed_inputs(this_ptr: &OpenChannelV2) -> crate::c_types::derived::COption_NoneZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().require_confirmed_inputs; + let mut inner_val = &mut OpenChannelV2::get_native_mut_ref(this_ptr).require_confirmed_inputs; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; local_inner_val } @@ -1782,7 +1778,7 @@ impl Clone for OpenChannelV2 { fn clone(&self) -> Self { Self { inner: if <*mut nativeOpenChannelV2>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1790,12 +1786,12 @@ impl Clone for OpenChannelV2 { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OpenChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOpenChannelV2)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOpenChannelV2) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OpenChannelV2 pub extern "C" fn OpenChannelV2_clone(orig: &OpenChannelV2) -> OpenChannelV2 { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a OpenChannelV2 object pub extern "C" fn OpenChannelV2_debug_str_void(o: *const c_void) -> Str { @@ -1885,7 +1881,7 @@ impl CommonAcceptChannelFields { /// The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_temporary_channel_id(this_ptr: &CommonAcceptChannelFields) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).temporary_channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The same `temporary_channel_id` received from the initiator's `open_channel2` or `open_channel` message. @@ -1897,7 +1893,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_temporary_channel_id(this_ptr: & /// omitted #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_dust_limit_satoshis(this_ptr: &CommonAcceptChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().dust_limit_satoshis; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).dust_limit_satoshis; *inner_val } /// The threshold below which outputs on transactions broadcast by the channel acceptor will be @@ -1909,7 +1905,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_dust_limit_satoshis(this_ptr: &m /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_max_htlc_value_in_flight_msat(this_ptr: &CommonAcceptChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_value_in_flight_msat; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).max_htlc_value_in_flight_msat; *inner_val } /// The maximum inbound HTLC value in flight towards sender, in milli-satoshi @@ -1920,7 +1916,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_max_htlc_value_in_flight_msat(th /// The minimum HTLC size incoming to channel acceptor, in milli-satoshi #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_htlc_minimum_msat(this_ptr: &CommonAcceptChannelFields) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum HTLC size incoming to channel acceptor, in milli-satoshi @@ -1931,7 +1927,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_htlc_minimum_msat(this_ptr: &mut /// Minimum depth of the funding transaction before the channel is considered open #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_minimum_depth(this_ptr: &CommonAcceptChannelFields) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().minimum_depth; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).minimum_depth; *inner_val } /// Minimum depth of the funding transaction before the channel is considered open @@ -1943,7 +1939,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_minimum_depth(this_ptr: &mut Com /// broadcast a commitment transaction #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_to_self_delay(this_ptr: &CommonAcceptChannelFields) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).to_self_delay; *inner_val } /// The number of blocks which the counterparty will have to wait to claim on-chain funds if they @@ -1955,7 +1951,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_to_self_delay(this_ptr: &mut Com /// The maximum number of inbound HTLCs towards channel acceptor #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_max_accepted_htlcs(this_ptr: &CommonAcceptChannelFields) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_accepted_htlcs; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).max_accepted_htlcs; *inner_val } /// The maximum number of inbound HTLCs towards channel acceptor @@ -1966,7 +1962,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_max_accepted_htlcs(this_ptr: &mu /// The channel acceptor's key controlling the funding transaction #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_funding_pubkey(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).funding_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The channel acceptor's key controlling the funding transaction @@ -1977,7 +1973,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_funding_pubkey(this_ptr: &mut Co /// Used to derive a revocation key for transactions broadcast by counterparty #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_revocation_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_basepoint; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).revocation_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive a revocation key for transactions broadcast by counterparty @@ -1988,7 +1984,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_revocation_basepoint(this_ptr: & /// A payment key to channel acceptor for transactions broadcast by counterparty #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_payment_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_basepoint; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).payment_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// A payment key to channel acceptor for transactions broadcast by counterparty @@ -2000,7 +1996,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_payment_basepoint(this_ptr: &mut /// acceptor #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_delayed_payment_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_basepoint; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).delayed_payment_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive a payment key to channel acceptor for transactions broadcast by channel @@ -2012,7 +2008,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_delayed_payment_basepoint(this_p /// Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_htlc_basepoint(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_basepoint; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).htlc_basepoint; crate::c_types::PublicKey::from_rust(&inner_val) } /// Used to derive an HTLC payment key to channel acceptor for transactions broadcast by counterparty @@ -2023,7 +2019,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_htlc_basepoint(this_ptr: &mut Co /// The first to-be-broadcast-by-channel-acceptor transaction's per commitment point #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_first_per_commitment_point(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().first_per_commitment_point; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).first_per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The first to-be-broadcast-by-channel-acceptor transaction's per commitment point @@ -2035,7 +2031,7 @@ pub extern "C" fn CommonAcceptChannelFields_set_first_per_commitment_point(this_ /// collaboratively close #[no_mangle] pub extern "C" fn CommonAcceptChannelFields_get_shutdown_scriptpubkey(this_ptr: &CommonAcceptChannelFields) -> crate::c_types::derived::COption_CVec_u8ZZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().shutdown_scriptpubkey; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).shutdown_scriptpubkey; 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().to_bytes().into() }) }; local_inner_val } @@ -2046,9 +2042,8 @@ pub extern "C" fn CommonAcceptChannelFields_set_shutdown_scriptpubkey(this_ptr: let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::script::ScriptBuf::from({ val_opt.take() }.into_rust()) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.shutdown_scriptpubkey = local_val; } -/// The channel type that this channel will represent. If none is set, we derive the channel -/// type from the intersection of our feature bits with our counterparty's feature bits from -/// the Init message. +/// The channel type that this channel will represent. As defined in the latest +/// specification, this field is required. However, it is an `Option` for legacy reasons. /// /// This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s /// [`CommonOpenChannelFields::channel_type`]. @@ -2056,13 +2051,12 @@ pub extern "C" fn CommonAcceptChannelFields_set_shutdown_scriptpubkey(this_ptr: /// 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 CommonAcceptChannelFields_get_channel_type(this_ptr: &CommonAcceptChannelFields) -> crate::lightning_types::features::ChannelTypeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_type; + let mut inner_val = &mut CommonAcceptChannelFields::get_native_mut_ref(this_ptr).channel_type; let mut local_inner_val = crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; local_inner_val } -/// The channel type that this channel will represent. If none is set, we derive the channel -/// type from the intersection of our feature bits with our counterparty's feature bits from -/// the Init message. +/// The channel type that this channel will represent. As defined in the latest +/// specification, this field is required. However, it is an `Option` for legacy reasons. /// /// This is required to match the equivalent field in [`OpenChannel`] or [`OpenChannelV2`]'s /// [`CommonOpenChannelFields::channel_type`]. @@ -2103,7 +2097,7 @@ impl Clone for CommonAcceptChannelFields { fn clone(&self) -> Self { Self { inner: if <*mut nativeCommonAcceptChannelFields>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2111,12 +2105,12 @@ impl Clone for CommonAcceptChannelFields { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommonAcceptChannelFields_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommonAcceptChannelFields)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCommonAcceptChannelFields) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the CommonAcceptChannelFields pub extern "C" fn CommonAcceptChannelFields_clone(orig: &CommonAcceptChannelFields) -> CommonAcceptChannelFields { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a CommonAcceptChannelFields object pub extern "C" fn CommonAcceptChannelFields_debug_str_void(o: *const c_void) -> Str { @@ -2207,7 +2201,7 @@ impl AcceptChannel { /// Common fields of `accept_channel(2)`-like messages #[no_mangle] pub extern "C" fn AcceptChannel_get_common_fields(this_ptr: &AcceptChannel) -> crate::lightning::ln::msgs::CommonAcceptChannelFields { - let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields; + let mut inner_val = &mut AcceptChannel::get_native_mut_ref(this_ptr).common_fields; crate::lightning::ln::msgs::CommonAcceptChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonAcceptChannelFields<>) as *mut _) }, is_owned: false } } /// Common fields of `accept_channel(2)`-like messages @@ -2218,7 +2212,7 @@ pub extern "C" fn AcceptChannel_set_common_fields(this_ptr: &mut AcceptChannel, /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel #[no_mangle] pub extern "C" fn AcceptChannel_get_channel_reserve_satoshis(this_ptr: &AcceptChannel) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_reserve_satoshis; + let mut inner_val = &mut AcceptChannel::get_native_mut_ref(this_ptr).channel_reserve_satoshis; *inner_val } /// The minimum value unencumbered by HTLCs for the counterparty to keep in the channel @@ -2239,7 +2233,7 @@ impl Clone for AcceptChannel { fn clone(&self) -> Self { Self { inner: if <*mut nativeAcceptChannel>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2247,12 +2241,12 @@ impl Clone for AcceptChannel { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn AcceptChannel_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannel)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAcceptChannel) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the AcceptChannel pub extern "C" fn AcceptChannel_clone(orig: &AcceptChannel) -> AcceptChannel { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a AcceptChannel object pub extern "C" fn AcceptChannel_debug_str_void(o: *const c_void) -> Str { @@ -2343,7 +2337,7 @@ impl AcceptChannelV2 { /// Common fields of `accept_channel(2)`-like messages #[no_mangle] pub extern "C" fn AcceptChannelV2_get_common_fields(this_ptr: &AcceptChannelV2) -> crate::lightning::ln::msgs::CommonAcceptChannelFields { - let mut inner_val = &mut this_ptr.get_native_mut_ref().common_fields; + let mut inner_val = &mut AcceptChannelV2::get_native_mut_ref(this_ptr).common_fields; crate::lightning::ln::msgs::CommonAcceptChannelFields { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommonAcceptChannelFields<>) as *mut _) }, is_owned: false } } /// Common fields of `accept_channel(2)`-like messages @@ -2354,7 +2348,7 @@ pub extern "C" fn AcceptChannelV2_set_common_fields(this_ptr: &mut AcceptChannel /// Part of the channel value contributed by the channel acceptor #[no_mangle] pub extern "C" fn AcceptChannelV2_get_funding_satoshis(this_ptr: &AcceptChannelV2) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_satoshis; + let mut inner_val = &mut AcceptChannelV2::get_native_mut_ref(this_ptr).funding_satoshis; *inner_val } /// Part of the channel value contributed by the channel acceptor @@ -2365,7 +2359,7 @@ pub extern "C" fn AcceptChannelV2_set_funding_satoshis(this_ptr: &mut AcceptChan /// The second to-be-broadcast-by-channel-acceptor transaction's per commitment point #[no_mangle] pub extern "C" fn AcceptChannelV2_get_second_per_commitment_point(this_ptr: &AcceptChannelV2) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().second_per_commitment_point; + let mut inner_val = &mut AcceptChannelV2::get_native_mut_ref(this_ptr).second_per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The second to-be-broadcast-by-channel-acceptor transaction's per commitment point @@ -2376,7 +2370,7 @@ pub extern "C" fn AcceptChannelV2_set_second_per_commitment_point(this_ptr: &mut /// Optionally, a requirement that only confirmed inputs can be added #[no_mangle] pub extern "C" fn AcceptChannelV2_get_require_confirmed_inputs(this_ptr: &AcceptChannelV2) -> crate::c_types::derived::COption_NoneZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().require_confirmed_inputs; + let mut inner_val = &mut AcceptChannelV2::get_native_mut_ref(this_ptr).require_confirmed_inputs; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; local_inner_val } @@ -2402,7 +2396,7 @@ impl Clone for AcceptChannelV2 { fn clone(&self) -> Self { Self { inner: if <*mut nativeAcceptChannelV2>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2410,12 +2404,12 @@ impl Clone for AcceptChannelV2 { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn AcceptChannelV2_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAcceptChannelV2)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAcceptChannelV2) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the AcceptChannelV2 pub extern "C" fn AcceptChannelV2_clone(orig: &AcceptChannelV2) -> AcceptChannelV2 { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a AcceptChannelV2 object pub extern "C" fn AcceptChannelV2_debug_str_void(o: *const c_void) -> Str { @@ -2506,7 +2500,7 @@ impl FundingCreated { /// A temporary channel ID, until the funding is established #[no_mangle] pub extern "C" fn FundingCreated_get_temporary_channel_id(this_ptr: &FundingCreated) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().temporary_channel_id; + let mut inner_val = &mut FundingCreated::get_native_mut_ref(this_ptr).temporary_channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// A temporary channel ID, until the funding is established @@ -2517,7 +2511,7 @@ pub extern "C" fn FundingCreated_set_temporary_channel_id(this_ptr: &mut Funding /// The funding transaction ID #[no_mangle] pub extern "C" fn FundingCreated_get_funding_txid(this_ptr: &FundingCreated) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txid; + let mut inner_val = &mut FundingCreated::get_native_mut_ref(this_ptr).funding_txid; inner_val.as_ref() } /// The funding transaction ID @@ -2528,7 +2522,7 @@ pub extern "C" fn FundingCreated_set_funding_txid(this_ptr: &mut FundingCreated, /// The specific output index funding this channel #[no_mangle] pub extern "C" fn FundingCreated_get_funding_output_index(this_ptr: &FundingCreated) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_output_index; + let mut inner_val = &mut FundingCreated::get_native_mut_ref(this_ptr).funding_output_index; *inner_val } /// The specific output index funding this channel @@ -2539,7 +2533,7 @@ 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::ECDSASignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; + let mut inner_val = &mut FundingCreated::get_native_mut_ref(this_ptr).signature; crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The signature of the channel initiator (funder) on the initial commitment transaction @@ -2562,7 +2556,7 @@ impl Clone for FundingCreated { fn clone(&self) -> Self { Self { inner: if <*mut nativeFundingCreated>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2570,12 +2564,12 @@ impl Clone for FundingCreated { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FundingCreated_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingCreated)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFundingCreated) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the FundingCreated pub extern "C" fn FundingCreated_clone(orig: &FundingCreated) -> FundingCreated { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a FundingCreated object pub extern "C" fn FundingCreated_debug_str_void(o: *const c_void) -> Str { @@ -2666,7 +2660,7 @@ impl FundingSigned { /// The channel ID #[no_mangle] pub extern "C" fn FundingSigned_get_channel_id(this_ptr: &FundingSigned) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut FundingSigned::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -2677,7 +2671,7 @@ pub extern "C" fn FundingSigned_set_channel_id(this_ptr: &mut FundingSigned, mut /// 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::ECDSASignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; + let mut inner_val = &mut FundingSigned::get_native_mut_ref(this_ptr).signature; crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The signature of the channel acceptor (fundee) on the initial commitment transaction @@ -2698,7 +2692,7 @@ impl Clone for FundingSigned { fn clone(&self) -> Self { Self { inner: if <*mut nativeFundingSigned>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2706,12 +2700,12 @@ impl Clone for FundingSigned { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FundingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFundingSigned)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFundingSigned) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the FundingSigned pub extern "C" fn FundingSigned_clone(orig: &FundingSigned) -> FundingSigned { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a FundingSigned object pub extern "C" fn FundingSigned_debug_str_void(o: *const c_void) -> Str { @@ -2800,7 +2794,7 @@ impl ChannelReady { /// The channel ID #[no_mangle] pub extern "C" fn ChannelReady_get_channel_id(this_ptr: &ChannelReady) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ChannelReady::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -2811,7 +2805,7 @@ pub extern "C" fn ChannelReady_set_channel_id(this_ptr: &mut ChannelReady, mut v /// The per-commitment point of the second commitment transaction #[no_mangle] pub extern "C" fn ChannelReady_get_next_per_commitment_point(this_ptr: &ChannelReady) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point; + let mut inner_val = &mut ChannelReady::get_native_mut_ref(this_ptr).next_per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The per-commitment point of the second commitment transaction @@ -2825,7 +2819,7 @@ pub extern "C" fn ChannelReady_set_next_per_commitment_point(this_ptr: &mut Chan /// messages' recipient. #[no_mangle] pub extern "C" fn ChannelReady_get_short_channel_id_alias(this_ptr: &ChannelReady) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id_alias; + let mut inner_val = &mut ChannelReady::get_native_mut_ref(this_ptr).short_channel_id_alias; 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 } @@ -2853,7 +2847,7 @@ impl Clone for ChannelReady { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelReady>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2861,12 +2855,12 @@ impl Clone for ChannelReady { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelReady_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReady)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelReady) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelReady pub extern "C" fn ChannelReady_clone(orig: &ChannelReady) -> ChannelReady { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelReady object pub extern "C" fn ChannelReady_debug_str_void(o: *const c_void) -> Str { @@ -2954,7 +2948,7 @@ impl Stfu { /// The channel ID where quiescence is intended #[no_mangle] pub extern "C" fn Stfu_get_channel_id(this_ptr: &Stfu) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut Stfu::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID where quiescence is intended @@ -2962,21 +2956,21 @@ pub extern "C" fn Stfu_get_channel_id(this_ptr: &Stfu) -> crate::lightning::ln:: pub extern "C" fn Stfu_set_channel_id(this_ptr: &mut Stfu, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Initiator flag, 1 if initiating, 0 if replying to an stfu. +/// Initiator flag, true if initiating, false if replying to an stfu. #[no_mangle] -pub extern "C" fn Stfu_get_initiator(this_ptr: &Stfu) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().initiator; +pub extern "C" fn Stfu_get_initiator(this_ptr: &Stfu) -> bool { + let mut inner_val = &mut Stfu::get_native_mut_ref(this_ptr).initiator; *inner_val } -/// Initiator flag, 1 if initiating, 0 if replying to an stfu. +/// Initiator flag, true if initiating, false if replying to an stfu. #[no_mangle] -pub extern "C" fn Stfu_set_initiator(this_ptr: &mut Stfu, mut val: u8) { +pub extern "C" fn Stfu_set_initiator(this_ptr: &mut Stfu, mut val: bool) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.initiator = val; } /// Constructs a new Stfu given each field #[must_use] #[no_mangle] -pub extern "C" fn Stfu_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut initiator_arg: u8) -> Stfu { +pub extern "C" fn Stfu_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut initiator_arg: bool) -> Stfu { Stfu { inner: ObjOps::heap_alloc(nativeStfu { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, initiator: initiator_arg, @@ -2986,7 +2980,7 @@ impl Clone for Stfu { fn clone(&self) -> Self { Self { inner: if <*mut nativeStfu>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2994,12 +2988,12 @@ impl Clone for Stfu { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Stfu_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeStfu)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeStfu) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Stfu pub extern "C" fn Stfu_clone(orig: &Stfu) -> Stfu { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Stfu object pub extern "C" fn Stfu_debug_str_void(o: *const c_void) -> Str { @@ -3077,7 +3071,7 @@ impl SpliceInit { /// The channel ID where splicing is intended #[no_mangle] pub extern "C" fn SpliceInit_get_channel_id(this_ptr: &SpliceInit) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID where splicing is intended @@ -3089,7 +3083,7 @@ pub extern "C" fn SpliceInit_set_channel_id(this_ptr: &mut SpliceInit, mut val: /// or remove from its channel balance (splice-out). #[no_mangle] pub extern "C" fn SpliceInit_get_funding_contribution_satoshis(this_ptr: &SpliceInit) -> i64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_contribution_satoshis; + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).funding_contribution_satoshis; *inner_val } /// The amount the splice initiator is intending to add to its channel balance (splice-in) @@ -3100,19 +3094,19 @@ pub extern "C" fn SpliceInit_set_funding_contribution_satoshis(this_ptr: &mut Sp } /// The feerate for the new funding transaction, set by the splice initiator #[no_mangle] -pub extern "C" fn SpliceInit_get_funding_feerate_perkw(this_ptr: &SpliceInit) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_feerate_perkw; +pub extern "C" fn SpliceInit_get_funding_feerate_per_kw(this_ptr: &SpliceInit) -> u32 { + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).funding_feerate_per_kw; *inner_val } /// The feerate for the new funding transaction, set by the splice initiator #[no_mangle] -pub extern "C" fn SpliceInit_set_funding_feerate_perkw(this_ptr: &mut SpliceInit, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_feerate_perkw = val; +pub extern "C" fn SpliceInit_set_funding_feerate_per_kw(this_ptr: &mut SpliceInit, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_feerate_per_kw = val; } /// The locktime for the new funding transaction #[no_mangle] pub extern "C" fn SpliceInit_get_locktime(this_ptr: &SpliceInit) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime; + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).locktime; *inner_val } /// The locktime for the new funding transaction @@ -3123,7 +3117,7 @@ pub extern "C" fn SpliceInit_set_locktime(this_ptr: &mut SpliceInit, mut val: u3 /// The key of the sender (splice initiator) controlling the new funding transaction #[no_mangle] pub extern "C" fn SpliceInit_get_funding_pubkey(this_ptr: &SpliceInit) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey; + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).funding_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The key of the sender (splice initiator) controlling the new funding transaction @@ -3134,7 +3128,7 @@ pub extern "C" fn SpliceInit_set_funding_pubkey(this_ptr: &mut SpliceInit, mut v /// If set, only confirmed inputs added (by the splice acceptor) will be accepted #[no_mangle] pub extern "C" fn SpliceInit_get_require_confirmed_inputs(this_ptr: &SpliceInit) -> crate::c_types::derived::COption_NoneZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().require_confirmed_inputs; + let mut inner_val = &mut SpliceInit::get_native_mut_ref(this_ptr).require_confirmed_inputs; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; local_inner_val } @@ -3147,12 +3141,12 @@ pub extern "C" fn SpliceInit_set_require_confirmed_inputs(this_ptr: &mut SpliceI /// Constructs a new SpliceInit given each field #[must_use] #[no_mangle] -pub extern "C" fn SpliceInit_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut funding_contribution_satoshis_arg: i64, mut funding_feerate_perkw_arg: u32, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> SpliceInit { +pub extern "C" fn SpliceInit_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut funding_contribution_satoshis_arg: i64, mut funding_feerate_per_kw_arg: u32, mut locktime_arg: u32, mut funding_pubkey_arg: crate::c_types::PublicKey, mut require_confirmed_inputs_arg: crate::c_types::derived::COption_NoneZ) -> SpliceInit { let mut local_require_confirmed_inputs_arg = if require_confirmed_inputs_arg.is_some() { Some( { () /*require_confirmed_inputs_arg.take()*/ }) } else { None }; SpliceInit { inner: ObjOps::heap_alloc(nativeSpliceInit { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, funding_contribution_satoshis: funding_contribution_satoshis_arg, - funding_feerate_perkw: funding_feerate_perkw_arg, + funding_feerate_per_kw: funding_feerate_per_kw_arg, locktime: locktime_arg, funding_pubkey: funding_pubkey_arg.into_rust(), require_confirmed_inputs: local_require_confirmed_inputs_arg, @@ -3162,7 +3156,7 @@ impl Clone for SpliceInit { fn clone(&self) -> Self { Self { inner: if <*mut nativeSpliceInit>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3170,12 +3164,12 @@ impl Clone for SpliceInit { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn SpliceInit_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceInit)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeSpliceInit) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the SpliceInit pub extern "C" fn SpliceInit_clone(orig: &SpliceInit) -> SpliceInit { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a SpliceInit object pub extern "C" fn SpliceInit_debug_str_void(o: *const c_void) -> Str { @@ -3253,7 +3247,7 @@ impl SpliceAck { /// The channel ID where splicing is intended #[no_mangle] pub extern "C" fn SpliceAck_get_channel_id(this_ptr: &SpliceAck) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut SpliceAck::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID where splicing is intended @@ -3265,7 +3259,7 @@ pub extern "C" fn SpliceAck_set_channel_id(this_ptr: &mut SpliceAck, mut val: cr /// or remove from its channel balance (splice-out). #[no_mangle] pub extern "C" fn SpliceAck_get_funding_contribution_satoshis(this_ptr: &SpliceAck) -> i64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_contribution_satoshis; + let mut inner_val = &mut SpliceAck::get_native_mut_ref(this_ptr).funding_contribution_satoshis; *inner_val } /// The amount the splice acceptor is intending to add to its channel balance (splice-in) @@ -3277,7 +3271,7 @@ pub extern "C" fn SpliceAck_set_funding_contribution_satoshis(this_ptr: &mut Spl /// The key of the sender (splice acceptor) controlling the new funding transaction #[no_mangle] pub extern "C" fn SpliceAck_get_funding_pubkey(this_ptr: &SpliceAck) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_pubkey; + let mut inner_val = &mut SpliceAck::get_native_mut_ref(this_ptr).funding_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The key of the sender (splice acceptor) controlling the new funding transaction @@ -3288,7 +3282,7 @@ pub extern "C" fn SpliceAck_set_funding_pubkey(this_ptr: &mut SpliceAck, mut val /// If set, only confirmed inputs added (by the splice initiator) will be accepted #[no_mangle] pub extern "C" fn SpliceAck_get_require_confirmed_inputs(this_ptr: &SpliceAck) -> crate::c_types::derived::COption_NoneZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().require_confirmed_inputs; + let mut inner_val = &mut SpliceAck::get_native_mut_ref(this_ptr).require_confirmed_inputs; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; local_inner_val } @@ -3314,7 +3308,7 @@ impl Clone for SpliceAck { fn clone(&self) -> Self { Self { inner: if <*mut nativeSpliceAck>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3322,12 +3316,12 @@ impl Clone for SpliceAck { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn SpliceAck_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceAck)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeSpliceAck) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the SpliceAck pub extern "C" fn SpliceAck_clone(orig: &SpliceAck) -> SpliceAck { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a SpliceAck object pub extern "C" fn SpliceAck_debug_str_void(o: *const c_void) -> Str { @@ -3405,7 +3399,7 @@ impl SpliceLocked { /// The channel ID #[no_mangle] pub extern "C" fn SpliceLocked_get_channel_id(this_ptr: &SpliceLocked) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut SpliceLocked::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -3416,7 +3410,7 @@ pub extern "C" fn SpliceLocked_set_channel_id(this_ptr: &mut SpliceLocked, mut v /// The ID of the new funding transaction that has been locked #[no_mangle] pub extern "C" fn SpliceLocked_get_splice_txid(this_ptr: &SpliceLocked) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().splice_txid; + let mut inner_val = &mut SpliceLocked::get_native_mut_ref(this_ptr).splice_txid; inner_val.as_ref() } /// The ID of the new funding transaction that has been locked @@ -3437,7 +3431,7 @@ impl Clone for SpliceLocked { fn clone(&self) -> Self { Self { inner: if <*mut nativeSpliceLocked>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3445,12 +3439,12 @@ impl Clone for SpliceLocked { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn SpliceLocked_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSpliceLocked)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeSpliceLocked) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the SpliceLocked pub extern "C" fn SpliceLocked_clone(orig: &SpliceLocked) -> SpliceLocked { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a SpliceLocked object pub extern "C" fn SpliceLocked_debug_str_void(o: *const c_void) -> Str { @@ -3529,7 +3523,7 @@ impl TxAddInput { /// The channel ID #[no_mangle] pub extern "C" fn TxAddInput_get_channel_id(this_ptr: &TxAddInput) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -3541,7 +3535,7 @@ pub extern "C" fn TxAddInput_set_channel_id(this_ptr: &mut TxAddInput, mut val: /// non-initiators. #[no_mangle] pub extern "C" fn TxAddInput_get_serial_id(this_ptr: &TxAddInput) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id; + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).serial_id; *inner_val } /// A randomly chosen unique identifier for this input, which is even for initiators and odd for @@ -3550,23 +3544,25 @@ pub extern "C" fn TxAddInput_get_serial_id(this_ptr: &TxAddInput) -> u64 { pub extern "C" fn TxAddInput_set_serial_id(this_ptr: &mut TxAddInput, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.serial_id = val; } -/// Serialized transaction that contains the output this input spends to verify that it is non -/// malleable. +/// Serialized transaction that contains the output this input spends to verify that it is +/// non-malleable. Omitted for shared input. #[no_mangle] -pub extern "C" fn TxAddInput_get_prevtx(this_ptr: &TxAddInput) -> crate::lightning::util::ser::TransactionU16LenLimited { - let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx; - crate::lightning::util::ser::TransactionU16LenLimited { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::ser::TransactionU16LenLimited<>) as *mut _) }, is_owned: false } +pub extern "C" fn TxAddInput_get_prevtx(this_ptr: &TxAddInput) -> crate::c_types::derived::COption_TransactionZ { + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).prevtx; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_TransactionZ::None } else { crate::c_types::derived::COption_TransactionZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::Transaction::from_bitcoin(&(*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val } -/// Serialized transaction that contains the output this input spends to verify that it is non -/// malleable. +/// Serialized transaction that contains the output this input spends to verify that it is +/// non-malleable. Omitted for shared input. #[no_mangle] -pub extern "C" fn TxAddInput_set_prevtx(this_ptr: &mut TxAddInput, mut val: crate::lightning::util::ser::TransactionU16LenLimited) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn TxAddInput_set_prevtx(this_ptr: &mut TxAddInput, mut val: crate::c_types::derived::COption_TransactionZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_bitcoin() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.prevtx = local_val; } /// The index of the output being spent #[no_mangle] pub extern "C" fn TxAddInput_get_prevtx_out(this_ptr: &TxAddInput) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().prevtx_out; + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).prevtx_out; *inner_val } /// The index of the output being spent @@ -3577,7 +3573,7 @@ pub extern "C" fn TxAddInput_set_prevtx_out(this_ptr: &mut TxAddInput, mut val: /// The sequence number of this input #[no_mangle] pub extern "C" fn TxAddInput_get_sequence(this_ptr: &TxAddInput) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().sequence; + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).sequence; *inner_val } /// The sequence number of this input @@ -3588,7 +3584,7 @@ pub extern "C" fn TxAddInput_set_sequence(this_ptr: &mut TxAddInput, mut val: u3 /// The ID of the previous funding transaction, when it is being added as an input during splicing #[no_mangle] pub extern "C" fn TxAddInput_get_shared_input_txid(this_ptr: &TxAddInput) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().shared_input_txid; + let mut inner_val = &mut TxAddInput::get_native_mut_ref(this_ptr).shared_input_txid; 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().as_ref() } }) }; local_inner_val } @@ -3601,12 +3597,13 @@ pub extern "C" fn TxAddInput_set_shared_input_txid(this_ptr: &mut TxAddInput, mu /// Constructs a new TxAddInput given each field #[must_use] #[no_mangle] -pub extern "C" fn TxAddInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut prevtx_arg: crate::lightning::util::ser::TransactionU16LenLimited, mut prevtx_out_arg: u32, mut sequence_arg: u32, mut shared_input_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> TxAddInput { +pub extern "C" fn TxAddInput_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut serial_id_arg: u64, mut prevtx_arg: crate::c_types::derived::COption_TransactionZ, mut prevtx_out_arg: u32, mut sequence_arg: u32, mut shared_input_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> TxAddInput { + let mut local_prevtx_arg = { /*prevtx_arg*/ let prevtx_arg_opt = prevtx_arg; if prevtx_arg_opt.is_none() { None } else { Some({ { { prevtx_arg_opt.take() }.into_bitcoin() }})} }; let mut local_shared_input_txid_arg = { /*shared_input_txid_arg*/ let shared_input_txid_arg_opt = shared_input_txid_arg; if shared_input_txid_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ shared_input_txid_arg_opt.take() }.data[..]).unwrap() }})} }; TxAddInput { inner: ObjOps::heap_alloc(nativeTxAddInput { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, serial_id: serial_id_arg, - prevtx: *unsafe { Box::from_raw(prevtx_arg.take_inner()) }, + prevtx: local_prevtx_arg, prevtx_out: prevtx_out_arg, sequence: sequence_arg, shared_input_txid: local_shared_input_txid_arg, @@ -3616,7 +3613,7 @@ impl Clone for TxAddInput { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxAddInput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3624,12 +3621,12 @@ impl Clone for TxAddInput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxAddInput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddInput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxAddInput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxAddInput pub extern "C" fn TxAddInput_clone(orig: &TxAddInput) -> TxAddInput { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxAddInput object pub extern "C" fn TxAddInput_debug_str_void(o: *const c_void) -> Str { @@ -3718,7 +3715,7 @@ impl TxAddOutput { /// The channel ID #[no_mangle] pub extern "C" fn TxAddOutput_get_channel_id(this_ptr: &TxAddOutput) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxAddOutput::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -3730,7 +3727,7 @@ pub extern "C" fn TxAddOutput_set_channel_id(this_ptr: &mut TxAddOutput, mut val /// non-initiators. #[no_mangle] pub extern "C" fn TxAddOutput_get_serial_id(this_ptr: &TxAddOutput) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id; + let mut inner_val = &mut TxAddOutput::get_native_mut_ref(this_ptr).serial_id; *inner_val } /// A randomly chosen unique identifier for this output, which is even for initiators and odd for @@ -3742,7 +3739,7 @@ pub extern "C" fn TxAddOutput_set_serial_id(this_ptr: &mut TxAddOutput, mut val: /// The satoshi value of the output #[no_mangle] pub extern "C" fn TxAddOutput_get_sats(this_ptr: &TxAddOutput) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().sats; + let mut inner_val = &mut TxAddOutput::get_native_mut_ref(this_ptr).sats; *inner_val } /// The satoshi value of the output @@ -3753,7 +3750,7 @@ pub extern "C" fn TxAddOutput_set_sats(this_ptr: &mut TxAddOutput, mut val: u64) /// The scriptPubKey for the output #[no_mangle] pub extern "C" fn TxAddOutput_get_script(this_ptr: &TxAddOutput) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().script; + let mut inner_val = &mut TxAddOutput::get_native_mut_ref(this_ptr).script; inner_val.as_bytes().to_vec().into() } /// The scriptPubKey for the output @@ -3776,7 +3773,7 @@ impl Clone for TxAddOutput { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxAddOutput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3784,12 +3781,12 @@ impl Clone for TxAddOutput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxAddOutput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAddOutput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxAddOutput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxAddOutput pub extern "C" fn TxAddOutput_clone(orig: &TxAddOutput) -> TxAddOutput { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxAddOutput object pub extern "C" fn TxAddOutput_debug_str_void(o: *const c_void) -> Str { @@ -3878,7 +3875,7 @@ impl TxRemoveInput { /// The channel ID #[no_mangle] pub extern "C" fn TxRemoveInput_get_channel_id(this_ptr: &TxRemoveInput) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxRemoveInput::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -3889,7 +3886,7 @@ pub extern "C" fn TxRemoveInput_set_channel_id(this_ptr: &mut TxRemoveInput, mut /// The serial ID of the input to be removed #[no_mangle] pub extern "C" fn TxRemoveInput_get_serial_id(this_ptr: &TxRemoveInput) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id; + let mut inner_val = &mut TxRemoveInput::get_native_mut_ref(this_ptr).serial_id; *inner_val } /// The serial ID of the input to be removed @@ -3910,7 +3907,7 @@ impl Clone for TxRemoveInput { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxRemoveInput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -3918,12 +3915,12 @@ impl Clone for TxRemoveInput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxRemoveInput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveInput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxRemoveInput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxRemoveInput pub extern "C" fn TxRemoveInput_clone(orig: &TxRemoveInput) -> TxRemoveInput { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxRemoveInput object pub extern "C" fn TxRemoveInput_debug_str_void(o: *const c_void) -> Str { @@ -4012,7 +4009,7 @@ impl TxRemoveOutput { /// The channel ID #[no_mangle] pub extern "C" fn TxRemoveOutput_get_channel_id(this_ptr: &TxRemoveOutput) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxRemoveOutput::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4023,7 +4020,7 @@ pub extern "C" fn TxRemoveOutput_set_channel_id(this_ptr: &mut TxRemoveOutput, m /// The serial ID of the output to be removed #[no_mangle] pub extern "C" fn TxRemoveOutput_get_serial_id(this_ptr: &TxRemoveOutput) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().serial_id; + let mut inner_val = &mut TxRemoveOutput::get_native_mut_ref(this_ptr).serial_id; *inner_val } /// The serial ID of the output to be removed @@ -4044,7 +4041,7 @@ impl Clone for TxRemoveOutput { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxRemoveOutput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4052,12 +4049,12 @@ impl Clone for TxRemoveOutput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxRemoveOutput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxRemoveOutput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxRemoveOutput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxRemoveOutput pub extern "C" fn TxRemoveOutput_clone(orig: &TxRemoveOutput) -> TxRemoveOutput { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxRemoveOutput object pub extern "C" fn TxRemoveOutput_debug_str_void(o: *const c_void) -> Str { @@ -4147,7 +4144,7 @@ impl TxComplete { /// The channel ID #[no_mangle] pub extern "C" fn TxComplete_get_channel_id(this_ptr: &TxComplete) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxComplete::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4167,7 +4164,7 @@ impl Clone for TxComplete { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxComplete>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4175,12 +4172,12 @@ impl Clone for TxComplete { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxComplete_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxComplete)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxComplete) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxComplete pub extern "C" fn TxComplete_clone(orig: &TxComplete) -> TxComplete { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxComplete object pub extern "C" fn TxComplete_debug_str_void(o: *const c_void) -> Str { @@ -4270,7 +4267,7 @@ impl TxSignatures { /// The channel ID #[no_mangle] pub extern "C" fn TxSignatures_get_channel_id(this_ptr: &TxSignatures) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxSignatures::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4281,7 +4278,7 @@ pub extern "C" fn TxSignatures_set_channel_id(this_ptr: &mut TxSignatures, mut v /// The TXID #[no_mangle] pub extern "C" fn TxSignatures_get_tx_hash(this_ptr: &TxSignatures) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().tx_hash; + let mut inner_val = &mut TxSignatures::get_native_mut_ref(this_ptr).tx_hash; inner_val.as_ref() } /// The TXID @@ -4294,7 +4291,7 @@ pub extern "C" fn TxSignatures_set_tx_hash(this_ptr: &mut TxSignatures, mut val: /// Returns a copy of the field. #[no_mangle] pub extern "C" fn TxSignatures_get_witnesses(this_ptr: &TxSignatures) -> crate::c_types::derived::CVec_WitnessZ { - let mut inner_val = this_ptr.get_native_mut_ref().witnesses.clone(); + let mut inner_val = TxSignatures::get_native_mut_ref(this_ptr).witnesses.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::Witness::from_bitcoin(&item) }); }; local_inner_val.into() } @@ -4307,7 +4304,7 @@ pub extern "C" fn TxSignatures_set_witnesses(this_ptr: &mut TxSignatures, mut va /// Optional signature for the shared input -- the previous funding outpoint -- signed by both peers #[no_mangle] pub extern "C" fn TxSignatures_get_shared_input_signature(this_ptr: &TxSignatures) -> crate::c_types::derived::COption_ECDSASignatureZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().shared_input_signature; + let mut inner_val = &mut TxSignatures::get_native_mut_ref(this_ptr).shared_input_signature; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } @@ -4334,7 +4331,7 @@ impl Clone for TxSignatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxSignatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4342,12 +4339,12 @@ impl Clone for TxSignatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxSignatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxSignatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxSignatures pub extern "C" fn TxSignatures_clone(orig: &TxSignatures) -> TxSignatures { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxSignatures object pub extern "C" fn TxSignatures_debug_str_void(o: *const c_void) -> Str { @@ -4437,7 +4434,7 @@ impl TxInitRbf { /// The channel ID #[no_mangle] pub extern "C" fn TxInitRbf_get_channel_id(this_ptr: &TxInitRbf) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxInitRbf::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4448,7 +4445,7 @@ pub extern "C" fn TxInitRbf_set_channel_id(this_ptr: &mut TxInitRbf, mut val: cr /// The locktime of the transaction #[no_mangle] pub extern "C" fn TxInitRbf_get_locktime(this_ptr: &TxInitRbf) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().locktime; + let mut inner_val = &mut TxInitRbf::get_native_mut_ref(this_ptr).locktime; *inner_val } /// The locktime of the transaction @@ -4459,7 +4456,7 @@ pub extern "C" fn TxInitRbf_set_locktime(this_ptr: &mut TxInitRbf, mut val: u32) /// The feerate of the transaction #[no_mangle] pub extern "C" fn TxInitRbf_get_feerate_sat_per_1000_weight(this_ptr: &TxInitRbf) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_sat_per_1000_weight; + let mut inner_val = &mut TxInitRbf::get_native_mut_ref(this_ptr).feerate_sat_per_1000_weight; *inner_val } /// The feerate of the transaction @@ -4471,7 +4468,7 @@ pub extern "C" fn TxInitRbf_set_feerate_sat_per_1000_weight(this_ptr: &mut TxIni /// (e.g. splice-out) the funding output of the transaction #[no_mangle] pub extern "C" fn TxInitRbf_get_funding_output_contribution(this_ptr: &TxInitRbf) -> crate::c_types::derived::COption_i64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_output_contribution; + let mut inner_val = &mut TxInitRbf::get_native_mut_ref(this_ptr).funding_output_contribution; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_i64Z::None } else { crate::c_types::derived::COption_i64Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -4498,7 +4495,7 @@ impl Clone for TxInitRbf { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxInitRbf>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4506,12 +4503,12 @@ impl Clone for TxInitRbf { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxInitRbf_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxInitRbf)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxInitRbf) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxInitRbf pub extern "C" fn TxInitRbf_clone(orig: &TxInitRbf) -> TxInitRbf { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxInitRbf object pub extern "C" fn TxInitRbf_debug_str_void(o: *const c_void) -> Str { @@ -4601,7 +4598,7 @@ impl TxAckRbf { /// The channel ID #[no_mangle] pub extern "C" fn TxAckRbf_get_channel_id(this_ptr: &TxAckRbf) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxAckRbf::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4613,7 +4610,7 @@ pub extern "C" fn TxAckRbf_set_channel_id(this_ptr: &mut TxAckRbf, mut val: crat /// (e.g. splice-out) the funding output of the transaction #[no_mangle] pub extern "C" fn TxAckRbf_get_funding_output_contribution(this_ptr: &TxAckRbf) -> crate::c_types::derived::COption_i64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_output_contribution; + let mut inner_val = &mut TxAckRbf::get_native_mut_ref(this_ptr).funding_output_contribution; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_i64Z::None } else { crate::c_types::derived::COption_i64Z::Some( { inner_val.unwrap() }) }; local_inner_val } @@ -4638,7 +4635,7 @@ impl Clone for TxAckRbf { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxAckRbf>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4646,12 +4643,12 @@ impl Clone for TxAckRbf { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxAckRbf_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAckRbf)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxAckRbf) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxAckRbf pub extern "C" fn TxAckRbf_clone(orig: &TxAckRbf) -> TxAckRbf { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxAckRbf object pub extern "C" fn TxAckRbf_debug_str_void(o: *const c_void) -> Str { @@ -4740,7 +4737,7 @@ impl TxAbort { /// The channel ID #[no_mangle] pub extern "C" fn TxAbort_get_channel_id(this_ptr: &TxAbort) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TxAbort::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4753,7 +4750,7 @@ pub extern "C" fn TxAbort_set_channel_id(this_ptr: &mut TxAbort, mut val: crate: /// Returns a copy of the field. #[no_mangle] pub extern "C" fn TxAbort_get_data(this_ptr: &TxAbort) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = this_ptr.get_native_mut_ref().data.clone(); + let mut inner_val = TxAbort::get_native_mut_ref(this_ptr).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() } @@ -4777,7 +4774,7 @@ impl Clone for TxAbort { fn clone(&self) -> Self { Self { inner: if <*mut nativeTxAbort>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4785,12 +4782,12 @@ impl Clone for TxAbort { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxAbort_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTxAbort)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTxAbort) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TxAbort pub extern "C" fn TxAbort_clone(orig: &TxAbort) -> TxAbort { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TxAbort object pub extern "C" fn TxAbort_debug_str_void(o: *const c_void) -> Str { @@ -4879,7 +4876,7 @@ impl Shutdown { /// The channel ID #[no_mangle] pub extern "C" fn Shutdown_get_channel_id(this_ptr: &Shutdown) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut Shutdown::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -4892,7 +4889,7 @@ pub extern "C" fn Shutdown_set_channel_id(this_ptr: &mut Shutdown, mut val: crat /// Must be in one of these forms: P2PKH, P2SH, P2WPKH, P2WSH, P2TR. #[no_mangle] pub extern "C" fn Shutdown_get_scriptpubkey(this_ptr: &Shutdown) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().scriptpubkey; + let mut inner_val = &mut Shutdown::get_native_mut_ref(this_ptr).scriptpubkey; inner_val.as_bytes().to_vec().into() } /// The destination of this peer's funds on closing. @@ -4915,7 +4912,7 @@ impl Clone for Shutdown { fn clone(&self) -> Self { Self { inner: if <*mut nativeShutdown>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -4923,12 +4920,12 @@ impl Clone for Shutdown { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Shutdown_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeShutdown)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeShutdown) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Shutdown pub extern "C" fn Shutdown_clone(orig: &Shutdown) -> Shutdown { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Shutdown object pub extern "C" fn Shutdown_debug_str_void(o: *const c_void) -> Str { @@ -5019,7 +5016,7 @@ impl ClosingSignedFeeRange { /// transaction. #[no_mangle] pub extern "C" fn ClosingSignedFeeRange_get_min_fee_satoshis(this_ptr: &ClosingSignedFeeRange) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_fee_satoshis; + let mut inner_val = &mut ClosingSignedFeeRange::get_native_mut_ref(this_ptr).min_fee_satoshis; *inner_val } /// The minimum absolute fee, in satoshis, which the sender is willing to place on the closing @@ -5032,7 +5029,7 @@ pub extern "C" fn ClosingSignedFeeRange_set_min_fee_satoshis(this_ptr: &mut Clos /// transaction. #[no_mangle] pub extern "C" fn ClosingSignedFeeRange_get_max_fee_satoshis(this_ptr: &ClosingSignedFeeRange) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_fee_satoshis; + let mut inner_val = &mut ClosingSignedFeeRange::get_native_mut_ref(this_ptr).max_fee_satoshis; *inner_val } /// The maximum absolute fee, in satoshis, which the sender is willing to place on the closing @@ -5054,7 +5051,7 @@ impl Clone for ClosingSignedFeeRange { fn clone(&self) -> Self { Self { inner: if <*mut nativeClosingSignedFeeRange>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -5062,12 +5059,12 @@ impl Clone for ClosingSignedFeeRange { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingSignedFeeRange_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingSignedFeeRange)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClosingSignedFeeRange) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ClosingSignedFeeRange pub extern "C" fn ClosingSignedFeeRange_clone(orig: &ClosingSignedFeeRange) -> ClosingSignedFeeRange { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ClosingSignedFeeRange object pub extern "C" fn ClosingSignedFeeRange_debug_str_void(o: *const c_void) -> Str { @@ -5156,7 +5153,7 @@ impl ClosingSigned { /// The channel ID #[no_mangle] pub extern "C" fn ClosingSigned_get_channel_id(this_ptr: &ClosingSigned) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut ClosingSigned::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID @@ -5167,7 +5164,7 @@ pub extern "C" fn ClosingSigned_set_channel_id(this_ptr: &mut ClosingSigned, mut /// The proposed total fee for the closing transaction #[no_mangle] pub extern "C" fn ClosingSigned_get_fee_satoshis(this_ptr: &ClosingSigned) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_satoshis; + let mut inner_val = &mut ClosingSigned::get_native_mut_ref(this_ptr).fee_satoshis; *inner_val } /// The proposed total fee for the closing transaction @@ -5178,7 +5175,7 @@ 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::ECDSASignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().signature; + let mut inner_val = &mut ClosingSigned::get_native_mut_ref(this_ptr).signature; crate::c_types::ECDSASignature::from_rust(&inner_val) } /// A signature on the closing transaction @@ -5192,7 +5189,7 @@ pub extern "C" fn ClosingSigned_set_signature(this_ptr: &mut ClosingSigned, mut /// 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 ClosingSigned_get_fee_range(this_ptr: &ClosingSigned) -> crate::lightning::ln::msgs::ClosingSignedFeeRange { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_range; + let mut inner_val = &mut ClosingSigned::get_native_mut_ref(this_ptr).fee_range; let mut local_inner_val = crate::lightning::ln::msgs::ClosingSignedFeeRange { 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::msgs::ClosingSignedFeeRange<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -5223,7 +5220,7 @@ impl Clone for ClosingSigned { fn clone(&self) -> Self { Self { inner: if <*mut nativeClosingSigned>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -5231,12 +5228,12 @@ impl Clone for ClosingSigned { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingSigned_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeClosingSigned)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClosingSigned) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ClosingSigned pub extern "C" fn ClosingSigned_clone(orig: &ClosingSigned) -> ClosingSigned { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ClosingSigned object pub extern "C" fn ClosingSigned_debug_str_void(o: *const c_void) -> Str { @@ -5261,20 +5258,20 @@ pub extern "C" fn ClosingSigned_eq(a: &ClosingSigned, b: &ClosingSigned) -> bool if a.get_native_ref() == b.get_native_ref() { true } else { false } } -use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport; -pub(crate) type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport; +use lightning::ln::msgs::ClosingComplete as nativeClosingCompleteImport; +pub(crate) type nativeClosingComplete = nativeClosingCompleteImport; -/// An [`update_add_htlc`] message to be sent to or received from a peer. +/// A [`closing_complete`] message to be sent to or received from a peer. /// -/// [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc +/// [`closing_complete`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig #[must_use] #[repr(C)] -pub struct UpdateAddHTLC { +pub struct ClosingComplete { /// 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 nativeUpdateAddHTLC, + pub inner: *mut nativeClosingComplete, /// 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 @@ -5282,37 +5279,37 @@ pub struct UpdateAddHTLC { pub is_owned: bool, } -impl core::ops::Deref for UpdateAddHTLC { - type Target = nativeUpdateAddHTLC; +impl core::ops::Deref for ClosingComplete { + type Target = nativeClosingComplete; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UpdateAddHTLC { } -unsafe impl core::marker::Sync for UpdateAddHTLC { } -impl Drop for UpdateAddHTLC { +unsafe impl core::marker::Send for ClosingComplete { } +unsafe impl core::marker::Sync for ClosingComplete { } +impl Drop for ClosingComplete { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) { + if self.is_owned && !<*mut nativeClosingComplete>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the ClosingComplete, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { } +pub extern "C" fn ClosingComplete_free(this_obj: ClosingComplete) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC) }; +pub(crate) extern "C" fn ClosingComplete_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClosingComplete) }; } #[allow(unused)] -impl UpdateAddHTLC { - pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateAddHTLC { +impl ClosingComplete { + pub(crate) fn get_native_ref(&self) -> &'static nativeClosingComplete { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateAddHTLC { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeClosingComplete { 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 nativeUpdateAddHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeClosingComplete { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -5322,154 +5319,143 @@ impl UpdateAddHTLC { Self { inner: self.inner, is_owned: false } } } -/// The channel ID +/// The channel ID. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn ClosingComplete_get_channel_id(this_ptr: &ClosingComplete) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// The channel ID +/// The channel ID. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn ClosingComplete_set_channel_id(this_ptr: &mut ClosingComplete, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The HTLC ID +/// The destination of the closer's funds on closing. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; - *inner_val +pub extern "C" fn ClosingComplete_get_closer_scriptpubkey(this_ptr: &ClosingComplete) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).closer_scriptpubkey; + inner_val.as_bytes().to_vec().into() } -/// The HTLC ID +/// The destination of the closer's funds on closing. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; +pub extern "C" fn ClosingComplete_set_closer_scriptpubkey(this_ptr: &mut ClosingComplete, mut val: crate::c_types::derived::CVec_u8Z) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_scriptpubkey = ::bitcoin::script::ScriptBuf::from(val.into_rust()); } -/// The HTLC value in milli-satoshi +/// The destination of the closee's funds on closing. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; - *inner_val +pub extern "C" fn ClosingComplete_get_closee_scriptpubkey(this_ptr: &ClosingComplete) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).closee_scriptpubkey; + inner_val.as_bytes().to_vec().into() } -/// The HTLC value in milli-satoshi +/// The destination of the closee's funds on closing. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msat = val; +pub extern "C" fn ClosingComplete_set_closee_scriptpubkey(this_ptr: &mut ClosingComplete, mut val: crate::c_types::derived::CVec_u8Z) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closee_scriptpubkey = ::bitcoin::script::ScriptBuf::from(val.into_rust()); } -/// The payment hash, the pre-image of which controls HTLC redemption +/// The proposed total fee for the closing transaction. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; - &inner_val.0 +pub extern "C" fn ClosingComplete_get_fee_satoshis(this_ptr: &ClosingComplete) -> u64 { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).fee_satoshis; + *inner_val } -/// The payment hash, the pre-image of which controls HTLC redemption +/// The proposed total fee for the closing transaction. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); +pub extern "C" fn ClosingComplete_set_fee_satoshis(this_ptr: &mut ClosingComplete, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_satoshis = val; } -/// The expiry height of the HTLC +/// The locktime of the closing transaction. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry; +pub extern "C" fn ClosingComplete_get_locktime(this_ptr: &ClosingComplete) -> u32 { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).locktime; *inner_val } -/// The expiry height of the HTLC +/// The locktime of the closing transaction. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry = val; +pub extern "C" fn ClosingComplete_set_locktime(this_ptr: &mut ClosingComplete, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.locktime = val; } -/// The extra fee skimmed by the sender of this message. See -/// [`ChannelConfig::accept_underpaying_htlcs`]. -/// -/// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs +/// A signature on the closing transaction omitting the `closee` output. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_skimmed_fee_msat(this_ptr: &UpdateAddHTLC) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().skimmed_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() }) }; +pub extern "C" fn ClosingComplete_get_closer_output_only(this_ptr: &ClosingComplete) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).closer_output_only; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } -/// The extra fee skimmed by the sender of this message. See -/// [`ChannelConfig::accept_underpaying_htlcs`]. -/// -/// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs +/// A signature on the closing transaction omitting the `closee` output. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_skimmed_fee_msat(this_ptr: &mut UpdateAddHTLC, 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) }.skimmed_fee_msat = local_val; +pub extern "C" fn ClosingComplete_set_closer_output_only(this_ptr: &mut ClosingComplete, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_output_only = local_val; } -/// The onion routing packet with encrypted data for the next hop. +/// A signature on the closing transaction omitting the `closer` output. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_onion_routing_packet(this_ptr: &UpdateAddHTLC) -> crate::lightning::ln::msgs::OnionPacket { - let mut inner_val = &mut this_ptr.get_native_mut_ref().onion_routing_packet; - crate::lightning::ln::msgs::OnionPacket { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::OnionPacket<>) as *mut _) }, is_owned: false } +pub extern "C" fn ClosingComplete_get_closee_output_only(this_ptr: &ClosingComplete) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).closee_output_only; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val } -/// The onion routing packet with encrypted data for the next hop. +/// A signature on the closing transaction omitting the `closer` output. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_onion_routing_packet(this_ptr: &mut UpdateAddHTLC, mut val: crate::lightning::ln::msgs::OnionPacket) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.onion_routing_packet = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn ClosingComplete_set_closee_output_only(this_ptr: &mut ClosingComplete, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closee_output_only = local_val; } -/// Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion -/// routing packet and the recipient-provided encrypted payload within. -/// -/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None +/// A signature on the closing transaction covering both `closer` and `closee` outputs. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_get_blinding_point(this_ptr: &UpdateAddHTLC) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().blinding_point; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; +pub extern "C" fn ClosingComplete_get_closer_and_closee_outputs(this_ptr: &ClosingComplete) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingComplete::get_native_mut_ref(this_ptr).closer_and_closee_outputs; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; local_inner_val } -/// Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion -/// routing packet and the recipient-provided encrypted payload within. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +/// A signature on the closing transaction covering both `closer` and `closee` outputs. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_set_blinding_point(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::PublicKey) { - let mut local_val = if val.is_null() { None } else { Some( { val.into_rust() }) }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinding_point = local_val; +pub extern "C" fn ClosingComplete_set_closer_and_closee_outputs(this_ptr: &mut ClosingComplete, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_and_closee_outputs = local_val; } -/// Constructs a new UpdateAddHTLC given each field -/// -/// Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Constructs a new ClosingComplete given each field #[must_use] #[no_mangle] -pub extern "C" fn UpdateAddHTLC_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut htlc_id_arg: u64, mut amount_msat_arg: u64, mut payment_hash_arg: crate::c_types::ThirtyTwoBytes, mut cltv_expiry_arg: u32, mut skimmed_fee_msat_arg: crate::c_types::derived::COption_u64Z, mut onion_routing_packet_arg: crate::lightning::ln::msgs::OnionPacket, mut blinding_point_arg: crate::c_types::PublicKey) -> UpdateAddHTLC { - let mut local_skimmed_fee_msat_arg = if skimmed_fee_msat_arg.is_some() { Some( { skimmed_fee_msat_arg.take() }) } else { None }; - let mut local_blinding_point_arg = if blinding_point_arg.is_null() { None } else { Some( { blinding_point_arg.into_rust() }) }; - UpdateAddHTLC { inner: ObjOps::heap_alloc(nativeUpdateAddHTLC { +pub extern "C" fn ClosingComplete_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut closer_scriptpubkey_arg: crate::c_types::derived::CVec_u8Z, mut closee_scriptpubkey_arg: crate::c_types::derived::CVec_u8Z, mut fee_satoshis_arg: u64, mut locktime_arg: u32, mut closer_output_only_arg: crate::c_types::derived::COption_ECDSASignatureZ, mut closee_output_only_arg: crate::c_types::derived::COption_ECDSASignatureZ, mut closer_and_closee_outputs_arg: crate::c_types::derived::COption_ECDSASignatureZ) -> ClosingComplete { + let mut local_closer_output_only_arg = { /*closer_output_only_arg*/ let closer_output_only_arg_opt = closer_output_only_arg; if closer_output_only_arg_opt.is_none() { None } else { Some({ { { closer_output_only_arg_opt.take() }.into_rust() }})} }; + let mut local_closee_output_only_arg = { /*closee_output_only_arg*/ let closee_output_only_arg_opt = closee_output_only_arg; if closee_output_only_arg_opt.is_none() { None } else { Some({ { { closee_output_only_arg_opt.take() }.into_rust() }})} }; + let mut local_closer_and_closee_outputs_arg = { /*closer_and_closee_outputs_arg*/ let closer_and_closee_outputs_arg_opt = closer_and_closee_outputs_arg; if closer_and_closee_outputs_arg_opt.is_none() { None } else { Some({ { { closer_and_closee_outputs_arg_opt.take() }.into_rust() }})} }; + ClosingComplete { inner: ObjOps::heap_alloc(nativeClosingComplete { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - htlc_id: htlc_id_arg, - amount_msat: amount_msat_arg, - payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), - cltv_expiry: cltv_expiry_arg, - skimmed_fee_msat: local_skimmed_fee_msat_arg, - onion_routing_packet: *unsafe { Box::from_raw(onion_routing_packet_arg.take_inner()) }, - blinding_point: local_blinding_point_arg, + closer_scriptpubkey: ::bitcoin::script::ScriptBuf::from(closer_scriptpubkey_arg.into_rust()), + closee_scriptpubkey: ::bitcoin::script::ScriptBuf::from(closee_scriptpubkey_arg.into_rust()), + fee_satoshis: fee_satoshis_arg, + locktime: locktime_arg, + closer_output_only: local_closer_output_only_arg, + closee_output_only: local_closee_output_only_arg, + closer_and_closee_outputs: local_closer_and_closee_outputs_arg, }), is_owned: true } } -impl Clone for UpdateAddHTLC { +impl Clone for ClosingComplete { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeClosingComplete>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateAddHTLC)).clone() })) as *mut c_void +pub(crate) extern "C" fn ClosingComplete_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClosingComplete) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UpdateAddHTLC -pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC { - orig.clone() +/// Creates a copy of the ClosingComplete +pub extern "C" fn ClosingComplete_clone(orig: &ClosingComplete) -> ClosingComplete { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UpdateAddHTLC object -pub extern "C" fn UpdateAddHTLC_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateAddHTLC }).into()} -/// Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. +/// Get a string which allows debug introspection of a ClosingComplete object +pub extern "C" fn ClosingComplete_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ClosingComplete }).into()} +/// Generates a non-cryptographic 64-bit hash of the ClosingComplete. #[no_mangle] -pub extern "C" fn UpdateAddHTLC_hash(o: &UpdateAddHTLC) -> u64 { +pub extern "C" fn ClosingComplete_hash(o: &ClosingComplete) -> 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)] @@ -5477,29 +5463,30 @@ pub extern "C" fn UpdateAddHTLC_hash(o: &UpdateAddHTLC) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UpdateAddHTLCs contain equal inner contents. +/// Checks if two ClosingCompletes 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 UpdateAddHTLC_eq(a: &UpdateAddHTLC, b: &UpdateAddHTLC) -> bool { +pub extern "C" fn ClosingComplete_eq(a: &ClosingComplete, b: &ClosingComplete) -> 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 } } -use lightning::ln::msgs::OnionMessage as nativeOnionMessageImport; -pub(crate) type nativeOnionMessage = nativeOnionMessageImport; +use lightning::ln::msgs::ClosingSig as nativeClosingSigImport; +pub(crate) type nativeClosingSig = nativeClosingSigImport; -/// An onion message to be sent to or received from a peer. +/// A [`closing_sig`] message to be sent to or received from a peer. /// +/// [`closing_sig`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig #[must_use] #[repr(C)] -pub struct OnionMessage { +pub struct ClosingSig { /// 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 nativeOnionMessage, + pub inner: *mut nativeClosingSig, /// 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 @@ -5507,37 +5494,37 @@ pub struct OnionMessage { pub is_owned: bool, } -impl core::ops::Deref for OnionMessage { - type Target = nativeOnionMessage; +impl core::ops::Deref for ClosingSig { + type Target = nativeClosingSig; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for OnionMessage { } -unsafe impl core::marker::Sync for OnionMessage { } -impl Drop for OnionMessage { +unsafe impl core::marker::Send for ClosingSig { } +unsafe impl core::marker::Sync for ClosingSig { } +impl Drop for ClosingSig { fn drop(&mut self) { - if self.is_owned && !<*mut nativeOnionMessage>::is_null(self.inner) { + if self.is_owned && !<*mut nativeClosingSig>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the ClosingSig, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn OnionMessage_free(this_obj: OnionMessage) { } +pub extern "C" fn ClosingSig_free(this_obj: ClosingSig) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn OnionMessage_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOnionMessage) }; +pub(crate) extern "C" fn ClosingSig_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClosingSig) }; } #[allow(unused)] -impl OnionMessage { - pub(crate) fn get_native_ref(&self) -> &'static nativeOnionMessage { +impl ClosingSig { + pub(crate) fn get_native_ref(&self) -> &'static nativeClosingSig { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOnionMessage { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeClosingSig { 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 nativeOnionMessage { + pub(crate) fn take_inner(mut self) -> *mut nativeClosingSig { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -5547,62 +5534,143 @@ impl OnionMessage { Self { inner: self.inner, is_owned: false } } } -/// Used in decrypting the onion packet's payload. +/// The channel ID. #[no_mangle] -pub extern "C" fn OnionMessage_get_blinding_point(this_ptr: &OnionMessage) -> 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) +pub extern "C" fn ClosingSig_get_channel_id(this_ptr: &ClosingSig) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// Used in decrypting the onion packet's payload. +/// The channel ID. #[no_mangle] -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(); +pub extern "C" fn ClosingSig_set_channel_id(this_ptr: &mut ClosingSig, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The full onion packet including hop data, pubkey, and hmac +/// The destination of the closer's funds on closing. #[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 } +pub extern "C" fn ClosingSig_get_closer_scriptpubkey(this_ptr: &ClosingSig) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).closer_scriptpubkey; + inner_val.as_bytes().to_vec().into() } -/// The full onion packet including hop data, pubkey, and hmac +/// The destination of the closer's funds on closing. #[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()) }; +pub extern "C" fn ClosingSig_set_closer_scriptpubkey(this_ptr: &mut ClosingSig, mut val: crate::c_types::derived::CVec_u8Z) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_scriptpubkey = ::bitcoin::script::ScriptBuf::from(val.into_rust()); } -/// Constructs a new OnionMessage given each field +/// The destination of the closee's funds on closing. +#[no_mangle] +pub extern "C" fn ClosingSig_get_closee_scriptpubkey(this_ptr: &ClosingSig) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).closee_scriptpubkey; + inner_val.as_bytes().to_vec().into() +} +/// The destination of the closee's funds on closing. +#[no_mangle] +pub extern "C" fn ClosingSig_set_closee_scriptpubkey(this_ptr: &mut ClosingSig, mut val: crate::c_types::derived::CVec_u8Z) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closee_scriptpubkey = ::bitcoin::script::ScriptBuf::from(val.into_rust()); +} +/// The proposed total fee for the closing transaction. +#[no_mangle] +pub extern "C" fn ClosingSig_get_fee_satoshis(this_ptr: &ClosingSig) -> u64 { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).fee_satoshis; + *inner_val +} +/// The proposed total fee for the closing transaction. +#[no_mangle] +pub extern "C" fn ClosingSig_set_fee_satoshis(this_ptr: &mut ClosingSig, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_satoshis = val; +} +/// The locktime of the closing transaction. +#[no_mangle] +pub extern "C" fn ClosingSig_get_locktime(this_ptr: &ClosingSig) -> u32 { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).locktime; + *inner_val +} +/// The locktime of the closing transaction. +#[no_mangle] +pub extern "C" fn ClosingSig_set_locktime(this_ptr: &mut ClosingSig, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.locktime = val; +} +/// A signature on the closing transaction omitting the `closee` output. +#[no_mangle] +pub extern "C" fn ClosingSig_get_closer_output_only(this_ptr: &ClosingSig) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).closer_output_only; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val +} +/// A signature on the closing transaction omitting the `closee` output. +#[no_mangle] +pub extern "C" fn ClosingSig_set_closer_output_only(this_ptr: &mut ClosingSig, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_output_only = local_val; +} +/// A signature on the closing transaction omitting the `closer` output. +#[no_mangle] +pub extern "C" fn ClosingSig_get_closee_output_only(this_ptr: &ClosingSig) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).closee_output_only; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val +} +/// A signature on the closing transaction omitting the `closer` output. +#[no_mangle] +pub extern "C" fn ClosingSig_set_closee_output_only(this_ptr: &mut ClosingSig, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closee_output_only = local_val; +} +/// A signature on the closing transaction covering both `closer` and `closee` outputs. +#[no_mangle] +pub extern "C" fn ClosingSig_get_closer_and_closee_outputs(this_ptr: &ClosingSig) -> crate::c_types::derived::COption_ECDSASignatureZ { + let mut inner_val = &mut ClosingSig::get_native_mut_ref(this_ptr).closer_and_closee_outputs; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ECDSASignatureZ::None } else { crate::c_types::derived::COption_ECDSASignatureZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ECDSASignature::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; + local_inner_val +} +/// A signature on the closing transaction covering both `closer` and `closee` outputs. +#[no_mangle] +pub extern "C" fn ClosingSig_set_closer_and_closee_outputs(this_ptr: &mut ClosingSig, mut val: crate::c_types::derived::COption_ECDSASignatureZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.closer_and_closee_outputs = local_val; +} +/// Constructs a new ClosingSig 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()) }, +pub extern "C" fn ClosingSig_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut closer_scriptpubkey_arg: crate::c_types::derived::CVec_u8Z, mut closee_scriptpubkey_arg: crate::c_types::derived::CVec_u8Z, mut fee_satoshis_arg: u64, mut locktime_arg: u32, mut closer_output_only_arg: crate::c_types::derived::COption_ECDSASignatureZ, mut closee_output_only_arg: crate::c_types::derived::COption_ECDSASignatureZ, mut closer_and_closee_outputs_arg: crate::c_types::derived::COption_ECDSASignatureZ) -> ClosingSig { + let mut local_closer_output_only_arg = { /*closer_output_only_arg*/ let closer_output_only_arg_opt = closer_output_only_arg; if closer_output_only_arg_opt.is_none() { None } else { Some({ { { closer_output_only_arg_opt.take() }.into_rust() }})} }; + let mut local_closee_output_only_arg = { /*closee_output_only_arg*/ let closee_output_only_arg_opt = closee_output_only_arg; if closee_output_only_arg_opt.is_none() { None } else { Some({ { { closee_output_only_arg_opt.take() }.into_rust() }})} }; + let mut local_closer_and_closee_outputs_arg = { /*closer_and_closee_outputs_arg*/ let closer_and_closee_outputs_arg_opt = closer_and_closee_outputs_arg; if closer_and_closee_outputs_arg_opt.is_none() { None } else { Some({ { { closer_and_closee_outputs_arg_opt.take() }.into_rust() }})} }; + ClosingSig { inner: ObjOps::heap_alloc(nativeClosingSig { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + closer_scriptpubkey: ::bitcoin::script::ScriptBuf::from(closer_scriptpubkey_arg.into_rust()), + closee_scriptpubkey: ::bitcoin::script::ScriptBuf::from(closee_scriptpubkey_arg.into_rust()), + fee_satoshis: fee_satoshis_arg, + locktime: locktime_arg, + closer_output_only: local_closer_output_only_arg, + closee_output_only: local_closee_output_only_arg, + closer_and_closee_outputs: local_closer_and_closee_outputs_arg, }), is_owned: true } } -impl Clone for OnionMessage { +impl Clone for ClosingSig { fn clone(&self) -> Self { Self { - inner: if <*mut nativeOnionMessage>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeClosingSig>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 OnionMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOnionMessage)).clone() })) as *mut c_void +pub(crate) extern "C" fn ClosingSig_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeClosingSig) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the OnionMessage -pub extern "C" fn OnionMessage_clone(orig: &OnionMessage) -> OnionMessage { - orig.clone() +/// Creates a copy of the ClosingSig +pub extern "C" fn ClosingSig_clone(orig: &ClosingSig) -> ClosingSig { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a OnionMessage object -pub extern "C" fn OnionMessage_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::OnionMessage }).into()} -/// Generates a non-cryptographic 64-bit hash of the OnionMessage. +/// Get a string which allows debug introspection of a ClosingSig object +pub extern "C" fn ClosingSig_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ClosingSig }).into()} +/// Generates a non-cryptographic 64-bit hash of the ClosingSig. #[no_mangle] -pub extern "C" fn OnionMessage_hash(o: &OnionMessage) -> u64 { +pub extern "C" fn ClosingSig_hash(o: &ClosingSig) -> 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)] @@ -5610,30 +5678,31 @@ pub extern "C" fn OnionMessage_hash(o: &OnionMessage) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two OnionMessages contain equal inner contents. +/// Checks if two ClosingSigs 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 OnionMessage_eq(a: &OnionMessage, b: &OnionMessage) -> bool { +pub extern "C" fn ClosingSig_eq(a: &ClosingSig, b: &ClosingSig) -> 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 } } -use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport; -pub(crate) type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport; +use lightning::ln::msgs::StartBatch as nativeStartBatchImport; +pub(crate) type nativeStartBatch = nativeStartBatchImport; -/// An [`update_fulfill_htlc`] message to be sent to or received from a peer. +/// A [`start_batch`] message to be sent to group together multiple channel messages as a single +/// logical message. /// -/// [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc +/// [`start_batch`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#batching-channel-messages #[must_use] #[repr(C)] -pub struct UpdateFulfillHTLC { +pub struct StartBatch { /// 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 nativeUpdateFulfillHTLC, + pub inner: *mut nativeStartBatch, /// 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 @@ -5641,37 +5710,37 @@ pub struct UpdateFulfillHTLC { pub is_owned: bool, } -impl core::ops::Deref for UpdateFulfillHTLC { - type Target = nativeUpdateFulfillHTLC; +impl core::ops::Deref for StartBatch { + type Target = nativeStartBatch; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UpdateFulfillHTLC { } -unsafe impl core::marker::Sync for UpdateFulfillHTLC { } -impl Drop for UpdateFulfillHTLC { +unsafe impl core::marker::Send for StartBatch { } +unsafe impl core::marker::Sync for StartBatch { } +impl Drop for StartBatch { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { + if self.is_owned && !<*mut nativeStartBatch>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the StartBatch, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { } +pub extern "C" fn StartBatch_free(this_obj: StartBatch) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC) }; +pub(crate) extern "C" fn StartBatch_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStartBatch) }; } #[allow(unused)] -impl UpdateFulfillHTLC { - pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFulfillHTLC { +impl StartBatch { + pub(crate) fn get_native_ref(&self) -> &'static nativeStartBatch { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFulfillHTLC { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeStartBatch { 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 nativeUpdateFulfillHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeStartBatch { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -5681,74 +5750,77 @@ impl UpdateFulfillHTLC { Self { inner: self.inner, is_owned: false } } } -/// The channel ID +/// The channel ID of all messages in the batch. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn StartBatch_get_channel_id(this_ptr: &StartBatch) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut StartBatch::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// The channel ID +/// The channel ID of all messages in the batch. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn StartBatch_set_channel_id(this_ptr: &mut StartBatch, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The HTLC ID +/// The number of messages to follow. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; +pub extern "C" fn StartBatch_get_batch_size(this_ptr: &StartBatch) -> u16 { + let mut inner_val = &mut StartBatch::get_native_mut_ref(this_ptr).batch_size; *inner_val } -/// The HTLC ID +/// The number of messages to follow. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; +pub extern "C" fn StartBatch_set_batch_size(this_ptr: &mut StartBatch, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.batch_size = val; } -/// The pre-image of the payment hash, allowing HTLC redemption +/// The type of all messages expected in the batch. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_preimage; - &inner_val.0 +pub extern "C" fn StartBatch_get_message_type(this_ptr: &StartBatch) -> crate::c_types::derived::COption_u16Z { + let mut inner_val = &mut StartBatch::get_native_mut_ref(this_ptr).message_type; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; + local_inner_val } -/// The pre-image of the payment hash, allowing HTLC redemption +/// The type of all messages expected in the batch. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_preimage = ::lightning::types::payment::PaymentPreimage(val.data); +pub extern "C" fn StartBatch_set_message_type(this_ptr: &mut StartBatch, mut val: crate::c_types::derived::COption_u16Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message_type = local_val; } -/// Constructs a new UpdateFulfillHTLC given each field +/// Constructs a new StartBatch given each field #[must_use] #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut htlc_id_arg: u64, mut payment_preimage_arg: crate::c_types::ThirtyTwoBytes) -> UpdateFulfillHTLC { - UpdateFulfillHTLC { inner: ObjOps::heap_alloc(nativeUpdateFulfillHTLC { +pub extern "C" fn StartBatch_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut batch_size_arg: u16, mut message_type_arg: crate::c_types::derived::COption_u16Z) -> StartBatch { + let mut local_message_type_arg = if message_type_arg.is_some() { Some( { message_type_arg.take() }) } else { None }; + StartBatch { inner: ObjOps::heap_alloc(nativeStartBatch { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - htlc_id: htlc_id_arg, - payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_arg.data), + batch_size: batch_size_arg, + message_type: local_message_type_arg, }), is_owned: true } } -impl Clone for UpdateFulfillHTLC { +impl Clone for StartBatch { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeStartBatch>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFulfillHTLC)).clone() })) as *mut c_void +pub(crate) extern "C" fn StartBatch_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeStartBatch) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UpdateFulfillHTLC -pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC { - orig.clone() +/// Creates a copy of the StartBatch +pub extern "C" fn StartBatch_clone(orig: &StartBatch) -> StartBatch { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UpdateFulfillHTLC object -pub extern "C" fn UpdateFulfillHTLC_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFulfillHTLC }).into()} -/// Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. +/// Get a string which allows debug introspection of a StartBatch object +pub extern "C" fn StartBatch_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::StartBatch }).into()} +/// Generates a non-cryptographic 64-bit hash of the StartBatch. #[no_mangle] -pub extern "C" fn UpdateFulfillHTLC_hash(o: &UpdateFulfillHTLC) -> u64 { +pub extern "C" fn StartBatch_hash(o: &StartBatch) -> 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)] @@ -5756,30 +5828,30 @@ pub extern "C" fn UpdateFulfillHTLC_hash(o: &UpdateFulfillHTLC) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UpdateFulfillHTLCs contain equal inner contents. +/// Checks if two StartBatchs 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 UpdateFulfillHTLC_eq(a: &UpdateFulfillHTLC, b: &UpdateFulfillHTLC) -> bool { +pub extern "C" fn StartBatch_eq(a: &StartBatch, b: &StartBatch) -> 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 } } -use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport; -pub(crate) type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport; +use lightning::ln::msgs::UpdateAddHTLC as nativeUpdateAddHTLCImport; +pub(crate) type nativeUpdateAddHTLC = nativeUpdateAddHTLCImport; -/// An [`update_fail_htlc`] message to be sent to or received from a peer. +/// An [`update_add_htlc`] message to be sent to or received from a peer. /// -/// [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc +/// [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc #[must_use] #[repr(C)] -pub struct UpdateFailHTLC { +pub struct UpdateAddHTLC { /// 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 nativeUpdateFailHTLC, + pub inner: *mut nativeUpdateAddHTLC, /// 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 @@ -5787,37 +5859,37 @@ pub struct UpdateFailHTLC { pub is_owned: bool, } -impl core::ops::Deref for UpdateFailHTLC { - type Target = nativeUpdateFailHTLC; +impl core::ops::Deref for UpdateAddHTLC { + type Target = nativeUpdateAddHTLC; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UpdateFailHTLC { } -unsafe impl core::marker::Sync for UpdateFailHTLC { } -impl Drop for UpdateFailHTLC { +unsafe impl core::marker::Send for UpdateAddHTLC { } +unsafe impl core::marker::Sync for UpdateAddHTLC { } +impl Drop for UpdateAddHTLC { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUpdateAddHTLC>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UpdateAddHTLC, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { } +pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC) }; +pub(crate) extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC) }; } #[allow(unused)] -impl UpdateFailHTLC { - pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFailHTLC { +impl UpdateAddHTLC { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateAddHTLC { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFailHTLC { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateAddHTLC { 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 nativeUpdateFailHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateAddHTLC { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -5829,51 +5901,173 @@ impl UpdateFailHTLC { } /// The channel ID #[no_mangle] -pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn UpdateAddHTLC_get_channel_id(this_ptr: &UpdateAddHTLC) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID #[no_mangle] -pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn UpdateAddHTLC_set_channel_id(this_ptr: &mut UpdateAddHTLC, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } /// The HTLC ID #[no_mangle] -pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; +pub extern "C" fn UpdateAddHTLC_get_htlc_id(this_ptr: &UpdateAddHTLC) -> u64 { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).htlc_id; *inner_val } /// The HTLC ID #[no_mangle] -pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) { +pub extern "C" fn UpdateAddHTLC_set_htlc_id(this_ptr: &mut UpdateAddHTLC, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; } -impl Clone for UpdateFailHTLC { +/// The HTLC value in milli-satoshi +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_amount_msat(this_ptr: &UpdateAddHTLC) -> u64 { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).amount_msat; + *inner_val +} +/// The HTLC value in milli-satoshi +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_amount_msat(this_ptr: &mut UpdateAddHTLC, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msat = val; +} +/// The payment hash, the pre-image of which controls HTLC redemption +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *const [u8; 32] { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).payment_hash; + &inner_val.0 +} +/// The payment hash, the pre-image of which controls HTLC redemption +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); +} +/// The expiry height of the HTLC +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_cltv_expiry(this_ptr: &UpdateAddHTLC) -> u32 { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).cltv_expiry; + *inner_val +} +/// The expiry height of the HTLC +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_cltv_expiry(this_ptr: &mut UpdateAddHTLC, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry = val; +} +/// The extra fee skimmed by the sender of this message. See +/// [`ChannelConfig::accept_underpaying_htlcs`]. +/// +/// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_skimmed_fee_msat(this_ptr: &UpdateAddHTLC) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).skimmed_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 extra fee skimmed by the sender of this message. See +/// [`ChannelConfig::accept_underpaying_htlcs`]. +/// +/// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_skimmed_fee_msat(this_ptr: &mut UpdateAddHTLC, 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) }.skimmed_fee_msat = local_val; +} +/// The onion routing packet with encrypted data for the next hop. +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_onion_routing_packet(this_ptr: &UpdateAddHTLC) -> crate::lightning::ln::msgs::OnionPacket { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).onion_routing_packet; + crate::lightning::ln::msgs::OnionPacket { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::OnionPacket<>) as *mut _) }, is_owned: false } +} +/// The onion routing packet with encrypted data for the next hop. +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_onion_routing_packet(this_ptr: &mut UpdateAddHTLC, mut val: crate::lightning::ln::msgs::OnionPacket) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.onion_routing_packet = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion +/// routing packet and the recipient-provided encrypted payload within. +/// +/// 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 UpdateAddHTLC_get_blinding_point(this_ptr: &UpdateAddHTLC) -> crate::c_types::PublicKey { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).blinding_point; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; + local_inner_val +} +/// Provided if we are relaying or receiving a payment within a blinded path, to decrypt the onion +/// routing packet and the recipient-provided encrypted payload within. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_blinding_point(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::PublicKey) { + let mut local_val = if val.is_null() { None } else { Some( { val.into_rust() }) }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.blinding_point = local_val; +} +/// Set to `Some` if the sender wants the receiver of this message to hold onto this HTLC until +/// receipt of a [`ReleaseHeldHtlc`] onion message from the payment recipient. +/// +/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_get_hold_htlc(this_ptr: &UpdateAddHTLC) -> crate::c_types::derived::COption_NoneZ { + let mut inner_val = &mut UpdateAddHTLC::get_native_mut_ref(this_ptr).hold_htlc; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; + local_inner_val +} +/// Set to `Some` if the sender wants the receiver of this message to hold onto this HTLC until +/// receipt of a [`ReleaseHeldHtlc`] onion message from the payment recipient. +/// +/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_set_hold_htlc(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::derived::COption_NoneZ) { + let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.hold_htlc = local_val; +} +/// Constructs a new UpdateAddHTLC given each field +/// +/// Note that blinding_point_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +#[must_use] +#[no_mangle] +pub extern "C" fn UpdateAddHTLC_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut htlc_id_arg: u64, mut amount_msat_arg: u64, mut payment_hash_arg: crate::c_types::ThirtyTwoBytes, mut cltv_expiry_arg: u32, mut skimmed_fee_msat_arg: crate::c_types::derived::COption_u64Z, mut onion_routing_packet_arg: crate::lightning::ln::msgs::OnionPacket, mut blinding_point_arg: crate::c_types::PublicKey, mut hold_htlc_arg: crate::c_types::derived::COption_NoneZ) -> UpdateAddHTLC { + let mut local_skimmed_fee_msat_arg = if skimmed_fee_msat_arg.is_some() { Some( { skimmed_fee_msat_arg.take() }) } else { None }; + let mut local_blinding_point_arg = if blinding_point_arg.is_null() { None } else { Some( { blinding_point_arg.into_rust() }) }; + let mut local_hold_htlc_arg = if hold_htlc_arg.is_some() { Some( { () /*hold_htlc_arg.take()*/ }) } else { None }; + UpdateAddHTLC { inner: ObjOps::heap_alloc(nativeUpdateAddHTLC { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + htlc_id: htlc_id_arg, + amount_msat: amount_msat_arg, + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), + cltv_expiry: cltv_expiry_arg, + skimmed_fee_msat: local_skimmed_fee_msat_arg, + onion_routing_packet: *unsafe { Box::from_raw(onion_routing_packet_arg.take_inner()) }, + blinding_point: local_blinding_point_arg, + hold_htlc: local_hold_htlc_arg, + }), is_owned: true } +} +impl Clone for UpdateAddHTLC { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUpdateAddHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFailHTLC)).clone() })) as *mut c_void +pub(crate) extern "C" fn UpdateAddHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUpdateAddHTLC) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UpdateFailHTLC -pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC { - orig.clone() +/// Creates a copy of the UpdateAddHTLC +pub extern "C" fn UpdateAddHTLC_clone(orig: &UpdateAddHTLC) -> UpdateAddHTLC { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UpdateFailHTLC object -pub extern "C" fn UpdateFailHTLC_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFailHTLC }).into()} -/// Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. +/// Get a string which allows debug introspection of a UpdateAddHTLC object +pub extern "C" fn UpdateAddHTLC_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateAddHTLC }).into()} +/// Generates a non-cryptographic 64-bit hash of the UpdateAddHTLC. #[no_mangle] -pub extern "C" fn UpdateFailHTLC_hash(o: &UpdateFailHTLC) -> u64 { +pub extern "C" fn UpdateAddHTLC_hash(o: &UpdateAddHTLC) -> 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)] @@ -5881,30 +6075,30 @@ pub extern "C" fn UpdateFailHTLC_hash(o: &UpdateFailHTLC) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UpdateFailHTLCs contain equal inner contents. +/// Checks if two UpdateAddHTLCs 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 UpdateFailHTLC_eq(a: &UpdateFailHTLC, b: &UpdateFailHTLC) -> bool { +pub extern "C" fn UpdateAddHTLC_eq(a: &UpdateAddHTLC, b: &UpdateAddHTLC) -> 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 } } -use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport; -pub(crate) type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport; +use lightning::ln::msgs::OnionMessage as nativeOnionMessageImport; +pub(crate) type nativeOnionMessage = nativeOnionMessageImport; -/// An [`update_fail_malformed_htlc`] message to be sent to or received from a peer. +/// An [`onion message`] to be sent to or received from a peer. /// -/// [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc +/// [`onion message`]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md#onion-messages #[must_use] #[repr(C)] -pub struct UpdateFailMalformedHTLC { +pub struct OnionMessage { /// 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 nativeUpdateFailMalformedHTLC, + pub inner: *mut nativeOnionMessage, /// 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 @@ -5912,37 +6106,37 @@ pub struct UpdateFailMalformedHTLC { pub is_owned: bool, } -impl core::ops::Deref for UpdateFailMalformedHTLC { - type Target = nativeUpdateFailMalformedHTLC; +impl core::ops::Deref for OnionMessage { + type Target = nativeOnionMessage; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UpdateFailMalformedHTLC { } -unsafe impl core::marker::Sync for UpdateFailMalformedHTLC { } -impl Drop for UpdateFailMalformedHTLC { +unsafe impl core::marker::Send for OnionMessage { } +unsafe impl core::marker::Sync for OnionMessage { } +impl Drop for OnionMessage { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { + if self.is_owned && !<*mut nativeOnionMessage>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { } +pub extern "C" fn OnionMessage_free(this_obj: OnionMessage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC) }; +pub(crate) extern "C" fn OnionMessage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOnionMessage) }; } #[allow(unused)] -impl UpdateFailMalformedHTLC { - pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFailMalformedHTLC { +impl OnionMessage { + pub(crate) fn get_native_ref(&self) -> &'static nativeOnionMessage { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFailMalformedHTLC { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOnionMessage { 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 nativeUpdateFailMalformedHTLC { + pub(crate) fn take_inner(mut self) -> *mut nativeOnionMessage { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -5952,64 +6146,62 @@ impl UpdateFailMalformedHTLC { Self { inner: self.inner, is_owned: false } } } -/// The channel ID -#[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } -} -/// The channel ID +/// Used in decrypting the onion packet's payload. #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::lightning::ln::types::ChannelId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn OnionMessage_get_blinding_point(this_ptr: &OnionMessage) -> crate::c_types::PublicKey { + let mut inner_val = &mut OnionMessage::get_native_mut_ref(this_ptr).blinding_point; + crate::c_types::PublicKey::from_rust(&inner_val) } -/// The HTLC ID +/// Used in decrypting the onion packet's payload. #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_id; - *inner_val +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 HTLC ID +/// The full onion packet including hop data, pubkey, and hmac #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; +pub extern "C" fn OnionMessage_get_onion_routing_packet(this_ptr: &OnionMessage) -> crate::lightning::onion_message::packet::Packet { + let mut inner_val = &mut OnionMessage::get_native_mut_ref(this_ptr).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 failure code +/// The full onion packet including hop data, pubkey, and hmac #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().failure_code; - *inner_val +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()) }; } -/// The failure code +/// Constructs a new OnionMessage given each field +#[must_use] #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_code = val; +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 UpdateFailMalformedHTLC { +impl Clone for OnionMessage { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeOnionMessage>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFailMalformedHTLC)).clone() })) as *mut c_void +pub(crate) extern "C" fn OnionMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOnionMessage) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UpdateFailMalformedHTLC -pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC { - orig.clone() +/// Creates a copy of the OnionMessage +pub extern "C" fn OnionMessage_clone(orig: &OnionMessage) -> OnionMessage { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UpdateFailMalformedHTLC object -pub extern "C" fn UpdateFailMalformedHTLC_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFailMalformedHTLC }).into()} -/// Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. +/// Get a string which allows debug introspection of a OnionMessage object +pub extern "C" fn OnionMessage_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::OnionMessage }).into()} +/// Generates a non-cryptographic 64-bit hash of the OnionMessage. #[no_mangle] -pub extern "C" fn UpdateFailMalformedHTLC_hash(o: &UpdateFailMalformedHTLC) -> u64 { +pub extern "C" fn OnionMessage_hash(o: &OnionMessage) -> 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)] @@ -6017,28 +6209,30 @@ pub extern "C" fn UpdateFailMalformedHTLC_hash(o: &UpdateFailMalformedHTLC) -> u core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UpdateFailMalformedHTLCs contain equal inner contents. +/// Checks if two OnionMessages 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 UpdateFailMalformedHTLC_eq(a: &UpdateFailMalformedHTLC, b: &UpdateFailMalformedHTLC) -> bool { +pub extern "C" fn OnionMessage_eq(a: &OnionMessage, b: &OnionMessage) -> 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 } } -use lightning::ln::msgs::CommitmentSignedBatch as nativeCommitmentSignedBatchImport; -pub(crate) type nativeCommitmentSignedBatch = nativeCommitmentSignedBatchImport; +use lightning::ln::msgs::UpdateFulfillHTLC as nativeUpdateFulfillHTLCImport; +pub(crate) type nativeUpdateFulfillHTLC = nativeUpdateFulfillHTLCImport; -/// Optional batch parameters for `commitment_signed` message. +/// An [`update_fulfill_htlc`] message to be sent to or received from a peer. +/// +/// [`update_fulfill_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc #[must_use] #[repr(C)] -pub struct CommitmentSignedBatch { +pub struct UpdateFulfillHTLC { /// 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 nativeCommitmentSignedBatch, + pub inner: *mut nativeUpdateFulfillHTLC, /// 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 @@ -6046,37 +6240,37 @@ pub struct CommitmentSignedBatch { pub is_owned: bool, } -impl core::ops::Deref for CommitmentSignedBatch { - type Target = nativeCommitmentSignedBatch; +impl core::ops::Deref for UpdateFulfillHTLC { + type Target = nativeUpdateFulfillHTLC; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for CommitmentSignedBatch { } -unsafe impl core::marker::Sync for CommitmentSignedBatch { } -impl Drop for CommitmentSignedBatch { +unsafe impl core::marker::Send for UpdateFulfillHTLC { } +unsafe impl core::marker::Sync for UpdateFulfillHTLC { } +impl Drop for UpdateFulfillHTLC { fn drop(&mut self) { - if self.is_owned && !<*mut nativeCommitmentSignedBatch>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the CommitmentSignedBatch, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_free(this_obj: CommitmentSignedBatch) { } +pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn CommitmentSignedBatch_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentSignedBatch) }; +pub(crate) extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC) }; } #[allow(unused)] -impl CommitmentSignedBatch { - pub(crate) fn get_native_ref(&self) -> &'static nativeCommitmentSignedBatch { +impl UpdateFulfillHTLC { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFulfillHTLC { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommitmentSignedBatch { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFulfillHTLC { 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 nativeCommitmentSignedBatch { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFulfillHTLC { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6086,62 +6280,95 @@ impl CommitmentSignedBatch { Self { inner: self.inner, is_owned: false } } } -/// Batch size N: all N `commitment_signed` messages must be received before being processed +/// The channel ID +#[no_mangle] +pub extern "C" fn UpdateFulfillHTLC_get_channel_id(this_ptr: &UpdateFulfillHTLC) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut UpdateFulfillHTLC::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } +} +/// The channel ID +#[no_mangle] +pub extern "C" fn UpdateFulfillHTLC_set_channel_id(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The HTLC ID #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_get_batch_size(this_ptr: &CommitmentSignedBatch) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().batch_size; +pub extern "C" fn UpdateFulfillHTLC_get_htlc_id(this_ptr: &UpdateFulfillHTLC) -> u64 { + let mut inner_val = &mut UpdateFulfillHTLC::get_native_mut_ref(this_ptr).htlc_id; *inner_val } -/// Batch size N: all N `commitment_signed` messages must be received before being processed +/// The HTLC ID #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_set_batch_size(this_ptr: &mut CommitmentSignedBatch, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.batch_size = val; +pub extern "C" fn UpdateFulfillHTLC_set_htlc_id(this_ptr: &mut UpdateFulfillHTLC, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; } -/// The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) +/// The pre-image of the payment hash, allowing HTLC redemption #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_get_funding_txid(this_ptr: &CommitmentSignedBatch) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_txid; - inner_val.as_ref() +pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfillHTLC) -> *const [u8; 32] { + let mut inner_val = &mut UpdateFulfillHTLC::get_native_mut_ref(this_ptr).payment_preimage; + &inner_val.0 } -/// The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) +/// The pre-image of the payment hash, allowing HTLC redemption #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_set_funding_txid(this_ptr: &mut CommitmentSignedBatch, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap(); +pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_preimage = ::lightning::types::payment::PaymentPreimage(val.data); +} +/// Optional field for attribution data that allows the sender to receive per hop HTLC hold times. +/// +/// 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 UpdateFulfillHTLC_get_attribution_data(this_ptr: &UpdateFulfillHTLC) -> crate::lightning::ln::onion_utils::AttributionData { + let mut inner_val = &mut UpdateFulfillHTLC::get_native_mut_ref(this_ptr).attribution_data; + let mut local_inner_val = crate::lightning::ln::onion_utils::AttributionData { 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::onion_utils::AttributionData<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// Optional field for attribution data that allows the sender to receive per hop HTLC hold times. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn UpdateFulfillHTLC_set_attribution_data(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::lightning::ln::onion_utils::AttributionData) { + 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) }.attribution_data = local_val; } -/// Constructs a new CommitmentSignedBatch given each field +/// Constructs a new UpdateFulfillHTLC given each field +/// +/// Note that attribution_data_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_new(mut batch_size_arg: u16, mut funding_txid_arg: crate::c_types::ThirtyTwoBytes) -> CommitmentSignedBatch { - CommitmentSignedBatch { inner: ObjOps::heap_alloc(nativeCommitmentSignedBatch { - batch_size: batch_size_arg, - funding_txid: ::bitcoin::hash_types::Txid::from_slice(&funding_txid_arg.data[..]).unwrap(), +pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut htlc_id_arg: u64, mut payment_preimage_arg: crate::c_types::ThirtyTwoBytes, mut attribution_data_arg: crate::lightning::ln::onion_utils::AttributionData) -> UpdateFulfillHTLC { + let mut local_attribution_data_arg = if attribution_data_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(attribution_data_arg.take_inner()) } }) }; + UpdateFulfillHTLC { inner: ObjOps::heap_alloc(nativeUpdateFulfillHTLC { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + htlc_id: htlc_id_arg, + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_arg.data), + attribution_data: local_attribution_data_arg, }), is_owned: true } } -impl Clone for CommitmentSignedBatch { +impl Clone for UpdateFulfillHTLC { fn clone(&self) -> Self { Self { - inner: if <*mut nativeCommitmentSignedBatch>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUpdateFulfillHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 CommitmentSignedBatch_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentSignedBatch)).clone() })) as *mut c_void +pub(crate) extern "C" fn UpdateFulfillHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUpdateFulfillHTLC) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the CommitmentSignedBatch -pub extern "C" fn CommitmentSignedBatch_clone(orig: &CommitmentSignedBatch) -> CommitmentSignedBatch { - orig.clone() +/// Creates a copy of the UpdateFulfillHTLC +pub extern "C" fn UpdateFulfillHTLC_clone(orig: &UpdateFulfillHTLC) -> UpdateFulfillHTLC { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a CommitmentSignedBatch object -pub extern "C" fn CommitmentSignedBatch_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommitmentSignedBatch }).into()} -/// Generates a non-cryptographic 64-bit hash of the CommitmentSignedBatch. +/// Get a string which allows debug introspection of a UpdateFulfillHTLC object +pub extern "C" fn UpdateFulfillHTLC_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFulfillHTLC }).into()} +/// Generates a non-cryptographic 64-bit hash of the UpdateFulfillHTLC. #[no_mangle] -pub extern "C" fn CommitmentSignedBatch_hash(o: &CommitmentSignedBatch) -> u64 { +pub extern "C" fn UpdateFulfillHTLC_hash(o: &UpdateFulfillHTLC) -> 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)] @@ -6149,30 +6376,36 @@ pub extern "C" fn CommitmentSignedBatch_hash(o: &CommitmentSignedBatch) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two CommitmentSignedBatchs contain equal inner contents. +/// Checks if two UpdateFulfillHTLCs 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 CommitmentSignedBatch_eq(a: &CommitmentSignedBatch, b: &CommitmentSignedBatch) -> bool { +pub extern "C" fn UpdateFulfillHTLC_eq(a: &UpdateFulfillHTLC, b: &UpdateFulfillHTLC) -> 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 } } -use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport; -pub(crate) type nativeCommitmentSigned = nativeCommitmentSignedImport; +use lightning::ln::msgs::PeerStorage as nativePeerStorageImport; +pub(crate) type nativePeerStorage = nativePeerStorageImport; -/// A [`commitment_signed`] message to be sent to or received from a peer. +/// A [`peer_storage`] message that can be sent to or received from a peer. /// -/// [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed +/// This message is used to distribute backup data to peers. +/// If data is lost or corrupted, users can retrieve it through [`PeerStorageRetrieval`] +/// to recover critical information, such as channel states, for fund recovery. +/// +/// [`peer_storage`] is used to send our own encrypted backup data to a peer. +/// +/// [`peer_storage`]: https://github.com/lightning/bolts/pull/1110 #[must_use] #[repr(C)] -pub struct CommitmentSigned { +pub struct PeerStorage { /// 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 nativeCommitmentSigned, + pub inner: *mut nativePeerStorage, /// 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 @@ -6180,37 +6413,37 @@ pub struct CommitmentSigned { pub is_owned: bool, } -impl core::ops::Deref for CommitmentSigned { - type Target = nativeCommitmentSigned; +impl core::ops::Deref for PeerStorage { + type Target = nativePeerStorage; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for CommitmentSigned { } -unsafe impl core::marker::Sync for CommitmentSigned { } -impl Drop for CommitmentSigned { +unsafe impl core::marker::Send for PeerStorage { } +unsafe impl core::marker::Sync for PeerStorage { } +impl Drop for PeerStorage { fn drop(&mut self) { - if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) { + if self.is_owned && !<*mut nativePeerStorage>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the PeerStorage, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { } +pub extern "C" fn PeerStorage_free(this_obj: PeerStorage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentSigned) }; +pub(crate) extern "C" fn PeerStorage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePeerStorage) }; } #[allow(unused)] -impl CommitmentSigned { - pub(crate) fn get_native_ref(&self) -> &'static nativeCommitmentSigned { +impl PeerStorage { + pub(crate) fn get_native_ref(&self) -> &'static nativePeerStorage { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommitmentSigned { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePeerStorage { 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 nativeCommitmentSigned { + pub(crate) fn take_inner(mut self) -> *mut nativePeerStorage { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6220,100 +6453,55 @@ impl CommitmentSigned { Self { inner: self.inner, is_owned: false } } } -/// The channel ID -#[no_mangle] -pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } -} -/// The channel ID -#[no_mangle] -pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::lightning::ln::types::ChannelId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// A signature on the commitment transaction -#[no_mangle] -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::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::ECDSASignature) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); -} -/// Signatures on the HTLC transactions +/// Our encrypted backup data included in the msg. /// /// Returns a copy of the field. #[no_mangle] -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::ECDSASignature::from_rust(&item) }); }; +pub extern "C" fn PeerStorage_get_data(this_ptr: &PeerStorage) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = PeerStorage::get_native_mut_ref(this_ptr).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() } -/// 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_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; -} -/// Optional batch size and other parameters -/// -/// 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 CommitmentSigned_get_batch(this_ptr: &CommitmentSigned) -> crate::lightning::ln::msgs::CommitmentSignedBatch { - let mut inner_val = &mut this_ptr.get_native_mut_ref().batch; - let mut local_inner_val = crate::lightning::ln::msgs::CommitmentSignedBatch { 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::msgs::CommitmentSignedBatch<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// Optional batch size and other parameters -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Our encrypted backup data included in the msg. #[no_mangle] -pub extern "C" fn CommitmentSigned_set_batch(this_ptr: &mut CommitmentSigned, mut val: crate::lightning::ln::msgs::CommitmentSignedBatch) { - 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) }.batch = local_val; +pub extern "C" fn PeerStorage_set_data(this_ptr: &mut PeerStorage, 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) }.data = local_val; } -/// Constructs a new CommitmentSigned given each field -/// -/// Note that batch_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Constructs a new PeerStorage given each field #[must_use] #[no_mangle] -pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut signature_arg: crate::c_types::ECDSASignature, mut htlc_signatures_arg: crate::c_types::derived::CVec_ECDSASignatureZ, mut batch_arg: crate::lightning::ln::msgs::CommitmentSignedBatch) -> 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() }); }; - let mut local_batch_arg = if batch_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(batch_arg.take_inner()) } }) }; - CommitmentSigned { inner: ObjOps::heap_alloc(nativeCommitmentSigned { - channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - signature: signature_arg.into_rust(), - htlc_signatures: local_htlc_signatures_arg, - batch: local_batch_arg, +pub extern "C" fn PeerStorage_new(mut data_arg: crate::c_types::derived::CVec_u8Z) -> PeerStorage { + let mut local_data_arg = Vec::new(); for mut item in data_arg.into_rust().drain(..) { local_data_arg.push( { item }); }; + PeerStorage { inner: ObjOps::heap_alloc(nativePeerStorage { + data: local_data_arg, }), is_owned: true } } -impl Clone for CommitmentSigned { +impl Clone for PeerStorage { fn clone(&self) -> Self { Self { - inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativePeerStorage>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentSigned)).clone() })) as *mut c_void +pub(crate) extern "C" fn PeerStorage_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePeerStorage) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the CommitmentSigned -pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned { - orig.clone() +/// Creates a copy of the PeerStorage +pub extern "C" fn PeerStorage_clone(orig: &PeerStorage) -> PeerStorage { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a CommitmentSigned object -pub extern "C" fn CommitmentSigned_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommitmentSigned }).into()} -/// Generates a non-cryptographic 64-bit hash of the CommitmentSigned. +/// Get a string which allows debug introspection of a PeerStorage object +pub extern "C" fn PeerStorage_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::PeerStorage }).into()} +/// Generates a non-cryptographic 64-bit hash of the PeerStorage. #[no_mangle] -pub extern "C" fn CommitmentSigned_hash(o: &CommitmentSigned) -> u64 { +pub extern "C" fn PeerStorage_hash(o: &PeerStorage) -> 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)] @@ -6321,30 +6509,36 @@ pub extern "C" fn CommitmentSigned_hash(o: &CommitmentSigned) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two CommitmentSigneds contain equal inner contents. +/// Checks if two PeerStorages 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 CommitmentSigned_eq(a: &CommitmentSigned, b: &CommitmentSigned) -> bool { +pub extern "C" fn PeerStorage_eq(a: &PeerStorage, b: &PeerStorage) -> 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 } } -use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport; -pub(crate) type nativeRevokeAndACK = nativeRevokeAndACKImport; +use lightning::ln::msgs::PeerStorageRetrieval as nativePeerStorageRetrievalImport; +pub(crate) type nativePeerStorageRetrieval = nativePeerStorageRetrievalImport; -/// A [`revoke_and_ack`] message to be sent to or received from a peer. +/// A [`peer_storage_retrieval`] message that can be sent to or received from a peer. /// -/// [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack +/// This message is sent to peers for whom we store backup data. +/// If we receive this message, it indicates that the peer had stored our backup data. +/// This data can be used for fund recovery in case of data loss. +/// +/// [`peer_storage_retrieval`] is used to send the most recent backup of the peer. +/// +/// [`peer_storage_retrieval`]: https://github.com/lightning/bolts/pull/1110 #[must_use] #[repr(C)] -pub struct RevokeAndACK { +pub struct PeerStorageRetrieval { /// 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 nativeRevokeAndACK, + pub inner: *mut nativePeerStorageRetrieval, /// 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 @@ -6352,37 +6546,37 @@ pub struct RevokeAndACK { pub is_owned: bool, } -impl core::ops::Deref for RevokeAndACK { - type Target = nativeRevokeAndACK; +impl core::ops::Deref for PeerStorageRetrieval { + type Target = nativePeerStorageRetrieval; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for RevokeAndACK { } -unsafe impl core::marker::Sync for RevokeAndACK { } -impl Drop for RevokeAndACK { +unsafe impl core::marker::Send for PeerStorageRetrieval { } +unsafe impl core::marker::Sync for PeerStorageRetrieval { } +impl Drop for PeerStorageRetrieval { fn drop(&mut self) { - if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) { + if self.is_owned && !<*mut nativePeerStorageRetrieval>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the PeerStorageRetrieval, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { } +pub extern "C" fn PeerStorageRetrieval_free(this_obj: PeerStorageRetrieval) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRevokeAndACK) }; +pub(crate) extern "C" fn PeerStorageRetrieval_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePeerStorageRetrieval) }; } #[allow(unused)] -impl RevokeAndACK { - pub(crate) fn get_native_ref(&self) -> &'static nativeRevokeAndACK { +impl PeerStorageRetrieval { + pub(crate) fn get_native_ref(&self) -> &'static nativePeerStorageRetrieval { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRevokeAndACK { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePeerStorageRetrieval { 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 nativeRevokeAndACK { + pub(crate) fn take_inner(mut self) -> *mut nativePeerStorageRetrieval { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6392,74 +6586,55 @@ impl RevokeAndACK { Self { inner: self.inner, is_owned: false } } } -/// The channel ID +/// Most recent peer's data included in the msg. +/// +/// Returns a copy of the field. #[no_mangle] -pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; - crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } -} -/// The channel ID -#[no_mangle] -pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::lightning::ln::types::ChannelId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The secret corresponding to the per-commitment point -#[no_mangle] -pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_secret; - inner_val -} -/// The secret corresponding to the per-commitment point -#[no_mangle] -pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_secret = val.data; -} -/// The next sender-broadcast commitment transaction's per-commitment point -#[no_mangle] -pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_per_commitment_point; - crate::c_types::PublicKey::from_rust(&inner_val) +pub extern "C" fn PeerStorageRetrieval_get_data(this_ptr: &PeerStorageRetrieval) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = PeerStorageRetrieval::get_native_mut_ref(this_ptr).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() } -/// The next sender-broadcast commitment transaction's per-commitment point +/// Most recent peer's data included in the msg. #[no_mangle] -pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust(); +pub extern "C" fn PeerStorageRetrieval_set_data(this_ptr: &mut PeerStorageRetrieval, 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) }.data = local_val; } -/// Constructs a new RevokeAndACK given each field +/// Constructs a new PeerStorageRetrieval given each field #[must_use] #[no_mangle] -pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, 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: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - per_commitment_secret: per_commitment_secret_arg.data, - next_per_commitment_point: next_per_commitment_point_arg.into_rust(), +pub extern "C" fn PeerStorageRetrieval_new(mut data_arg: crate::c_types::derived::CVec_u8Z) -> PeerStorageRetrieval { + let mut local_data_arg = Vec::new(); for mut item in data_arg.into_rust().drain(..) { local_data_arg.push( { item }); }; + PeerStorageRetrieval { inner: ObjOps::heap_alloc(nativePeerStorageRetrieval { + data: local_data_arg, }), is_owned: true } } -impl Clone for RevokeAndACK { +impl Clone for PeerStorageRetrieval { fn clone(&self) -> Self { Self { - inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativePeerStorageRetrieval>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRevokeAndACK)).clone() })) as *mut c_void +pub(crate) extern "C" fn PeerStorageRetrieval_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePeerStorageRetrieval) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the RevokeAndACK -pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK { - orig.clone() +/// Creates a copy of the PeerStorageRetrieval +pub extern "C" fn PeerStorageRetrieval_clone(orig: &PeerStorageRetrieval) -> PeerStorageRetrieval { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a RevokeAndACK object -pub extern "C" fn RevokeAndACK_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::RevokeAndACK }).into()} -/// Generates a non-cryptographic 64-bit hash of the RevokeAndACK. +/// Get a string which allows debug introspection of a PeerStorageRetrieval object +pub extern "C" fn PeerStorageRetrieval_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::PeerStorageRetrieval }).into()} +/// Generates a non-cryptographic 64-bit hash of the PeerStorageRetrieval. #[no_mangle] -pub extern "C" fn RevokeAndACK_hash(o: &RevokeAndACK) -> u64 { +pub extern "C" fn PeerStorageRetrieval_hash(o: &PeerStorageRetrieval) -> 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)] @@ -6467,30 +6642,30 @@ pub extern "C" fn RevokeAndACK_hash(o: &RevokeAndACK) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two RevokeAndACKs contain equal inner contents. +/// Checks if two PeerStorageRetrievals 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 RevokeAndACK_eq(a: &RevokeAndACK, b: &RevokeAndACK) -> bool { +pub extern "C" fn PeerStorageRetrieval_eq(a: &PeerStorageRetrieval, b: &PeerStorageRetrieval) -> 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 } } -use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport; -pub(crate) type nativeUpdateFee = nativeUpdateFeeImport; +use lightning::ln::msgs::UpdateFailHTLC as nativeUpdateFailHTLCImport; +pub(crate) type nativeUpdateFailHTLC = nativeUpdateFailHTLCImport; -/// An [`update_fee`] message to be sent to or received from a peer +/// An [`update_fail_htlc`] message to be sent to or received from a peer. /// -/// [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee +/// [`update_fail_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc #[must_use] #[repr(C)] -pub struct UpdateFee { +pub struct UpdateFailHTLC { /// 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 nativeUpdateFee, + pub inner: *mut nativeUpdateFailHTLC, /// 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 @@ -6498,37 +6673,37 @@ pub struct UpdateFee { pub is_owned: bool, } -impl core::ops::Deref for UpdateFee { - type Target = nativeUpdateFee; +impl core::ops::Deref for UpdateFailHTLC { + type Target = nativeUpdateFailHTLC; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UpdateFee { } -unsafe impl core::marker::Sync for UpdateFee { } -impl Drop for UpdateFee { +unsafe impl core::marker::Send for UpdateFailHTLC { } +unsafe impl core::marker::Sync for UpdateFailHTLC { } +impl Drop for UpdateFailHTLC { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUpdateFailHTLC>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UpdateFailHTLC, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { } +pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFee) }; +pub(crate) extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC) }; } #[allow(unused)] -impl UpdateFee { - pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFee { +impl UpdateFailHTLC { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFailHTLC { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFee { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFailHTLC { 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 nativeUpdateFee { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailHTLC { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6540,60 +6715,68 @@ impl UpdateFee { } /// The channel ID #[no_mangle] -pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn UpdateFailHTLC_get_channel_id(this_ptr: &UpdateFailHTLC) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut UpdateFailHTLC::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID #[no_mangle] -pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn UpdateFailHTLC_set_channel_id(this_ptr: &mut UpdateFailHTLC, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Fee rate per 1000-weight of the transaction +/// The HTLC ID #[no_mangle] -pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_per_kw; +pub extern "C" fn UpdateFailHTLC_get_htlc_id(this_ptr: &UpdateFailHTLC) -> u64 { + let mut inner_val = &mut UpdateFailHTLC::get_native_mut_ref(this_ptr).htlc_id; *inner_val } -/// Fee rate per 1000-weight of the transaction +/// The HTLC ID #[no_mangle] -pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_per_kw = val; +pub extern "C" fn UpdateFailHTLC_set_htlc_id(this_ptr: &mut UpdateFailHTLC, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; } -/// Constructs a new UpdateFee given each field -#[must_use] +/// Optional field for the attribution data that allows the sender to pinpoint the failing node under all conditions +/// +/// 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 UpdateFee_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut feerate_per_kw_arg: u32) -> UpdateFee { - UpdateFee { inner: ObjOps::heap_alloc(nativeUpdateFee { - channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - feerate_per_kw: feerate_per_kw_arg, - }), is_owned: true } +pub extern "C" fn UpdateFailHTLC_get_attribution_data(this_ptr: &UpdateFailHTLC) -> crate::lightning::ln::onion_utils::AttributionData { + let mut inner_val = &mut UpdateFailHTLC::get_native_mut_ref(this_ptr).attribution_data; + let mut local_inner_val = crate::lightning::ln::onion_utils::AttributionData { 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::onion_utils::AttributionData<>) as *mut _ }, is_owned: false }; + local_inner_val } -impl Clone for UpdateFee { +/// Optional field for the attribution data that allows the sender to pinpoint the failing node under all conditions +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn UpdateFailHTLC_set_attribution_data(this_ptr: &mut UpdateFailHTLC, mut val: crate::lightning::ln::onion_utils::AttributionData) { + 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) }.attribution_data = local_val; +} +impl Clone for UpdateFailHTLC { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUpdateFee>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUpdateFailHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUpdateFee)).clone() })) as *mut c_void +pub(crate) extern "C" fn UpdateFailHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUpdateFailHTLC) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UpdateFee -pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee { - orig.clone() +/// Creates a copy of the UpdateFailHTLC +pub extern "C" fn UpdateFailHTLC_clone(orig: &UpdateFailHTLC) -> UpdateFailHTLC { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UpdateFee object -pub extern "C" fn UpdateFee_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFee }).into()} -/// Generates a non-cryptographic 64-bit hash of the UpdateFee. +/// Get a string which allows debug introspection of a UpdateFailHTLC object +pub extern "C" fn UpdateFailHTLC_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFailHTLC }).into()} +/// Generates a non-cryptographic 64-bit hash of the UpdateFailHTLC. #[no_mangle] -pub extern "C" fn UpdateFee_hash(o: &UpdateFee) -> u64 { +pub extern "C" fn UpdateFailHTLC_hash(o: &UpdateFailHTLC) -> 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)] @@ -6601,30 +6784,30 @@ pub extern "C" fn UpdateFee_hash(o: &UpdateFee) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UpdateFees contain equal inner contents. +/// Checks if two UpdateFailHTLCs 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 UpdateFee_eq(a: &UpdateFee, b: &UpdateFee) -> bool { +pub extern "C" fn UpdateFailHTLC_eq(a: &UpdateFailHTLC, b: &UpdateFailHTLC) -> 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 } } -use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport; -pub(crate) type nativeChannelReestablish = nativeChannelReestablishImport; +use lightning::ln::msgs::UpdateFailMalformedHTLC as nativeUpdateFailMalformedHTLCImport; +pub(crate) type nativeUpdateFailMalformedHTLC = nativeUpdateFailMalformedHTLCImport; -/// A [`channel_reestablish`] message to be sent to or received from a peer. +/// An [`update_fail_malformed_htlc`] message to be sent to or received from a peer. /// -/// [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission +/// [`update_fail_malformed_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#removing-an-htlc-update_fulfill_htlc-update_fail_htlc-and-update_fail_malformed_htlc #[must_use] #[repr(C)] -pub struct ChannelReestablish { +pub struct UpdateFailMalformedHTLC { /// 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 nativeChannelReestablish, + pub inner: *mut nativeUpdateFailMalformedHTLC, /// 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 @@ -6632,37 +6815,37 @@ pub struct ChannelReestablish { pub is_owned: bool, } -impl core::ops::Deref for ChannelReestablish { - type Target = nativeChannelReestablish; +impl core::ops::Deref for UpdateFailMalformedHTLC { + type Target = nativeUpdateFailMalformedHTLC; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for ChannelReestablish { } -unsafe impl core::marker::Sync for ChannelReestablish { } -impl Drop for ChannelReestablish { +unsafe impl core::marker::Send for UpdateFailMalformedHTLC { } +unsafe impl core::marker::Sync for UpdateFailMalformedHTLC { } +impl Drop for UpdateFailMalformedHTLC { fn drop(&mut self) { - if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UpdateFailMalformedHTLC, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { } +pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReestablish) }; +pub(crate) extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC) }; } #[allow(unused)] -impl ChannelReestablish { - pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReestablish { +impl UpdateFailMalformedHTLC { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFailMalformedHTLC { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReestablish { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFailMalformedHTLC { 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 nativeChannelReestablish { + pub(crate) fn take_inner(mut self) -> *mut nativeUpdateFailMalformedHTLC { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6674,113 +6857,62 @@ impl ChannelReestablish { } /// The channel ID #[no_mangle] -pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn UpdateFailMalformedHTLC_get_channel_id(this_ptr: &UpdateFailMalformedHTLC) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut UpdateFailMalformedHTLC::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID #[no_mangle] -pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn UpdateFailMalformedHTLC_set_channel_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The next commitment number for the sender +/// The HTLC ID #[no_mangle] -pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_local_commitment_number; +pub extern "C" fn UpdateFailMalformedHTLC_get_htlc_id(this_ptr: &UpdateFailMalformedHTLC) -> u64 { + let mut inner_val = &mut UpdateFailMalformedHTLC::get_native_mut_ref(this_ptr).htlc_id; *inner_val } -/// The next commitment number for the sender +/// The HTLC ID #[no_mangle] -pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_local_commitment_number = val; +pub extern "C" fn UpdateFailMalformedHTLC_set_htlc_id(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_id = val; } -/// The next commitment number for the recipient +/// The failure code #[no_mangle] -pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().next_remote_commitment_number; +pub extern "C" fn UpdateFailMalformedHTLC_get_failure_code(this_ptr: &UpdateFailMalformedHTLC) -> u16 { + let mut inner_val = &mut UpdateFailMalformedHTLC::get_native_mut_ref(this_ptr).failure_code; *inner_val } -/// The next commitment number for the recipient -#[no_mangle] -pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_remote_commitment_number = val; -} -/// Proof that the sender knows the per-commitment secret of a specific commitment transaction -/// belonging to the recipient -#[no_mangle] -pub extern "C" fn ChannelReestablish_get_your_last_per_commitment_secret(this_ptr: &ChannelReestablish) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().your_last_per_commitment_secret; - inner_val -} -/// Proof that the sender knows the per-commitment secret of a specific commitment transaction -/// belonging to the recipient -#[no_mangle] -pub extern "C" fn ChannelReestablish_set_your_last_per_commitment_secret(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.your_last_per_commitment_secret = val.data; -} -/// The sender's per-commitment point for their current commitment transaction -#[no_mangle] -pub extern "C" fn ChannelReestablish_get_my_current_per_commitment_point(this_ptr: &ChannelReestablish) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().my_current_per_commitment_point; - crate::c_types::PublicKey::from_rust(&inner_val) -} -/// The sender's per-commitment point for their current commitment transaction -#[no_mangle] -pub extern "C" fn ChannelReestablish_set_my_current_per_commitment_point(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::PublicKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.my_current_per_commitment_point = val.into_rust(); -} -/// The next funding transaction ID -#[no_mangle] -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_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().as_ref() } }) }; - 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_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] +/// The failure code #[no_mangle] -pub extern "C" fn ChannelReestablish_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, 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: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - 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, - my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(), - next_funding_txid: local_next_funding_txid_arg, - }), is_owned: true } +pub extern "C" fn UpdateFailMalformedHTLC_set_failure_code(this_ptr: &mut UpdateFailMalformedHTLC, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.failure_code = val; } -impl Clone for ChannelReestablish { +impl Clone for UpdateFailMalformedHTLC { fn clone(&self) -> Self { Self { - inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUpdateFailMalformedHTLC>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelReestablish)).clone() })) as *mut c_void +pub(crate) extern "C" fn UpdateFailMalformedHTLC_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUpdateFailMalformedHTLC) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the ChannelReestablish -pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish { - orig.clone() +/// Creates a copy of the UpdateFailMalformedHTLC +pub extern "C" fn UpdateFailMalformedHTLC_clone(orig: &UpdateFailMalformedHTLC) -> UpdateFailMalformedHTLC { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a ChannelReestablish object -pub extern "C" fn ChannelReestablish_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelReestablish }).into()} -/// Generates a non-cryptographic 64-bit hash of the ChannelReestablish. +/// Get a string which allows debug introspection of a UpdateFailMalformedHTLC object +pub extern "C" fn UpdateFailMalformedHTLC_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFailMalformedHTLC }).into()} +/// Generates a non-cryptographic 64-bit hash of the UpdateFailMalformedHTLC. #[no_mangle] -pub extern "C" fn ChannelReestablish_hash(o: &ChannelReestablish) -> u64 { +pub extern "C" fn UpdateFailMalformedHTLC_hash(o: &UpdateFailMalformedHTLC) -> 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)] @@ -6788,30 +6920,30 @@ pub extern "C" fn ChannelReestablish_hash(o: &ChannelReestablish) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two ChannelReestablishs contain equal inner contents. +/// Checks if two UpdateFailMalformedHTLCs 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 ChannelReestablish_eq(a: &ChannelReestablish, b: &ChannelReestablish) -> bool { +pub extern "C" fn UpdateFailMalformedHTLC_eq(a: &UpdateFailMalformedHTLC, b: &UpdateFailMalformedHTLC) -> 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 } } -use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport; -pub(crate) type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport; +use lightning::ln::msgs::CommitmentSigned as nativeCommitmentSignedImport; +pub(crate) type nativeCommitmentSigned = nativeCommitmentSignedImport; -/// An [`announcement_signatures`] message to be sent to or received from a peer. +/// A [`commitment_signed`] message to be sent to or received from a peer. /// -/// [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message +/// [`commitment_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#committing-updates-so-far-commitment_signed #[must_use] #[repr(C)] -pub struct AnnouncementSignatures { +pub struct CommitmentSigned { /// 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 nativeAnnouncementSignatures, + pub inner: *mut nativeCommitmentSigned, /// 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 @@ -6819,37 +6951,37 @@ pub struct AnnouncementSignatures { pub is_owned: bool, } -impl core::ops::Deref for AnnouncementSignatures { - type Target = nativeAnnouncementSignatures; +impl core::ops::Deref for CommitmentSigned { + type Target = nativeCommitmentSigned; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for AnnouncementSignatures { } -unsafe impl core::marker::Sync for AnnouncementSignatures { } -impl Drop for AnnouncementSignatures { +unsafe impl core::marker::Send for CommitmentSigned { } +unsafe impl core::marker::Sync for CommitmentSigned { } +impl Drop for CommitmentSigned { fn drop(&mut self) { - if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) { + if self.is_owned && !<*mut nativeCommitmentSigned>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the CommitmentSigned, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { } +pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures) }; +pub(crate) extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentSigned) }; } #[allow(unused)] -impl AnnouncementSignatures { - pub(crate) fn get_native_ref(&self) -> &'static nativeAnnouncementSignatures { +impl CommitmentSigned { + pub(crate) fn get_native_ref(&self) -> &'static nativeCommitmentSigned { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAnnouncementSignatures { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommitmentSigned { 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 nativeAnnouncementSignatures { + pub(crate) fn take_inner(mut self) -> *mut nativeCommitmentSigned { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -6861,84 +6993,92 @@ impl AnnouncementSignatures { } /// The channel ID #[no_mangle] -pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; +pub extern "C" fn CommitmentSigned_get_channel_id(this_ptr: &CommitmentSigned) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut CommitmentSigned::get_native_mut_ref(this_ptr).channel_id; crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } /// The channel ID #[no_mangle] -pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::lightning::ln::types::ChannelId) { +pub extern "C" fn CommitmentSigned_set_channel_id(this_ptr: &mut CommitmentSigned, mut val: crate::lightning::ln::types::ChannelId) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The short channel ID +/// A signature on the commitment transaction #[no_mangle] -pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; - *inner_val +pub extern "C" fn CommitmentSigned_get_signature(this_ptr: &CommitmentSigned) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut CommitmentSigned::get_native_mut_ref(this_ptr).signature; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// The short channel ID +/// A signature on the commitment transaction #[no_mangle] -pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; +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(); } -/// A signature by the node key +/// Signatures on the HTLC transactions +/// +/// Returns a copy of the field. #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn CommitmentSigned_get_htlc_signatures(this_ptr: &CommitmentSigned) -> crate::c_types::derived::CVec_ECDSASignatureZ { + let mut inner_val = CommitmentSigned::get_native_mut_ref(this_ptr).htlc_signatures.clone(); + 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() } -/// A signature by the node key +/// Signatures on the HTLC transactions #[no_mangle] -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(); +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; } -/// A signature by the funding key +/// The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn CommitmentSigned_get_funding_txid(this_ptr: &CommitmentSigned) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { + let mut inner_val = &mut CommitmentSigned::get_native_mut_ref(this_ptr).funding_txid; + 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().as_ref() } }) }; + local_inner_val } -/// A signature by the funding key +/// The funding transaction, to discriminate among multiple pending funding transactions (e.g. in case of splicing) #[no_mangle] -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(); +pub extern "C" fn CommitmentSigned_set_funding_txid(this_ptr: &mut CommitmentSigned, 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) }.funding_txid = local_val; } -/// Constructs a new AnnouncementSignatures given each field +/// Constructs a new CommitmentSigned given each field #[must_use] #[no_mangle] -pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, 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 { +pub extern "C" fn CommitmentSigned_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut signature_arg: crate::c_types::ECDSASignature, mut htlc_signatures_arg: crate::c_types::derived::CVec_ECDSASignatureZ, mut funding_txid_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> 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() }); }; + let mut local_funding_txid_arg = { /*funding_txid_arg*/ let funding_txid_arg_opt = funding_txid_arg; if funding_txid_arg_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ funding_txid_arg_opt.take() }.data[..]).unwrap() }})} }; + CommitmentSigned { inner: ObjOps::heap_alloc(nativeCommitmentSigned { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, - short_channel_id: short_channel_id_arg, - node_signature: node_signature_arg.into_rust(), - bitcoin_signature: bitcoin_signature_arg.into_rust(), + signature: signature_arg.into_rust(), + htlc_signatures: local_htlc_signatures_arg, + funding_txid: local_funding_txid_arg, }), is_owned: true } } -impl Clone for AnnouncementSignatures { +impl Clone for CommitmentSigned { fn clone(&self) -> Self { Self { - inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeCommitmentSigned>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeAnnouncementSignatures)).clone() })) as *mut c_void +pub(crate) extern "C" fn CommitmentSigned_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCommitmentSigned) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the AnnouncementSignatures -pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures { - orig.clone() +/// Creates a copy of the CommitmentSigned +pub extern "C" fn CommitmentSigned_clone(orig: &CommitmentSigned) -> CommitmentSigned { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a AnnouncementSignatures object -pub extern "C" fn AnnouncementSignatures_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::AnnouncementSignatures }).into()} -/// Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. +/// Get a string which allows debug introspection of a CommitmentSigned object +pub extern "C" fn CommitmentSigned_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommitmentSigned }).into()} +/// Generates a non-cryptographic 64-bit hash of the CommitmentSigned. #[no_mangle] -pub extern "C" fn AnnouncementSignatures_hash(o: &AnnouncementSignatures) -> u64 { +pub extern "C" fn CommitmentSigned_hash(o: &CommitmentSigned) -> 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)] @@ -6946,668 +7086,375 @@ pub extern "C" fn AnnouncementSignatures_hash(o: &AnnouncementSignatures) -> u64 core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two AnnouncementSignaturess contain equal inner contents. +/// Checks if two CommitmentSigneds 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 AnnouncementSignatures_eq(a: &AnnouncementSignatures, b: &AnnouncementSignatures) -> bool { +pub extern "C" fn CommitmentSigned_eq(a: &CommitmentSigned, b: &CommitmentSigned) -> 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 } } -/// An address which can be used to connect to a remote peer. -#[derive(Clone)] + +use lightning::ln::msgs::RevokeAndACK as nativeRevokeAndACKImport; +pub(crate) type nativeRevokeAndACK = nativeRevokeAndACKImport; + +/// A [`revoke_and_ack`] message to be sent to or received from a peer. +/// +/// [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack #[must_use] #[repr(C)] -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 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 - port: u16, - }, - /// 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. - OnionV2( - crate::c_types::TwelveBytes), - /// 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\". - OnionV3 { - /// The ed25519 long-term public key of the peer - ed25519_pubkey: crate::c_types::ThirtyTwoBytes, - /// The checksum of the pubkey and version, as included in the onion address - checksum: u16, - /// The version byte, as defined by the Tor Onion v3 spec. - version: u8, - /// The port on which the node is listening - port: u16, - }, - /// A hostname/port on which the peer is listening. - Hostname { - /// The hostname on which the node is listening. - hostname: crate::lightning::util::ser::Hostname, - /// The port on which the node is listening. - port: u16, - }, +pub struct RevokeAndACK { + /// 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 nativeRevokeAndACK, + /// 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, } -use lightning::ln::msgs::SocketAddress as SocketAddressImport; -pub(crate) type nativeSocketAddress = SocketAddressImport; -impl SocketAddress { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeSocketAddress { - match self { - SocketAddress::TcpIpV4 {ref addr, ref port, } => { - let mut addr_nonref = Clone::clone(addr); - let mut port_nonref = Clone::clone(port); - nativeSocketAddress::TcpIpV4 { - addr: addr_nonref.data, - port: port_nonref, - } - }, - SocketAddress::TcpIpV6 {ref addr, ref port, } => { - let mut addr_nonref = Clone::clone(addr); - let mut port_nonref = Clone::clone(port); - nativeSocketAddress::TcpIpV6 { - addr: addr_nonref.data, - port: port_nonref, - } - }, - SocketAddress::OnionV2 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeSocketAddress::OnionV2 ( - a_nonref.data, - ) - }, - 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); - nativeSocketAddress::OnionV3 { - ed25519_pubkey: ed25519_pubkey_nonref.data, - checksum: checksum_nonref, - version: version_nonref, - port: port_nonref, - } - }, - SocketAddress::Hostname {ref hostname, ref port, } => { - let mut hostname_nonref = Clone::clone(hostname); - let mut port_nonref = Clone::clone(port); - nativeSocketAddress::Hostname { - hostname: *unsafe { Box::from_raw(hostname_nonref.take_inner()) }, - port: port_nonref, - } - }, +impl core::ops::Deref for RevokeAndACK { + type Target = nativeRevokeAndACK; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for RevokeAndACK { } +unsafe impl core::marker::Sync for RevokeAndACK { } +impl Drop for RevokeAndACK { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeRevokeAndACK>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeSocketAddress { - match self { - SocketAddress::TcpIpV4 {mut addr, mut port, } => { - nativeSocketAddress::TcpIpV4 { - addr: addr.data, - port: port, - } - }, - SocketAddress::TcpIpV6 {mut addr, mut port, } => { - nativeSocketAddress::TcpIpV6 { - addr: addr.data, - port: port, - } - }, - SocketAddress::OnionV2 (mut a, ) => { - nativeSocketAddress::OnionV2 ( - a.data, - ) - }, - SocketAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { - nativeSocketAddress::OnionV3 { - ed25519_pubkey: ed25519_pubkey.data, - checksum: checksum, - version: version, - port: port, - } - }, - SocketAddress::Hostname {mut hostname, mut port, } => { - nativeSocketAddress::Hostname { - hostname: *unsafe { Box::from_raw(hostname.take_inner()) }, - port: port, - } - }, - } +} +/// Frees any resources used by the RevokeAndACK, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRevokeAndACK) }; +} +#[allow(unused)] +impl RevokeAndACK { + pub(crate) fn get_native_ref(&self) -> &'static nativeRevokeAndACK { + unsafe { &*ObjOps::untweak_ptr(self.inner) } } - #[allow(unused)] - pub(crate) fn from_native(native: &SocketAddressImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSocketAddress) }; - match native { - nativeSocketAddress::TcpIpV4 {ref addr, ref port, } => { - let mut addr_nonref = Clone::clone(addr); - let mut port_nonref = Clone::clone(port); - SocketAddress::TcpIpV4 { - addr: crate::c_types::FourBytes { data: addr_nonref }, - port: port_nonref, - } - }, - nativeSocketAddress::TcpIpV6 {ref addr, ref port, } => { - let mut addr_nonref = Clone::clone(addr); - let mut port_nonref = Clone::clone(port); - SocketAddress::TcpIpV6 { - addr: crate::c_types::SixteenBytes { data: addr_nonref }, - port: port_nonref, - } - }, - nativeSocketAddress::OnionV2 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - SocketAddress::OnionV2 ( - crate::c_types::TwelveBytes { data: a_nonref }, - ) - }, - 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); - SocketAddress::OnionV3 { - ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref }, - checksum: checksum_nonref, - version: version_nonref, - port: port_nonref, - } - }, - nativeSocketAddress::Hostname {ref hostname, ref port, } => { - let mut hostname_nonref = Clone::clone(hostname); - let mut port_nonref = Clone::clone(port); - SocketAddress::Hostname { - hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname_nonref), is_owned: true }, - port: port_nonref, - } - }, - } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRevokeAndACK { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } } - #[allow(unused)] - pub(crate) fn native_into(native: nativeSocketAddress) -> Self { - match native { - nativeSocketAddress::TcpIpV4 {mut addr, mut port, } => { - SocketAddress::TcpIpV4 { - addr: crate::c_types::FourBytes { data: addr }, - port: port, - } - }, - nativeSocketAddress::TcpIpV6 {mut addr, mut port, } => { - SocketAddress::TcpIpV6 { - addr: crate::c_types::SixteenBytes { data: addr }, - port: port, - } - }, - nativeSocketAddress::OnionV2 (mut a, ) => { - SocketAddress::OnionV2 ( - crate::c_types::TwelveBytes { data: a }, - ) - }, - 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, - } - }, - nativeSocketAddress::Hostname {mut hostname, mut port, } => { - SocketAddress::Hostname { - hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname), is_owned: true }, - port: port, - } - }, - } + /// 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 nativeRevokeAndACK { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } } } -/// Frees any resources used by the SocketAddress +/// The channel ID #[no_mangle] -pub extern "C" fn SocketAddress_free(this_ptr: SocketAddress) { } -/// Creates a copy of the SocketAddress +pub extern "C" fn RevokeAndACK_get_channel_id(this_ptr: &RevokeAndACK) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut RevokeAndACK::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } +} +/// The channel ID #[no_mangle] -pub extern "C" fn SocketAddress_clone(orig: &SocketAddress) -> SocketAddress { - orig.clone() +pub extern "C" fn RevokeAndACK_set_channel_id(this_ptr: &mut RevokeAndACK, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SocketAddress_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddress)).clone() })) as *mut c_void +/// The secret corresponding to the per-commitment point +#[no_mangle] +pub extern "C" fn RevokeAndACK_get_per_commitment_secret(this_ptr: &RevokeAndACK) -> *const [u8; 32] { + let mut inner_val = &mut RevokeAndACK::get_native_mut_ref(this_ptr).per_commitment_secret; + inner_val } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SocketAddress_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddress) }; +/// The secret corresponding to the per-commitment point +#[no_mangle] +pub extern "C" fn RevokeAndACK_set_per_commitment_secret(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_secret = val.data; } +/// The next sender-broadcast commitment transaction's per-commitment point #[no_mangle] -/// 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, - } +pub extern "C" fn RevokeAndACK_get_next_per_commitment_point(this_ptr: &RevokeAndACK) -> crate::c_types::PublicKey { + let mut inner_val = &mut RevokeAndACK::get_native_mut_ref(this_ptr).next_per_commitment_point; + crate::c_types::PublicKey::from_rust(&inner_val) } +/// The next sender-broadcast commitment transaction's per-commitment point #[no_mangle] -/// 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, - } +pub extern "C" fn RevokeAndACK_set_next_per_commitment_point(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_per_commitment_point = val.into_rust(); } +/// A list of `(htlc_id, blinded_path)`. The receiver of this message will use the blinded paths +/// as reply paths to [`HeldHtlcAvailable`] onion messages that they send to the often-offline +/// receiver of this HTLC. The `htlc_id` is used by the receiver of this message to identify which +/// held HTLC a given blinded path corresponds to. +/// +/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable +/// +/// Returns a copy of the field. #[no_mangle] -/// 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, ) +pub extern "C" fn RevokeAndACK_get_release_htlc_message_paths(this_ptr: &RevokeAndACK) -> crate::c_types::derived::CVec_C2Tuple_u64BlindedMessagePathZZ { + let mut inner_val = RevokeAndACK::get_native_mut_ref(this_ptr).release_htlc_message_paths.clone(); + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { let (mut orig_inner_val_0_0, mut orig_inner_val_0_1) = item; let mut local_inner_val_0 = (orig_inner_val_0_0, crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(orig_inner_val_0_1), is_owned: true }).into(); local_inner_val_0 }); }; + local_inner_val.into() } +/// A list of `(htlc_id, blinded_path)`. The receiver of this message will use the blinded paths +/// as reply paths to [`HeldHtlcAvailable`] onion messages that they send to the often-offline +/// receiver of this HTLC. The `htlc_id` is used by the receiver of this message to identify which +/// held HTLC a given blinded path corresponds to. +/// +/// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable #[no_mangle] -/// 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, - port, - } +pub extern "C" fn RevokeAndACK_set_release_htlc_message_paths(this_ptr: &mut RevokeAndACK, mut val: crate::c_types::derived::CVec_C2Tuple_u64BlindedMessagePathZZ) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { let (mut orig_val_0_0, mut orig_val_0_1) = item.to_rust(); let mut local_val_0 = (orig_val_0_0, *unsafe { Box::from_raw(orig_val_0_1.take_inner()) }); local_val_0 }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.release_htlc_message_paths = local_val; } +/// Constructs a new RevokeAndACK given each field +#[must_use] #[no_mangle] -/// 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, +pub extern "C" fn RevokeAndACK_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut per_commitment_secret_arg: crate::c_types::ThirtyTwoBytes, mut next_per_commitment_point_arg: crate::c_types::PublicKey, mut release_htlc_message_paths_arg: crate::c_types::derived::CVec_C2Tuple_u64BlindedMessagePathZZ) -> RevokeAndACK { + let mut local_release_htlc_message_paths_arg = Vec::new(); for mut item in release_htlc_message_paths_arg.into_rust().drain(..) { local_release_htlc_message_paths_arg.push( { let (mut orig_release_htlc_message_paths_arg_0_0, mut orig_release_htlc_message_paths_arg_0_1) = item.to_rust(); let mut local_release_htlc_message_paths_arg_0 = (orig_release_htlc_message_paths_arg_0_0, *unsafe { Box::from_raw(orig_release_htlc_message_paths_arg_0_1.take_inner()) }); local_release_htlc_message_paths_arg_0 }); }; + RevokeAndACK { inner: ObjOps::heap_alloc(nativeRevokeAndACK { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + per_commitment_secret: per_commitment_secret_arg.data, + next_per_commitment_point: next_per_commitment_point_arg.into_rust(), + release_htlc_message_paths: local_release_htlc_message_paths_arg, + }), is_owned: true } +} +impl Clone for RevokeAndACK { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeRevokeAndACK>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + is_owned: true, + } } } -/// Get a string which allows debug introspection of a SocketAddress object -pub extern "C" fn SocketAddress_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SocketAddress }).into()} -/// Generates a non-cryptographic 64-bit hash of the SocketAddress. +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn RevokeAndACK_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRevokeAndACK) }))) as *mut c_void +} #[no_mangle] -pub extern "C" fn SocketAddress_hash(o: &SocketAddress) -> u64 { +/// Creates a copy of the RevokeAndACK +pub extern "C" fn RevokeAndACK_clone(orig: &RevokeAndACK) -> RevokeAndACK { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a RevokeAndACK object +pub extern "C" fn RevokeAndACK_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::RevokeAndACK }).into()} +/// Generates a non-cryptographic 64-bit hash of the RevokeAndACK. +#[no_mangle] +pub extern "C" fn RevokeAndACK_hash(o: &RevokeAndACK) -> 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.to_native(), &mut hasher); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two SocketAddresss contain equal inner contents. +/// Checks if two RevokeAndACKs 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 SocketAddress_eq(a: &SocketAddress, b: &SocketAddress) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -#[no_mangle] -/// 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()) +pub extern "C" fn RevokeAndACK_eq(a: &RevokeAndACK, b: &RevokeAndACK) -> 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 } } -#[allow(unused)] -pub(crate) extern "C" fn SocketAddress_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - SocketAddress_write(unsafe { &*(obj as *const SocketAddress) }) -} -#[no_mangle] -/// 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)] + +use lightning::ln::msgs::UpdateFee as nativeUpdateFeeImport; +pub(crate) type nativeUpdateFee = nativeUpdateFeeImport; + +/// An [`update_fee`] message to be sent to or received from a peer +/// +/// [`update_fee`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#updating-fees-update_fee #[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, +pub struct UpdateFee { + /// 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 nativeUpdateFee, + /// 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, } -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: &SocketAddressParseErrorImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSocketAddressParseError) }; - 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, +impl core::ops::Deref for UpdateFee { + type Target = nativeUpdateFee; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for UpdateFee { } +unsafe impl core::marker::Sync for UpdateFee { } +impl Drop for UpdateFee { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeUpdateFee>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Creates a copy of the SocketAddressParseError +/// Frees any resources used by the UpdateFee, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn SocketAddressParseError_clone(orig: &SocketAddressParseError) -> SocketAddressParseError { - orig.clone() -} +pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SocketAddressParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddressParseError)).clone() })) as *mut c_void +pub(crate) extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFee) }; } #[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SocketAddressParseError_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddressParseError) }; +impl UpdateFee { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateFee { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateFee { + 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 nativeUpdateFee { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } } +/// The channel ID #[no_mangle] -/// Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError -pub extern "C" fn SocketAddressParseError_socket_addr_parse() -> SocketAddressParseError { - SocketAddressParseError::SocketAddrParse} +pub extern "C" fn UpdateFee_get_channel_id(this_ptr: &UpdateFee) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut UpdateFee::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } +} +/// The channel ID #[no_mangle] -/// Utility method to constructs a new InvalidInput-variant SocketAddressParseError -pub extern "C" fn SocketAddressParseError_invalid_input() -> SocketAddressParseError { - SocketAddressParseError::InvalidInput} +pub extern "C" fn UpdateFee_set_channel_id(this_ptr: &mut UpdateFee, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Fee rate per 1000-weight of the transaction #[no_mangle] -/// Utility method to constructs a new InvalidPort-variant SocketAddressParseError -pub extern "C" fn SocketAddressParseError_invalid_port() -> SocketAddressParseError { - SocketAddressParseError::InvalidPort} +pub extern "C" fn UpdateFee_get_feerate_per_kw(this_ptr: &UpdateFee) -> u32 { + let mut inner_val = &mut UpdateFee::get_native_mut_ref(this_ptr).feerate_per_kw; + *inner_val +} +/// Fee rate per 1000-weight of the transaction #[no_mangle] -/// Utility method to constructs a new InvalidOnionV3-variant SocketAddressParseError -pub extern "C" fn SocketAddressParseError_invalid_onion_v3() -> SocketAddressParseError { - SocketAddressParseError::InvalidOnionV3} -/// Get a string which allows debug introspection of a SocketAddressParseError object -pub extern "C" fn SocketAddressParseError_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SocketAddressParseError }).into()} -/// Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. +pub extern "C" fn UpdateFee_set_feerate_per_kw(this_ptr: &mut UpdateFee, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_per_kw = val; +} +/// Constructs a new UpdateFee given each field +#[must_use] #[no_mangle] -pub extern "C" fn SocketAddressParseError_hash(o: &SocketAddressParseError) -> u64 { +pub extern "C" fn UpdateFee_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut feerate_per_kw_arg: u32) -> UpdateFee { + UpdateFee { inner: ObjOps::heap_alloc(nativeUpdateFee { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + feerate_per_kw: feerate_per_kw_arg, + }), is_owned: true } +} +impl Clone for UpdateFee { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeUpdateFee>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 UpdateFee_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUpdateFee) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the UpdateFee +pub extern "C" fn UpdateFee_clone(orig: &UpdateFee) -> UpdateFee { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a UpdateFee object +pub extern "C" fn UpdateFee_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UpdateFee }).into()} +/// Generates a non-cryptographic 64-bit hash of the UpdateFee. +#[no_mangle] +pub extern "C" fn UpdateFee_hash(o: &UpdateFee) -> 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.to_native(), &mut hasher); + core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two SocketAddressParseErrors contain equal inner contents. +/// Checks if two UpdateFees 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 SocketAddressParseError_eq(a: &SocketAddressParseError, b: &SocketAddressParseError) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -#[no_mangle] -/// Get the string representation of a SocketAddressParseError object -pub extern "C" fn SocketAddressParseError_to_str(o: &crate::lightning::ln::msgs::SocketAddressParseError) -> Str { - alloc::format!("{}", &o.to_native()).into() +pub extern "C" fn UpdateFee_eq(a: &UpdateFee, b: &UpdateFee) -> 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 } } -/// Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. + +use lightning::ln::msgs::ChannelReestablish as nativeChannelReestablishImport; +pub(crate) type nativeChannelReestablish = nativeChannelReestablishImport; + +/// A [`channel_reestablish`] message to be sent to or received from a peer. /// -/// 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 +/// [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission +#[must_use] +#[repr(C)] +pub struct ChannelReestablish { + /// 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 nativeChannelReestablish, + /// 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, } -#[no_mangle] -/// Get the string representation of a SocketAddress object -pub extern "C" fn SocketAddress_to_str(o: &crate::lightning::ln::msgs::SocketAddress) -> Str { - alloc::format!("{}", &o.to_native()).into() +impl core::ops::Deref for ChannelReestablish { + type Target = nativeChannelReestablish; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -#[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() +unsafe impl core::marker::Send for ChannelReestablish { } +unsafe impl core::marker::Sync for ChannelReestablish { } +impl Drop for ChannelReestablish { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelReestablish>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } } -/// Represents the set of gossip messages that require a signature from a node's identity key. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum UnsignedGossipMessage { - /// An unsigned channel announcement. - ChannelAnnouncement( - crate::lightning::ln::msgs::UnsignedChannelAnnouncement), - /// An unsigned channel update. - ChannelUpdate( - crate::lightning::ln::msgs::UnsignedChannelUpdate), - /// An unsigned node announcement. - NodeAnnouncement( - crate::lightning::ln::msgs::UnsignedNodeAnnouncement), -} -use lightning::ln::msgs::UnsignedGossipMessage as UnsignedGossipMessageImport; -pub(crate) type nativeUnsignedGossipMessage = UnsignedGossipMessageImport; - -impl UnsignedGossipMessage { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeUnsignedGossipMessage { - match self { - UnsignedGossipMessage::ChannelAnnouncement (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeUnsignedGossipMessage::ChannelAnnouncement ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - UnsignedGossipMessage::ChannelUpdate (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeUnsignedGossipMessage::ChannelUpdate ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - UnsignedGossipMessage::NodeAnnouncement (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeUnsignedGossipMessage::NodeAnnouncement ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeUnsignedGossipMessage { - match self { - UnsignedGossipMessage::ChannelAnnouncement (mut a, ) => { - nativeUnsignedGossipMessage::ChannelAnnouncement ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - UnsignedGossipMessage::ChannelUpdate (mut a, ) => { - nativeUnsignedGossipMessage::ChannelUpdate ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - UnsignedGossipMessage::NodeAnnouncement (mut a, ) => { - nativeUnsignedGossipMessage::NodeAnnouncement ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &UnsignedGossipMessageImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeUnsignedGossipMessage) }; - match native { - nativeUnsignedGossipMessage::ChannelAnnouncement (ref a, ) => { - let mut a_nonref = Clone::clone(a); - UnsignedGossipMessage::ChannelAnnouncement ( - crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeUnsignedGossipMessage::ChannelUpdate (ref a, ) => { - let mut a_nonref = Clone::clone(a); - UnsignedGossipMessage::ChannelUpdate ( - crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeUnsignedGossipMessage::NodeAnnouncement (ref a, ) => { - let mut a_nonref = Clone::clone(a); - UnsignedGossipMessage::NodeAnnouncement ( - crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeUnsignedGossipMessage) -> Self { - match native { - nativeUnsignedGossipMessage::ChannelAnnouncement (mut a, ) => { - UnsignedGossipMessage::ChannelAnnouncement ( - crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeUnsignedGossipMessage::ChannelUpdate (mut a, ) => { - UnsignedGossipMessage::ChannelUpdate ( - crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeUnsignedGossipMessage::NodeAnnouncement (mut a, ) => { - UnsignedGossipMessage::NodeAnnouncement ( - crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the UnsignedGossipMessage -#[no_mangle] -pub extern "C" fn UnsignedGossipMessage_free(this_ptr: UnsignedGossipMessage) { } -/// Creates a copy of the UnsignedGossipMessage -#[no_mangle] -pub extern "C" fn UnsignedGossipMessage_clone(orig: &UnsignedGossipMessage) -> UnsignedGossipMessage { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedGossipMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UnsignedGossipMessage)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedGossipMessage_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut UnsignedGossipMessage) }; -} -#[no_mangle] -/// Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage -pub extern "C" fn UnsignedGossipMessage_channel_announcement(a: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> UnsignedGossipMessage { - UnsignedGossipMessage::ChannelAnnouncement(a, ) -} -#[no_mangle] -/// Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage -pub extern "C" fn UnsignedGossipMessage_channel_update(a: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> UnsignedGossipMessage { - UnsignedGossipMessage::ChannelUpdate(a, ) -} -#[no_mangle] -/// Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage -pub extern "C" fn UnsignedGossipMessage_node_announcement(a: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> UnsignedGossipMessage { - UnsignedGossipMessage::NodeAnnouncement(a, ) -} -#[no_mangle] -/// Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read -pub extern "C" fn UnsignedGossipMessage_write(obj: &crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) -} -#[allow(unused)] -pub(crate) extern "C" fn UnsignedGossipMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - UnsignedGossipMessage_write(unsafe { &*(obj as *const UnsignedGossipMessage) }) -} - -use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport; -pub(crate) type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport; - -/// The unsigned part of a [`node_announcement`] message. -/// -/// [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message -#[must_use] -#[repr(C)] -pub struct UnsignedNodeAnnouncement { - /// 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 nativeUnsignedNodeAnnouncement, - /// 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 core::ops::Deref for UnsignedNodeAnnouncement { - type Target = nativeUnsignedNodeAnnouncement; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for UnsignedNodeAnnouncement { } -unsafe impl core::marker::Sync for UnsignedNodeAnnouncement { } -impl Drop for UnsignedNodeAnnouncement { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the ChannelReestablish, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { } +pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement) }; +pub(crate) extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReestablish) }; } #[allow(unused)] -impl UnsignedNodeAnnouncement { - pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedNodeAnnouncement { +impl ChannelReestablish { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelReestablish { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedNodeAnnouncement { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelReestablish { 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 nativeUnsignedNodeAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelReestablish { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -7617,167 +7464,175 @@ impl UnsignedNodeAnnouncement { Self { inner: self.inner, is_owned: false } } } -/// The advertised features +/// The channel ID #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning_types::features::NodeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; - crate::lightning_types::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::NodeFeatures<>) as *mut _) }, is_owned: false } +pub extern "C" fn ChannelReestablish_get_channel_id(this_ptr: &ChannelReestablish) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// The advertised features +/// The channel ID #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning_types::features::NodeFeatures) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn ChannelReestablish_set_channel_id(this_ptr: &mut ChannelReestablish, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// A strictly monotonic announcement counter, with gaps allowed +/// The next commitment number for the sender #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().timestamp; +pub extern "C" fn ChannelReestablish_get_next_local_commitment_number(this_ptr: &ChannelReestablish) -> u64 { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).next_local_commitment_number; *inner_val } -/// A strictly monotonic announcement counter, with gaps allowed +/// The next commitment number for the sender #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp = val; +pub extern "C" fn ChannelReestablish_set_next_local_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_local_commitment_number = val; } -/// The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back -/// to this node). +/// The next commitment number for the recipient #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id; - crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } +pub extern "C" fn ChannelReestablish_get_next_remote_commitment_number(this_ptr: &ChannelReestablish) -> u64 { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).next_remote_commitment_number; + *inner_val } -/// The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back -/// to this node). +/// The next commitment number for the recipient #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn ChannelReestablish_set_next_remote_commitment_number(this_ptr: &mut ChannelReestablish, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_remote_commitment_number = val; } -/// An RGB color for UI purposes +/// Proof that the sender knows the per-commitment secret of a specific commitment transaction +/// belonging to the recipient #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().rgb; +pub extern "C" fn ChannelReestablish_get_your_last_per_commitment_secret(this_ptr: &ChannelReestablish) -> *const [u8; 32] { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).your_last_per_commitment_secret; inner_val } -/// An RGB color for UI purposes +/// Proof that the sender knows the per-commitment secret of a specific commitment transaction +/// belonging to the recipient #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.rgb = val.data; +pub extern "C" fn ChannelReestablish_set_your_last_per_commitment_secret(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.your_last_per_commitment_secret = val.data; } -/// An alias, for UI purposes. -/// -/// This should be sanitized before use. There is no guarantee of uniqueness. +/// The sender's per-commitment point for their current commitment transaction #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::routing::gossip::NodeAlias { - let mut inner_val = &mut this_ptr.get_native_mut_ref().alias; - crate::lightning::routing::gossip::NodeAlias { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeAlias<>) as *mut _) }, is_owned: false } +pub extern "C" fn ChannelReestablish_get_my_current_per_commitment_point(this_ptr: &ChannelReestablish) -> crate::c_types::PublicKey { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).my_current_per_commitment_point; + crate::c_types::PublicKey::from_rust(&inner_val) } -/// An alias, for UI purposes. -/// -/// This should be sanitized before use. There is no guarantee of uniqueness. +/// The sender's per-commitment point for their current commitment transaction #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::routing::gossip::NodeAlias) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.alias = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn ChannelReestablish_set_my_current_per_commitment_point(this_ptr: &mut ChannelReestablish, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.my_current_per_commitment_point = val.into_rust(); } -/// List of addresses on which this node is reachable +/// The next funding transaction ID /// -/// Returns a copy of the field. -#[no_mangle] -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::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_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; -} -/// Excess address data which was signed as a part of the message which we do not (yet) understand how -/// to decode. +/// Allows peers to finalize the signing steps of an interactive transaction construction, or +/// safely abort that transaction if it was not signed by one of the peers, who has thus already +/// removed it from its state. /// -/// This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol. +/// If we've sent `commtiment_signed` for an interactively constructed transaction +/// during a signing session, but have not received `tx_signatures` we MUST set `next_funding` +/// to the txid of that interactive transaction, else we MUST NOT set it. /// -/// Returns a copy of the field. +/// See the spec for further details on this: +/// * `channel_reestablish`-sending node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2466-L2470 +/// * `channel_reestablish`-receiving node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2520-L2531 +/// +/// 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 UnsignedNodeAnnouncement_get_excess_address_data(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = this_ptr.get_native_mut_ref().excess_address_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() +pub extern "C" fn ChannelReestablish_get_next_funding(this_ptr: &ChannelReestablish) -> crate::lightning::ln::msgs::NextFunding { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).next_funding; + let mut local_inner_val = crate::lightning::ln::msgs::NextFunding { 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::msgs::NextFunding<>) as *mut _ }, is_owned: false }; + local_inner_val } -/// Excess address data which was signed as a part of the message which we do not (yet) understand how -/// to decode. +/// The next funding transaction ID /// -/// This is stored to ensure forward-compatibility as new address types are added to the lightning gossip protocol. +/// Allows peers to finalize the signing steps of an interactive transaction construction, or +/// safely abort that transaction if it was not signed by one of the peers, who has thus already +/// removed it from its state. +/// +/// If we've sent `commtiment_signed` for an interactively constructed transaction +/// during a signing session, but have not received `tx_signatures` we MUST set `next_funding` +/// to the txid of that interactive transaction, else we MUST NOT set it. +/// +/// See the spec for further details on this: +/// * `channel_reestablish`-sending node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2466-L2470 +/// * `channel_reestablish`-receiving node: https:///github.com/lightning/bolts/blob/247e83d/02-peer-protocol.md?plain=1#L2520-L2531 +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_excess_address_data(this_ptr: &mut UnsignedNodeAnnouncement, 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_address_data = local_val; +pub extern "C" fn ChannelReestablish_set_next_funding(this_ptr: &mut ChannelReestablish, mut val: crate::lightning::ln::msgs::NextFunding) { + 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) }.next_funding = local_val; } -/// Excess data which was signed as a part of the message which we do not (yet) understand how -/// to decode. +/// The last funding txid sent by the sending node, which may be: +/// - the txid of the last `splice_locked` it sent, otherwise +/// - the txid of the funding transaction if it sent `channel_ready`, or else +/// - `None` if it has never sent `channel_ready` or `splice_locked` /// -/// This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. +/// Also contains a bitfield indicating which messages should be retransmitted. /// -/// Returns a copy of the field. +/// 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 UnsignedNodeAnnouncement_get_excess_data(this_ptr: &UnsignedNodeAnnouncement) -> 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() +pub extern "C" fn ChannelReestablish_get_my_current_funding_locked(this_ptr: &ChannelReestablish) -> crate::lightning::ln::msgs::FundingLocked { + let mut inner_val = &mut ChannelReestablish::get_native_mut_ref(this_ptr).my_current_funding_locked; + let mut local_inner_val = crate::lightning::ln::msgs::FundingLocked { 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::msgs::FundingLocked<>) as *mut _ }, is_owned: false }; + local_inner_val } -/// Excess data which was signed as a part of the message which we do not (yet) understand how -/// to decode. +/// The last funding txid sent by the sending node, which may be: +/// - the txid of the last `splice_locked` it sent, otherwise +/// - the txid of the funding transaction if it sent `channel_ready`, or else +/// - `None` if it has never sent `channel_ready` or `splice_locked` /// -/// This is stored to ensure forward-compatibility as new fields are added to the lightning gossip protocol. +/// Also contains a bitfield indicating which messages should be retransmitted. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_set_excess_data(this_ptr: &mut UnsignedNodeAnnouncement, 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; +pub extern "C" fn ChannelReestablish_set_my_current_funding_locked(this_ptr: &mut ChannelReestablish, mut val: crate::lightning::ln::msgs::FundingLocked) { + 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) }.my_current_funding_locked = local_val; } -/// Constructs a new UnsignedNodeAnnouncement given each field +/// Constructs a new ChannelReestablish given each field +/// +/// Note that next_funding_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that my_current_funding_locked_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_new(mut features_arg: crate::lightning_types::features::NodeFeatures, mut timestamp_arg: u32, mut node_id_arg: crate::lightning::routing::gossip::NodeId, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::lightning::routing::gossip::NodeAlias, mut addresses_arg: crate::c_types::derived::CVec_SocketAddressZ, mut excess_address_data_arg: crate::c_types::derived::CVec_u8Z, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedNodeAnnouncement { - let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); }; - let mut local_excess_address_data_arg = Vec::new(); for mut item in excess_address_data_arg.into_rust().drain(..) { local_excess_address_data_arg.push( { item }); }; - let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); }; - UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(nativeUnsignedNodeAnnouncement { - features: *unsafe { Box::from_raw(features_arg.take_inner()) }, - timestamp: timestamp_arg, - node_id: *unsafe { Box::from_raw(node_id_arg.take_inner()) }, - rgb: rgb_arg.data, - alias: *unsafe { Box::from_raw(alias_arg.take_inner()) }, - addresses: local_addresses_arg, - excess_address_data: local_excess_address_data_arg, - excess_data: local_excess_data_arg, +pub extern "C" fn ChannelReestablish_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, 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_arg: crate::lightning::ln::msgs::NextFunding, mut my_current_funding_locked_arg: crate::lightning::ln::msgs::FundingLocked) -> ChannelReestablish { + let mut local_next_funding_arg = if next_funding_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(next_funding_arg.take_inner()) } }) }; + let mut local_my_current_funding_locked_arg = if my_current_funding_locked_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(my_current_funding_locked_arg.take_inner()) } }) }; + ChannelReestablish { inner: ObjOps::heap_alloc(nativeChannelReestablish { + channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + 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, + my_current_per_commitment_point: my_current_per_commitment_point_arg.into_rust(), + next_funding: local_next_funding_arg, + my_current_funding_locked: local_my_current_funding_locked_arg, }), is_owned: true } } -impl Clone for UnsignedNodeAnnouncement { +impl Clone for ChannelReestablish { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeChannelReestablish>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedNodeAnnouncement)).clone() })) as *mut c_void +pub(crate) extern "C" fn ChannelReestablish_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelReestablish) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UnsignedNodeAnnouncement -pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement { - orig.clone() +/// Creates a copy of the ChannelReestablish +pub extern "C" fn ChannelReestablish_clone(orig: &ChannelReestablish) -> ChannelReestablish { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UnsignedNodeAnnouncement object -pub extern "C" fn UnsignedNodeAnnouncement_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedNodeAnnouncement }).into()} -/// Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. +/// Get a string which allows debug introspection of a ChannelReestablish object +pub extern "C" fn ChannelReestablish_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelReestablish }).into()} +/// Generates a non-cryptographic 64-bit hash of the ChannelReestablish. #[no_mangle] -pub extern "C" fn UnsignedNodeAnnouncement_hash(o: &UnsignedNodeAnnouncement) -> u64 { +pub extern "C" fn ChannelReestablish_hash(o: &ChannelReestablish) -> 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)] @@ -7785,30 +7640,29 @@ pub extern "C" fn UnsignedNodeAnnouncement_hash(o: &UnsignedNodeAnnouncement) -> core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UnsignedNodeAnnouncements contain equal inner contents. +/// Checks if two ChannelReestablishs 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 UnsignedNodeAnnouncement_eq(a: &UnsignedNodeAnnouncement, b: &UnsignedNodeAnnouncement) -> bool { +pub extern "C" fn ChannelReestablish_eq(a: &ChannelReestablish, b: &ChannelReestablish) -> 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 } } -use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport; -pub(crate) type nativeNodeAnnouncement = nativeNodeAnnouncementImport; +use lightning::ln::msgs::NextFunding as nativeNextFundingImport; +pub(crate) type nativeNextFunding = nativeNextFundingImport; -/// A [`node_announcement`] message to be sent to or received from a peer. -/// -/// [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message +/// Information exchanged during channel reestablishment about the next funding from interactive +/// transaction construction. #[must_use] #[repr(C)] -pub struct NodeAnnouncement { +pub struct NextFunding { /// 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 nativeNodeAnnouncement, + pub inner: *mut nativeNextFunding, /// 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 @@ -7816,37 +7670,37 @@ pub struct NodeAnnouncement { pub is_owned: bool, } -impl core::ops::Deref for NodeAnnouncement { - type Target = nativeNodeAnnouncement; +impl core::ops::Deref for NextFunding { + type Target = nativeNextFunding; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for NodeAnnouncement { } -unsafe impl core::marker::Sync for NodeAnnouncement { } -impl Drop for NodeAnnouncement { +unsafe impl core::marker::Send for NextFunding { } +unsafe impl core::marker::Sync for NextFunding { } +impl Drop for NextFunding { fn drop(&mut self) { - if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) { + if self.is_owned && !<*mut nativeNextFunding>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the NextFunding, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { } +pub extern "C" fn NextFunding_free(this_obj: NextFunding) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeAnnouncement) }; +pub(crate) extern "C" fn NextFunding_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNextFunding) }; } #[allow(unused)] -impl NodeAnnouncement { - pub(crate) fn get_native_ref(&self) -> &'static nativeNodeAnnouncement { +impl NextFunding { + pub(crate) fn get_native_ref(&self) -> &'static nativeNextFunding { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeAnnouncement { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNextFunding { 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 nativeNodeAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeNextFunding { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -7856,62 +7710,66 @@ impl NodeAnnouncement { Self { inner: self.inner, is_owned: false } } } -/// The signature by the node key +/// The txid of the interactive transaction construction. #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn NextFunding_get_txid(this_ptr: &NextFunding) -> *const [u8; 32] { + let mut inner_val = &mut NextFunding::get_native_mut_ref(this_ptr).txid; + inner_val.as_ref() } -/// The signature by the node key +/// The txid of the interactive transaction construction. #[no_mangle] -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(); +pub extern "C" fn NextFunding_set_txid(this_ptr: &mut NextFunding, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap(); } -/// The actual content of the announcement +/// A bitfield indicating which messages should be retransmitted by the receiving node. +/// +/// See [`NextFundingFlag`] for details. #[no_mangle] -pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement { - let mut inner_val = &mut this_ptr.get_native_mut_ref().contents; - crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedNodeAnnouncement<>) as *mut _) }, is_owned: false } +pub extern "C" fn NextFunding_get_retransmit_flags(this_ptr: &NextFunding) -> u8 { + let mut inner_val = &mut NextFunding::get_native_mut_ref(this_ptr).retransmit_flags; + *inner_val } -/// The actual content of the announcement +/// A bitfield indicating which messages should be retransmitted by the receiving node. +/// +/// See [`NextFundingFlag`] for details. #[no_mangle] -pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn NextFunding_set_retransmit_flags(this_ptr: &mut NextFunding, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.retransmit_flags = val; } -/// Constructs a new NodeAnnouncement given each field +/// Constructs a new NextFunding given each field #[must_use] #[no_mangle] -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()) }, +pub extern "C" fn NextFunding_new(mut txid_arg: crate::c_types::ThirtyTwoBytes, mut retransmit_flags_arg: u8) -> NextFunding { + NextFunding { inner: ObjOps::heap_alloc(nativeNextFunding { + txid: ::bitcoin::hash_types::Txid::from_slice(&txid_arg.data[..]).unwrap(), + retransmit_flags: retransmit_flags_arg, }), is_owned: true } } -impl Clone for NodeAnnouncement { +impl Clone for NextFunding { fn clone(&self) -> Self { Self { - inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeNextFunding>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAnnouncement)).clone() })) as *mut c_void +pub(crate) extern "C" fn NextFunding_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNextFunding) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the NodeAnnouncement -pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement { - orig.clone() +/// Creates a copy of the NextFunding +pub extern "C" fn NextFunding_clone(orig: &NextFunding) -> NextFunding { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a NodeAnnouncement object -pub extern "C" fn NodeAnnouncement_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::NodeAnnouncement }).into()} -/// Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. +/// Get a string which allows debug introspection of a NextFunding object +pub extern "C" fn NextFunding_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::NextFunding }).into()} +/// Generates a non-cryptographic 64-bit hash of the NextFunding. #[no_mangle] -pub extern "C" fn NodeAnnouncement_hash(o: &NodeAnnouncement) -> u64 { +pub extern "C" fn NextFunding_hash(o: &NextFunding) -> 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)] @@ -7919,30 +7777,99 @@ pub extern "C" fn NodeAnnouncement_hash(o: &NodeAnnouncement) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two NodeAnnouncements contain equal inner contents. +/// Checks if two NextFundings 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 NodeAnnouncement_eq(a: &NodeAnnouncement, b: &NodeAnnouncement) -> bool { +pub extern "C" fn NextFunding_eq(a: &NextFunding, b: &NextFunding) -> 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 } } +/// Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`. +#[no_mangle] +pub extern "C" fn NextFunding_retransmit(this_arg: &mut crate::lightning::ln::msgs::NextFunding, mut flag: crate::lightning::ln::msgs::NextFundingFlag) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::msgs::nativeNextFunding)) }.retransmit(flag.into_native()) +} -use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport; -pub(crate) type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport; +/// Returns whether the message corresponding to `flag` should be retransmitted. +#[must_use] +#[no_mangle] +pub extern "C" fn NextFunding_should_retransmit(this_arg: &crate::lightning::ln::msgs::NextFunding, mut flag: crate::lightning::ln::msgs::NextFundingFlag) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.should_retransmit(flag.into_native()); + ret +} -/// The unsigned part of a [`channel_announcement`] message. -/// -/// [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message +/// Bit positions used in [`NextFunding::retransmit_flags`] for requesting message retransmission. +#[derive(Clone)] #[must_use] #[repr(C)] -pub struct UnsignedChannelAnnouncement { +pub enum NextFundingFlag { + /// Retransmit `commitment_signed`. + CommitmentSigned, +} +use lightning::ln::msgs::NextFundingFlag as NextFundingFlagImport; +pub(crate) type nativeNextFundingFlag = NextFundingFlagImport; + +impl NextFundingFlag { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeNextFundingFlag { + match self { + NextFundingFlag::CommitmentSigned => nativeNextFundingFlag::CommitmentSigned, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeNextFundingFlag { + match self { + NextFundingFlag::CommitmentSigned => nativeNextFundingFlag::CommitmentSigned, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &NextFundingFlagImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeNextFundingFlag) }; + match native { + nativeNextFundingFlag::CommitmentSigned => NextFundingFlag::CommitmentSigned, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeNextFundingFlag) -> Self { + match native { + nativeNextFundingFlag::CommitmentSigned => NextFundingFlag::CommitmentSigned, + } + } +} +/// Creates a copy of the NextFundingFlag +#[no_mangle] +pub extern "C" fn NextFundingFlag_clone(orig: &NextFundingFlag) -> NextFundingFlag { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn NextFundingFlag_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const NextFundingFlag)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn NextFundingFlag_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut NextFundingFlag) }; +} +#[no_mangle] +/// Utility method to constructs a new CommitmentSigned-variant NextFundingFlag +pub extern "C" fn NextFundingFlag_commitment_signed() -> NextFundingFlag { + NextFundingFlag::CommitmentSigned} + +use lightning::ln::msgs::FundingLocked as nativeFundingLockedImport; +pub(crate) type nativeFundingLocked = nativeFundingLockedImport; + +/// Information exchanged during channel reestablishment about the last funding locked. +#[must_use] +#[repr(C)] +pub struct FundingLocked { /// 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 nativeUnsignedChannelAnnouncement, + pub inner: *mut nativeFundingLocked, /// 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 @@ -7950,37 +7877,37 @@ pub struct UnsignedChannelAnnouncement { pub is_owned: bool, } -impl core::ops::Deref for UnsignedChannelAnnouncement { - type Target = nativeUnsignedChannelAnnouncement; +impl core::ops::Deref for FundingLocked { + type Target = nativeFundingLocked; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for UnsignedChannelAnnouncement { } -unsafe impl core::marker::Sync for UnsignedChannelAnnouncement { } -impl Drop for UnsignedChannelAnnouncement { +unsafe impl core::marker::Send for FundingLocked { } +unsafe impl core::marker::Sync for FundingLocked { } +impl Drop for FundingLocked { fn drop(&mut self) { - if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { + if self.is_owned && !<*mut nativeFundingLocked>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { } +pub extern "C" fn FundingLocked_free(this_obj: FundingLocked) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement) }; +pub(crate) extern "C" fn FundingLocked_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingLocked) }; } #[allow(unused)] -impl UnsignedChannelAnnouncement { - pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedChannelAnnouncement { +impl FundingLocked { + pub(crate) fn get_native_ref(&self) -> &'static nativeFundingLocked { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedChannelAnnouncement { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeFundingLocked { 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 nativeUnsignedChannelAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeFundingLocked { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -7990,145 +7917,68 @@ impl UnsignedChannelAnnouncement { Self { inner: self.inner, is_owned: false } } } -/// The advertised channel features -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning_types::features::ChannelFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; - crate::lightning_types::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelFeatures<>) as *mut _) }, is_owned: false } -} -/// The advertised channel features -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning_types::features::ChannelFeatures) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The genesis hash of the blockchain where the channel is to be opened +/// The last txid sent by the sending node, which may be either from the last `splice_locked` or +/// for the initial funding transaction if it sent `channel_ready`. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; +pub extern "C" fn FundingLocked_get_txid(this_ptr: &FundingLocked) -> *const [u8; 32] { + let mut inner_val = &mut FundingLocked::get_native_mut_ref(this_ptr).txid; inner_val.as_ref() } -/// The genesis hash of the blockchain where the channel is to be opened +/// The last txid sent by the sending node, which may be either from the last `splice_locked` or +/// for the initial funding transaction if it sent `channel_ready`. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +pub extern "C" fn FundingLocked_set_txid(this_ptr: &mut FundingLocked, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.txid = ::bitcoin::hash_types::Txid::from_slice(&val.data[..]).unwrap(); } -/// The short channel ID +/// A bitfield indicating which messages should be retransmitted by the receiving node. +/// +/// See [`FundingLockedFlags`] for details. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; +pub extern "C" fn FundingLocked_get_retransmit_flags(this_ptr: &FundingLocked) -> u8 { + let mut inner_val = &mut FundingLocked::get_native_mut_ref(this_ptr).retransmit_flags; *inner_val } -/// The short channel ID -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; -} -/// One of the two `node_id`s which are endpoints of this channel +/// A bitfield indicating which messages should be retransmitted by the receiving node. +/// +/// See [`FundingLockedFlags`] for details. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id_1; - crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } +pub extern "C" fn FundingLocked_set_retransmit_flags(this_ptr: &mut FundingLocked, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.retransmit_flags = val; } -/// One of the two `node_id`s which are endpoints of this channel +/// Constructs a new FundingLocked given each field +#[must_use] #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id_1 = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn FundingLocked_new(mut txid_arg: crate::c_types::ThirtyTwoBytes, mut retransmit_flags_arg: u8) -> FundingLocked { + FundingLocked { inner: ObjOps::heap_alloc(nativeFundingLocked { + txid: ::bitcoin::hash_types::Txid::from_slice(&txid_arg.data[..]).unwrap(), + retransmit_flags: retransmit_flags_arg, + }), is_owned: true } } -/// The other of the two `node_id`s which are endpoints of this channel -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_id_2; - crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } -} -/// The other of the two `node_id`s which are endpoints of this channel -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id_2 = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The funding key for the first node -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_key_1; - crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } -} -/// The funding key for the first node -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_key_1 = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The funding key for the second node -#[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().bitcoin_key_2; - crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } -} -/// The funding key for the second node -#[no_mangle] -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_types::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::constants::ChainHash::from(&chain_hash_arg.data), - 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 { +impl Clone for FundingLocked { fn clone(&self) -> Self { Self { - inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeFundingLocked>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedChannelAnnouncement)).clone() })) as *mut c_void +pub(crate) extern "C" fn FundingLocked_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFundingLocked) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the UnsignedChannelAnnouncement -pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement { - orig.clone() +/// Creates a copy of the FundingLocked +pub extern "C" fn FundingLocked_clone(orig: &FundingLocked) -> FundingLocked { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a UnsignedChannelAnnouncement object -pub extern "C" fn UnsignedChannelAnnouncement_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedChannelAnnouncement }).into()} -/// Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. +/// Get a string which allows debug introspection of a FundingLocked object +pub extern "C" fn FundingLocked_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::FundingLocked }).into()} +/// Generates a non-cryptographic 64-bit hash of the FundingLocked. #[no_mangle] -pub extern "C" fn UnsignedChannelAnnouncement_hash(o: &UnsignedChannelAnnouncement) -> u64 { +pub extern "C" fn FundingLocked_hash(o: &FundingLocked) -> 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)] @@ -8136,30 +7986,101 @@ pub extern "C" fn UnsignedChannelAnnouncement_hash(o: &UnsignedChannelAnnounceme core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two UnsignedChannelAnnouncements contain equal inner contents. +/// Checks if two FundingLockeds 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 UnsignedChannelAnnouncement_eq(a: &UnsignedChannelAnnouncement, b: &UnsignedChannelAnnouncement) -> bool { +pub extern "C" fn FundingLocked_eq(a: &FundingLocked, b: &FundingLocked) -> 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 } } +/// Sets the bit in `retransmit_flags` for retransmitting the message corresponding to `flag`. +#[no_mangle] +pub extern "C" fn FundingLocked_retransmit(this_arg: &mut crate::lightning::ln::msgs::FundingLocked, mut flag: crate::lightning::ln::msgs::FundingLockedFlags) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::ln::msgs::nativeFundingLocked)) }.retransmit(flag.into_native()) +} -use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport; -pub(crate) type nativeChannelAnnouncement = nativeChannelAnnouncementImport; +/// Returns whether the message corresponding to `flag` should be retransmitted. +#[must_use] +#[no_mangle] +pub extern "C" fn FundingLocked_should_retransmit(this_arg: &crate::lightning::ln::msgs::FundingLocked, mut flag: crate::lightning::ln::msgs::FundingLockedFlags) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.should_retransmit(flag.into_native()); + ret +} -/// A [`channel_announcement`] message to be sent to or received from a peer. +/// Bit positions used in [`FundingLocked::retransmit_flags`] for requesting message retransmission. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum FundingLockedFlags { + /// Retransmit `announcement_signatures`. + AnnouncementSignatures, +} +use lightning::ln::msgs::FundingLockedFlags as FundingLockedFlagsImport; +pub(crate) type nativeFundingLockedFlags = FundingLockedFlagsImport; + +impl FundingLockedFlags { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeFundingLockedFlags { + match self { + FundingLockedFlags::AnnouncementSignatures => nativeFundingLockedFlags::AnnouncementSignatures, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeFundingLockedFlags { + match self { + FundingLockedFlags::AnnouncementSignatures => nativeFundingLockedFlags::AnnouncementSignatures, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &FundingLockedFlagsImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeFundingLockedFlags) }; + match native { + nativeFundingLockedFlags::AnnouncementSignatures => FundingLockedFlags::AnnouncementSignatures, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeFundingLockedFlags) -> Self { + match native { + nativeFundingLockedFlags::AnnouncementSignatures => FundingLockedFlags::AnnouncementSignatures, + } + } +} +/// Creates a copy of the FundingLockedFlags +#[no_mangle] +pub extern "C" fn FundingLockedFlags_clone(orig: &FundingLockedFlags) -> FundingLockedFlags { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn FundingLockedFlags_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const FundingLockedFlags)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn FundingLockedFlags_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut FundingLockedFlags) }; +} +#[no_mangle] +/// Utility method to constructs a new AnnouncementSignatures-variant FundingLockedFlags +pub extern "C" fn FundingLockedFlags_announcement_signatures() -> FundingLockedFlags { + FundingLockedFlags::AnnouncementSignatures} + +use lightning::ln::msgs::AnnouncementSignatures as nativeAnnouncementSignaturesImport; +pub(crate) type nativeAnnouncementSignatures = nativeAnnouncementSignaturesImport; + +/// An [`announcement_signatures`] message to be sent to or received from a peer. /// -/// [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message +/// [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message #[must_use] #[repr(C)] -pub struct ChannelAnnouncement { +pub struct AnnouncementSignatures { /// 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 nativeChannelAnnouncement, + pub inner: *mut nativeAnnouncementSignatures, /// 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 @@ -8167,37 +8088,37 @@ pub struct ChannelAnnouncement { pub is_owned: bool, } -impl core::ops::Deref for ChannelAnnouncement { - type Target = nativeChannelAnnouncement; +impl core::ops::Deref for AnnouncementSignatures { + type Target = nativeAnnouncementSignatures; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for ChannelAnnouncement { } -unsafe impl core::marker::Sync for ChannelAnnouncement { } -impl Drop for ChannelAnnouncement { +unsafe impl core::marker::Send for AnnouncementSignatures { } +unsafe impl core::marker::Sync for AnnouncementSignatures { } +impl Drop for AnnouncementSignatures { fn drop(&mut self) { - if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) { + if self.is_owned && !<*mut nativeAnnouncementSignatures>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the AnnouncementSignatures, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { } +pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelAnnouncement) }; +pub(crate) extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures) }; } #[allow(unused)] -impl ChannelAnnouncement { - pub(crate) fn get_native_ref(&self) -> &'static nativeChannelAnnouncement { +impl AnnouncementSignatures { + pub(crate) fn get_native_ref(&self) -> &'static nativeAnnouncementSignatures { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelAnnouncement { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAnnouncementSignatures { 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 nativeChannelAnnouncement { + pub(crate) fn take_inner(mut self) -> *mut nativeAnnouncementSignatures { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -8207,98 +8128,86 @@ impl ChannelAnnouncement { Self { inner: self.inner, is_owned: false } } } -/// Authentication of the announcement by the first public node +/// The channel ID #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn AnnouncementSignatures_get_channel_id(this_ptr: &AnnouncementSignatures) -> crate::lightning::ln::types::ChannelId { + let mut inner_val = &mut AnnouncementSignatures::get_native_mut_ref(this_ptr).channel_id; + crate::lightning::ln::types::ChannelId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::types::ChannelId<>) as *mut _) }, is_owned: false } } -/// Authentication of the announcement by the first public node +/// The channel ID #[no_mangle] -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(); +pub extern "C" fn AnnouncementSignatures_set_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: crate::lightning::ln::types::ChannelId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_id = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Authentication of the announcement by the second public node +/// The short channel ID #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn AnnouncementSignatures_get_short_channel_id(this_ptr: &AnnouncementSignatures) -> u64 { + let mut inner_val = &mut AnnouncementSignatures::get_native_mut_ref(this_ptr).short_channel_id; + *inner_val } -/// Authentication of the announcement by the second public node +/// The short channel ID #[no_mangle] -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(); +pub extern "C" fn AnnouncementSignatures_set_short_channel_id(this_ptr: &mut AnnouncementSignatures, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; } -/// Proof of funding UTXO ownership by the first public node +/// A signature by the node key #[no_mangle] -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; +pub extern "C" fn AnnouncementSignatures_get_node_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut AnnouncementSignatures::get_native_mut_ref(this_ptr).node_signature; crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// Proof of funding UTXO ownership by the first public node +/// A signature by the node key #[no_mangle] -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(); +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(); } -/// Proof of funding UTXO ownership by the second public node +/// A signature by the funding key #[no_mangle] -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; +pub extern "C" fn AnnouncementSignatures_get_bitcoin_signature(this_ptr: &AnnouncementSignatures) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut AnnouncementSignatures::get_native_mut_ref(this_ptr).bitcoin_signature; 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::ECDSASignature) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_signature_2 = val.into_rust(); -} -/// The actual announcement -#[no_mangle] -pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement { - let mut inner_val = &mut this_ptr.get_native_mut_ref().contents; - crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false } -} -/// The actual announcement +/// A signature by the funding key #[no_mangle] -pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; +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 ChannelAnnouncement given each field +/// Constructs a new AnnouncementSignatures given each field #[must_use] #[no_mangle] -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(), - bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(), - bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(), - contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, +pub extern "C" fn AnnouncementSignatures_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, 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: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, + short_channel_id: short_channel_id_arg, + node_signature: node_signature_arg.into_rust(), + bitcoin_signature: bitcoin_signature_arg.into_rust(), }), is_owned: true } } -impl Clone for ChannelAnnouncement { +impl Clone for AnnouncementSignatures { fn clone(&self) -> Self { Self { - inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeAnnouncementSignatures>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelAnnouncement)).clone() })) as *mut c_void +pub(crate) extern "C" fn AnnouncementSignatures_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAnnouncementSignatures) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the ChannelAnnouncement -pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement { - orig.clone() +/// Creates a copy of the AnnouncementSignatures +pub extern "C" fn AnnouncementSignatures_clone(orig: &AnnouncementSignatures) -> AnnouncementSignatures { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a ChannelAnnouncement object -pub extern "C" fn ChannelAnnouncement_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelAnnouncement }).into()} -/// Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. +/// Get a string which allows debug introspection of a AnnouncementSignatures object +pub extern "C" fn AnnouncementSignatures_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::AnnouncementSignatures }).into()} +/// Generates a non-cryptographic 64-bit hash of the AnnouncementSignatures. #[no_mangle] -pub extern "C" fn ChannelAnnouncement_hash(o: &ChannelAnnouncement) -> u64 { +pub extern "C" fn AnnouncementSignatures_hash(o: &AnnouncementSignatures) -> 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)] @@ -8306,303 +8215,630 @@ pub extern "C" fn ChannelAnnouncement_hash(o: &ChannelAnnouncement) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two ChannelAnnouncements contain equal inner contents. +/// Checks if two AnnouncementSignaturess 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 ChannelAnnouncement_eq(a: &ChannelAnnouncement, b: &ChannelAnnouncement) -> bool { +pub extern "C" fn AnnouncementSignatures_eq(a: &AnnouncementSignatures, b: &AnnouncementSignatures) -> 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 } } - -use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport; -pub(crate) type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport; - -/// The unsigned part of a [`channel_update`] message. -/// -/// [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message +/// An address which can be used to connect to a remote peer. +#[derive(Clone)] #[must_use] #[repr(C)] -pub struct UnsignedChannelUpdate { - /// 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 nativeUnsignedChannelUpdate, - /// 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, +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 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 + port: u16, + }, + /// 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. + OnionV2( + crate::c_types::TwelveBytes), + /// 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\". + OnionV3 { + /// The ed25519 long-term public key of the peer + ed25519_pubkey: crate::c_types::ThirtyTwoBytes, + /// The checksum of the pubkey and version, as included in the onion address + checksum: u16, + /// The version byte, as defined by the Tor Onion v3 spec. + version: u8, + /// The port on which the node is listening + port: u16, + }, + /// A hostname/port on which the peer is listening. + Hostname { + /// The hostname on which the node is listening. + hostname: crate::lightning::util::ser::Hostname, + /// The port on which the node is listening. + port: u16, + }, } +use lightning::ln::msgs::SocketAddress as SocketAddressImport; +pub(crate) type nativeSocketAddress = SocketAddressImport; -impl core::ops::Deref for UnsignedChannelUpdate { - type Target = nativeUnsignedChannelUpdate; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for UnsignedChannelUpdate { } -unsafe impl core::marker::Sync for UnsignedChannelUpdate { } -impl Drop for UnsignedChannelUpdate { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; +impl SocketAddress { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeSocketAddress { + match self { + SocketAddress::TcpIpV4 {ref addr, ref port, } => { + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); + nativeSocketAddress::TcpIpV4 { + addr: addr_nonref.data, + port: port_nonref, + } + }, + SocketAddress::TcpIpV6 {ref addr, ref port, } => { + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); + nativeSocketAddress::TcpIpV6 { + addr: addr_nonref.data, + port: port_nonref, + } + }, + SocketAddress::OnionV2 (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeSocketAddress::OnionV2 ( + a_nonref.data, + ) + }, + 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); + nativeSocketAddress::OnionV3 { + ed25519_pubkey: ed25519_pubkey_nonref.data, + checksum: checksum_nonref, + version: version_nonref, + port: port_nonref, + } + }, + SocketAddress::Hostname {ref hostname, ref port, } => { + let mut hostname_nonref = Clone::clone(hostname); + let mut port_nonref = Clone::clone(port); + nativeSocketAddress::Hostname { + hostname: *unsafe { Box::from_raw(hostname_nonref.take_inner()) }, + port: port_nonref, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeSocketAddress { + match self { + SocketAddress::TcpIpV4 {mut addr, mut port, } => { + nativeSocketAddress::TcpIpV4 { + addr: addr.data, + port: port, + } + }, + SocketAddress::TcpIpV6 {mut addr, mut port, } => { + nativeSocketAddress::TcpIpV6 { + addr: addr.data, + port: port, + } + }, + SocketAddress::OnionV2 (mut a, ) => { + nativeSocketAddress::OnionV2 ( + a.data, + ) + }, + SocketAddress::OnionV3 {mut ed25519_pubkey, mut checksum, mut version, mut port, } => { + nativeSocketAddress::OnionV3 { + ed25519_pubkey: ed25519_pubkey.data, + checksum: checksum, + version: version, + port: port, + } + }, + SocketAddress::Hostname {mut hostname, mut port, } => { + nativeSocketAddress::Hostname { + hostname: *unsafe { Box::from_raw(hostname.take_inner()) }, + port: port, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &SocketAddressImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSocketAddress) }; + match native { + nativeSocketAddress::TcpIpV4 {ref addr, ref port, } => { + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); + SocketAddress::TcpIpV4 { + addr: crate::c_types::FourBytes { data: addr_nonref }, + port: port_nonref, + } + }, + nativeSocketAddress::TcpIpV6 {ref addr, ref port, } => { + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); + SocketAddress::TcpIpV6 { + addr: crate::c_types::SixteenBytes { data: addr_nonref }, + port: port_nonref, + } + }, + nativeSocketAddress::OnionV2 (ref a, ) => { + let mut a_nonref = Clone::clone(a); + SocketAddress::OnionV2 ( + crate::c_types::TwelveBytes { data: a_nonref }, + ) + }, + 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); + SocketAddress::OnionV3 { + ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref }, + checksum: checksum_nonref, + version: version_nonref, + port: port_nonref, + } + }, + nativeSocketAddress::Hostname {ref hostname, ref port, } => { + let mut hostname_nonref = Clone::clone(hostname); + let mut port_nonref = Clone::clone(port); + SocketAddress::Hostname { + hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname_nonref), is_owned: true }, + port: port_nonref, + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeSocketAddress) -> Self { + match native { + nativeSocketAddress::TcpIpV4 {mut addr, mut port, } => { + SocketAddress::TcpIpV4 { + addr: crate::c_types::FourBytes { data: addr }, + port: port, + } + }, + nativeSocketAddress::TcpIpV6 {mut addr, mut port, } => { + SocketAddress::TcpIpV6 { + addr: crate::c_types::SixteenBytes { data: addr }, + port: port, + } + }, + nativeSocketAddress::OnionV2 (mut a, ) => { + SocketAddress::OnionV2 ( + crate::c_types::TwelveBytes { data: a }, + ) + }, + 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, + } + }, + nativeSocketAddress::Hostname {mut hostname, mut port, } => { + SocketAddress::Hostname { + hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname), is_owned: true }, + port: port, + } + }, } } } -/// Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the SocketAddress #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { } +pub extern "C" fn SocketAddress_free(this_ptr: SocketAddress) { } +/// Creates a copy of the SocketAddress +#[no_mangle] +pub extern "C" fn SocketAddress_clone(orig: &SocketAddress) -> SocketAddress { + orig.clone() +} #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate) }; +pub(crate) extern "C" fn SocketAddress_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddress)).clone() })) as *mut c_void } #[allow(unused)] -impl UnsignedChannelUpdate { - pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedChannelUpdate { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedChannelUpdate { - 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 nativeUnsignedChannelUpdate { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SocketAddress_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddress) }; } -/// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; - inner_val.as_ref() +/// 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, + } } -/// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +/// 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, + } } -/// The short channel ID #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; - *inner_val +/// 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, ) } -/// The short channel ID #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; +/// 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, + port, + } } -/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().timestamp; - *inner_val +/// 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, + } } -/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel +/// Get a string which allows debug introspection of a SocketAddress object +pub extern "C" fn SocketAddress_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SocketAddress }).into()} +/// Generates a non-cryptographic 64-bit hash of the SocketAddress. #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp = val; +pub extern "C" fn SocketAddress_hash(o: &SocketAddress) -> 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) } -/// Flags pertaining to this message. +/// 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 UnsignedChannelUpdate_get_message_flags(this_ptr: &UnsignedChannelUpdate) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().message_flags; - *inner_val +pub extern "C" fn SocketAddress_eq(a: &SocketAddress, b: &SocketAddress) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } } -/// Flags pertaining to this message. #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_message_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message_flags = val; +/// 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()) } -/// Flags pertaining to the channel, including to which direction in the channel this update -/// applies and whether the direction is currently able to forward HTLCs. -#[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_channel_flags(this_ptr: &UnsignedChannelUpdate) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_flags; - *inner_val +#[allow(unused)] +pub(crate) extern "C" fn SocketAddress_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + SocketAddress_write(unsafe { &*(obj as *const SocketAddress) }) } -/// Flags pertaining to the channel, including to which direction in the channel this update -/// applies and whether the direction is currently able to forward HTLCs. #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_channel_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_flags = val; +/// 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 } -/// The number of blocks such that if: -/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` -/// then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines -/// the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a -/// `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, -/// then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before -/// forwarding. Note that the HTLC sender is the one who originally sets this value when -/// constructing the route. -#[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; - *inner_val +/// [`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, } -/// The number of blocks such that if: -/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` -/// then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines -/// the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a -/// `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, -/// then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before -/// forwarding. Note that the HTLC sender is the one who originally sets this value when -/// constructing the route. -#[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; +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: &SocketAddressParseErrorImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSocketAddressParseError) }; + 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, + } + } } -/// The minimum HTLC size incoming to sender, in milli-satoshi +/// Creates a copy of the SocketAddressParseError #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; - *inner_val +pub extern "C" fn SocketAddressParseError_clone(orig: &SocketAddressParseError) -> SocketAddressParseError { + orig.clone() } -/// The minimum HTLC size incoming to sender, in milli-satoshi -#[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val; +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SocketAddressParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SocketAddressParseError)).clone() })) as *mut c_void } -/// The maximum HTLC value incoming to sender, in milli-satoshi. -/// -/// This used to be optional. -#[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_htlc_maximum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; - *inner_val +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SocketAddressParseError_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut SocketAddressParseError) }; } -/// The maximum HTLC value incoming to sender, in milli-satoshi. -/// -/// This used to be optional. #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_htlc_maximum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = val; -} -/// The base HTLC fee charged by sender, in milli-satoshi +/// Utility method to constructs a new SocketAddrParse-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_socket_addr_parse() -> SocketAddressParseError { + SocketAddressParseError::SocketAddrParse} #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_base_msat; - *inner_val -} -/// The base HTLC fee charged by sender, in milli-satoshi +/// Utility method to constructs a new InvalidInput-variant SocketAddressParseError +pub extern "C" fn SocketAddressParseError_invalid_input() -> SocketAddressParseError { + SocketAddressParseError::InvalidInput} #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val; +/// 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} +/// Get a string which allows debug introspection of a SocketAddressParseError object +pub extern "C" fn SocketAddressParseError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::SocketAddressParseError }).into()} +/// Generates a non-cryptographic 64-bit hash of the SocketAddressParseError. +#[no_mangle] +pub extern "C" fn SocketAddressParseError_hash(o: &SocketAddressParseError) -> 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) } -/// The amount to fee multiplier, in micro-satoshi +/// 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 UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_proportional_millionths; - *inner_val +pub extern "C" fn SocketAddressParseError_eq(a: &SocketAddressParseError, b: &SocketAddressParseError) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } } -/// The amount to fee multiplier, in micro-satoshi #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = val; +/// Get the string representation of a SocketAddressParseError object +pub extern "C" fn SocketAddressParseError_to_str(o: &crate::lightning::ln::msgs::SocketAddressParseError) -> Str { + alloc::format!("{}", &o.to_native()).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. +/// Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`]. /// -/// Returns a copy of the field. +/// The host part must end with \".onion\". #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_get_excess_data(this_ptr: &UnsignedChannelUpdate) -> 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() +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 } -/// 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 UnsignedChannelUpdate_set_excess_data(this_ptr: &mut UnsignedChannelUpdate, 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; +/// Get the string representation of a SocketAddress object +pub extern "C" fn SocketAddress_to_str(o: &crate::lightning::ln::msgs::SocketAddress) -> Str { + alloc::format!("{}", &o.to_native()).into() } -/// Constructs a new UnsignedChannelUpdate given each field -#[must_use] #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut timestamp_arg: u32, mut message_flags_arg: u8, mut channel_flags_arg: u8, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: u64, mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedChannelUpdate { - let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); }; - UnsignedChannelUpdate { inner: ObjOps::heap_alloc(nativeUnsignedChannelUpdate { - chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), - short_channel_id: short_channel_id_arg, - timestamp: timestamp_arg, - message_flags: message_flags_arg, - channel_flags: channel_flags_arg, - cltv_expiry_delta: cltv_expiry_delta_arg, - htlc_minimum_msat: htlc_minimum_msat_arg, - htlc_maximum_msat: htlc_maximum_msat_arg, - fee_base_msat: fee_base_msat_arg, - fee_proportional_millionths: fee_proportional_millionths_arg, - excess_data: local_excess_data_arg, - }), is_owned: true } +/// 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() } -impl Clone for UnsignedChannelUpdate { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, - is_owned: true, +/// Represents the set of gossip messages that require a signature from a node's identity key. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum UnsignedGossipMessage { + /// An unsigned channel announcement. + ChannelAnnouncement( + crate::lightning::ln::msgs::UnsignedChannelAnnouncement), + /// An unsigned channel update. + ChannelUpdate( + crate::lightning::ln::msgs::UnsignedChannelUpdate), + /// An unsigned node announcement. + NodeAnnouncement( + crate::lightning::ln::msgs::UnsignedNodeAnnouncement), +} +use lightning::ln::msgs::UnsignedGossipMessage as UnsignedGossipMessageImport; +pub(crate) type nativeUnsignedGossipMessage = UnsignedGossipMessageImport; + +impl UnsignedGossipMessage { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeUnsignedGossipMessage { + match self { + UnsignedGossipMessage::ChannelAnnouncement (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeUnsignedGossipMessage::ChannelAnnouncement ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + UnsignedGossipMessage::ChannelUpdate (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeUnsignedGossipMessage::ChannelUpdate ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + UnsignedGossipMessage::NodeAnnouncement (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeUnsignedGossipMessage::NodeAnnouncement ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeUnsignedGossipMessage { + match self { + UnsignedGossipMessage::ChannelAnnouncement (mut a, ) => { + nativeUnsignedGossipMessage::ChannelAnnouncement ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + UnsignedGossipMessage::ChannelUpdate (mut a, ) => { + nativeUnsignedGossipMessage::ChannelUpdate ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + UnsignedGossipMessage::NodeAnnouncement (mut a, ) => { + nativeUnsignedGossipMessage::NodeAnnouncement ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &UnsignedGossipMessageImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeUnsignedGossipMessage) }; + match native { + nativeUnsignedGossipMessage::ChannelAnnouncement (ref a, ) => { + let mut a_nonref = Clone::clone(a); + UnsignedGossipMessage::ChannelAnnouncement ( + crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeUnsignedGossipMessage::ChannelUpdate (ref a, ) => { + let mut a_nonref = Clone::clone(a); + UnsignedGossipMessage::ChannelUpdate ( + crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeUnsignedGossipMessage::NodeAnnouncement (ref a, ) => { + let mut a_nonref = Clone::clone(a); + UnsignedGossipMessage::NodeAnnouncement ( + crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeUnsignedGossipMessage) -> Self { + match native { + nativeUnsignedGossipMessage::ChannelAnnouncement (mut a, ) => { + UnsignedGossipMessage::ChannelAnnouncement ( + crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeUnsignedGossipMessage::ChannelUpdate (mut a, ) => { + UnsignedGossipMessage::ChannelUpdate ( + crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeUnsignedGossipMessage::NodeAnnouncement (mut a, ) => { + UnsignedGossipMessage::NodeAnnouncement ( + crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, } } } +/// Frees any resources used by the UnsignedGossipMessage +#[no_mangle] +pub extern "C" fn UnsignedGossipMessage_free(this_ptr: UnsignedGossipMessage) { } +/// Creates a copy of the UnsignedGossipMessage +#[no_mangle] +pub extern "C" fn UnsignedGossipMessage_clone(orig: &UnsignedGossipMessage) -> UnsignedGossipMessage { + orig.clone() +} #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedChannelUpdate)).clone() })) as *mut c_void +pub(crate) extern "C" fn UnsignedGossipMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const UnsignedGossipMessage)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn UnsignedGossipMessage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut UnsignedGossipMessage) }; } #[no_mangle] -/// Creates a copy of the UnsignedChannelUpdate -pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate { - orig.clone() +/// Utility method to constructs a new ChannelAnnouncement-variant UnsignedGossipMessage +pub extern "C" fn UnsignedGossipMessage_channel_announcement(a: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> UnsignedGossipMessage { + UnsignedGossipMessage::ChannelAnnouncement(a, ) } -/// Get a string which allows debug introspection of a UnsignedChannelUpdate object -pub extern "C" fn UnsignedChannelUpdate_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedChannelUpdate }).into()} -/// Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. #[no_mangle] -pub extern "C" fn UnsignedChannelUpdate_hash(o: &UnsignedChannelUpdate) -> 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) +/// Utility method to constructs a new ChannelUpdate-variant UnsignedGossipMessage +pub extern "C" fn UnsignedGossipMessage_channel_update(a: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> UnsignedGossipMessage { + UnsignedGossipMessage::ChannelUpdate(a, ) } -/// Checks if two UnsignedChannelUpdates 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 UnsignedChannelUpdate_eq(a: &UnsignedChannelUpdate, b: &UnsignedChannelUpdate) -> 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 } +/// Utility method to constructs a new NodeAnnouncement-variant UnsignedGossipMessage +pub extern "C" fn UnsignedGossipMessage_node_announcement(a: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> UnsignedGossipMessage { + UnsignedGossipMessage::NodeAnnouncement(a, ) +} +#[no_mangle] +/// Serialize the UnsignedGossipMessage object into a byte array which can be read by UnsignedGossipMessage_read +pub extern "C" fn UnsignedGossipMessage_write(obj: &crate::lightning::ln::msgs::UnsignedGossipMessage) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn UnsignedGossipMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + UnsignedGossipMessage_write(unsafe { &*(obj as *const UnsignedGossipMessage) }) } -use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport; -pub(crate) type nativeChannelUpdate = nativeChannelUpdateImport; +use lightning::ln::msgs::UnsignedNodeAnnouncement as nativeUnsignedNodeAnnouncementImport; +pub(crate) type nativeUnsignedNodeAnnouncement = nativeUnsignedNodeAnnouncementImport; -/// A [`channel_update`] message to be sent to or received from a peer. +/// The unsigned part of a [`node_announcement`] message. /// -/// [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message +/// [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message #[must_use] #[repr(C)] -pub struct ChannelUpdate { +pub struct UnsignedNodeAnnouncement { /// 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 nativeChannelUpdate, + pub inner: *mut nativeUnsignedNodeAnnouncement, /// 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 @@ -8610,37 +8846,37 @@ pub struct ChannelUpdate { pub is_owned: bool, } -impl core::ops::Deref for ChannelUpdate { - type Target = nativeChannelUpdate; +impl core::ops::Deref for UnsignedNodeAnnouncement { + type Target = nativeUnsignedNodeAnnouncement; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for ChannelUpdate { } -unsafe impl core::marker::Sync for ChannelUpdate { } -impl Drop for ChannelUpdate { +unsafe impl core::marker::Send for UnsignedNodeAnnouncement { } +unsafe impl core::marker::Sync for UnsignedNodeAnnouncement { } +impl Drop for UnsignedNodeAnnouncement { fn drop(&mut self) { - if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UnsignedNodeAnnouncement, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { } +pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelUpdate) }; +pub(crate) extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement) }; } #[allow(unused)] -impl ChannelUpdate { - pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUpdate { +impl UnsignedNodeAnnouncement { + pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedNodeAnnouncement { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUpdate { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedNodeAnnouncement { 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 nativeChannelUpdate { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedNodeAnnouncement { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -8650,62 +8886,167 @@ impl ChannelUpdate { Self { inner: self.inner, is_owned: false } } } -/// A signature of the channel update +/// The advertised features #[no_mangle] -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::ECDSASignature::from_rust(&inner_val) +pub extern "C" fn UnsignedNodeAnnouncement_get_features(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning_types::features::NodeFeatures { + let mut inner_val = &mut UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).features; + crate::lightning_types::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::NodeFeatures<>) as *mut _) }, is_owned: false } } -/// A signature of the channel update +/// The advertised features #[no_mangle] -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(); +pub extern "C" fn UnsignedNodeAnnouncement_set_features(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning_types::features::NodeFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The actual channel update +/// A strictly monotonic announcement counter, with gaps allowed #[no_mangle] -pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate { - let mut inner_val = &mut this_ptr.get_native_mut_ref().contents; - crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelUpdate<>) as *mut _) }, is_owned: false } +pub extern "C" fn UnsignedNodeAnnouncement_get_timestamp(this_ptr: &UnsignedNodeAnnouncement) -> u32 { + let mut inner_val = &mut UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).timestamp; + *inner_val } -/// The actual channel update +/// A strictly monotonic announcement counter, with gaps allowed #[no_mangle] -pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::lightning::ln::msgs::UnsignedChannelUpdate) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; +pub extern "C" fn UnsignedNodeAnnouncement_set_timestamp(this_ptr: &mut UnsignedNodeAnnouncement, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp = val; } -/// Constructs a new ChannelUpdate given each field +/// The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back +/// to this node). +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_node_id(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::routing::gossip::NodeId { + let mut inner_val = &mut UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).node_id; + crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } +} +/// The `node_id` this announcement originated from (don't rebroadcast the `node_announcement` back +/// to this node). +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_set_node_id(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// An RGB color for UI purposes +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_rgb(this_ptr: &UnsignedNodeAnnouncement) -> *const [u8; 3] { + let mut inner_val = &mut UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).rgb; + inner_val +} +/// An RGB color for UI purposes +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_set_rgb(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::c_types::ThreeBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.rgb = val.data; +} +/// An alias, for UI purposes. +/// +/// This should be sanitized before use. There is no guarantee of uniqueness. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_alias(this_ptr: &UnsignedNodeAnnouncement) -> crate::lightning::routing::gossip::NodeAlias { + let mut inner_val = &mut UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).alias; + crate::lightning::routing::gossip::NodeAlias { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeAlias<>) as *mut _) }, is_owned: false } +} +/// An alias, for UI purposes. +/// +/// This should be sanitized before use. There is no guarantee of uniqueness. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_set_alias(this_ptr: &mut UnsignedNodeAnnouncement, mut val: crate::lightning::routing::gossip::NodeAlias) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.alias = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// List of addresses on which this node is reachable +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_addresses(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_SocketAddressZ { + let mut inner_val = UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).addresses.clone(); + 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_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; +} +/// Excess address 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 address types are added to the lightning gossip protocol. +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_excess_address_data(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).excess_address_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 address 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 address types are added to the lightning gossip protocol. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_set_excess_address_data(this_ptr: &mut UnsignedNodeAnnouncement, 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_address_data = local_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. +#[no_mangle] +pub extern "C" fn UnsignedNodeAnnouncement_get_excess_data(this_ptr: &UnsignedNodeAnnouncement) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = UnsignedNodeAnnouncement::get_native_mut_ref(this_ptr).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 UnsignedNodeAnnouncement_set_excess_data(this_ptr: &mut UnsignedNodeAnnouncement, 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 UnsignedNodeAnnouncement given each field #[must_use] #[no_mangle] -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()) }, +pub extern "C" fn UnsignedNodeAnnouncement_new(mut features_arg: crate::lightning_types::features::NodeFeatures, mut timestamp_arg: u32, mut node_id_arg: crate::lightning::routing::gossip::NodeId, mut rgb_arg: crate::c_types::ThreeBytes, mut alias_arg: crate::lightning::routing::gossip::NodeAlias, mut addresses_arg: crate::c_types::derived::CVec_SocketAddressZ, mut excess_address_data_arg: crate::c_types::derived::CVec_u8Z, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedNodeAnnouncement { + let mut local_addresses_arg = Vec::new(); for mut item in addresses_arg.into_rust().drain(..) { local_addresses_arg.push( { item.into_native() }); }; + let mut local_excess_address_data_arg = Vec::new(); for mut item in excess_address_data_arg.into_rust().drain(..) { local_excess_address_data_arg.push( { item }); }; + let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); }; + UnsignedNodeAnnouncement { inner: ObjOps::heap_alloc(nativeUnsignedNodeAnnouncement { + features: *unsafe { Box::from_raw(features_arg.take_inner()) }, + timestamp: timestamp_arg, + node_id: *unsafe { Box::from_raw(node_id_arg.take_inner()) }, + rgb: rgb_arg.data, + alias: *unsafe { Box::from_raw(alias_arg.take_inner()) }, + addresses: local_addresses_arg, + excess_address_data: local_excess_address_data_arg, + excess_data: local_excess_data_arg, }), is_owned: true } } -impl Clone for ChannelUpdate { +impl Clone for UnsignedNodeAnnouncement { fn clone(&self) -> Self { Self { - inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUnsignedNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUpdate)).clone() })) as *mut c_void +pub(crate) extern "C" fn UnsignedNodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnsignedNodeAnnouncement) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the ChannelUpdate -pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate { - orig.clone() +/// Creates a copy of the UnsignedNodeAnnouncement +pub extern "C" fn UnsignedNodeAnnouncement_clone(orig: &UnsignedNodeAnnouncement) -> UnsignedNodeAnnouncement { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a ChannelUpdate object -pub extern "C" fn ChannelUpdate_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelUpdate }).into()} -/// Generates a non-cryptographic 64-bit hash of the ChannelUpdate. +/// Get a string which allows debug introspection of a UnsignedNodeAnnouncement object +pub extern "C" fn UnsignedNodeAnnouncement_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedNodeAnnouncement }).into()} +/// Generates a non-cryptographic 64-bit hash of the UnsignedNodeAnnouncement. #[no_mangle] -pub extern "C" fn ChannelUpdate_hash(o: &ChannelUpdate) -> u64 { +pub extern "C" fn UnsignedNodeAnnouncement_hash(o: &UnsignedNodeAnnouncement) -> 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)] @@ -8713,33 +9054,30 @@ pub extern "C" fn ChannelUpdate_hash(o: &ChannelUpdate) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two ChannelUpdates contain equal inner contents. +/// Checks if two UnsignedNodeAnnouncements 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 ChannelUpdate_eq(a: &ChannelUpdate, b: &ChannelUpdate) -> bool { +pub extern "C" fn UnsignedNodeAnnouncement_eq(a: &UnsignedNodeAnnouncement, b: &UnsignedNodeAnnouncement) -> 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 } } -use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport; -pub(crate) type nativeQueryChannelRange = nativeQueryChannelRangeImport; +use lightning::ln::msgs::NodeAnnouncement as nativeNodeAnnouncementImport; +pub(crate) type nativeNodeAnnouncement = nativeNodeAnnouncementImport; -/// A [`query_channel_range`] message is used to query a peer for channel -/// UTXOs in a range of blocks. The recipient of a query makes a best -/// effort to reply to the query using one or more [`ReplyChannelRange`] -/// messages. +/// A [`node_announcement`] message to be sent to or received from a peer. /// -/// [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages +/// [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message #[must_use] #[repr(C)] -pub struct QueryChannelRange { +pub struct NodeAnnouncement { /// 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 nativeQueryChannelRange, + pub inner: *mut nativeNodeAnnouncement, /// 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 @@ -8747,37 +9085,37 @@ pub struct QueryChannelRange { pub is_owned: bool, } -impl core::ops::Deref for QueryChannelRange { - type Target = nativeQueryChannelRange; +impl core::ops::Deref for NodeAnnouncement { + type Target = nativeNodeAnnouncement; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for QueryChannelRange { } -unsafe impl core::marker::Sync for QueryChannelRange { } -impl Drop for QueryChannelRange { +unsafe impl core::marker::Send for NodeAnnouncement { } +unsafe impl core::marker::Sync for NodeAnnouncement { } +impl Drop for NodeAnnouncement { fn drop(&mut self) { - if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) { + if self.is_owned && !<*mut nativeNodeAnnouncement>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the NodeAnnouncement, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { } +pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryChannelRange) }; +pub(crate) extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeAnnouncement) }; } #[allow(unused)] -impl QueryChannelRange { - pub(crate) fn get_native_ref(&self) -> &'static nativeQueryChannelRange { +impl NodeAnnouncement { + pub(crate) fn get_native_ref(&self) -> &'static nativeNodeAnnouncement { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeQueryChannelRange { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeAnnouncement { 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 nativeQueryChannelRange { + pub(crate) fn take_inner(mut self) -> *mut nativeNodeAnnouncement { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -8787,74 +9125,62 @@ impl QueryChannelRange { Self { inner: self.inner, is_owned: false } } } -/// The genesis hash of the blockchain being queried -#[no_mangle] -pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; - inner_val.as_ref() -} -/// The genesis hash of the blockchain being queried -#[no_mangle] -pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); -} -/// The height of the first block for the channel UTXOs being queried +/// The signature by the node key #[no_mangle] -pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().first_blocknum; - *inner_val +pub extern "C" fn NodeAnnouncement_get_signature(this_ptr: &NodeAnnouncement) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut NodeAnnouncement::get_native_mut_ref(this_ptr).signature; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// The height of the first block for the channel UTXOs being queried +/// The signature by the node key #[no_mangle] -pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_blocknum = val; +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 number of blocks to include in the query results +/// The actual content of the announcement #[no_mangle] -pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().number_of_blocks; - *inner_val +pub extern "C" fn NodeAnnouncement_get_contents(this_ptr: &NodeAnnouncement) -> crate::lightning::ln::msgs::UnsignedNodeAnnouncement { + let mut inner_val = &mut NodeAnnouncement::get_native_mut_ref(this_ptr).contents; + crate::lightning::ln::msgs::UnsignedNodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedNodeAnnouncement<>) as *mut _) }, is_owned: false } } -/// The number of blocks to include in the query results +/// The actual content of the announcement #[no_mangle] -pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.number_of_blocks = val; +pub extern "C" fn NodeAnnouncement_set_contents(this_ptr: &mut NodeAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Constructs a new QueryChannelRange given each field +/// Constructs a new NodeAnnouncement given each field #[must_use] #[no_mangle] -pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32) -> QueryChannelRange { - QueryChannelRange { inner: ObjOps::heap_alloc(nativeQueryChannelRange { - chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), - first_blocknum: first_blocknum_arg, - number_of_blocks: number_of_blocks_arg, +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()) }, }), is_owned: true } } -impl Clone for QueryChannelRange { +impl Clone for NodeAnnouncement { fn clone(&self) -> Self { Self { - inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeNodeAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQueryChannelRange)).clone() })) as *mut c_void +pub(crate) extern "C" fn NodeAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeAnnouncement) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the QueryChannelRange -pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange { - orig.clone() +/// Creates a copy of the NodeAnnouncement +pub extern "C" fn NodeAnnouncement_clone(orig: &NodeAnnouncement) -> NodeAnnouncement { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a QueryChannelRange object -pub extern "C" fn QueryChannelRange_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::QueryChannelRange }).into()} -/// Generates a non-cryptographic 64-bit hash of the QueryChannelRange. +/// Get a string which allows debug introspection of a NodeAnnouncement object +pub extern "C" fn NodeAnnouncement_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::NodeAnnouncement }).into()} +/// Generates a non-cryptographic 64-bit hash of the NodeAnnouncement. #[no_mangle] -pub extern "C" fn QueryChannelRange_hash(o: &QueryChannelRange) -> u64 { +pub extern "C" fn NodeAnnouncement_hash(o: &NodeAnnouncement) -> 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)] @@ -8862,38 +9188,30 @@ pub extern "C" fn QueryChannelRange_hash(o: &QueryChannelRange) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two QueryChannelRanges contain equal inner contents. +/// Checks if two NodeAnnouncements 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 QueryChannelRange_eq(a: &QueryChannelRange, b: &QueryChannelRange) -> bool { +pub extern "C" fn NodeAnnouncement_eq(a: &NodeAnnouncement, b: &NodeAnnouncement) -> 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 } } -use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport; -pub(crate) type nativeReplyChannelRange = nativeReplyChannelRangeImport; +use lightning::ln::msgs::UnsignedChannelAnnouncement as nativeUnsignedChannelAnnouncementImport; +pub(crate) type nativeUnsignedChannelAnnouncement = nativeUnsignedChannelAnnouncementImport; -/// A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`] -/// message. -/// -/// Multiple `reply_channel_range` messages can be sent in reply -/// to a single [`QueryChannelRange`] message. The query recipient makes a -/// best effort to respond based on their local network view which may -/// not be a perfect view of the network. The `short_channel_id`s in the -/// reply are encoded. We only support `encoding_type=0` uncompressed -/// serialization and do not support `encoding_type=1` zlib serialization. +/// The unsigned part of a [`channel_announcement`] message. /// -/// [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages +/// [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message #[must_use] #[repr(C)] -pub struct ReplyChannelRange { +pub struct UnsignedChannelAnnouncement { /// 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 nativeReplyChannelRange, + pub inner: *mut nativeUnsignedChannelAnnouncement, /// 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 @@ -8901,37 +9219,37 @@ pub struct ReplyChannelRange { pub is_owned: bool, } -impl core::ops::Deref for ReplyChannelRange { - type Target = nativeReplyChannelRange; +impl core::ops::Deref for UnsignedChannelAnnouncement { + type Target = nativeUnsignedChannelAnnouncement; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for ReplyChannelRange { } -unsafe impl core::marker::Sync for ReplyChannelRange { } -impl Drop for ReplyChannelRange { +unsafe impl core::marker::Send for UnsignedChannelAnnouncement { } +unsafe impl core::marker::Sync for UnsignedChannelAnnouncement { } +impl Drop for UnsignedChannelAnnouncement { fn drop(&mut self) { - if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UnsignedChannelAnnouncement, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { } +pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyChannelRange) }; +pub(crate) extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement) }; } #[allow(unused)] -impl ReplyChannelRange { - pub(crate) fn get_native_ref(&self) -> &'static nativeReplyChannelRange { +impl UnsignedChannelAnnouncement { + pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedChannelAnnouncement { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReplyChannelRange { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedChannelAnnouncement { 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 nativeReplyChannelRange { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelAnnouncement { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -8941,103 +9259,145 @@ impl ReplyChannelRange { Self { inner: self.inner, is_owned: false } } } -/// The genesis hash of the blockchain being queried +/// The advertised channel features #[no_mangle] -pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; +pub extern "C" fn UnsignedChannelAnnouncement_get_features(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning_types::features::ChannelFeatures { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).features; + crate::lightning_types::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelFeatures<>) as *mut _) }, is_owned: false } +} +/// The advertised channel features +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_set_features(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning_types::features::ChannelFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.features = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The genesis hash of the blockchain where the channel is to be opened +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_get_chain_hash(this_ptr: &UnsignedChannelAnnouncement) -> *const [u8; 32] { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).chain_hash; inner_val.as_ref() } -/// The genesis hash of the blockchain being queried +/// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] -pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) { +pub extern "C" fn UnsignedChannelAnnouncement_set_chain_hash(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); } -/// The height of the first block in the range of the reply +/// The short channel ID #[no_mangle] -pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().first_blocknum; +pub extern "C" fn UnsignedChannelAnnouncement_get_short_channel_id(this_ptr: &UnsignedChannelAnnouncement) -> u64 { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } -/// The height of the first block in the range of the reply +/// The short channel ID #[no_mangle] -pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_blocknum = val; +pub extern "C" fn UnsignedChannelAnnouncement_set_short_channel_id(this_ptr: &mut UnsignedChannelAnnouncement, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; } -/// The number of blocks included in the range of the reply +/// One of the two `node_id`s which are endpoints of this channel #[no_mangle] -pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().number_of_blocks; - *inner_val +pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).node_id_1; + crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } } -/// The number of blocks included in the range of the reply +/// One of the two `node_id`s which are endpoints of this channel #[no_mangle] -pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.number_of_blocks = val; +pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id_1 = *unsafe { Box::from_raw(val.take_inner()) }; } -/// True when this is the final reply for a query +/// The other of the two `node_id`s which are endpoints of this channel #[no_mangle] -pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().sync_complete; - *inner_val +pub extern "C" fn UnsignedChannelAnnouncement_get_node_id_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).node_id_2; + crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } } -/// True when this is the final reply for a query +/// The other of the two `node_id`s which are endpoints of this channel #[no_mangle] -pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sync_complete = val; +pub extern "C" fn UnsignedChannelAnnouncement_set_node_id_2(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_id_2 = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The `short_channel_id`s in the channel range +/// The funding key for the first node +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).bitcoin_key_1; + crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } +} +/// The funding key for the first node +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr: &mut UnsignedChannelAnnouncement, mut val: crate::lightning::routing::gossip::NodeId) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.bitcoin_key_1 = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The funding key for the second node +#[no_mangle] +pub extern "C" fn UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr: &UnsignedChannelAnnouncement) -> crate::lightning::routing::gossip::NodeId { + let mut inner_val = &mut UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).bitcoin_key_2; + crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } +} +/// The funding key for the second node +#[no_mangle] +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 ReplyChannelRange_get_short_channel_ids(this_ptr: &ReplyChannelRange) -> crate::c_types::derived::CVec_u64Z { - let mut inner_val = this_ptr.get_native_mut_ref().short_channel_ids.clone(); +pub extern "C" fn UnsignedChannelAnnouncement_get_excess_data(this_ptr: &UnsignedChannelAnnouncement) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = UnsignedChannelAnnouncement::get_native_mut_ref(this_ptr).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() } -/// The `short_channel_id`s in the channel range +/// 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 ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) { +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) }.short_channel_ids = local_val; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.excess_data = local_val; } -/// Constructs a new ReplyChannelRange given each field +/// Constructs a new UnsignedChannelAnnouncement given each field #[must_use] #[no_mangle] -pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32, mut sync_complete_arg: bool, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> ReplyChannelRange { - let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); }; - ReplyChannelRange { inner: ObjOps::heap_alloc(nativeReplyChannelRange { +pub extern "C" fn UnsignedChannelAnnouncement_new(mut features_arg: crate::lightning_types::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::constants::ChainHash::from(&chain_hash_arg.data), - first_blocknum: first_blocknum_arg, - number_of_blocks: number_of_blocks_arg, - sync_complete: sync_complete_arg, - short_channel_ids: local_short_channel_ids_arg, + 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 ReplyChannelRange { +impl Clone for UnsignedChannelAnnouncement { fn clone(&self) -> Self { Self { - inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUnsignedChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReplyChannelRange)).clone() })) as *mut c_void +pub(crate) extern "C" fn UnsignedChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnsignedChannelAnnouncement) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the ReplyChannelRange -pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange { - orig.clone() +/// Creates a copy of the UnsignedChannelAnnouncement +pub extern "C" fn UnsignedChannelAnnouncement_clone(orig: &UnsignedChannelAnnouncement) -> UnsignedChannelAnnouncement { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a ReplyChannelRange object -pub extern "C" fn ReplyChannelRange_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ReplyChannelRange }).into()} -/// Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. +/// Get a string which allows debug introspection of a UnsignedChannelAnnouncement object +pub extern "C" fn UnsignedChannelAnnouncement_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedChannelAnnouncement }).into()} +/// Generates a non-cryptographic 64-bit hash of the UnsignedChannelAnnouncement. #[no_mangle] -pub extern "C" fn ReplyChannelRange_hash(o: &ReplyChannelRange) -> u64 { +pub extern "C" fn UnsignedChannelAnnouncement_hash(o: &UnsignedChannelAnnouncement) -> 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)] @@ -9045,38 +9405,30 @@ pub extern "C" fn ReplyChannelRange_hash(o: &ReplyChannelRange) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two ReplyChannelRanges contain equal inner contents. +/// Checks if two UnsignedChannelAnnouncements 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 ReplyChannelRange_eq(a: &ReplyChannelRange, b: &ReplyChannelRange) -> bool { +pub extern "C" fn UnsignedChannelAnnouncement_eq(a: &UnsignedChannelAnnouncement, b: &UnsignedChannelAnnouncement) -> 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 } } -use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport; -pub(crate) type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport; +use lightning::ln::msgs::ChannelAnnouncement as nativeChannelAnnouncementImport; +pub(crate) type nativeChannelAnnouncement = nativeChannelAnnouncementImport; -/// A [`query_short_channel_ids`] message is used to query a peer for -/// routing gossip messages related to one or more `short_channel_id`s. -/// -/// The query recipient will reply with the latest, if available, -/// [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages -/// it maintains for the requested `short_channel_id`s followed by a -/// [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in -/// this query are encoded. We only support `encoding_type=0` uncompressed -/// serialization and do not support `encoding_type=1` zlib serialization. +/// A [`channel_announcement`] message to be sent to or received from a peer. /// -/// [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages +/// [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message #[must_use] #[repr(C)] -pub struct QueryShortChannelIds { +pub struct ChannelAnnouncement { /// 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 nativeQueryShortChannelIds, + pub inner: *mut nativeChannelAnnouncement, /// 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 @@ -9084,37 +9436,37 @@ pub struct QueryShortChannelIds { pub is_owned: bool, } -impl core::ops::Deref for QueryShortChannelIds { - type Target = nativeQueryShortChannelIds; +impl core::ops::Deref for ChannelAnnouncement { + type Target = nativeChannelAnnouncement; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for QueryShortChannelIds { } -unsafe impl core::marker::Sync for QueryShortChannelIds { } -impl Drop for QueryShortChannelIds { +unsafe impl core::marker::Send for ChannelAnnouncement { } +unsafe impl core::marker::Sync for ChannelAnnouncement { } +impl Drop for ChannelAnnouncement { fn drop(&mut self) { - if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) { + if self.is_owned && !<*mut nativeChannelAnnouncement>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the ChannelAnnouncement, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { } +pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds) }; +pub(crate) extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelAnnouncement) }; } #[allow(unused)] -impl QueryShortChannelIds { - pub(crate) fn get_native_ref(&self) -> &'static nativeQueryShortChannelIds { +impl ChannelAnnouncement { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelAnnouncement { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeQueryShortChannelIds { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelAnnouncement { 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 nativeQueryShortChannelIds { + pub(crate) fn take_inner(mut self) -> *mut nativeChannelAnnouncement { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -9124,206 +9476,98 @@ impl QueryShortChannelIds { Self { inner: self.inner, is_owned: false } } } -/// The genesis hash of the blockchain being queried +/// Authentication of the announcement by the first public node #[no_mangle] -pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; - inner_val.as_ref() +pub extern "C" fn ChannelAnnouncement_get_node_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut ChannelAnnouncement::get_native_mut_ref(this_ptr).node_signature_1; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// The genesis hash of the blockchain being queried +/// Authentication of the announcement by the first public node #[no_mangle] -pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); -} -/// The short_channel_ids that are being queried -/// -/// Returns a copy of the field. -#[no_mangle] -pub extern "C" fn QueryShortChannelIds_get_short_channel_ids(this_ptr: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u64Z { - let mut inner_val = this_ptr.get_native_mut_ref().short_channel_ids.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 short_channel_ids that are being queried -#[no_mangle] -pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) { - 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) }.short_channel_ids = local_val; -} -/// Constructs a new QueryShortChannelIds given each field -#[must_use] -#[no_mangle] -pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> QueryShortChannelIds { - let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); }; - QueryShortChannelIds { inner: ObjOps::heap_alloc(nativeQueryShortChannelIds { - chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), - short_channel_ids: local_short_channel_ids_arg, - }), is_owned: true } -} -impl Clone for QueryShortChannelIds { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeQueryShortChannelIds>::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 QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeQueryShortChannelIds)).clone() })) as *mut c_void +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] -/// Creates a copy of the QueryShortChannelIds -pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds { - orig.clone() +pub extern "C" fn ChannelAnnouncement_get_node_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut ChannelAnnouncement::get_native_mut_ref(this_ptr).node_signature_2; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// Get a string which allows debug introspection of a QueryShortChannelIds object -pub extern "C" fn QueryShortChannelIds_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::QueryShortChannelIds }).into()} -/// Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. +/// Authentication of the announcement by the second public node #[no_mangle] -pub extern "C" fn QueryShortChannelIds_hash(o: &QueryShortChannelIds) -> 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) +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(); } -/// Checks if two QueryShortChannelIdss 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. +/// Proof of funding UTXO ownership by the first public node #[no_mangle] -pub extern "C" fn QueryShortChannelIds_eq(a: &QueryShortChannelIds, b: &QueryShortChannelIds) -> 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 } -} - -use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport; -pub(crate) type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport; - -/// A [`reply_short_channel_ids_end`] message is sent as a reply to a -/// message. The query recipient makes a best -/// effort to respond based on their local network view which may not be -/// a perfect view of the network. -/// -/// [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages -#[must_use] -#[repr(C)] -pub struct ReplyShortChannelIdsEnd { - /// 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 nativeReplyShortChannelIdsEnd, - /// 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 core::ops::Deref for ReplyShortChannelIdsEnd { - type Target = nativeReplyShortChannelIdsEnd; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for ReplyShortChannelIdsEnd { } -unsafe impl core::marker::Sync for ReplyShortChannelIdsEnd { } -impl Drop for ReplyShortChannelIdsEnd { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } +pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_1(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut ChannelAnnouncement::get_native_mut_ref(this_ptr).bitcoin_signature_1; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. +/// Proof of funding UTXO ownership by the first public node #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd) }; -} -#[allow(unused)] -impl ReplyShortChannelIdsEnd { - pub(crate) fn get_native_ref(&self) -> &'static nativeReplyShortChannelIdsEnd { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReplyShortChannelIdsEnd { - 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 nativeReplyShortChannelIdsEnd { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } +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(); } -/// The genesis hash of the blockchain that was queried +/// Proof of funding UTXO ownership by the second public node #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; - inner_val.as_ref() +pub extern "C" fn ChannelAnnouncement_get_bitcoin_signature_2(this_ptr: &ChannelAnnouncement) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut ChannelAnnouncement::get_native_mut_ref(this_ptr).bitcoin_signature_2; + crate::c_types::ECDSASignature::from_rust(&inner_val) } -/// The genesis hash of the blockchain that was queried +/// Proof of funding UTXO ownership by the second public node #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +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(); } -/// Indicates if the query recipient maintains up-to-date channel -/// information for the `chain_hash` +/// The actual announcement #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().full_information; - *inner_val +pub extern "C" fn ChannelAnnouncement_get_contents(this_ptr: &ChannelAnnouncement) -> crate::lightning::ln::msgs::UnsignedChannelAnnouncement { + let mut inner_val = &mut ChannelAnnouncement::get_native_mut_ref(this_ptr).contents; + crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false } } -/// Indicates if the query recipient maintains up-to-date channel -/// information for the `chain_hash` +/// The actual announcement #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.full_information = val; +pub extern "C" fn ChannelAnnouncement_set_contents(this_ptr: &mut ChannelAnnouncement, mut val: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Constructs a new ReplyShortChannelIdsEnd given each field +/// Constructs a new ChannelAnnouncement given each field #[must_use] #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd { - ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(nativeReplyShortChannelIdsEnd { - chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), - full_information: full_information_arg, +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(), + bitcoin_signature_1: bitcoin_signature_1_arg.into_rust(), + bitcoin_signature_2: bitcoin_signature_2_arg.into_rust(), + contents: *unsafe { Box::from_raw(contents_arg.take_inner()) }, }), is_owned: true } } -impl Clone for ReplyShortChannelIdsEnd { +impl Clone for ChannelAnnouncement { fn clone(&self) -> Self { Self { - inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeChannelAnnouncement>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReplyShortChannelIdsEnd)).clone() })) as *mut c_void +pub(crate) extern "C" fn ChannelAnnouncement_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelAnnouncement) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the ReplyShortChannelIdsEnd -pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd { - orig.clone() +/// Creates a copy of the ChannelAnnouncement +pub extern "C" fn ChannelAnnouncement_clone(orig: &ChannelAnnouncement) -> ChannelAnnouncement { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a ReplyShortChannelIdsEnd object -pub extern "C" fn ReplyShortChannelIdsEnd_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ReplyShortChannelIdsEnd }).into()} -/// Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. +/// Get a string which allows debug introspection of a ChannelAnnouncement object +pub extern "C" fn ChannelAnnouncement_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelAnnouncement }).into()} +/// Generates a non-cryptographic 64-bit hash of the ChannelAnnouncement. #[no_mangle] -pub extern "C" fn ReplyShortChannelIdsEnd_hash(o: &ReplyShortChannelIdsEnd) -> u64 { +pub extern "C" fn ChannelAnnouncement_hash(o: &ChannelAnnouncement) -> 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)] @@ -9331,32 +9575,30 @@ pub extern "C" fn ReplyShortChannelIdsEnd_hash(o: &ReplyShortChannelIdsEnd) -> u core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two ReplyShortChannelIdsEnds contain equal inner contents. +/// Checks if two ChannelAnnouncements 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 ReplyShortChannelIdsEnd_eq(a: &ReplyShortChannelIdsEnd, b: &ReplyShortChannelIdsEnd) -> bool { +pub extern "C" fn ChannelAnnouncement_eq(a: &ChannelAnnouncement, b: &ChannelAnnouncement) -> 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 } } -use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport; -pub(crate) type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport; +use lightning::ln::msgs::UnsignedChannelUpdate as nativeUnsignedChannelUpdateImport; +pub(crate) type nativeUnsignedChannelUpdate = nativeUnsignedChannelUpdateImport; -/// A [`gossip_timestamp_filter`] message is used by a node to request -/// gossip relay for messages in the requested time range when the -/// `gossip_queries` feature has been negotiated. +/// The unsigned part of a [`channel_update`] message. /// -/// [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message +/// [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message #[must_use] #[repr(C)] -pub struct GossipTimestampFilter { +pub struct UnsignedChannelUpdate { /// 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 nativeGossipTimestampFilter, + pub inner: *mut nativeUnsignedChannelUpdate, /// 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 @@ -9364,37 +9606,37 @@ pub struct GossipTimestampFilter { pub is_owned: bool, } -impl core::ops::Deref for GossipTimestampFilter { - type Target = nativeGossipTimestampFilter; +impl core::ops::Deref for UnsignedChannelUpdate { + type Target = nativeUnsignedChannelUpdate; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for GossipTimestampFilter { } -unsafe impl core::marker::Sync for GossipTimestampFilter { } -impl Drop for GossipTimestampFilter { +unsafe impl core::marker::Send for UnsignedChannelUpdate { } +unsafe impl core::marker::Sync for UnsignedChannelUpdate { } +impl Drop for UnsignedChannelUpdate { fn drop(&mut self) { - if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) { + if self.is_owned && !<*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the UnsignedChannelUpdate, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { } +pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter) }; +pub(crate) extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate) }; } #[allow(unused)] -impl GossipTimestampFilter { - pub(crate) fn get_native_ref(&self) -> &'static nativeGossipTimestampFilter { +impl UnsignedChannelUpdate { + pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedChannelUpdate { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeGossipTimestampFilter { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedChannelUpdate { 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 nativeGossipTimestampFilter { + pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedChannelUpdate { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -9404,74 +9646,201 @@ impl GossipTimestampFilter { Self { inner: self.inner, is_owned: false } } } -/// The genesis hash of the blockchain for channel and node information +/// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] -pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chain_hash; +pub extern "C" fn UnsignedChannelUpdate_get_chain_hash(this_ptr: &UnsignedChannelUpdate) -> *const [u8; 32] { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).chain_hash; inner_val.as_ref() } -/// The genesis hash of the blockchain for channel and node information +/// The genesis hash of the blockchain where the channel is to be opened #[no_mangle] -pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) { +pub extern "C" fn UnsignedChannelUpdate_set_chain_hash(this_ptr: &mut UnsignedChannelUpdate, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); } -/// The starting unix timestamp +/// The short channel ID #[no_mangle] -pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().first_timestamp; +pub extern "C" fn UnsignedChannelUpdate_get_short_channel_id(this_ptr: &UnsignedChannelUpdate) -> u64 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } -/// The starting unix timestamp +/// The short channel ID #[no_mangle] -pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_timestamp = val; +pub extern "C" fn UnsignedChannelUpdate_set_short_channel_id(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.short_channel_id = val; } -/// The range of information in seconds +/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel #[no_mangle] -pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().timestamp_range; +pub extern "C" fn UnsignedChannelUpdate_get_timestamp(this_ptr: &UnsignedChannelUpdate) -> u32 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).timestamp; *inner_val } -/// The range of information in seconds +/// A strictly monotonic announcement counter, with gaps allowed, specific to this channel #[no_mangle] -pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp_range = val; +pub extern "C" fn UnsignedChannelUpdate_set_timestamp(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp = val; } -/// Constructs a new GossipTimestampFilter given each field +/// Flags pertaining to this message. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_message_flags(this_ptr: &UnsignedChannelUpdate) -> u8 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).message_flags; + *inner_val +} +/// Flags pertaining to this message. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_message_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message_flags = val; +} +/// Flags pertaining to the channel, including to which direction in the channel this update +/// applies and whether the direction is currently able to forward HTLCs. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_channel_flags(this_ptr: &UnsignedChannelUpdate) -> u8 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).channel_flags; + *inner_val +} +/// Flags pertaining to the channel, including to which direction in the channel this update +/// applies and whether the direction is currently able to forward HTLCs. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_channel_flags(this_ptr: &mut UnsignedChannelUpdate, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_flags = val; +} +/// The number of blocks such that if: +/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` +/// then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines +/// the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a +/// `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, +/// then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before +/// forwarding. Note that the HTLC sender is the one who originally sets this value when +/// constructing the route. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr: &UnsignedChannelUpdate) -> u16 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).cltv_expiry_delta; + *inner_val +} +/// The number of blocks such that if: +/// `incoming_htlc.cltv_expiry < outgoing_htlc.cltv_expiry + cltv_expiry_delta` +/// then we need to fail the HTLC backwards. When forwarding an HTLC, `cltv_expiry_delta` determines +/// the outgoing HTLC's minimum `cltv_expiry` value -- so, if an incoming HTLC comes in with a +/// `cltv_expiry` of 100000, and the node we're forwarding to has a `cltv_expiry_delta` value of 10, +/// then we'll check that the outgoing HTLC's `cltv_expiry` value is at least 100010 before +/// forwarding. Note that the HTLC sender is the one who originally sets this value when +/// constructing the route. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr: &mut UnsignedChannelUpdate, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; +} +/// The minimum HTLC size incoming to sender, in milli-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).htlc_minimum_msat; + *inner_val +} +/// The minimum HTLC size incoming to sender, in milli-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_minimum_msat = val; +} +/// The maximum HTLC value incoming to sender, in milli-satoshi. +/// +/// This used to be optional. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_htlc_maximum_msat(this_ptr: &UnsignedChannelUpdate) -> u64 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).htlc_maximum_msat; + *inner_val +} +/// The maximum HTLC value incoming to sender, in milli-satoshi. +/// +/// This used to be optional. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_htlc_maximum_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_maximum_msat = val; +} +/// The base HTLC fee charged by sender, in milli-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_fee_base_msat(this_ptr: &UnsignedChannelUpdate) -> u32 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).fee_base_msat; + *inner_val +} +/// The base HTLC fee charged by sender, in milli-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_fee_base_msat(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_base_msat = val; +} +/// The amount to fee multiplier, in micro-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr: &UnsignedChannelUpdate) -> u32 { + let mut inner_val = &mut UnsignedChannelUpdate::get_native_mut_ref(this_ptr).fee_proportional_millionths; + *inner_val +} +/// The amount to fee multiplier, in micro-satoshi +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr: &mut UnsignedChannelUpdate, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_proportional_millionths = 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. +#[no_mangle] +pub extern "C" fn UnsignedChannelUpdate_get_excess_data(this_ptr: &UnsignedChannelUpdate) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = UnsignedChannelUpdate::get_native_mut_ref(this_ptr).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 UnsignedChannelUpdate_set_excess_data(this_ptr: &mut UnsignedChannelUpdate, 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 UnsignedChannelUpdate given each field #[must_use] #[no_mangle] -pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_timestamp_arg: u32, mut timestamp_range_arg: u32) -> GossipTimestampFilter { - GossipTimestampFilter { inner: ObjOps::heap_alloc(nativeGossipTimestampFilter { +pub extern "C" fn UnsignedChannelUpdate_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_id_arg: u64, mut timestamp_arg: u32, mut message_flags_arg: u8, mut channel_flags_arg: u8, mut cltv_expiry_delta_arg: u16, mut htlc_minimum_msat_arg: u64, mut htlc_maximum_msat_arg: u64, mut fee_base_msat_arg: u32, mut fee_proportional_millionths_arg: u32, mut excess_data_arg: crate::c_types::derived::CVec_u8Z) -> UnsignedChannelUpdate { + let mut local_excess_data_arg = Vec::new(); for mut item in excess_data_arg.into_rust().drain(..) { local_excess_data_arg.push( { item }); }; + UnsignedChannelUpdate { inner: ObjOps::heap_alloc(nativeUnsignedChannelUpdate { chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), - first_timestamp: first_timestamp_arg, - timestamp_range: timestamp_range_arg, + short_channel_id: short_channel_id_arg, + timestamp: timestamp_arg, + message_flags: message_flags_arg, + channel_flags: channel_flags_arg, + cltv_expiry_delta: cltv_expiry_delta_arg, + htlc_minimum_msat: htlc_minimum_msat_arg, + htlc_maximum_msat: htlc_maximum_msat_arg, + fee_base_msat: fee_base_msat_arg, + fee_proportional_millionths: fee_proportional_millionths_arg, + excess_data: local_excess_data_arg, }), is_owned: true } } -impl Clone for GossipTimestampFilter { +impl Clone for UnsignedChannelUpdate { fn clone(&self) -> Self { Self { - inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + inner: if <*mut nativeUnsignedChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, 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 GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeGossipTimestampFilter)).clone() })) as *mut c_void +pub(crate) extern "C" fn UnsignedChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnsignedChannelUpdate) }))) as *mut c_void } #[no_mangle] -/// Creates a copy of the GossipTimestampFilter -pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter { - orig.clone() +/// Creates a copy of the UnsignedChannelUpdate +pub extern "C" fn UnsignedChannelUpdate_clone(orig: &UnsignedChannelUpdate) -> UnsignedChannelUpdate { + Clone::clone(orig) } -/// Get a string which allows debug introspection of a GossipTimestampFilter object -pub extern "C" fn GossipTimestampFilter_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::GossipTimestampFilter }).into()} -/// Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. +/// Get a string which allows debug introspection of a UnsignedChannelUpdate object +pub extern "C" fn UnsignedChannelUpdate_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::UnsignedChannelUpdate }).into()} +/// Generates a non-cryptographic 64-bit hash of the UnsignedChannelUpdate. #[no_mangle] -pub extern "C" fn GossipTimestampFilter_hash(o: &GossipTimestampFilter) -> u64 { +pub extern "C" fn UnsignedChannelUpdate_hash(o: &UnsignedChannelUpdate) -> 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)] @@ -9479,597 +9848,3435 @@ pub extern "C" fn GossipTimestampFilter_hash(o: &GossipTimestampFilter) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } -/// Checks if two GossipTimestampFilters contain equal inner contents. +/// Checks if two UnsignedChannelUpdates 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 GossipTimestampFilter_eq(a: &GossipTimestampFilter, b: &GossipTimestampFilter) -> bool { +pub extern "C" fn UnsignedChannelUpdate_eq(a: &UnsignedChannelUpdate, b: &UnsignedChannelUpdate) -> 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 } } -/// Used to put an error message in a [`LightningError`]. -#[derive(Clone)] + +use lightning::ln::msgs::ChannelUpdate as nativeChannelUpdateImport; +pub(crate) type nativeChannelUpdate = nativeChannelUpdateImport; + +/// A [`channel_update`] message to be sent to or received from a peer. +/// +/// [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message #[must_use] #[repr(C)] -pub enum ErrorAction { - /// The peer took some action which made us think they were useless. Disconnect them. - DisconnectPeer { - /// An error message which we should make an effort to send before we disconnect. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - msg: crate::lightning::ln::msgs::ErrorMessage, - }, - /// The peer did something incorrect. Tell them without closing any channels and disconnect them. - DisconnectPeerWithWarning { - /// A warning message which we should make an effort to send before we disconnect. - msg: crate::lightning::ln::msgs::WarningMessage, - }, - /// The peer did something harmless that we weren't able to process, just log and ignore - IgnoreError, - /// The peer did something harmless that we weren't able to meaningfully process. - /// If the error is logged, log it at the given level. - IgnoreAndLog( - crate::lightning::util::logger::Level), - /// The peer provided us with a gossip message which we'd already seen. In most cases this - /// should be ignored, but it may result in the message being forwarded if it is a duplicate of - /// our own channel announcements. - IgnoreDuplicateGossip, - /// The peer did something incorrect. Tell them. - SendErrorMessage { - /// The message to send. - msg: crate::lightning::ln::msgs::ErrorMessage, - }, - /// The peer did something incorrect. Tell them without closing any channels. - SendWarningMessage { - /// The message to send. - msg: crate::lightning::ln::msgs::WarningMessage, - /// The peer may have done something harmless that we weren't able to meaningfully process, - /// though we should still tell them about it. - /// If this event is logged, log it at the given level. - log_level: crate::lightning::util::logger::Level, - }, +pub struct ChannelUpdate { + /// 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 nativeChannelUpdate, + /// 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, } -use lightning::ln::msgs::ErrorAction as ErrorActionImport; -pub(crate) type nativeErrorAction = ErrorActionImport; -impl ErrorAction { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeErrorAction { - match self { - ErrorAction::DisconnectPeer {ref msg, } => { +impl core::ops::Deref for ChannelUpdate { + type Target = nativeChannelUpdate; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ChannelUpdate { } +unsafe impl core::marker::Sync for ChannelUpdate { } +impl Drop for ChannelUpdate { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelUpdate>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelUpdate, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelUpdate) }; +} +#[allow(unused)] +impl ChannelUpdate { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelUpdate { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelUpdate { + 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 nativeChannelUpdate { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// A signature of the channel update +#[no_mangle] +pub extern "C" fn ChannelUpdate_get_signature(this_ptr: &ChannelUpdate) -> crate::c_types::ECDSASignature { + let mut inner_val = &mut ChannelUpdate::get_native_mut_ref(this_ptr).signature; + 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::ECDSASignature) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.signature = val.into_rust(); +} +/// The actual channel update +#[no_mangle] +pub extern "C" fn ChannelUpdate_get_contents(this_ptr: &ChannelUpdate) -> crate::lightning::ln::msgs::UnsignedChannelUpdate { + let mut inner_val = &mut ChannelUpdate::get_native_mut_ref(this_ptr).contents; + crate::lightning::ln::msgs::UnsignedChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::UnsignedChannelUpdate<>) as *mut _) }, is_owned: false } +} +/// The actual channel update +#[no_mangle] +pub extern "C" fn ChannelUpdate_set_contents(this_ptr: &mut ChannelUpdate, mut val: crate::lightning::ln::msgs::UnsignedChannelUpdate) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.contents = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new ChannelUpdate given each field +#[must_use] +#[no_mangle] +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()) }, + }), is_owned: true } +} +impl Clone for ChannelUpdate { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ChannelUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelUpdate) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelUpdate +pub extern "C" fn ChannelUpdate_clone(orig: &ChannelUpdate) -> ChannelUpdate { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a ChannelUpdate object +pub extern "C" fn ChannelUpdate_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ChannelUpdate }).into()} +/// Generates a non-cryptographic 64-bit hash of the ChannelUpdate. +#[no_mangle] +pub extern "C" fn ChannelUpdate_hash(o: &ChannelUpdate) -> 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 ChannelUpdates 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 ChannelUpdate_eq(a: &ChannelUpdate, b: &ChannelUpdate) -> 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 } +} + +use lightning::ln::msgs::QueryChannelRange as nativeQueryChannelRangeImport; +pub(crate) type nativeQueryChannelRange = nativeQueryChannelRangeImport; + +/// A [`query_channel_range`] message is used to query a peer for channel +/// UTXOs in a range of blocks. The recipient of a query makes a best +/// effort to reply to the query using one or more [`ReplyChannelRange`] +/// messages. +/// +/// [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages +#[must_use] +#[repr(C)] +pub struct QueryChannelRange { + /// 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 nativeQueryChannelRange, + /// 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 core::ops::Deref for QueryChannelRange { + type Target = nativeQueryChannelRange; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for QueryChannelRange { } +unsafe impl core::marker::Sync for QueryChannelRange { } +impl Drop for QueryChannelRange { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeQueryChannelRange>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the QueryChannelRange, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryChannelRange) }; +} +#[allow(unused)] +impl QueryChannelRange { + pub(crate) fn get_native_ref(&self) -> &'static nativeQueryChannelRange { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeQueryChannelRange { + 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 nativeQueryChannelRange { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn QueryChannelRange_get_chain_hash(this_ptr: &QueryChannelRange) -> *const [u8; 32] { + let mut inner_val = &mut QueryChannelRange::get_native_mut_ref(this_ptr).chain_hash; + inner_val.as_ref() +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn QueryChannelRange_set_chain_hash(this_ptr: &mut QueryChannelRange, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +} +/// The height of the first block for the channel UTXOs being queried +#[no_mangle] +pub extern "C" fn QueryChannelRange_get_first_blocknum(this_ptr: &QueryChannelRange) -> u32 { + let mut inner_val = &mut QueryChannelRange::get_native_mut_ref(this_ptr).first_blocknum; + *inner_val +} +/// The height of the first block for the channel UTXOs being queried +#[no_mangle] +pub extern "C" fn QueryChannelRange_set_first_blocknum(this_ptr: &mut QueryChannelRange, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_blocknum = val; +} +/// The number of blocks to include in the query results +#[no_mangle] +pub extern "C" fn QueryChannelRange_get_number_of_blocks(this_ptr: &QueryChannelRange) -> u32 { + let mut inner_val = &mut QueryChannelRange::get_native_mut_ref(this_ptr).number_of_blocks; + *inner_val +} +/// The number of blocks to include in the query results +#[no_mangle] +pub extern "C" fn QueryChannelRange_set_number_of_blocks(this_ptr: &mut QueryChannelRange, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.number_of_blocks = val; +} +/// Constructs a new QueryChannelRange given each field +#[must_use] +#[no_mangle] +pub extern "C" fn QueryChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32) -> QueryChannelRange { + QueryChannelRange { inner: ObjOps::heap_alloc(nativeQueryChannelRange { + chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), + first_blocknum: first_blocknum_arg, + number_of_blocks: number_of_blocks_arg, + }), is_owned: true } +} +impl Clone for QueryChannelRange { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeQueryChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 QueryChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeQueryChannelRange) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the QueryChannelRange +pub extern "C" fn QueryChannelRange_clone(orig: &QueryChannelRange) -> QueryChannelRange { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a QueryChannelRange object +pub extern "C" fn QueryChannelRange_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::QueryChannelRange }).into()} +/// Generates a non-cryptographic 64-bit hash of the QueryChannelRange. +#[no_mangle] +pub extern "C" fn QueryChannelRange_hash(o: &QueryChannelRange) -> 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 QueryChannelRanges 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 QueryChannelRange_eq(a: &QueryChannelRange, b: &QueryChannelRange) -> 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 } +} + +use lightning::ln::msgs::ReplyChannelRange as nativeReplyChannelRangeImport; +pub(crate) type nativeReplyChannelRange = nativeReplyChannelRangeImport; + +/// A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`] +/// message. +/// +/// Multiple `reply_channel_range` messages can be sent in reply +/// to a single [`QueryChannelRange`] message. The query recipient makes a +/// best effort to respond based on their local network view which may +/// not be a perfect view of the network. The `short_channel_id`s in the +/// reply are encoded. We only support `encoding_type=0` uncompressed +/// serialization and do not support `encoding_type=1` zlib serialization. +/// +/// [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages +#[must_use] +#[repr(C)] +pub struct ReplyChannelRange { + /// 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 nativeReplyChannelRange, + /// 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 core::ops::Deref for ReplyChannelRange { + type Target = nativeReplyChannelRange; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ReplyChannelRange { } +unsafe impl core::marker::Sync for ReplyChannelRange { } +impl Drop for ReplyChannelRange { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeReplyChannelRange>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ReplyChannelRange, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyChannelRange) }; +} +#[allow(unused)] +impl ReplyChannelRange { + pub(crate) fn get_native_ref(&self) -> &'static nativeReplyChannelRange { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReplyChannelRange { + 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 nativeReplyChannelRange { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn ReplyChannelRange_get_chain_hash(this_ptr: &ReplyChannelRange) -> *const [u8; 32] { + let mut inner_val = &mut ReplyChannelRange::get_native_mut_ref(this_ptr).chain_hash; + inner_val.as_ref() +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn ReplyChannelRange_set_chain_hash(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +} +/// The height of the first block in the range of the reply +#[no_mangle] +pub extern "C" fn ReplyChannelRange_get_first_blocknum(this_ptr: &ReplyChannelRange) -> u32 { + let mut inner_val = &mut ReplyChannelRange::get_native_mut_ref(this_ptr).first_blocknum; + *inner_val +} +/// The height of the first block in the range of the reply +#[no_mangle] +pub extern "C" fn ReplyChannelRange_set_first_blocknum(this_ptr: &mut ReplyChannelRange, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_blocknum = val; +} +/// The number of blocks included in the range of the reply +#[no_mangle] +pub extern "C" fn ReplyChannelRange_get_number_of_blocks(this_ptr: &ReplyChannelRange) -> u32 { + let mut inner_val = &mut ReplyChannelRange::get_native_mut_ref(this_ptr).number_of_blocks; + *inner_val +} +/// The number of blocks included in the range of the reply +#[no_mangle] +pub extern "C" fn ReplyChannelRange_set_number_of_blocks(this_ptr: &mut ReplyChannelRange, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.number_of_blocks = val; +} +/// True when this is the final reply for a query +#[no_mangle] +pub extern "C" fn ReplyChannelRange_get_sync_complete(this_ptr: &ReplyChannelRange) -> bool { + let mut inner_val = &mut ReplyChannelRange::get_native_mut_ref(this_ptr).sync_complete; + *inner_val +} +/// True when this is the final reply for a query +#[no_mangle] +pub extern "C" fn ReplyChannelRange_set_sync_complete(this_ptr: &mut ReplyChannelRange, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sync_complete = val; +} +/// The `short_channel_id`s in the channel range +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn ReplyChannelRange_get_short_channel_ids(this_ptr: &ReplyChannelRange) -> crate::c_types::derived::CVec_u64Z { + let mut inner_val = ReplyChannelRange::get_native_mut_ref(this_ptr).short_channel_ids.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 `short_channel_id`s in the channel range +#[no_mangle] +pub extern "C" fn ReplyChannelRange_set_short_channel_ids(this_ptr: &mut ReplyChannelRange, mut val: crate::c_types::derived::CVec_u64Z) { + 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) }.short_channel_ids = local_val; +} +/// Constructs a new ReplyChannelRange given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ReplyChannelRange_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_blocknum_arg: u32, mut number_of_blocks_arg: u32, mut sync_complete_arg: bool, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> ReplyChannelRange { + let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); }; + ReplyChannelRange { inner: ObjOps::heap_alloc(nativeReplyChannelRange { + chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), + first_blocknum: first_blocknum_arg, + number_of_blocks: number_of_blocks_arg, + sync_complete: sync_complete_arg, + short_channel_ids: local_short_channel_ids_arg, + }), is_owned: true } +} +impl Clone for ReplyChannelRange { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeReplyChannelRange>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ReplyChannelRange_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReplyChannelRange) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ReplyChannelRange +pub extern "C" fn ReplyChannelRange_clone(orig: &ReplyChannelRange) -> ReplyChannelRange { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a ReplyChannelRange object +pub extern "C" fn ReplyChannelRange_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ReplyChannelRange }).into()} +/// Generates a non-cryptographic 64-bit hash of the ReplyChannelRange. +#[no_mangle] +pub extern "C" fn ReplyChannelRange_hash(o: &ReplyChannelRange) -> 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 ReplyChannelRanges 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 ReplyChannelRange_eq(a: &ReplyChannelRange, b: &ReplyChannelRange) -> 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 } +} + +use lightning::ln::msgs::QueryShortChannelIds as nativeQueryShortChannelIdsImport; +pub(crate) type nativeQueryShortChannelIds = nativeQueryShortChannelIdsImport; + +/// A [`query_short_channel_ids`] message is used to query a peer for +/// routing gossip messages related to one or more `short_channel_id`s. +/// +/// The query recipient will reply with the latest, if available, +/// [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages +/// it maintains for the requested `short_channel_id`s followed by a +/// [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in +/// this query are encoded. We only support `encoding_type=0` uncompressed +/// serialization and do not support `encoding_type=1` zlib serialization. +/// +/// [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages +#[must_use] +#[repr(C)] +pub struct QueryShortChannelIds { + /// 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 nativeQueryShortChannelIds, + /// 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 core::ops::Deref for QueryShortChannelIds { + type Target = nativeQueryShortChannelIds; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for QueryShortChannelIds { } +unsafe impl core::marker::Sync for QueryShortChannelIds { } +impl Drop for QueryShortChannelIds { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeQueryShortChannelIds>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the QueryShortChannelIds, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds) }; +} +#[allow(unused)] +impl QueryShortChannelIds { + pub(crate) fn get_native_ref(&self) -> &'static nativeQueryShortChannelIds { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeQueryShortChannelIds { + 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 nativeQueryShortChannelIds { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_get_chain_hash(this_ptr: &QueryShortChannelIds) -> *const [u8; 32] { + let mut inner_val = &mut QueryShortChannelIds::get_native_mut_ref(this_ptr).chain_hash; + inner_val.as_ref() +} +/// The genesis hash of the blockchain being queried +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_set_chain_hash(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +} +/// The short_channel_ids that are being queried +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_get_short_channel_ids(this_ptr: &QueryShortChannelIds) -> crate::c_types::derived::CVec_u64Z { + let mut inner_val = QueryShortChannelIds::get_native_mut_ref(this_ptr).short_channel_ids.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 short_channel_ids that are being queried +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_set_short_channel_ids(this_ptr: &mut QueryShortChannelIds, mut val: crate::c_types::derived::CVec_u64Z) { + 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) }.short_channel_ids = local_val; +} +/// Constructs a new QueryShortChannelIds given each field +#[must_use] +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut short_channel_ids_arg: crate::c_types::derived::CVec_u64Z) -> QueryShortChannelIds { + let mut local_short_channel_ids_arg = Vec::new(); for mut item in short_channel_ids_arg.into_rust().drain(..) { local_short_channel_ids_arg.push( { item }); }; + QueryShortChannelIds { inner: ObjOps::heap_alloc(nativeQueryShortChannelIds { + chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), + short_channel_ids: local_short_channel_ids_arg, + }), is_owned: true } +} +impl Clone for QueryShortChannelIds { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeQueryShortChannelIds>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 QueryShortChannelIds_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeQueryShortChannelIds) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the QueryShortChannelIds +pub extern "C" fn QueryShortChannelIds_clone(orig: &QueryShortChannelIds) -> QueryShortChannelIds { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a QueryShortChannelIds object +pub extern "C" fn QueryShortChannelIds_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::QueryShortChannelIds }).into()} +/// Generates a non-cryptographic 64-bit hash of the QueryShortChannelIds. +#[no_mangle] +pub extern "C" fn QueryShortChannelIds_hash(o: &QueryShortChannelIds) -> 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 QueryShortChannelIdss 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 QueryShortChannelIds_eq(a: &QueryShortChannelIds, b: &QueryShortChannelIds) -> 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 } +} + +use lightning::ln::msgs::ReplyShortChannelIdsEnd as nativeReplyShortChannelIdsEndImport; +pub(crate) type nativeReplyShortChannelIdsEnd = nativeReplyShortChannelIdsEndImport; + +/// A [`reply_short_channel_ids_end`] message is sent as a reply to a +/// message. The query recipient makes a best +/// effort to respond based on their local network view which may not be +/// a perfect view of the network. +/// +/// [`reply_short_channel_ids_end`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages +#[must_use] +#[repr(C)] +pub struct ReplyShortChannelIdsEnd { + /// 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 nativeReplyShortChannelIdsEnd, + /// 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 core::ops::Deref for ReplyShortChannelIdsEnd { + type Target = nativeReplyShortChannelIdsEnd; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ReplyShortChannelIdsEnd { } +unsafe impl core::marker::Sync for ReplyShortChannelIdsEnd { } +impl Drop for ReplyShortChannelIdsEnd { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ReplyShortChannelIdsEnd, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd) }; +} +#[allow(unused)] +impl ReplyShortChannelIdsEnd { + pub(crate) fn get_native_ref(&self) -> &'static nativeReplyShortChannelIdsEnd { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReplyShortChannelIdsEnd { + 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 nativeReplyShortChannelIdsEnd { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The genesis hash of the blockchain that was queried +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_get_chain_hash(this_ptr: &ReplyShortChannelIdsEnd) -> *const [u8; 32] { + let mut inner_val = &mut ReplyShortChannelIdsEnd::get_native_mut_ref(this_ptr).chain_hash; + inner_val.as_ref() +} +/// The genesis hash of the blockchain that was queried +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_set_chain_hash(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +} +/// Indicates if the query recipient maintains up-to-date channel +/// information for the `chain_hash` +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_get_full_information(this_ptr: &ReplyShortChannelIdsEnd) -> bool { + let mut inner_val = &mut ReplyShortChannelIdsEnd::get_native_mut_ref(this_ptr).full_information; + *inner_val +} +/// Indicates if the query recipient maintains up-to-date channel +/// information for the `chain_hash` +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_set_full_information(this_ptr: &mut ReplyShortChannelIdsEnd, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.full_information = val; +} +/// Constructs a new ReplyShortChannelIdsEnd given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut full_information_arg: bool) -> ReplyShortChannelIdsEnd { + ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(nativeReplyShortChannelIdsEnd { + chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), + full_information: full_information_arg, + }), is_owned: true } +} +impl Clone for ReplyShortChannelIdsEnd { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeReplyShortChannelIdsEnd>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ReplyShortChannelIdsEnd_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReplyShortChannelIdsEnd) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ReplyShortChannelIdsEnd +pub extern "C" fn ReplyShortChannelIdsEnd_clone(orig: &ReplyShortChannelIdsEnd) -> ReplyShortChannelIdsEnd { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a ReplyShortChannelIdsEnd object +pub extern "C" fn ReplyShortChannelIdsEnd_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ReplyShortChannelIdsEnd }).into()} +/// Generates a non-cryptographic 64-bit hash of the ReplyShortChannelIdsEnd. +#[no_mangle] +pub extern "C" fn ReplyShortChannelIdsEnd_hash(o: &ReplyShortChannelIdsEnd) -> 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 ReplyShortChannelIdsEnds 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 ReplyShortChannelIdsEnd_eq(a: &ReplyShortChannelIdsEnd, b: &ReplyShortChannelIdsEnd) -> 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 } +} + +use lightning::ln::msgs::GossipTimestampFilter as nativeGossipTimestampFilterImport; +pub(crate) type nativeGossipTimestampFilter = nativeGossipTimestampFilterImport; + +/// A [`gossip_timestamp_filter`] message is used by a node to request +/// gossip relay for messages in the requested time range when the +/// `gossip_queries` feature has been negotiated. +/// +/// [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message +#[must_use] +#[repr(C)] +pub struct GossipTimestampFilter { + /// 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 nativeGossipTimestampFilter, + /// 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 core::ops::Deref for GossipTimestampFilter { + type Target = nativeGossipTimestampFilter; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for GossipTimestampFilter { } +unsafe impl core::marker::Sync for GossipTimestampFilter { } +impl Drop for GossipTimestampFilter { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeGossipTimestampFilter>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the GossipTimestampFilter, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter) }; +} +#[allow(unused)] +impl GossipTimestampFilter { + pub(crate) fn get_native_ref(&self) -> &'static nativeGossipTimestampFilter { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeGossipTimestampFilter { + 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 nativeGossipTimestampFilter { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The genesis hash of the blockchain for channel and node information +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_get_chain_hash(this_ptr: &GossipTimestampFilter) -> *const [u8; 32] { + let mut inner_val = &mut GossipTimestampFilter::get_native_mut_ref(this_ptr).chain_hash; + inner_val.as_ref() +} +/// The genesis hash of the blockchain for channel and node information +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_set_chain_hash(this_ptr: &mut GossipTimestampFilter, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.chain_hash = ::bitcoin::constants::ChainHash::from(&val.data); +} +/// The starting unix timestamp +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_get_first_timestamp(this_ptr: &GossipTimestampFilter) -> u32 { + let mut inner_val = &mut GossipTimestampFilter::get_native_mut_ref(this_ptr).first_timestamp; + *inner_val +} +/// The starting unix timestamp +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_set_first_timestamp(this_ptr: &mut GossipTimestampFilter, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.first_timestamp = val; +} +/// The range of information in seconds +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_get_timestamp_range(this_ptr: &GossipTimestampFilter) -> u32 { + let mut inner_val = &mut GossipTimestampFilter::get_native_mut_ref(this_ptr).timestamp_range; + *inner_val +} +/// The range of information in seconds +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_set_timestamp_range(this_ptr: &mut GossipTimestampFilter, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.timestamp_range = val; +} +/// Constructs a new GossipTimestampFilter given each field +#[must_use] +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_new(mut chain_hash_arg: crate::c_types::ThirtyTwoBytes, mut first_timestamp_arg: u32, mut timestamp_range_arg: u32) -> GossipTimestampFilter { + GossipTimestampFilter { inner: ObjOps::heap_alloc(nativeGossipTimestampFilter { + chain_hash: ::bitcoin::constants::ChainHash::from(&chain_hash_arg.data), + first_timestamp: first_timestamp_arg, + timestamp_range: timestamp_range_arg, + }), is_owned: true } +} +impl Clone for GossipTimestampFilter { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeGossipTimestampFilter>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 GossipTimestampFilter_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeGossipTimestampFilter) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the GossipTimestampFilter +pub extern "C" fn GossipTimestampFilter_clone(orig: &GossipTimestampFilter) -> GossipTimestampFilter { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a GossipTimestampFilter object +pub extern "C" fn GossipTimestampFilter_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::GossipTimestampFilter }).into()} +/// Generates a non-cryptographic 64-bit hash of the GossipTimestampFilter. +#[no_mangle] +pub extern "C" fn GossipTimestampFilter_hash(o: &GossipTimestampFilter) -> 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 GossipTimestampFilters 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 GossipTimestampFilter_eq(a: &GossipTimestampFilter, b: &GossipTimestampFilter) -> 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 } +} +/// Used to put an error message in a [`LightningError`]. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum ErrorAction { + /// The peer took some action which made us think they were useless. Disconnect them. + DisconnectPeer { + /// An error message which we should make an effort to send before we disconnect. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + msg: crate::lightning::ln::msgs::ErrorMessage, + }, + /// The peer did something incorrect. Tell them without closing any channels and disconnect them. + DisconnectPeerWithWarning { + /// A warning message which we should make an effort to send before we disconnect. + msg: crate::lightning::ln::msgs::WarningMessage, + }, + /// The peer did something harmless that we weren't able to process, just log and ignore + IgnoreError, + /// The peer did something harmless that we weren't able to meaningfully process. + /// If the error is logged, log it at the given level. + IgnoreAndLog( + crate::lightning::util::logger::Level), + /// The peer provided us with a gossip message which we'd already seen. In most cases this + /// should be ignored, but it may result in the message being forwarded if it is a duplicate of + /// our own channel announcements. + IgnoreDuplicateGossip, + /// The peer did something incorrect. Tell them. + SendErrorMessage { + /// The message to send. + msg: crate::lightning::ln::msgs::ErrorMessage, + }, + /// The peer did something incorrect. Tell them without closing any channels. + SendWarningMessage { + /// The message to send. + msg: crate::lightning::ln::msgs::WarningMessage, + /// The peer may have done something harmless that we weren't able to meaningfully process, + /// though we should still tell them about it. + /// If this event is logged, log it at the given level. + log_level: crate::lightning::util::logger::Level, + }, +} +use lightning::ln::msgs::ErrorAction as ErrorActionImport; +pub(crate) type nativeErrorAction = ErrorActionImport; + +impl ErrorAction { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeErrorAction { + match self { + ErrorAction::DisconnectPeer {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) }; + nativeErrorAction::DisconnectPeer { + msg: local_msg_nonref, + } + }, + ErrorAction::DisconnectPeerWithWarning {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + nativeErrorAction::DisconnectPeerWithWarning { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, + ErrorAction::IgnoreAndLog (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeErrorAction::IgnoreAndLog ( + a_nonref.into_native(), + ) + }, + ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip, + ErrorAction::SendErrorMessage {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + nativeErrorAction::SendErrorMessage { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + ErrorAction::SendWarningMessage {ref msg, ref log_level, } => { + let mut msg_nonref = Clone::clone(msg); + let mut log_level_nonref = Clone::clone(log_level); + nativeErrorAction::SendWarningMessage { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + log_level: log_level_nonref.into_native(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeErrorAction { + match self { + ErrorAction::DisconnectPeer {mut msg, } => { + let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) }; + nativeErrorAction::DisconnectPeer { + msg: local_msg, + } + }, + ErrorAction::DisconnectPeerWithWarning {mut msg, } => { + nativeErrorAction::DisconnectPeerWithWarning { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, + ErrorAction::IgnoreAndLog (mut a, ) => { + nativeErrorAction::IgnoreAndLog ( + a.into_native(), + ) + }, + ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip, + ErrorAction::SendErrorMessage {mut msg, } => { + nativeErrorAction::SendErrorMessage { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + ErrorAction::SendWarningMessage {mut msg, mut log_level, } => { + nativeErrorAction::SendWarningMessage { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + log_level: log_level.into_native(), + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &ErrorActionImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeErrorAction) }; + match native { + nativeErrorAction::DisconnectPeer {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + let mut local_msg_nonref = crate::lightning::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((msg_nonref.unwrap())) } }, is_owned: true }; + ErrorAction::DisconnectPeer { + msg: local_msg_nonref, + } + }, + nativeErrorAction::DisconnectPeerWithWarning {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + ErrorAction::DisconnectPeerWithWarning { + msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, + nativeErrorAction::IgnoreAndLog (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ErrorAction::IgnoreAndLog ( + crate::lightning::util::logger::Level::native_into(a_nonref), + ) + }, + nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip, + nativeErrorAction::SendErrorMessage {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + ErrorAction::SendErrorMessage { + msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeErrorAction::SendWarningMessage {ref msg, ref log_level, } => { + let mut msg_nonref = Clone::clone(msg); + let mut log_level_nonref = Clone::clone(log_level); + ErrorAction::SendWarningMessage { + msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + log_level: crate::lightning::util::logger::Level::native_into(log_level_nonref), + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeErrorAction) -> Self { + match native { + nativeErrorAction::DisconnectPeer {mut msg, } => { + let mut local_msg = crate::lightning::ln::msgs::ErrorMessage { inner: if msg.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((msg.unwrap())) } }, is_owned: true }; + ErrorAction::DisconnectPeer { + msg: local_msg, + } + }, + nativeErrorAction::DisconnectPeerWithWarning {mut msg, } => { + ErrorAction::DisconnectPeerWithWarning { + msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, + nativeErrorAction::IgnoreAndLog (mut a, ) => { + ErrorAction::IgnoreAndLog ( + crate::lightning::util::logger::Level::native_into(a), + ) + }, + nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip, + nativeErrorAction::SendErrorMessage {mut msg, } => { + ErrorAction::SendErrorMessage { + msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeErrorAction::SendWarningMessage {mut msg, mut log_level, } => { + ErrorAction::SendWarningMessage { + msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + log_level: crate::lightning::util::logger::Level::native_into(log_level), + } + }, + } + } +} +/// Frees any resources used by the ErrorAction +#[no_mangle] +pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { } +/// Creates a copy of the ErrorAction +#[no_mangle] +pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ErrorAction_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ErrorAction)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ErrorAction_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut ErrorAction) }; +} +#[no_mangle] +/// Utility method to constructs a new DisconnectPeer-variant ErrorAction +pub extern "C" fn ErrorAction_disconnect_peer(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction { + ErrorAction::DisconnectPeer { + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction +pub extern "C" fn ErrorAction_disconnect_peer_with_warning(msg: crate::lightning::ln::msgs::WarningMessage) -> ErrorAction { + ErrorAction::DisconnectPeerWithWarning { + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new IgnoreError-variant ErrorAction +pub extern "C" fn ErrorAction_ignore_error() -> ErrorAction { + ErrorAction::IgnoreError} +#[no_mangle] +/// Utility method to constructs a new IgnoreAndLog-variant ErrorAction +pub extern "C" fn ErrorAction_ignore_and_log(a: crate::lightning::util::logger::Level) -> ErrorAction { + ErrorAction::IgnoreAndLog(a, ) +} +#[no_mangle] +/// Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction +pub extern "C" fn ErrorAction_ignore_duplicate_gossip() -> ErrorAction { + ErrorAction::IgnoreDuplicateGossip} +#[no_mangle] +/// Utility method to constructs a new SendErrorMessage-variant ErrorAction +pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction { + ErrorAction::SendErrorMessage { + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new SendWarningMessage-variant ErrorAction +pub extern "C" fn ErrorAction_send_warning_message(msg: crate::lightning::ln::msgs::WarningMessage, log_level: crate::lightning::util::logger::Level) -> ErrorAction { + ErrorAction::SendWarningMessage { + msg, + log_level, + } +} +/// Get a string which allows debug introspection of a ErrorAction object +pub extern "C" fn ErrorAction_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ErrorAction }).into()} +/// Generates a non-cryptographic 64-bit hash of the ErrorAction. +#[no_mangle] +pub extern "C" fn ErrorAction_hash(o: &ErrorAction) -> 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) +} + +use lightning::ln::msgs::LightningError as nativeLightningErrorImport; +pub(crate) type nativeLightningError = nativeLightningErrorImport; + +/// An Err type for failure to process messages. +#[must_use] +#[repr(C)] +pub struct LightningError { + /// 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 nativeLightningError, + /// 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 core::ops::Deref for LightningError { + type Target = nativeLightningError; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for LightningError { } +unsafe impl core::marker::Sync for LightningError { } +impl Drop for LightningError { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn LightningError_free(this_obj: LightningError) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn LightningError_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLightningError) }; +} +#[allow(unused)] +impl LightningError { + pub(crate) fn get_native_ref(&self) -> &'static nativeLightningError { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLightningError { + 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 nativeLightningError { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// A human-readable message describing the error +#[no_mangle] +pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str { + let mut inner_val = &mut LightningError::get_native_mut_ref(this_ptr).err; + inner_val.as_str().into() +} +/// A human-readable message describing the error +#[no_mangle] +pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::Str) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.err = val.into_string(); +} +/// The action which should be taken against the offending peer. +#[no_mangle] +pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::lightning::ln::msgs::ErrorAction { + let mut inner_val = &mut LightningError::get_native_mut_ref(this_ptr).action; + crate::lightning::ln::msgs::ErrorAction::from_native(inner_val) +} +/// The action which should be taken against the offending peer. +#[no_mangle] +pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::lightning::ln::msgs::ErrorAction) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.action = val.into_native(); +} +/// Constructs a new LightningError given each field +#[must_use] +#[no_mangle] +pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::Str, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError { + LightningError { inner: ObjOps::heap_alloc(nativeLightningError { + err: err_arg.into_string(), + action: action_arg.into_native(), + }), is_owned: true } +} +impl Clone for LightningError { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeLightningError>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeLightningError) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the LightningError +pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a LightningError object +pub extern "C" fn LightningError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::LightningError }).into()} + +use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport; +pub(crate) type nativeCommitmentUpdate = nativeCommitmentUpdateImport; + +/// Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment +/// transaction updates if they were pending. +#[must_use] +#[repr(C)] +pub struct CommitmentUpdate { + /// 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 nativeCommitmentUpdate, + /// 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 core::ops::Deref for CommitmentUpdate { + type Target = nativeCommitmentUpdate; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for CommitmentUpdate { } +unsafe impl core::marker::Sync for CommitmentUpdate { } +impl Drop for CommitmentUpdate { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentUpdate) }; +} +#[allow(unused)] +impl CommitmentUpdate { + pub(crate) fn get_native_ref(&self) -> &'static nativeCommitmentUpdate { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommitmentUpdate { + 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 nativeCommitmentUpdate { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// `update_add_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_get_update_add_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateAddHTLCZ { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).update_add_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// `update_add_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) { + 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) }.update_add_htlcs = local_val; +} +/// `update_fulfill_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_get_update_fulfill_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFulfillHTLCZ { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).update_fulfill_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// `update_fulfill_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) { + 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) }.update_fulfill_htlcs = local_val; +} +/// `update_fail_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_get_update_fail_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailHTLCZ { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).update_fail_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// `update_fail_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) { + 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) }.update_fail_htlcs = local_val; +} +/// `update_fail_malformed_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).update_fail_malformed_htlcs; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// `update_fail_malformed_htlc` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) { + 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) }.update_fail_malformed_htlcs = local_val; +} +/// An `update_fee` message which should be sent +/// +/// 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 CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).update_fee; + let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { 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::msgs::UpdateFee<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// An `update_fee` message which should be sent +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::UpdateFee) { + 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) }.update_fee = local_val; +} +/// `commitment_signed` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_CommitmentSignedZ { + let mut inner_val = &mut CommitmentUpdate::get_native_mut_ref(this_ptr).commitment_signed; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// `commitment_signed` messages which should be sent +#[no_mangle] +pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_CommitmentSignedZ) { + 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) }.commitment_signed = local_val; +} +/// 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::c_types::derived::CVec_CommitmentSignedZ) -> CommitmentUpdate { + let mut local_update_add_htlcs_arg = Vec::new(); for mut item in update_add_htlcs_arg.into_rust().drain(..) { local_update_add_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fulfill_htlcs_arg = Vec::new(); for mut item in update_fulfill_htlcs_arg.into_rust().drain(..) { local_update_fulfill_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fail_htlcs_arg = Vec::new(); for mut item in update_fail_htlcs_arg.into_rust().drain(..) { local_update_fail_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fail_malformed_htlcs_arg = Vec::new(); for mut item in update_fail_malformed_htlcs_arg.into_rust().drain(..) { local_update_fail_malformed_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_update_fee_arg = if update_fee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_fee_arg.take_inner()) } }) }; + let mut local_commitment_signed_arg = Vec::new(); for mut item in commitment_signed_arg.into_rust().drain(..) { local_commitment_signed_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + CommitmentUpdate { inner: ObjOps::heap_alloc(nativeCommitmentUpdate { + update_add_htlcs: local_update_add_htlcs_arg, + update_fulfill_htlcs: local_update_fulfill_htlcs_arg, + update_fail_htlcs: local_update_fail_htlcs_arg, + update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg, + update_fee: local_update_fee_arg, + commitment_signed: local_commitment_signed_arg, + }), is_owned: true } +} +impl Clone for CommitmentUpdate { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCommitmentUpdate) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the CommitmentUpdate +pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a CommitmentUpdate object +pub extern "C" fn CommitmentUpdate_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommitmentUpdate }).into()} +/// Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. +#[no_mangle] +pub extern "C" fn CommitmentUpdate_hash(o: &CommitmentUpdate) -> 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 CommitmentUpdates 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 CommitmentUpdate_eq(a: &CommitmentUpdate, b: &CommitmentUpdate) -> 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 } +} +/// An event generated by a [`BaseMessageHandler`] which indicates a message should be sent to a +/// peer (or broadcast to most peers). +/// +/// These events are handled by [`PeerManager::process_events`] if you are using a [`PeerManager`]. +/// +/// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events +/// [`PeerManager`]: crate::ln::peer_handler::PeerManager +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum MessageSendEvent { + /// Used to indicate that we've accepted a channel open and should send the accept_channel + /// message provided to the given peer. + SendAcceptChannel { + /// 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::AcceptChannel, + }, + /// Used to indicate that we've accepted a V2 channel open and should send the accept_channel2 + /// message provided to the given peer. + SendAcceptChannelV2 { + /// 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::AcceptChannelV2, + }, + /// Used to indicate that we've initiated a channel open and should send the open_channel + /// message provided to the given peer. + SendOpenChannel { + /// 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::OpenChannel, + }, + /// Used to indicate that we've initiated a V2 channel open and should send the open_channel2 + /// message provided to the given peer. + SendOpenChannelV2 { + /// 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::OpenChannelV2, + }, + /// Used to indicate that a funding_created message should be sent to the peer with the given node_id. + SendFundingCreated { + /// 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::FundingCreated, + }, + /// Used to indicate that a funding_signed message should be sent to the peer with the given node_id. + SendFundingSigned { + /// 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::FundingSigned, + }, + /// Used to indicate that a stfu message should be sent to the peer with the given node id. + SendStfu { + /// 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::Stfu, + }, + /// Used to indicate that a splice_init message should be sent to the peer with the given node id. + SendSpliceInit { + /// 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::SpliceInit, + }, + /// Used to indicate that a splice_ack message should be sent to the peer with the given node id. + SendSpliceAck { + /// 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::SpliceAck, + }, + /// Used to indicate that a splice_locked message should be sent to the peer with the given node id. + SendSpliceLocked { + /// 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::SpliceLocked, + }, + /// Used to indicate that a tx_add_input message should be sent to the peer with the given node_id. + SendTxAddInput { + /// 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, + }, + /// Used to indicate that a tx_add_output message should be sent to the peer with the given node_id. + SendTxAddOutput { + /// 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::TxAddOutput, + }, + /// Used to indicate that a tx_remove_input message should be sent to the peer with the given node_id. + SendTxRemoveInput { + /// 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::TxRemoveInput, + }, + /// Used to indicate that a tx_remove_output message should be sent to the peer with the given node_id. + SendTxRemoveOutput { + /// 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::TxRemoveOutput, + }, + /// Used to indicate that a tx_complete message should be sent to the peer with the given node_id. + SendTxComplete { + /// 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::TxComplete, + }, + /// Used to indicate that a tx_signatures message should be sent to the peer with the given node_id. + SendTxSignatures { + /// 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::TxSignatures, + }, + /// Used to indicate that a tx_init_rbf message should be sent to the peer with the given node_id. + SendTxInitRbf { + /// 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::TxInitRbf, + }, + /// Used to indicate that a tx_ack_rbf message should be sent to the peer with the given node_id. + SendTxAckRbf { + /// 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::TxAckRbf, + }, + /// Used to indicate that a tx_abort message should be sent to the peer with the given node_id. + SendTxAbort { + /// 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::TxAbort, + }, + /// Used to indicate that a channel_ready message should be sent to the peer with the given node_id. + SendChannelReady { + /// The node_id of the node which should receive these message(s) + node_id: crate::c_types::PublicKey, + /// The channel_ready message which should be sent. + msg: crate::lightning::ln::msgs::ChannelReady, + }, + /// Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. + SendAnnouncementSignatures { + /// The node_id of the node which should receive these message(s) + node_id: crate::c_types::PublicKey, + /// The announcement_signatures message which should be sent. + msg: crate::lightning::ln::msgs::AnnouncementSignatures, + }, + /// Used to indicate that a series of HTLC update messages, as well as a commitment_signed + /// message should be sent to the peer with the given node_id. + UpdateHTLCs { + /// The node_id of the node which should receive these message(s) + node_id: crate::c_types::PublicKey, + /// The channel_id associated with all the update messages. + channel_id: crate::lightning::ln::types::ChannelId, + /// The update messages which should be sent. ALL messages in the struct should be sent! + updates: crate::lightning::ln::msgs::CommitmentUpdate, + }, + /// Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id. + SendRevokeAndACK { + /// 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::RevokeAndACK, + }, + /// Used to indicate that a closing_signed message should be sent to the peer with the given node_id. + SendClosingSigned { + /// 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::ClosingSigned, + }, + /// Used to indicate that a `closing_complete` message should be sent to the peer with the given `node_id`. + SendClosingComplete { + /// 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::ClosingComplete, + }, + /// Used to indicate that a `closing_sig` message should be sent to the peer with the given `node_id`. + SendClosingSig { + /// 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::ClosingSig, + }, + /// Used to indicate that a shutdown message should be sent to the peer with the given node_id. + SendShutdown { + /// 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::Shutdown, + }, + /// Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id. + SendChannelReestablish { + /// 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::ChannelReestablish, + }, + /// Used to send a channel_announcement and channel_update to a specific peer, likely on + /// initial connection to ensure our peers know about our channels. + SendChannelAnnouncement { + /// The node_id of the node which should receive this message + node_id: crate::c_types::PublicKey, + /// The channel_announcement which should be sent. + msg: crate::lightning::ln::msgs::ChannelAnnouncement, + /// The followup channel_update which should be sent. + update_msg: crate::lightning::ln::msgs::ChannelUpdate, + }, + /// Used to indicate that a channel_announcement and channel_update should be broadcast to all + /// peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2). + /// + /// Note that after doing so, you very likely (unless you did so very recently) want to + /// broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This + /// ensures that any nodes which see our channel_announcement also have a relevant + /// node_announcement, including relevant feature flags which may be important for routing + /// through or to us. + /// + /// [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement + BroadcastChannelAnnouncement { + /// The channel_announcement which should be sent. + msg: crate::lightning::ln::msgs::ChannelAnnouncement, + /// The followup channel_update which should be sent. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + update_msg: crate::lightning::ln::msgs::ChannelUpdate, + }, + /// Used to indicate that a channel_update should be broadcast to all peers. + BroadcastChannelUpdate { + /// The channel_update which should be sent. + msg: crate::lightning::ln::msgs::ChannelUpdate, + }, + /// Used to indicate that a node_announcement should be broadcast to all peers. + BroadcastNodeAnnouncement { + /// The node_announcement which should be sent. + msg: crate::lightning::ln::msgs::NodeAnnouncement, + }, + /// Used to indicate that a channel_update should be sent to a single peer. + /// In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a + /// private channel and we shouldn't be informing all of our peers of channel parameters. + SendChannelUpdate { + /// The node_id of the node which should receive this message + node_id: crate::c_types::PublicKey, + /// The channel_update which should be sent. + msg: crate::lightning::ln::msgs::ChannelUpdate, + }, + /// Broadcast an error downstream to be handled + HandleError { + /// The node_id of the node which should receive this message + node_id: crate::c_types::PublicKey, + /// The action which should be taken. + action: crate::lightning::ln::msgs::ErrorAction, + }, + /// Query a peer for channels with funding transaction UTXOs in a block range. + SendChannelRangeQuery { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The query_channel_range which should be sent. + msg: crate::lightning::ln::msgs::QueryChannelRange, + }, + /// Request routing gossip messages from a peer for a list of channels identified by + /// their short_channel_ids. + SendShortIdsQuery { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The query_short_channel_ids which should be sent. + msg: crate::lightning::ln::msgs::QueryShortChannelIds, + }, + /// Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events + /// emitted during processing of the query. + SendReplyChannelRange { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The reply_channel_range which should be sent. + msg: crate::lightning::ln::msgs::ReplyChannelRange, + }, + /// Sends a timestamp filter for inbound gossip. This should be sent on each new connection to + /// enable receiving gossip messages from the peer. + SendGossipTimestampFilter { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The gossip_timestamp_filter which should be sent. + msg: crate::lightning::ln::msgs::GossipTimestampFilter, + }, + /// Sends a channel partner Peer Storage of our backup which they should store. + /// This should be sent on each new connection to the channel partner or whenever we want + /// them to update the backup that they store. + SendPeerStorage { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The peer_storage which should be sent. + msg: crate::lightning::ln::msgs::PeerStorage, + }, + /// Sends a channel partner their own peer storage which we store and update when they send + /// a [`PeerStorage`]. + SendPeerStorageRetrieval { + /// The node_id of this message recipient + node_id: crate::c_types::PublicKey, + /// The peer_storage_retrieval which should be sent. + msg: crate::lightning::ln::msgs::PeerStorageRetrieval, + }, +} +use lightning::ln::msgs::MessageSendEvent as MessageSendEventImport; +pub(crate) type nativeMessageSendEvent = MessageSendEventImport; + +impl MessageSendEvent { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeMessageSendEvent { + match self { + MessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendAcceptChannel { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendAcceptChannelV2 {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendAcceptChannelV2 { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendOpenChannel { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendOpenChannelV2 {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendOpenChannelV2 { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendFundingCreated { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendFundingSigned { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendStfu {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendStfu { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceInit {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendSpliceInit { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceAck {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendSpliceAck { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceLocked {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendSpliceLocked { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxAddInput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxAddInput { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxAddOutput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxAddOutput { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxRemoveInput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxRemoveInput { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxRemoveOutput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxRemoveOutput { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxComplete {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxComplete { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxSignatures {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxSignatures { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxInitRbf {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxInitRbf { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxAckRbf {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxAckRbf { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendTxAbort {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendTxAbort { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendChannelReady { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendAnnouncementSignatures { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::UpdateHTLCs {ref node_id, ref channel_id, ref updates, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut updates_nonref = Clone::clone(updates); + nativeMessageSendEvent::UpdateHTLCs { + node_id: node_id_nonref.into_rust(), + channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, + updates: *unsafe { Box::from_raw(updates_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendRevokeAndACK { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendClosingSigned { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendClosingComplete {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendClosingComplete { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendClosingSig {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendClosingSig { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendShutdown {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendShutdown { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendChannelReestablish { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); + nativeMessageSendEvent::SendChannelAnnouncement { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + update_msg: *unsafe { Box::from_raw(update_msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); + let mut local_update_msg_nonref = if update_msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_msg_nonref.take_inner()) } }) }; + nativeMessageSendEvent::BroadcastChannelAnnouncement { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + update_msg: local_update_msg_nonref, + } + }, + MessageSendEvent::BroadcastChannelUpdate {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::BroadcastChannelUpdate { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::BroadcastNodeAnnouncement {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::BroadcastNodeAnnouncement { + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendChannelUpdate { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::HandleError {ref node_id, ref action, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut action_nonref = Clone::clone(action); + nativeMessageSendEvent::HandleError { + node_id: node_id_nonref.into_rust(), + action: action_nonref.into_native(), + } + }, + MessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendChannelRangeQuery { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendShortIdsQuery { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendReplyChannelRange { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendGossipTimestampFilter { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendPeerStorage {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendPeerStorage { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + MessageSendEvent::SendPeerStorageRetrieval {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + nativeMessageSendEvent::SendPeerStorageRetrieval { + node_id: node_id_nonref.into_rust(), + msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeMessageSendEvent { + match self { + MessageSendEvent::SendAcceptChannel {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendAcceptChannel { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendAcceptChannelV2 {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendAcceptChannelV2 { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendOpenChannel {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendOpenChannel { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendOpenChannelV2 {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendOpenChannelV2 { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendFundingCreated {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendFundingCreated { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendFundingSigned {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendFundingSigned { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendStfu {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendStfu { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceInit {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendSpliceInit { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceAck {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendSpliceAck { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendSpliceLocked {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendSpliceLocked { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxAddInput {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxAddInput { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxAddOutput {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxAddOutput { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxRemoveInput {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxRemoveInput { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxRemoveOutput {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxRemoveOutput { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxComplete {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxComplete { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxSignatures {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxSignatures { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxInitRbf {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxInitRbf { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxAckRbf {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxAckRbf { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendTxAbort {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendTxAbort { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendChannelReady {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendChannelReady { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendAnnouncementSignatures { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::UpdateHTLCs {mut node_id, mut channel_id, mut updates, } => { + nativeMessageSendEvent::UpdateHTLCs { + node_id: node_id.into_rust(), + channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, + updates: *unsafe { Box::from_raw(updates.take_inner()) }, + } + }, + MessageSendEvent::SendRevokeAndACK {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendRevokeAndACK { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendClosingSigned {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendClosingSigned { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendClosingComplete {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendClosingComplete { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendClosingSig {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendClosingSig { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendShutdown {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendShutdown { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendChannelReestablish {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendChannelReestablish { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendChannelAnnouncement {mut node_id, mut msg, mut update_msg, } => { + nativeMessageSendEvent::SendChannelAnnouncement { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + update_msg: *unsafe { Box::from_raw(update_msg.take_inner()) }, + } + }, + MessageSendEvent::BroadcastChannelAnnouncement {mut msg, mut update_msg, } => { + let mut local_update_msg = if update_msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_msg.take_inner()) } }) }; + nativeMessageSendEvent::BroadcastChannelAnnouncement { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + update_msg: local_update_msg, + } + }, + MessageSendEvent::BroadcastChannelUpdate {mut msg, } => { + nativeMessageSendEvent::BroadcastChannelUpdate { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::BroadcastNodeAnnouncement {mut msg, } => { + nativeMessageSendEvent::BroadcastNodeAnnouncement { + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendChannelUpdate { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::HandleError {mut node_id, mut action, } => { + nativeMessageSendEvent::HandleError { + node_id: node_id.into_rust(), + action: action.into_native(), + } + }, + MessageSendEvent::SendChannelRangeQuery {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendChannelRangeQuery { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendShortIdsQuery {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendShortIdsQuery { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendReplyChannelRange { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendGossipTimestampFilter {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendGossipTimestampFilter { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendPeerStorage {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendPeerStorage { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + MessageSendEvent::SendPeerStorageRetrieval {mut node_id, mut msg, } => { + nativeMessageSendEvent::SendPeerStorageRetrieval { + node_id: node_id.into_rust(), + msg: *unsafe { Box::from_raw(msg.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &MessageSendEventImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeMessageSendEvent) }; + match native { + nativeMessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendAcceptChannel { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendAcceptChannelV2 {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendAcceptChannelV2 { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::AcceptChannelV2 { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendOpenChannel { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendOpenChannelV2 {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendOpenChannelV2 { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::OpenChannelV2 { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendFundingCreated { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendFundingSigned { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendStfu {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendStfu { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::Stfu { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendSpliceInit {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendSpliceInit { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::SpliceInit { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendSpliceAck {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendSpliceAck { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::SpliceAck { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendSpliceLocked {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendSpliceLocked { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::SpliceLocked { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxAddInput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxAddInput { + 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 }, + } + }, + nativeMessageSendEvent::SendTxAddOutput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxAddOutput { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxAddOutput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxRemoveInput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxRemoveInput { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxRemoveInput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxRemoveOutput {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxRemoveOutput { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxRemoveOutput { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxComplete {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxComplete { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxComplete { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxSignatures {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxSignatures { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxSignatures { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxInitRbf {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxInitRbf { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxInitRbf { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxAckRbf {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendTxAckRbf { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::TxAckRbf { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxAbort {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + 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::TxAbort { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendChannelReady { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendAnnouncementSignatures { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::UpdateHTLCs {ref node_id, ref channel_id, ref updates, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut updates_nonref = Clone::clone(updates); + MessageSendEvent::UpdateHTLCs { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, + updates: crate::lightning::ln::msgs::CommitmentUpdate { inner: ObjOps::heap_alloc(updates_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendRevokeAndACK { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendClosingSigned { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingComplete {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendClosingComplete { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ClosingComplete { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingSig {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendClosingSig { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ClosingSig { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendShutdown {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendShutdown { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendChannelReestablish { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); + MessageSendEvent::SendChannelAnnouncement { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + update_msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(update_msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); + let mut local_update_msg_nonref = crate::lightning::ln::msgs::ChannelUpdate { inner: if update_msg_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((update_msg_nonref.unwrap())) } }, is_owned: true }; + MessageSendEvent::BroadcastChannelAnnouncement { + msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + update_msg: local_update_msg_nonref, + } + }, + nativeMessageSendEvent::BroadcastChannelUpdate {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::BroadcastChannelUpdate { + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::BroadcastNodeAnnouncement {ref msg, } => { + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::BroadcastNodeAnnouncement { + msg: crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); let mut msg_nonref = Clone::clone(msg); - let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) }; - nativeErrorAction::DisconnectPeer { - msg: local_msg_nonref, + MessageSendEvent::SendChannelUpdate { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, - ErrorAction::DisconnectPeerWithWarning {ref msg, } => { + nativeMessageSendEvent::HandleError {ref node_id, ref action, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut action_nonref = Clone::clone(action); + MessageSendEvent::HandleError { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + action: crate::lightning::ln::msgs::ErrorAction::native_into(action_nonref), + } + }, + nativeMessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); let mut msg_nonref = Clone::clone(msg); - nativeErrorAction::DisconnectPeerWithWarning { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + MessageSendEvent::SendChannelRangeQuery { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, - ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, - ErrorAction::IgnoreAndLog (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeErrorAction::IgnoreAndLog ( - a_nonref.into_native(), - ) + nativeMessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendShortIdsQuery { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } }, - ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip, - ErrorAction::SendErrorMessage {ref msg, } => { + nativeMessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); let mut msg_nonref = Clone::clone(msg); - nativeErrorAction::SendErrorMessage { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, + MessageSendEvent::SendReplyChannelRange { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, - ErrorAction::SendWarningMessage {ref msg, ref log_level, } => { + nativeMessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); let mut msg_nonref = Clone::clone(msg); - let mut log_level_nonref = Clone::clone(log_level); - nativeErrorAction::SendWarningMessage { - msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, - log_level: log_level_nonref.into_native(), + MessageSendEvent::SendGossipTimestampFilter { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendPeerStorage {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendPeerStorage { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::PeerStorage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + } + }, + nativeMessageSendEvent::SendPeerStorageRetrieval {ref node_id, ref msg, } => { + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + MessageSendEvent::SendPeerStorageRetrieval { + node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), + msg: crate::lightning::ln::msgs::PeerStorageRetrieval { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, } } #[allow(unused)] - pub(crate) fn into_native(self) -> nativeErrorAction { - match self { - ErrorAction::DisconnectPeer {mut msg, } => { - let mut local_msg = if msg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg.take_inner()) } }) }; - nativeErrorAction::DisconnectPeer { - msg: local_msg, + pub(crate) fn native_into(native: nativeMessageSendEvent) -> Self { + match native { + nativeMessageSendEvent::SendAcceptChannel {mut node_id, mut msg, } => { + MessageSendEvent::SendAcceptChannel { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - ErrorAction::DisconnectPeerWithWarning {mut msg, } => { - nativeErrorAction::DisconnectPeerWithWarning { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, + nativeMessageSendEvent::SendAcceptChannelV2 {mut node_id, mut msg, } => { + MessageSendEvent::SendAcceptChannelV2 { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::AcceptChannelV2 { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, - ErrorAction::IgnoreAndLog (mut a, ) => { - nativeErrorAction::IgnoreAndLog ( - a.into_native(), - ) + nativeMessageSendEvent::SendOpenChannel {mut node_id, mut msg, } => { + MessageSendEvent::SendOpenChannel { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } }, - ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip, - ErrorAction::SendErrorMessage {mut msg, } => { - nativeErrorAction::SendErrorMessage { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, + nativeMessageSendEvent::SendOpenChannelV2 {mut node_id, mut msg, } => { + MessageSendEvent::SendOpenChannelV2 { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::OpenChannelV2 { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - ErrorAction::SendWarningMessage {mut msg, mut log_level, } => { - nativeErrorAction::SendWarningMessage { - msg: *unsafe { Box::from_raw(msg.take_inner()) }, - log_level: log_level.into_native(), + nativeMessageSendEvent::SendFundingCreated {mut node_id, mut msg, } => { + MessageSendEvent::SendFundingCreated { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &ErrorActionImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeErrorAction) }; - match native { - nativeErrorAction::DisconnectPeer {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - let mut local_msg_nonref = crate::lightning::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((msg_nonref.unwrap())) } }, is_owned: true }; - ErrorAction::DisconnectPeer { - msg: local_msg_nonref, + nativeMessageSendEvent::SendFundingSigned {mut node_id, mut msg, } => { + MessageSendEvent::SendFundingSigned { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::DisconnectPeerWithWarning {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - ErrorAction::DisconnectPeerWithWarning { - msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + nativeMessageSendEvent::SendStfu {mut node_id, mut msg, } => { + MessageSendEvent::SendStfu { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::Stfu { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, - nativeErrorAction::IgnoreAndLog (ref a, ) => { - let mut a_nonref = Clone::clone(a); - ErrorAction::IgnoreAndLog ( - crate::lightning::util::logger::Level::native_into(a_nonref), - ) + nativeMessageSendEvent::SendSpliceInit {mut node_id, mut msg, } => { + MessageSendEvent::SendSpliceInit { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::SpliceInit { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } }, - nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip, - nativeErrorAction::SendErrorMessage {ref msg, } => { - let mut msg_nonref = Clone::clone(msg); - ErrorAction::SendErrorMessage { - msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, + nativeMessageSendEvent::SendSpliceAck {mut node_id, mut msg, } => { + MessageSendEvent::SendSpliceAck { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::SpliceAck { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::SendWarningMessage {ref msg, ref log_level, } => { - let mut msg_nonref = Clone::clone(msg); - let mut log_level_nonref = Clone::clone(log_level); - ErrorAction::SendWarningMessage { - msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, - log_level: crate::lightning::util::logger::Level::native_into(log_level_nonref), + nativeMessageSendEvent::SendSpliceLocked {mut node_id, mut msg, } => { + MessageSendEvent::SendSpliceLocked { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::SpliceLocked { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeErrorAction) -> Self { - match native { - nativeErrorAction::DisconnectPeer {mut msg, } => { - let mut local_msg = crate::lightning::ln::msgs::ErrorMessage { inner: if msg.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((msg.unwrap())) } }, is_owned: true }; - ErrorAction::DisconnectPeer { - msg: local_msg, + nativeMessageSendEvent::SendTxAddInput {mut node_id, mut msg, } => { + MessageSendEvent::SendTxAddInput { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxAddInput { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::DisconnectPeerWithWarning {mut msg, } => { - ErrorAction::DisconnectPeerWithWarning { - msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + nativeMessageSendEvent::SendTxAddOutput {mut node_id, mut msg, } => { + MessageSendEvent::SendTxAddOutput { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxAddOutput { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, - nativeErrorAction::IgnoreAndLog (mut a, ) => { - ErrorAction::IgnoreAndLog ( - crate::lightning::util::logger::Level::native_into(a), - ) + nativeMessageSendEvent::SendTxRemoveInput {mut node_id, mut msg, } => { + MessageSendEvent::SendTxRemoveInput { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxRemoveInput { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } }, - nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip, - nativeErrorAction::SendErrorMessage {mut msg, } => { - ErrorAction::SendErrorMessage { - msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + nativeMessageSendEvent::SendTxRemoveOutput {mut node_id, mut msg, } => { + MessageSendEvent::SendTxRemoveOutput { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxRemoveOutput { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, - nativeErrorAction::SendWarningMessage {mut msg, mut log_level, } => { - ErrorAction::SendWarningMessage { - msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg), is_owned: true }, - log_level: crate::lightning::util::logger::Level::native_into(log_level), + nativeMessageSendEvent::SendTxComplete {mut node_id, mut msg, } => { + MessageSendEvent::SendTxComplete { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxComplete { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxSignatures {mut node_id, mut msg, } => { + MessageSendEvent::SendTxSignatures { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxSignatures { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxInitRbf {mut node_id, mut msg, } => { + MessageSendEvent::SendTxInitRbf { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxInitRbf { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxAckRbf {mut node_id, mut msg, } => { + MessageSendEvent::SendTxAckRbf { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxAckRbf { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendTxAbort {mut node_id, mut msg, } => { + MessageSendEvent::SendTxAbort { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::TxAbort { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelReady {mut node_id, mut msg, } => { + MessageSendEvent::SendChannelReady { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendAnnouncementSignatures {mut node_id, mut msg, } => { + MessageSendEvent::SendAnnouncementSignatures { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::UpdateHTLCs {mut node_id, mut channel_id, mut updates, } => { + MessageSendEvent::UpdateHTLCs { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, + updates: crate::lightning::ln::msgs::CommitmentUpdate { inner: ObjOps::heap_alloc(updates), is_owned: true }, + } + }, + nativeMessageSendEvent::SendRevokeAndACK {mut node_id, mut msg, } => { + MessageSendEvent::SendRevokeAndACK { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingSigned {mut node_id, mut msg, } => { + MessageSendEvent::SendClosingSigned { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingComplete {mut node_id, mut msg, } => { + MessageSendEvent::SendClosingComplete { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ClosingComplete { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendClosingSig {mut node_id, mut msg, } => { + MessageSendEvent::SendClosingSig { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ClosingSig { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendShutdown {mut node_id, mut msg, } => { + MessageSendEvent::SendShutdown { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelReestablish {mut node_id, mut msg, } => { + MessageSendEvent::SendChannelReestablish { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelAnnouncement {mut node_id, mut msg, mut update_msg, } => { + MessageSendEvent::SendChannelAnnouncement { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, + update_msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(update_msg), is_owned: true }, + } + }, + nativeMessageSendEvent::BroadcastChannelAnnouncement {mut msg, mut update_msg, } => { + let mut local_update_msg = crate::lightning::ln::msgs::ChannelUpdate { inner: if update_msg.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((update_msg.unwrap())) } }, is_owned: true }; + MessageSendEvent::BroadcastChannelAnnouncement { + msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, + update_msg: local_update_msg, + } + }, + nativeMessageSendEvent::BroadcastChannelUpdate {mut msg, } => { + MessageSendEvent::BroadcastChannelUpdate { + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::BroadcastNodeAnnouncement {mut msg, } => { + MessageSendEvent::BroadcastNodeAnnouncement { + msg: crate::lightning::ln::msgs::NodeAnnouncement { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendChannelUpdate {mut node_id, mut msg, } => { + MessageSendEvent::SendChannelUpdate { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::HandleError {mut node_id, mut action, } => { + MessageSendEvent::HandleError { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + action: crate::lightning::ln::msgs::ErrorAction::native_into(action), + } + }, + nativeMessageSendEvent::SendChannelRangeQuery {mut node_id, mut msg, } => { + MessageSendEvent::SendChannelRangeQuery { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendShortIdsQuery {mut node_id, mut msg, } => { + MessageSendEvent::SendShortIdsQuery { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendReplyChannelRange {mut node_id, mut msg, } => { + MessageSendEvent::SendReplyChannelRange { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendGossipTimestampFilter {mut node_id, mut msg, } => { + MessageSendEvent::SendGossipTimestampFilter { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendPeerStorage {mut node_id, mut msg, } => { + MessageSendEvent::SendPeerStorage { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::PeerStorage { inner: ObjOps::heap_alloc(msg), is_owned: true }, + } + }, + nativeMessageSendEvent::SendPeerStorageRetrieval {mut node_id, mut msg, } => { + MessageSendEvent::SendPeerStorageRetrieval { + node_id: crate::c_types::PublicKey::from_rust(&node_id), + msg: crate::lightning::ln::msgs::PeerStorageRetrieval { inner: ObjOps::heap_alloc(msg), is_owned: true }, } }, } } } -/// Frees any resources used by the ErrorAction -#[no_mangle] -pub extern "C" fn ErrorAction_free(this_ptr: ErrorAction) { } -/// Creates a copy of the ErrorAction -#[no_mangle] -pub extern "C" fn ErrorAction_clone(orig: &ErrorAction) -> ErrorAction { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ErrorAction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ErrorAction)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ErrorAction_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut ErrorAction) }; -} -#[no_mangle] -/// Utility method to constructs a new DisconnectPeer-variant ErrorAction -pub extern "C" fn ErrorAction_disconnect_peer(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction { - ErrorAction::DisconnectPeer { - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new DisconnectPeerWithWarning-variant ErrorAction -pub extern "C" fn ErrorAction_disconnect_peer_with_warning(msg: crate::lightning::ln::msgs::WarningMessage) -> ErrorAction { - ErrorAction::DisconnectPeerWithWarning { - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new IgnoreError-variant ErrorAction -pub extern "C" fn ErrorAction_ignore_error() -> ErrorAction { - ErrorAction::IgnoreError} -#[no_mangle] -/// Utility method to constructs a new IgnoreAndLog-variant ErrorAction -pub extern "C" fn ErrorAction_ignore_and_log(a: crate::lightning::util::logger::Level) -> ErrorAction { - ErrorAction::IgnoreAndLog(a, ) -} -#[no_mangle] -/// Utility method to constructs a new IgnoreDuplicateGossip-variant ErrorAction -pub extern "C" fn ErrorAction_ignore_duplicate_gossip() -> ErrorAction { - ErrorAction::IgnoreDuplicateGossip} -#[no_mangle] -/// Utility method to constructs a new SendErrorMessage-variant ErrorAction -pub extern "C" fn ErrorAction_send_error_message(msg: crate::lightning::ln::msgs::ErrorMessage) -> ErrorAction { - ErrorAction::SendErrorMessage { - msg, - } -} -#[no_mangle] -/// Utility method to constructs a new SendWarningMessage-variant ErrorAction -pub extern "C" fn ErrorAction_send_warning_message(msg: crate::lightning::ln::msgs::WarningMessage, log_level: crate::lightning::util::logger::Level) -> ErrorAction { - ErrorAction::SendWarningMessage { - msg, - log_level, - } -} -/// Get a string which allows debug introspection of a ErrorAction object -pub extern "C" fn ErrorAction_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::ErrorAction }).into()} -/// Generates a non-cryptographic 64-bit hash of the ErrorAction. -#[no_mangle] -pub extern "C" fn ErrorAction_hash(o: &ErrorAction) -> 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) -} - -use lightning::ln::msgs::LightningError as nativeLightningErrorImport; -pub(crate) type nativeLightningError = nativeLightningErrorImport; - -/// An Err type for failure to process messages. -#[must_use] -#[repr(C)] -pub struct LightningError { - /// 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 nativeLightningError, - /// 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 core::ops::Deref for LightningError { - type Target = nativeLightningError; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LightningError { } -unsafe impl core::marker::Sync for LightningError { } -impl Drop for LightningError { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLightningError>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LightningError, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the MessageSendEvent #[no_mangle] -pub extern "C" fn LightningError_free(this_obj: LightningError) { } +pub extern "C" fn MessageSendEvent_free(this_ptr: MessageSendEvent) { } +/// Creates a copy of the MessageSendEvent +#[no_mangle] +pub extern "C" fn MessageSendEvent_clone(orig: &MessageSendEvent) -> MessageSendEvent { + orig.clone() +} #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LightningError_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLightningError) }; +pub(crate) extern "C" fn MessageSendEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MessageSendEvent)).clone() })) as *mut c_void } #[allow(unused)] -impl LightningError { - pub(crate) fn get_native_ref(&self) -> &'static nativeLightningError { - unsafe { &*ObjOps::untweak_ptr(self.inner) } +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn MessageSendEvent_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut MessageSendEvent) }; +} +#[no_mangle] +/// Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_accept_channel(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AcceptChannel) -> MessageSendEvent { + MessageSendEvent::SendAcceptChannel { + node_id, + msg, } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLightningError { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } +} +#[no_mangle] +/// Utility method to constructs a new SendAcceptChannelV2-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_accept_channel_v2(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AcceptChannelV2) -> MessageSendEvent { + MessageSendEvent::SendAcceptChannelV2 { + node_id, + msg, } - /// 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 nativeLightningError { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret +} +#[no_mangle] +/// Utility method to constructs a new SendOpenChannel-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_open_channel(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::OpenChannel) -> MessageSendEvent { + MessageSendEvent::SendOpenChannel { + node_id, + msg, } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } +} +#[no_mangle] +/// Utility method to constructs a new SendOpenChannelV2-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_open_channel_v2(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::OpenChannelV2) -> MessageSendEvent { + MessageSendEvent::SendOpenChannelV2 { + node_id, + msg, } } -/// A human-readable message describing the error #[no_mangle] -pub extern "C" fn LightningError_get_err(this_ptr: &LightningError) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().err; - inner_val.as_str().into() +/// Utility method to constructs a new SendFundingCreated-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_funding_created(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::FundingCreated) -> MessageSendEvent { + MessageSendEvent::SendFundingCreated { + node_id, + msg, + } } -/// A human-readable message describing the error #[no_mangle] -pub extern "C" fn LightningError_set_err(this_ptr: &mut LightningError, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.err = val.into_string(); +/// Utility method to constructs a new SendFundingSigned-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_funding_signed(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::FundingSigned) -> MessageSendEvent { + MessageSendEvent::SendFundingSigned { + node_id, + msg, + } } -/// The action which should be taken against the offending peer. #[no_mangle] -pub extern "C" fn LightningError_get_action(this_ptr: &LightningError) -> crate::lightning::ln::msgs::ErrorAction { - let mut inner_val = &mut this_ptr.get_native_mut_ref().action; - crate::lightning::ln::msgs::ErrorAction::from_native(inner_val) +/// Utility method to constructs a new SendStfu-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_stfu(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::Stfu) -> MessageSendEvent { + MessageSendEvent::SendStfu { + node_id, + msg, + } } -/// The action which should be taken against the offending peer. #[no_mangle] -pub extern "C" fn LightningError_set_action(this_ptr: &mut LightningError, mut val: crate::lightning::ln::msgs::ErrorAction) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.action = val.into_native(); +/// Utility method to constructs a new SendSpliceInit-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_splice_init(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceInit) -> MessageSendEvent { + MessageSendEvent::SendSpliceInit { + node_id, + msg, + } } -/// Constructs a new LightningError given each field -#[must_use] #[no_mangle] -pub extern "C" fn LightningError_new(mut err_arg: crate::c_types::Str, mut action_arg: crate::lightning::ln::msgs::ErrorAction) -> LightningError { - LightningError { inner: ObjOps::heap_alloc(nativeLightningError { - err: err_arg.into_string(), - action: action_arg.into_native(), - }), is_owned: true } +/// Utility method to constructs a new SendSpliceAck-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_splice_ack(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceAck) -> MessageSendEvent { + MessageSendEvent::SendSpliceAck { + node_id, + msg, + } } -impl Clone for LightningError { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLightningError>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, - is_owned: true, - } +#[no_mangle] +/// Utility method to constructs a new SendSpliceLocked-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_splice_locked(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::SpliceLocked) -> MessageSendEvent { + MessageSendEvent::SendSpliceLocked { + node_id, + msg, } } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LightningError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLightningError)).clone() })) as *mut c_void +#[no_mangle] +/// Utility method to constructs a new SendTxAddInput-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_add_input(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAddInput) -> MessageSendEvent { + MessageSendEvent::SendTxAddInput { + node_id, + msg, + } } #[no_mangle] -/// Creates a copy of the LightningError -pub extern "C" fn LightningError_clone(orig: &LightningError) -> LightningError { - orig.clone() +/// Utility method to constructs a new SendTxAddOutput-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_add_output(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAddOutput) -> MessageSendEvent { + MessageSendEvent::SendTxAddOutput { + node_id, + msg, + } } -/// Get a string which allows debug introspection of a LightningError object -pub extern "C" fn LightningError_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::LightningError }).into()} - -use lightning::ln::msgs::CommitmentUpdate as nativeCommitmentUpdateImport; -pub(crate) type nativeCommitmentUpdate = nativeCommitmentUpdateImport; - -/// Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment -/// transaction updates if they were pending. -#[must_use] -#[repr(C)] -pub struct CommitmentUpdate { - /// 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 nativeCommitmentUpdate, - /// 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, +#[no_mangle] +/// Utility method to constructs a new SendTxRemoveInput-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_remove_input(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxRemoveInput) -> MessageSendEvent { + MessageSendEvent::SendTxRemoveInput { + node_id, + msg, + } } - -impl core::ops::Deref for CommitmentUpdate { - type Target = nativeCommitmentUpdate; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +#[no_mangle] +/// Utility method to constructs a new SendTxRemoveOutput-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_remove_output(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxRemoveOutput) -> MessageSendEvent { + MessageSendEvent::SendTxRemoveOutput { + node_id, + msg, + } } -unsafe impl core::marker::Send for CommitmentUpdate { } -unsafe impl core::marker::Sync for CommitmentUpdate { } -impl Drop for CommitmentUpdate { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeCommitmentUpdate>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } +#[no_mangle] +/// Utility method to constructs a new SendTxComplete-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_complete(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxComplete) -> MessageSendEvent { + MessageSendEvent::SendTxComplete { + node_id, + msg, } } -/// Frees any resources used by the CommitmentUpdate, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentUpdate) }; +/// Utility method to constructs a new SendTxSignatures-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_signatures(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxSignatures) -> MessageSendEvent { + MessageSendEvent::SendTxSignatures { + node_id, + msg, + } } -#[allow(unused)] -impl CommitmentUpdate { - pub(crate) fn get_native_ref(&self) -> &'static nativeCommitmentUpdate { - unsafe { &*ObjOps::untweak_ptr(self.inner) } +#[no_mangle] +/// Utility method to constructs a new SendTxInitRbf-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_init_rbf(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxInitRbf) -> MessageSendEvent { + MessageSendEvent::SendTxInitRbf { + node_id, + msg, } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCommitmentUpdate { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } +} +#[no_mangle] +/// Utility method to constructs a new SendTxAckRbf-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_tx_ack_rbf(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::TxAckRbf) -> MessageSendEvent { + MessageSendEvent::SendTxAckRbf { + node_id, + msg, } - /// 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 nativeCommitmentUpdate { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret +} +#[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::TxAbort) -> MessageSendEvent { + MessageSendEvent::SendTxAbort { + node_id, + msg, } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } +} +#[no_mangle] +/// Utility method to constructs a new SendChannelReady-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_channel_ready(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelReady) -> MessageSendEvent { + MessageSendEvent::SendChannelReady { + node_id, + msg, } } -/// `update_add_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_get_update_add_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateAddHTLCZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_add_htlcs; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false } }); }; - local_inner_val.into() +/// Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_announcement_signatures(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::AnnouncementSignatures) -> MessageSendEvent { + MessageSendEvent::SendAnnouncementSignatures { + node_id, + msg, + } } -/// `update_add_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_update_add_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateAddHTLCZ) { - 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) }.update_add_htlcs = local_val; +/// Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_update_htlcs(node_id: crate::c_types::PublicKey, channel_id: crate::lightning::ln::types::ChannelId, updates: crate::lightning::ln::msgs::CommitmentUpdate) -> MessageSendEvent { + MessageSendEvent::UpdateHTLCs { + node_id, + channel_id, + updates, + } } -/// `update_fulfill_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_get_update_fulfill_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFulfillHTLCZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fulfill_htlcs; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false } }); }; - local_inner_val.into() +/// Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_revoke_and_ack(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::RevokeAndACK) -> MessageSendEvent { + MessageSendEvent::SendRevokeAndACK { + node_id, + msg, + } } -/// `update_fulfill_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFulfillHTLCZ) { - 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) }.update_fulfill_htlcs = local_val; +/// Utility method to constructs a new SendClosingSigned-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_closing_signed(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ClosingSigned) -> MessageSendEvent { + MessageSendEvent::SendClosingSigned { + node_id, + msg, + } } -/// `update_fail_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_get_update_fail_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailHTLCZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fail_htlcs; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false } }); }; - local_inner_val.into() +/// Utility method to constructs a new SendClosingComplete-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_closing_complete(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ClosingComplete) -> MessageSendEvent { + MessageSendEvent::SendClosingComplete { + node_id, + msg, + } } -/// `update_fail_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_update_fail_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailHTLCZ) { - 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) }.update_fail_htlcs = local_val; +/// Utility method to constructs a new SendClosingSig-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_closing_sig(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ClosingSig) -> MessageSendEvent { + MessageSendEvent::SendClosingSig { + node_id, + msg, + } } -/// `update_fail_malformed_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptr: &CommitmentUpdate) -> crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fail_malformed_htlcs; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false } }); }; - local_inner_val.into() +/// Utility method to constructs a new SendShutdown-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_shutdown(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::Shutdown) -> MessageSendEvent { + MessageSendEvent::SendShutdown { + node_id, + msg, + } } -/// `update_fail_malformed_htlc` messages which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: &mut CommitmentUpdate, mut val: crate::c_types::derived::CVec_UpdateFailMalformedHTLCZ) { - 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) }.update_fail_malformed_htlcs = local_val; +/// Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_channel_reestablish(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelReestablish) -> MessageSendEvent { + MessageSendEvent::SendChannelReestablish { + node_id, + msg, + } } -/// An `update_fee` message which should be sent -/// -/// 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 CommitmentUpdate_get_update_fee(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::UpdateFee { - let mut inner_val = &mut this_ptr.get_native_mut_ref().update_fee; - let mut local_inner_val = crate::lightning::ln::msgs::UpdateFee { 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::msgs::UpdateFee<>) as *mut _ }, is_owned: false }; - local_inner_val +/// Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_channel_announcement(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelAnnouncement, update_msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { + MessageSendEvent::SendChannelAnnouncement { + node_id, + msg, + update_msg, + } } -/// An `update_fee` message which should be sent -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_update_fee(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::UpdateFee) { - 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) }.update_fee = local_val; +/// Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_broadcast_channel_announcement(msg: crate::lightning::ln::msgs::ChannelAnnouncement, update_msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { + MessageSendEvent::BroadcastChannelAnnouncement { + msg, + update_msg, + } +} +#[no_mangle] +/// Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_broadcast_channel_update(msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { + MessageSendEvent::BroadcastChannelUpdate { + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_broadcast_node_announcement(msg: crate::lightning::ln::msgs::NodeAnnouncement) -> MessageSendEvent { + MessageSendEvent::BroadcastNodeAnnouncement { + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_channel_update(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ChannelUpdate) -> MessageSendEvent { + MessageSendEvent::SendChannelUpdate { + node_id, + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new HandleError-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_handle_error(node_id: crate::c_types::PublicKey, action: crate::lightning::ln::msgs::ErrorAction) -> MessageSendEvent { + MessageSendEvent::HandleError { + node_id, + action, + } +} +#[no_mangle] +/// Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_channel_range_query(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryChannelRange) -> MessageSendEvent { + MessageSendEvent::SendChannelRangeQuery { + node_id, + msg, + } +} +#[no_mangle] +/// Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_short_ids_query(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> MessageSendEvent { + MessageSendEvent::SendShortIdsQuery { + node_id, + msg, + } } -/// A `commitment_signed` message which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_get_commitment_signed(this_ptr: &CommitmentUpdate) -> crate::lightning::ln::msgs::CommitmentSigned { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_signed; - crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false } +/// Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_reply_channel_range(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::ReplyChannelRange) -> MessageSendEvent { + MessageSendEvent::SendReplyChannelRange { + node_id, + msg, + } } -/// A `commitment_signed` message which should be sent #[no_mangle] -pub extern "C" fn CommitmentUpdate_set_commitment_signed(this_ptr: &mut CommitmentUpdate, mut val: crate::lightning::ln::msgs::CommitmentSigned) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.commitment_signed = *unsafe { Box::from_raw(val.take_inner()) }; +/// Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_gossip_timestamp_filter(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::GossipTimestampFilter) -> MessageSendEvent { + MessageSendEvent::SendGossipTimestampFilter { + node_id, + msg, + } } -/// 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 { - let mut local_update_add_htlcs_arg = Vec::new(); for mut item in update_add_htlcs_arg.into_rust().drain(..) { local_update_add_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_update_fulfill_htlcs_arg = Vec::new(); for mut item in update_fulfill_htlcs_arg.into_rust().drain(..) { local_update_fulfill_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_update_fail_htlcs_arg = Vec::new(); for mut item in update_fail_htlcs_arg.into_rust().drain(..) { local_update_fail_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_update_fail_malformed_htlcs_arg = Vec::new(); for mut item in update_fail_malformed_htlcs_arg.into_rust().drain(..) { local_update_fail_malformed_htlcs_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut local_update_fee_arg = if update_fee_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_fee_arg.take_inner()) } }) }; - CommitmentUpdate { inner: ObjOps::heap_alloc(nativeCommitmentUpdate { - update_add_htlcs: local_update_add_htlcs_arg, - update_fulfill_htlcs: local_update_fulfill_htlcs_arg, - update_fail_htlcs: local_update_fail_htlcs_arg, - update_fail_malformed_htlcs: local_update_fail_malformed_htlcs_arg, - update_fee: local_update_fee_arg, - commitment_signed: *unsafe { Box::from_raw(commitment_signed_arg.take_inner()) }, - }), is_owned: true } +/// Utility method to constructs a new SendPeerStorage-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_peer_storage(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::PeerStorage) -> MessageSendEvent { + MessageSendEvent::SendPeerStorage { + node_id, + msg, + } } -impl Clone for CommitmentUpdate { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeCommitmentUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, - is_owned: true, - } +#[no_mangle] +/// Utility method to constructs a new SendPeerStorageRetrieval-variant MessageSendEvent +pub extern "C" fn MessageSendEvent_send_peer_storage_retrieval(node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::PeerStorageRetrieval) -> MessageSendEvent { + MessageSendEvent::SendPeerStorageRetrieval { + node_id, + msg, } } +/// Get a string which allows debug introspection of a MessageSendEvent object +pub extern "C" fn MessageSendEvent_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::MessageSendEvent }).into()} +/// A trait to describe an object which handles when peers connect + disconnect and generates +/// outbound messages. +/// +/// It acts as a supertrait for all the P2P message handlers and can contribute to the +/// [`InitFeatures`] which we send to peers or decide to refuse connection to peers. +#[repr(C)] +pub struct BaseMessageHandler { + /// 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, + /// Gets the list of pending events which were generated by previous actions, clearing the list + /// in the process. + pub get_and_clear_pending_msg_events: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ, + /// Indicates a connection to the peer failed/an existing connection was lost. + pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey), + /// Gets the node feature flags which this handler itself supports. All available handlers are + /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + /// which are broadcasted in our [`NodeAnnouncement`] message. + pub provided_node_features: extern "C" fn (this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures, + /// Gets the init feature flags which should be sent to the given peer. All available handlers + /// are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + /// which are sent in our [`Init`] message. + /// + /// Note that this method is called before [`Self::peer_connected`]. + pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures, + /// Handle a peer (re)connecting. + /// + /// May return an `Err(())` to indicate that we should immediately disconnect from the peer + /// (e.g. because the features they support are not sufficient to communicate with us). + /// + /// Note, of course, that other message handlers may wish to communicate with the peer, which + /// disconnecting them will prevent. + /// + /// [`Self::peer_disconnected`] will not be called if `Err(())` is returned. + pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ, + /// 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 BaseMessageHandler {} +unsafe impl Sync for BaseMessageHandler {} #[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn CommitmentUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeCommitmentUpdate)).clone() })) as *mut c_void +pub(crate) fn BaseMessageHandler_clone_fields(orig: &BaseMessageHandler) -> BaseMessageHandler { + BaseMessageHandler { + this_arg: orig.this_arg, + get_and_clear_pending_msg_events: Clone::clone(&orig.get_and_clear_pending_msg_events), + peer_disconnected: Clone::clone(&orig.peer_disconnected), + provided_node_features: Clone::clone(&orig.provided_node_features), + provided_init_features: Clone::clone(&orig.provided_init_features), + peer_connected: Clone::clone(&orig.peer_connected), + free: Clone::clone(&orig.free), + } } -#[no_mangle] -/// Creates a copy of the CommitmentUpdate -pub extern "C" fn CommitmentUpdate_clone(orig: &CommitmentUpdate) -> CommitmentUpdate { - orig.clone() + +use lightning::ln::msgs::BaseMessageHandler as rustBaseMessageHandler; +impl rustBaseMessageHandler for BaseMessageHandler { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.get_and_clear_pending_msg_events)(self.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.provided_node_features)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } } -/// Get a string which allows debug introspection of a CommitmentUpdate object -pub extern "C" fn CommitmentUpdate_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::CommitmentUpdate }).into()} -/// Generates a non-cryptographic 64-bit hash of the CommitmentUpdate. -#[no_mangle] -pub extern "C" fn CommitmentUpdate_hash(o: &CommitmentUpdate) -> 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) + +pub struct BaseMessageHandlerRef(BaseMessageHandler); +impl rustBaseMessageHandler for BaseMessageHandlerRef { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.0.get_and_clear_pending_msg_events)(self.0.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.provided_node_features)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } } -/// Checks if two CommitmentUpdates 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. + +// 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 BaseMessageHandler { + type Target = BaseMessageHandlerRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const BaseMessageHandlerRef) } + } +} +impl core::ops::DerefMut for BaseMessageHandler { + fn deref_mut(&mut self) -> &mut BaseMessageHandlerRef { + unsafe { &mut *(self as *mut _ as *mut BaseMessageHandlerRef) } + } +} +/// Calls the free function if one is set #[no_mangle] -pub extern "C" fn CommitmentUpdate_eq(a: &CommitmentUpdate, b: &CommitmentUpdate) -> 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 } +pub extern "C" fn BaseMessageHandler_free(this_ptr: BaseMessageHandler) { } +impl Drop for BaseMessageHandler { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } } /// A trait to describe an object which can receive channel messages. /// @@ -10094,12 +13301,22 @@ pub struct ChannelMessageHandler { pub handle_funding_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned), /// Handle an incoming `channel_ready` message from the given peer. pub handle_channel_ready: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady), + /// Handle an incoming `peer_storage` message from the given peer. + pub handle_peer_storage: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::PeerStorage), + /// Handle an incoming `peer_storage_retrieval` message from the given peer. + pub handle_peer_storage_retrieval: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::PeerStorageRetrieval), /// Handle an incoming `shutdown` message from the given peer. pub handle_shutdown: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Shutdown), /// Handle an incoming `closing_signed` message from the given peer. pub handle_closing_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ClosingSigned), /// Handle an incoming `stfu` message from the given peer. pub handle_stfu: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu), + /// Handle an incoming `splice_init` message from the given peer. + pub handle_splice_init: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceInit), + /// Handle an incoming `splice_ack` message from the given peer. + pub handle_splice_ack: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceAck), + /// Handle an incoming `splice_locked` message from the given peer. + pub handle_splice_locked: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceLocked), /// Handle an incoming `tx_add_input message` from the given peer. pub handle_tx_add_input: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput), /// Handle an incoming `tx_add_output` message from the given peer. @@ -10121,45 +13338,27 @@ pub struct ChannelMessageHandler { /// Handle an incoming `update_add_htlc` message from the given peer. pub handle_update_add_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC), /// Handle an incoming `update_fulfill_htlc` message from the given peer. - pub handle_update_fulfill_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC), + pub handle_update_fulfill_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: crate::lightning::ln::msgs::UpdateFulfillHTLC), /// Handle an incoming `update_fail_htlc` message from the given peer. pub handle_update_fail_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC), /// Handle an incoming `update_fail_malformed_htlc` message from the given peer. pub handle_update_fail_malformed_htlc: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC), /// Handle an incoming `commitment_signed` message from the given peer. pub handle_commitment_signed: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned), + /// Handle a batch of incoming `commitment_signed` message from the given peer. + pub handle_commitment_signed_batch: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, channel_id: crate::lightning::ln::types::ChannelId, batch: crate::c_types::derived::CVec_CommitmentSignedZ), /// Handle an incoming `revoke_and_ack` message from the given peer. pub handle_revoke_and_ack: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK), /// Handle an incoming `update_fee` message from the given peer. pub handle_update_fee: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFee), /// Handle an incoming `announcement_signatures` message from the given peer. pub handle_announcement_signatures: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures), - /// Indicates a connection to the peer failed/an existing connection was lost. - pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey), - /// Handle a peer reconnecting, possibly generating `channel_reestablish` message(s). - /// - /// May return an `Err(())` if the features the peer supports are not sufficient to communicate - /// with us. Implementors should be somewhat conservative about doing so, however, as other - /// message handlers may still wish to communicate with this peer. - /// - /// [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ, /// Handle an incoming `channel_reestablish` message from the given peer. pub handle_channel_reestablish: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish), /// Handle an incoming `channel_update` message from the given peer. pub handle_channel_update: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate), /// Handle an incoming `error` message from the given peer. pub handle_error: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage), - /// Gets the node feature flags which this handler itself supports. All available handlers are - /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - /// which are broadcasted in our [`NodeAnnouncement`] message. - pub provided_node_features: extern "C" fn (this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures, - /// Gets the init feature flags which should be sent to the given peer. All available handlers - /// are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - /// which are sent in our [`Init`] message. - /// - /// Note that this method is called before [`Self::peer_connected`]. - pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures, /// Gets the chain hashes for this `ChannelMessageHandler` indicating which chains it supports. /// /// If it's `None`, then no particular network chain hash compatibility will be enforced when @@ -10172,8 +13371,8 @@ pub struct ChannelMessageHandler { /// Note: Since this function is called frequently, it should be as /// efficient as possible for its intended purpose. pub message_received: extern "C" fn (this_arg: *const c_void), - /// Implementation of MessageSendEventsProvider for this object. - pub MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider, + /// Implementation of BaseMessageHandler for this object. + pub BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler, /// 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, @@ -10191,9 +13390,14 @@ pub(crate) fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) - handle_funding_created: Clone::clone(&orig.handle_funding_created), handle_funding_signed: Clone::clone(&orig.handle_funding_signed), handle_channel_ready: Clone::clone(&orig.handle_channel_ready), + handle_peer_storage: Clone::clone(&orig.handle_peer_storage), + handle_peer_storage_retrieval: Clone::clone(&orig.handle_peer_storage_retrieval), handle_shutdown: Clone::clone(&orig.handle_shutdown), handle_closing_signed: Clone::clone(&orig.handle_closing_signed), handle_stfu: Clone::clone(&orig.handle_stfu), + handle_splice_init: Clone::clone(&orig.handle_splice_init), + handle_splice_ack: Clone::clone(&orig.handle_splice_ack), + handle_splice_locked: Clone::clone(&orig.handle_splice_locked), handle_tx_add_input: Clone::clone(&orig.handle_tx_add_input), handle_tx_add_output: Clone::clone(&orig.handle_tx_add_output), handle_tx_remove_input: Clone::clone(&orig.handle_tx_remove_input), @@ -10208,35 +13412,64 @@ pub(crate) fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) - handle_update_fail_htlc: Clone::clone(&orig.handle_update_fail_htlc), handle_update_fail_malformed_htlc: Clone::clone(&orig.handle_update_fail_malformed_htlc), handle_commitment_signed: Clone::clone(&orig.handle_commitment_signed), + handle_commitment_signed_batch: Clone::clone(&orig.handle_commitment_signed_batch), handle_revoke_and_ack: Clone::clone(&orig.handle_revoke_and_ack), handle_update_fee: Clone::clone(&orig.handle_update_fee), handle_announcement_signatures: Clone::clone(&orig.handle_announcement_signatures), - peer_disconnected: Clone::clone(&orig.peer_disconnected), - peer_connected: Clone::clone(&orig.peer_connected), handle_channel_reestablish: Clone::clone(&orig.handle_channel_reestablish), handle_channel_update: Clone::clone(&orig.handle_channel_update), handle_error: Clone::clone(&orig.handle_error), - provided_node_features: Clone::clone(&orig.provided_node_features), - provided_init_features: Clone::clone(&orig.provided_init_features), get_chain_hashes: Clone::clone(&orig.get_chain_hashes), message_received: Clone::clone(&orig.message_received), - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider), + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler_clone_fields(&orig.BaseMessageHandler), free: Clone::clone(&orig.free), } } -impl lightning::events::MessageSendEventsProvider for ChannelMessageHandler { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.MessageSendEventsProvider.this_arg); +impl lightning::ln::msgs::BaseMessageHandler for ChannelMessageHandler { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.BaseMessageHandler.get_and_clear_pending_msg_events)(self.BaseMessageHandler.this_arg); let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; local_ret } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.BaseMessageHandler.peer_disconnected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.BaseMessageHandler.provided_node_features)(self.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.BaseMessageHandler.provided_init_features)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.BaseMessageHandler.peer_connected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } } -impl lightning::events::MessageSendEventsProvider for ChannelMessageHandlerRef { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.0.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.0.MessageSendEventsProvider.this_arg); +impl lightning::ln::msgs::BaseMessageHandler for ChannelMessageHandlerRef { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.0.BaseMessageHandler.get_and_clear_pending_msg_events)(self.0.BaseMessageHandler.this_arg); let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; local_ret } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.0.BaseMessageHandler.peer_disconnected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_node_features)(self.0.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_init_features)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.0.BaseMessageHandler.peer_connected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } } use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler; @@ -10262,6 +13495,12 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_channel_ready(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { (self.handle_channel_ready)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReady { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReady<>) as *mut _) }, is_owned: false }) } + fn handle_peer_storage(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::PeerStorage) { + (self.handle_peer_storage)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::PeerStorage { inner: ObjOps::heap_alloc(msg), is_owned: true }) + } + fn handle_peer_storage_retrieval(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::PeerStorageRetrieval) { + (self.handle_peer_storage_retrieval)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::PeerStorageRetrieval { inner: ObjOps::heap_alloc(msg), is_owned: true }) + } fn handle_shutdown(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false }) } @@ -10271,6 +13510,15 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_stfu(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { (self.handle_stfu)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Stfu { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Stfu<>) as *mut _) }, is_owned: false }) } + fn handle_splice_init(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceInit) { + (self.handle_splice_init)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceInit { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceInit<>) as *mut _) }, is_owned: false }) + } + fn handle_splice_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceAck) { + (self.handle_splice_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceAck { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceAck<>) as *mut _) }, is_owned: false }) + } + fn handle_splice_locked(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceLocked) { + (self.handle_splice_locked)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceLocked { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceLocked<>) as *mut _) }, is_owned: false }) + } fn handle_tx_add_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { (self.handle_tx_add_input)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddInput<>) as *mut _) }, is_owned: false }) } @@ -10301,8 +13549,8 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_update_add_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { - (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false }) + fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::UpdateFulfillHTLC) { + (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: ObjOps::heap_alloc(msg), is_owned: true }) } fn handle_update_fail_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false }) @@ -10313,6 +13561,10 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_commitment_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false }) } + fn handle_commitment_signed_batch(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut channel_id: lightning::ln::types::ChannelId, mut batch: Vec) { + let mut local_batch = Vec::new(); for mut item in batch.drain(..) { local_batch.push( { crate::lightning::ln::msgs::CommitmentSigned { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + (self.handle_commitment_signed_batch)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, local_batch.into()) + } fn handle_revoke_and_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false }) } @@ -10322,14 +13574,6 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_announcement_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false }) } - fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { - (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) - } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } fn handle_channel_reestablish(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false }) } @@ -10339,14 +13583,6 @@ impl rustChannelMessageHandler for ChannelMessageHandler { fn handle_error(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false }) } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.provided_node_features)(self.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } fn get_chain_hashes(&self) -> Option> { let mut ret = (self.get_chain_hashes)(self.this_arg); let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { let mut local_ret_0 = Vec::new(); for mut item in { ret_opt.take() }.into_rust().drain(..) { local_ret_0.push( { ::bitcoin::constants::ChainHash::from(&item.data) }); }; local_ret_0 }})} }; @@ -10380,6 +13616,12 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_channel_ready(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { (self.0.handle_channel_ready)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReady { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReady<>) as *mut _) }, is_owned: false }) } + fn handle_peer_storage(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::PeerStorage) { + (self.0.handle_peer_storage)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::PeerStorage { inner: ObjOps::heap_alloc(msg), is_owned: true }) + } + fn handle_peer_storage_retrieval(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::PeerStorageRetrieval) { + (self.0.handle_peer_storage_retrieval)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::PeerStorageRetrieval { inner: ObjOps::heap_alloc(msg), is_owned: true }) + } fn handle_shutdown(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { (self.0.handle_shutdown)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false }) } @@ -10389,6 +13631,15 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_stfu(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { (self.0.handle_stfu)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Stfu { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Stfu<>) as *mut _) }, is_owned: false }) } + fn handle_splice_init(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceInit) { + (self.0.handle_splice_init)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceInit { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceInit<>) as *mut _) }, is_owned: false }) + } + fn handle_splice_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceAck) { + (self.0.handle_splice_ack)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceAck { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceAck<>) as *mut _) }, is_owned: false }) + } + fn handle_splice_locked(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::SpliceLocked) { + (self.0.handle_splice_locked)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::SpliceLocked { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::SpliceLocked<>) as *mut _) }, is_owned: false }) + } fn handle_tx_add_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { (self.0.handle_tx_add_input)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddInput<>) as *mut _) }, is_owned: false }) } @@ -10419,8 +13670,8 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_update_add_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { (self.0.handle_update_add_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { - (self.0.handle_update_fulfill_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false }) + fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::UpdateFulfillHTLC) { + (self.0.handle_update_fulfill_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: ObjOps::heap_alloc(msg), is_owned: true }) } fn handle_update_fail_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { (self.0.handle_update_fail_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false }) @@ -10431,6 +13682,10 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_commitment_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { (self.0.handle_commitment_signed)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false }) } + fn handle_commitment_signed_batch(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut channel_id: lightning::ln::types::ChannelId, mut batch: Vec) { + let mut local_batch = Vec::new(); for mut item in batch.drain(..) { local_batch.push( { crate::lightning::ln::msgs::CommitmentSigned { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + (self.0.handle_commitment_signed_batch)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, local_batch.into()) + } fn handle_revoke_and_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { (self.0.handle_revoke_and_ack)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false }) } @@ -10440,14 +13695,6 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_announcement_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { (self.0.handle_announcement_signatures)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false }) } - fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { - (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) - } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } fn handle_channel_reestablish(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { (self.0.handle_channel_reestablish)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false }) } @@ -10457,14 +13704,6 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { fn handle_error(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { (self.0.handle_error)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false }) } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.0.provided_node_features)(self.0.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } fn get_chain_hashes(&self) -> Option> { let mut ret = (self.0.get_chain_hashes)(self.0.this_arg); let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { let mut local_ret_0 = Vec::new(); for mut item in { ret_opt.take() }.into_rust().drain(..) { local_ret_0.push( { ::bitcoin::constants::ChainHash::from(&item.data) }); }; local_ret_0 }})} }; @@ -10543,14 +13782,6 @@ pub struct RoutingMessageHandler { /// Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None pub get_next_node_announcement: extern "C" fn (this_arg: *const c_void, starting_point: crate::lightning::routing::gossip::NodeId) -> crate::lightning::ln::msgs::NodeAnnouncement, - /// Called when a connection is established with a peer. This can be used to - /// perform routing table synchronization using a strategy defined by the - /// implementor. - /// - /// May return an `Err(())` if the features the peer supports are not sufficient to communicate - /// with us. Implementors should be somewhat conservative about doing so, however, as other - /// message handlers may still wish to communicate with this peer. - pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ, /// Handles the reply of a query we initiated to learn about channels /// for a given range of blocks. We can expect to receive one or more /// replies to a single query. @@ -10571,18 +13802,8 @@ pub struct RoutingMessageHandler { /// caller should seek to reduce the rate of new gossip messages handled, especially /// [`ChannelAnnouncement`]s. pub processing_queue_high: extern "C" fn (this_arg: *const c_void) -> bool, - /// Gets the node feature flags which this handler itself supports. All available handlers are - /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - /// which are broadcasted in our [`NodeAnnouncement`] message. - pub provided_node_features: extern "C" fn (this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures, - /// Gets the init feature flags which should be sent to the given peer. All available handlers - /// are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - /// which are sent in our [`Init`] message. - /// - /// Note that this method is called before [`Self::peer_connected`]. - pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures, - /// Implementation of MessageSendEventsProvider for this object. - pub MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider, + /// Implementation of BaseMessageHandler for this object. + pub BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler, /// 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, @@ -10598,31 +13819,60 @@ pub(crate) fn RoutingMessageHandler_clone_fields(orig: &RoutingMessageHandler) - handle_channel_update: Clone::clone(&orig.handle_channel_update), get_next_channel_announcement: Clone::clone(&orig.get_next_channel_announcement), get_next_node_announcement: Clone::clone(&orig.get_next_node_announcement), - peer_connected: Clone::clone(&orig.peer_connected), handle_reply_channel_range: Clone::clone(&orig.handle_reply_channel_range), handle_reply_short_channel_ids_end: Clone::clone(&orig.handle_reply_short_channel_ids_end), handle_query_channel_range: Clone::clone(&orig.handle_query_channel_range), handle_query_short_channel_ids: Clone::clone(&orig.handle_query_short_channel_ids), processing_queue_high: Clone::clone(&orig.processing_queue_high), - provided_node_features: Clone::clone(&orig.provided_node_features), - provided_init_features: Clone::clone(&orig.provided_init_features), - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider), + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler_clone_fields(&orig.BaseMessageHandler), free: Clone::clone(&orig.free), } -} -impl lightning::events::MessageSendEventsProvider for RoutingMessageHandler { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.MessageSendEventsProvider.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; +} +impl lightning::ln::msgs::BaseMessageHandler for RoutingMessageHandler { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.BaseMessageHandler.get_and_clear_pending_msg_events)(self.BaseMessageHandler.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.BaseMessageHandler.peer_disconnected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.BaseMessageHandler.provided_node_features)(self.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.BaseMessageHandler.provided_init_features)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.BaseMessageHandler.peer_connected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; local_ret } } -impl lightning::events::MessageSendEventsProvider for RoutingMessageHandlerRef { - fn get_and_clear_pending_msg_events(&self) -> Vec { - let mut ret = (self.0.MessageSendEventsProvider.get_and_clear_pending_msg_events)(self.0.MessageSendEventsProvider.this_arg); +impl lightning::ln::msgs::BaseMessageHandler for RoutingMessageHandlerRef { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.0.BaseMessageHandler.get_and_clear_pending_msg_events)(self.0.BaseMessageHandler.this_arg); let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; local_ret } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.0.BaseMessageHandler.peer_disconnected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_node_features)(self.0.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_init_features)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.0.BaseMessageHandler.peer_connected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } } use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler; @@ -10656,11 +13906,6 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } fn handle_reply_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; @@ -10685,14 +13930,6 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { let mut ret = (self.processing_queue_high)(self.this_arg); ret } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.provided_node_features)(self.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } } pub struct RoutingMessageHandlerRef(RoutingMessageHandler); @@ -10726,11 +13963,6 @@ impl rustRoutingMessageHandler for RoutingMessageHandlerRef { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } fn handle_reply_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_reply_channel_range)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; @@ -10755,14 +13987,6 @@ impl rustRoutingMessageHandler for RoutingMessageHandlerRef { let mut ret = (self.0.processing_queue_high)(self.0.this_arg); ret } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.0.provided_node_features)(self.0.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -10798,33 +14022,16 @@ pub struct OnionMessageHandler { pub handle_onion_message: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage), /// Returns the next pending onion message for the peer with the given node id. /// + /// Note that onion messages can only be provided upstream via this method and *not* via + /// [`BaseMessageHandler::get_and_clear_pending_msg_events`]. + /// /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None pub next_onion_message_for_peer: extern "C" fn (this_arg: *const c_void, peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage, - /// Called when a connection is established with a peer. Can be used to track which peers - /// advertise onion message support and are online. - /// - /// May return an `Err(())` if the features the peer supports are not sufficient to communicate - /// with us. Implementors should be somewhat conservative about doing so, however, as other - /// message handlers may still wish to communicate with this peer. - /// - /// [`Self::peer_disconnected`] will not be called if `Err(())` is returned. - pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ, - /// Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to - /// drop and refuse to forward onion messages to this peer. - pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey), /// Performs actions that should happen roughly every ten seconds after startup. Allows handlers - /// to drop any buffered onion messages intended for prospective peers. + /// to drop any buffered onion messages intended for prospective peerst. pub timer_tick_occurred: extern "C" fn (this_arg: *const c_void), - /// Gets the node feature flags which this handler itself supports. All available handlers are - /// queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] - /// which are broadcasted in our [`NodeAnnouncement`] message. - pub provided_node_features: extern "C" fn (this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures, - /// Gets the init feature flags which should be sent to the given peer. All available handlers - /// are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] - /// which are sent in our [`Init`] message. - /// - /// Note that this method is called before [`Self::peer_connected`]. - pub provided_init_features: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures, + /// Implementation of BaseMessageHandler for this object. + pub BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler, /// 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, @@ -10837,14 +14044,57 @@ pub(crate) fn OnionMessageHandler_clone_fields(orig: &OnionMessageHandler) -> On this_arg: orig.this_arg, handle_onion_message: Clone::clone(&orig.handle_onion_message), next_onion_message_for_peer: Clone::clone(&orig.next_onion_message_for_peer), - peer_connected: Clone::clone(&orig.peer_connected), - peer_disconnected: Clone::clone(&orig.peer_disconnected), timer_tick_occurred: Clone::clone(&orig.timer_tick_occurred), - provided_node_features: Clone::clone(&orig.provided_node_features), - provided_init_features: Clone::clone(&orig.provided_init_features), + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler_clone_fields(&orig.BaseMessageHandler), free: Clone::clone(&orig.free), } } +impl lightning::ln::msgs::BaseMessageHandler for OnionMessageHandler { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.BaseMessageHandler.get_and_clear_pending_msg_events)(self.BaseMessageHandler.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.BaseMessageHandler.peer_disconnected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.BaseMessageHandler.provided_node_features)(self.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.BaseMessageHandler.provided_init_features)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.BaseMessageHandler.peer_connected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } +} +impl lightning::ln::msgs::BaseMessageHandler for OnionMessageHandlerRef { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.0.BaseMessageHandler.get_and_clear_pending_msg_events)(self.0.BaseMessageHandler.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.0.BaseMessageHandler.peer_disconnected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_node_features)(self.0.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_init_features)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.0.BaseMessageHandler.peer_connected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } +} use lightning::ln::msgs::OnionMessageHandler as rustOnionMessageHandler; impl rustOnionMessageHandler for OnionMessageHandler { @@ -10856,25 +14106,9 @@ impl rustOnionMessageHandler for OnionMessageHandler { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } - fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { - (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) - } fn timer_tick_occurred(&self) { (self.timer_tick_occurred)(self.this_arg) } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.provided_node_features)(self.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } } pub struct OnionMessageHandlerRef(OnionMessageHandler); @@ -10887,25 +14121,9 @@ impl rustOnionMessageHandler for OnionMessageHandlerRef { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { - let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); - 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)) })*/ })}; - local_ret - } - fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { - (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) - } fn timer_tick_occurred(&self) { (self.0.timer_tick_occurred)(self.0.this_arg) } - fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { - let mut ret = (self.0.provided_node_features)(self.0.this_arg); - *unsafe { Box::from_raw(ret.take_inner()) } - } - fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { - let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); - *unsafe { Box::from_raw(ret.take_inner()) } - } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -10931,6 +14149,110 @@ impl Drop for OnionMessageHandler { } } } +/// A handler which can only be used to send messages. +/// +/// This is implemented by [`ChainMonitor`]. +/// +/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor +#[repr(C)] +pub struct SendOnlyMessageHandler { + /// 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 BaseMessageHandler for this object. + pub BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler, + /// 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 SendOnlyMessageHandler {} +unsafe impl Sync for SendOnlyMessageHandler {} +#[allow(unused)] +pub(crate) fn SendOnlyMessageHandler_clone_fields(orig: &SendOnlyMessageHandler) -> SendOnlyMessageHandler { + SendOnlyMessageHandler { + this_arg: orig.this_arg, + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler_clone_fields(&orig.BaseMessageHandler), + free: Clone::clone(&orig.free), + } +} +impl lightning::ln::msgs::BaseMessageHandler for SendOnlyMessageHandler { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.BaseMessageHandler.get_and_clear_pending_msg_events)(self.BaseMessageHandler.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.BaseMessageHandler.peer_disconnected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.BaseMessageHandler.provided_node_features)(self.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.BaseMessageHandler.provided_init_features)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.BaseMessageHandler.peer_connected)(self.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } +} +impl lightning::ln::msgs::BaseMessageHandler for SendOnlyMessageHandlerRef { + fn get_and_clear_pending_msg_events(&self) -> Vec { + let mut ret = (self.0.BaseMessageHandler.get_and_clear_pending_msg_events)(self.0.BaseMessageHandler.this_arg); + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { item.into_native() }); }; + local_ret + } + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { + (self.0.BaseMessageHandler.peer_disconnected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_node_features)(self.0.BaseMessageHandler.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + let mut ret = (self.0.BaseMessageHandler.provided_init_features)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + let mut ret = (self.0.BaseMessageHandler.peer_connected)(self.0.BaseMessageHandler.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); + 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)) })*/ })}; + local_ret + } +} + +use lightning::ln::msgs::SendOnlyMessageHandler as rustSendOnlyMessageHandler; +impl rustSendOnlyMessageHandler for SendOnlyMessageHandler { +} + +pub struct SendOnlyMessageHandlerRef(SendOnlyMessageHandler); +impl rustSendOnlyMessageHandler for SendOnlyMessageHandlerRef { +} + +// 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 SendOnlyMessageHandler { + type Target = SendOnlyMessageHandlerRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const SendOnlyMessageHandlerRef) } + } +} +impl core::ops::DerefMut for SendOnlyMessageHandler { + fn deref_mut(&mut self) -> &mut SendOnlyMessageHandlerRef { + unsafe { &mut *(self as *mut _ as *mut SendOnlyMessageHandlerRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn SendOnlyMessageHandler_free(this_ptr: SendOnlyMessageHandler) { } +impl Drop for SendOnlyMessageHandler { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} use lightning::ln::msgs::FinalOnionHopData as nativeFinalOnionHopDataImport; pub(crate) type nativeFinalOnionHopData = nativeFinalOnionHopDataImport; @@ -10997,7 +14319,7 @@ impl FinalOnionHopData { /// proof to the recipient that the payment was sent by someone with the generated invoice. #[no_mangle] pub extern "C" fn FinalOnionHopData_get_payment_secret(this_ptr: &FinalOnionHopData) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_secret; + let mut inner_val = &mut FinalOnionHopData::get_native_mut_ref(this_ptr).payment_secret; &inner_val.0 } /// When sending a multi-part payment, this secret is used to identify a payment across HTLCs. @@ -11012,7 +14334,7 @@ pub extern "C" fn FinalOnionHopData_set_payment_secret(this_ptr: &mut FinalOnion /// Message serialization may panic if this value is more than 21 million Bitcoin. #[no_mangle] pub extern "C" fn FinalOnionHopData_get_total_msat(this_ptr: &FinalOnionHopData) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().total_msat; + let mut inner_val = &mut FinalOnionHopData::get_native_mut_ref(this_ptr).total_msat; *inner_val } /// The intended total amount that this payment is for. @@ -11035,7 +14357,7 @@ impl Clone for FinalOnionHopData { fn clone(&self) -> Self { Self { inner: if <*mut nativeFinalOnionHopData>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -11043,12 +14365,12 @@ impl Clone for FinalOnionHopData { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FinalOnionHopData_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFinalOnionHopData)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFinalOnionHopData) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the FinalOnionHopData pub extern "C" fn FinalOnionHopData_clone(orig: &FinalOnionHopData) -> FinalOnionHopData { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a FinalOnionHopData object pub extern "C" fn FinalOnionHopData_debug_str_void(o: *const c_void) -> Str { @@ -11137,7 +14459,7 @@ impl OnionPacket { /// BOLT 4 version number. #[no_mangle] pub extern "C" fn OnionPacket_get_version(this_ptr: &OnionPacket) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().version; + let mut inner_val = &mut OnionPacket::get_native_mut_ref(this_ptr).version; *inner_val } /// BOLT 4 version number. @@ -11154,7 +14476,7 @@ pub extern "C" fn OnionPacket_set_version(this_ptr: &mut OnionPacket, mut val: u /// Returns a copy of the field. #[no_mangle] pub extern "C" fn OnionPacket_get_public_key(this_ptr: &OnionPacket) -> crate::c_types::derived::CResult_PublicKeySecp256k1ErrorZ { - let mut inner_val = this_ptr.get_native_mut_ref().public_key.clone(); + let mut inner_val = OnionPacket::get_native_mut_ref(this_ptr).public_key.clone(); let mut local_inner_val = match inner_val { 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_inner_val } @@ -11171,7 +14493,7 @@ pub extern "C" fn OnionPacket_set_public_key(this_ptr: &mut OnionPacket, mut val /// HMAC to verify the integrity of hop_data. #[no_mangle] pub extern "C" fn OnionPacket_get_hmac(this_ptr: &OnionPacket) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().hmac; + let mut inner_val = &mut OnionPacket::get_native_mut_ref(this_ptr).hmac; inner_val } /// HMAC to verify the integrity of hop_data. @@ -11183,7 +14505,7 @@ impl Clone for OnionPacket { fn clone(&self) -> Self { Self { inner: if <*mut nativeOnionPacket>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -11191,12 +14513,12 @@ impl Clone for OnionPacket { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OnionPacket_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOnionPacket)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOnionPacket) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OnionPacket pub extern "C" fn OnionPacket_clone(orig: &OnionPacket) -> OnionPacket { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the OnionPacket. #[no_mangle] @@ -11283,7 +14605,7 @@ impl TrampolineOnionPacket { /// Bolt 04 version number #[no_mangle] pub extern "C" fn TrampolineOnionPacket_get_version(this_ptr: &TrampolineOnionPacket) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().version; + let mut inner_val = &mut TrampolineOnionPacket::get_native_mut_ref(this_ptr).version; *inner_val } /// Bolt 04 version number @@ -11294,7 +14616,7 @@ pub extern "C" fn TrampolineOnionPacket_set_version(this_ptr: &mut TrampolineOni /// A random sepc256k1 point, used to build the ECDH shared secret to decrypt hop_data #[no_mangle] pub extern "C" fn TrampolineOnionPacket_get_public_key(this_ptr: &TrampolineOnionPacket) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().public_key; + let mut inner_val = &mut TrampolineOnionPacket::get_native_mut_ref(this_ptr).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 @@ -11307,7 +14629,7 @@ pub extern "C" fn TrampolineOnionPacket_set_public_key(this_ptr: &mut Trampoline /// Returns a copy of the field. #[no_mangle] pub extern "C" fn TrampolineOnionPacket_get_hop_data(this_ptr: &TrampolineOnionPacket) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = this_ptr.get_native_mut_ref().hop_data.clone(); + let mut inner_val = TrampolineOnionPacket::get_native_mut_ref(this_ptr).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() } @@ -11320,7 +14642,7 @@ pub extern "C" fn TrampolineOnionPacket_set_hop_data(this_ptr: &mut TrampolineOn /// HMAC to verify the integrity of hop_data #[no_mangle] pub extern "C" fn TrampolineOnionPacket_get_hmac(this_ptr: &TrampolineOnionPacket) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().hmac; + let mut inner_val = &mut TrampolineOnionPacket::get_native_mut_ref(this_ptr).hmac; inner_val } /// HMAC to verify the integrity of hop_data @@ -11344,7 +14666,7 @@ impl Clone for TrampolineOnionPacket { fn clone(&self) -> Self { Self { inner: if <*mut nativeTrampolineOnionPacket>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -11352,12 +14674,12 @@ impl Clone for TrampolineOnionPacket { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TrampolineOnionPacket_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTrampolineOnionPacket)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTrampolineOnionPacket) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TrampolineOnionPacket pub extern "C" fn TrampolineOnionPacket_clone(orig: &TrampolineOnionPacket) -> TrampolineOnionPacket { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the TrampolineOnionPacket. #[no_mangle] @@ -11387,6 +14709,13 @@ pub extern "C" fn TrampolineOnionPacket_write(obj: &crate::lightning::ln::msgs:: pub(crate) extern "C" fn TrampolineOnionPacket_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeTrampolineOnionPacket) }) } +#[no_mangle] +/// Read a TrampolineOnionPacket from a byte array, created by TrampolineOnionPacket_write +pub extern "C" fn TrampolineOnionPacket_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_TrampolineOnionPacketDecodeErrorZ { + 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::TrampolineOnionPacket { 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 +} /// Get a string which allows debug introspection of a TrampolineOnionPacket object pub extern "C" fn TrampolineOnionPacket_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::TrampolineOnionPacket }).into()} @@ -11396,6 +14725,12 @@ pub extern "C" fn DecodeError_to_str(o: &crate::lightning::ln::msgs::DecodeError alloc::format!("{}", &o.to_native()).into() } #[no_mangle] +/// Build a DecodeError from a IOError +pub extern "C" fn DecodeError_from_IOError(f: crate::c_types::IOError) -> crate::lightning::ln::msgs::DecodeError { + let from_obj = f.to_rust(); + crate::lightning::ln::msgs::DecodeError::native_into((lightning::ln::msgs::DecodeError::from(from_obj))) +} +#[no_mangle] /// Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read pub extern "C" fn AcceptChannel_write(obj: &crate::lightning::ln::msgs::AcceptChannel) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) @@ -11668,6 +15003,38 @@ pub extern "C" fn ChannelReestablish_read(ser: crate::c_types::u8slice) -> crate local_res } #[no_mangle] +/// Serialize the NextFunding object into a byte array which can be read by NextFunding_read +pub extern "C" fn NextFunding_write(obj: &crate::lightning::ln::msgs::NextFunding) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn NextFunding_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeNextFunding) }) +} +#[no_mangle] +/// Read a NextFunding from a byte array, created by NextFunding_write +pub extern "C" fn NextFunding_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NextFundingDecodeErrorZ { + 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::NextFunding { 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 FundingLocked object into a byte array which can be read by FundingLocked_read +pub extern "C" fn FundingLocked_write(obj: &crate::lightning::ln::msgs::FundingLocked) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn FundingLocked_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeFundingLocked) }) +} +#[no_mangle] +/// Read a FundingLocked from a byte array, created by FundingLocked_write +pub extern "C" fn FundingLocked_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_FundingLockedDecodeErrorZ { + 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::FundingLocked { 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 ClosingSigned object into a byte array which can be read by ClosingSigned_read pub extern "C" fn ClosingSigned_write(obj: &crate::lightning::ln::msgs::ClosingSigned) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) @@ -11684,35 +15051,51 @@ pub extern "C" fn ClosingSigned_read(ser: crate::c_types::u8slice) -> crate::c_t local_res } #[no_mangle] -/// Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read -pub extern "C" fn ClosingSignedFeeRange_write(obj: &crate::lightning::ln::msgs::ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z { +/// Serialize the ClosingComplete object into a byte array which can be read by ClosingComplete_read +pub extern "C" fn ClosingComplete_write(obj: &crate::lightning::ln::msgs::ClosingComplete) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[allow(unused)] -pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeClosingSignedFeeRange) }) +pub(crate) extern "C" fn ClosingComplete_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeClosingComplete) }) } #[no_mangle] -/// Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write -pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedFeeRangeDecodeErrorZ { - 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::ClosingSignedFeeRange { 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() }; +/// Read a ClosingComplete from a byte array, created by ClosingComplete_write +pub extern "C" fn ClosingComplete_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingCompleteDecodeErrorZ { + 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::ClosingComplete { 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 ClosingSig object into a byte array which can be read by ClosingSig_read +pub extern "C" fn ClosingSig_write(obj: &crate::lightning::ln::msgs::ClosingSig) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ClosingSig_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeClosingSig) }) +} +#[no_mangle] +/// Read a ClosingSig from a byte array, created by ClosingSig_write +pub extern "C" fn ClosingSig_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSigDecodeErrorZ { + 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::ClosingSig { 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 CommitmentSignedBatch object into a byte array which can be read by CommitmentSignedBatch_read -pub extern "C" fn CommitmentSignedBatch_write(obj: &crate::lightning::ln::msgs::CommitmentSignedBatch) -> crate::c_types::derived::CVec_u8Z { +/// Serialize the ClosingSignedFeeRange object into a byte array which can be read by ClosingSignedFeeRange_read +pub extern "C" fn ClosingSignedFeeRange_write(obj: &crate::lightning::ln::msgs::ClosingSignedFeeRange) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) } #[allow(unused)] -pub(crate) extern "C" fn CommitmentSignedBatch_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeCommitmentSignedBatch) }) +pub(crate) extern "C" fn ClosingSignedFeeRange_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeClosingSignedFeeRange) }) } #[no_mangle] -/// Read a CommitmentSignedBatch from a byte array, created by CommitmentSignedBatch_write -pub extern "C" fn CommitmentSignedBatch_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CommitmentSignedBatchDecodeErrorZ { - 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::CommitmentSignedBatch { 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() }; +/// Read a ClosingSignedFeeRange from a byte array, created by ClosingSignedFeeRange_write +pub extern "C" fn ClosingSignedFeeRange_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ClosingSignedFeeRangeDecodeErrorZ { + 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::ClosingSignedFeeRange { 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] @@ -11924,6 +15307,54 @@ pub extern "C" fn UpdateFulfillHTLC_read(ser: crate::c_types::u8slice) -> crate: local_res } #[no_mangle] +/// Serialize the PeerStorage object into a byte array which can be read by PeerStorage_read +pub extern "C" fn PeerStorage_write(obj: &crate::lightning::ln::msgs::PeerStorage) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn PeerStorage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativePeerStorage) }) +} +#[no_mangle] +/// Read a PeerStorage from a byte array, created by PeerStorage_write +pub extern "C" fn PeerStorage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PeerStorageDecodeErrorZ { + 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::PeerStorage { 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 PeerStorageRetrieval object into a byte array which can be read by PeerStorageRetrieval_read +pub extern "C" fn PeerStorageRetrieval_write(obj: &crate::lightning::ln::msgs::PeerStorageRetrieval) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn PeerStorageRetrieval_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativePeerStorageRetrieval) }) +} +#[no_mangle] +/// Read a PeerStorageRetrieval from a byte array, created by PeerStorageRetrieval_write +pub extern "C" fn PeerStorageRetrieval_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PeerStorageRetrievalDecodeErrorZ { + 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::PeerStorageRetrieval { 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 StartBatch object into a byte array which can be read by StartBatch_read +pub extern "C" fn StartBatch_write(obj: &crate::lightning::ln::msgs::StartBatch) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn StartBatch_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::msgs::nativeStartBatch) }) +} +#[no_mangle] +/// Read a StartBatch from a byte array, created by StartBatch_write +pub extern "C" fn StartBatch_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StartBatchDecodeErrorZ { + 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::StartBatch { 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 OnionPacket object into a byte array which can be read by OnionPacket_read pub extern "C" fn OnionPacket_write(obj: &crate::lightning::ln::msgs::OnionPacket) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) diff --git a/lightning-c-bindings/src/lightning/ln/onion_payment.rs b/lightning-c-bindings/src/lightning/ln/onion_payment.rs index e9b33a8d..813a3a0c 100644 --- a/lightning-c-bindings/src/lightning/ln/onion_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/onion_payment.rs @@ -82,21 +82,21 @@ impl InboundHTLCErr { } /// BOLT 4 error code. #[no_mangle] -pub extern "C" fn InboundHTLCErr_get_err_code(this_ptr: &InboundHTLCErr) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().err_code; - *inner_val +pub extern "C" fn InboundHTLCErr_get_reason(this_ptr: &InboundHTLCErr) -> crate::lightning::ln::onion_utils::LocalHTLCFailureReason { + let mut inner_val = &mut InboundHTLCErr::get_native_mut_ref(this_ptr).reason; + crate::lightning::ln::onion_utils::LocalHTLCFailureReason::from_native(inner_val) } /// BOLT 4 error code. #[no_mangle] -pub extern "C" fn InboundHTLCErr_set_err_code(this_ptr: &mut InboundHTLCErr, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.err_code = val; +pub extern "C" fn InboundHTLCErr_set_reason(this_ptr: &mut InboundHTLCErr, mut val: crate::lightning::ln::onion_utils::LocalHTLCFailureReason) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.reason = val.into_native(); } /// Data attached to this error. /// /// Returns a copy of the field. #[no_mangle] pub extern "C" fn InboundHTLCErr_get_err_data(this_ptr: &InboundHTLCErr) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = this_ptr.get_native_mut_ref().err_data.clone(); + let mut inner_val = InboundHTLCErr::get_native_mut_ref(this_ptr).err_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() } @@ -109,7 +109,7 @@ pub extern "C" fn InboundHTLCErr_set_err_data(this_ptr: &mut InboundHTLCErr, mut /// Error message text. #[no_mangle] pub extern "C" fn InboundHTLCErr_get_msg(this_ptr: &InboundHTLCErr) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().msg; + let mut inner_val = &mut InboundHTLCErr::get_native_mut_ref(this_ptr).msg; inner_val.into() } /// Error message text. @@ -120,10 +120,10 @@ pub extern "C" fn InboundHTLCErr_set_msg(this_ptr: &mut InboundHTLCErr, mut val: /// Constructs a new InboundHTLCErr given each field #[must_use] #[no_mangle] -pub extern "C" fn InboundHTLCErr_new(mut err_code_arg: u16, mut err_data_arg: crate::c_types::derived::CVec_u8Z, mut msg_arg: crate::c_types::Str) -> InboundHTLCErr { +pub extern "C" fn InboundHTLCErr_new(mut reason_arg: crate::lightning::ln::onion_utils::LocalHTLCFailureReason, mut err_data_arg: crate::c_types::derived::CVec_u8Z, mut msg_arg: crate::c_types::Str) -> InboundHTLCErr { let mut local_err_data_arg = Vec::new(); for mut item in err_data_arg.into_rust().drain(..) { local_err_data_arg.push( { item }); }; InboundHTLCErr { inner: ObjOps::heap_alloc(nativeInboundHTLCErr { - err_code: err_code_arg, + reason: reason_arg.into_native(), err_data: local_err_data_arg, msg: msg_arg.into_str(), }), is_owned: true } @@ -132,7 +132,7 @@ impl Clone for InboundHTLCErr { fn clone(&self) -> Self { Self { inner: if <*mut nativeInboundHTLCErr>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -140,12 +140,12 @@ impl Clone for InboundHTLCErr { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InboundHTLCErr_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInboundHTLCErr)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInboundHTLCErr) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InboundHTLCErr pub extern "C" fn InboundHTLCErr_clone(orig: &InboundHTLCErr) -> InboundHTLCErr { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InboundHTLCErr object pub extern "C" fn InboundHTLCErr_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/ln/onion_utils.rs b/lightning-c-bindings/src/lightning/ln/onion_utils.rs new file mode 100644 index 00000000..5bbb3d96 --- /dev/null +++ b/lightning-c-bindings/src/lightning/ln/onion_utils.rs @@ -0,0 +1,774 @@ +// 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. + +//! Low-level onion manipulation logic and fields + +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 fuzzy_onion_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}; + +} +/// The reason that a HTLC was failed by the local node. These errors either represent direct, +/// human-readable mappings of BOLT04 error codes or provide additional information that would +/// otherwise be erased by the BOLT04 error code. +/// +/// For example: +/// [`Self::FeeInsufficient`] is a direct representation of its underlying BOLT04 error code. +/// [`Self::PrivateChannelForward`] provides additional information that is not provided by its +/// BOLT04 error code. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum LocalHTLCFailureReason { + /// There has been a temporary processing failure on the node which may resolve on retry. + TemporaryNodeFailure, + /// These has been a permanent processing failure on the node which will not resolve on retry. + PermanentNodeFailure, + /// The HTLC does not implement a feature that is required by our node. + /// + /// The sender may have outdated gossip, or a bug in its implementation. + RequiredNodeFeature, + /// The onion version specified by the HTLC packet is unknown to our node. + InvalidOnionVersion, + /// The integrity of the HTLC packet cannot be verified because it has an invalid HMAC. + InvalidOnionHMAC, + /// The onion packet has an invalid ephemeral key, so the HTLC cannot be processed. + InvalidOnionKey, + /// A temporary forwarding error has occurred which may resolve on retry. + TemporaryChannelFailure, + /// A permanent forwarding error has occurred which will not resolve on retry. + PermanentChannelFailure, + /// The HTLC does not implement a feature that is required by our channel for processing. + RequiredChannelFeature, + /// The HTLC's target outgoing channel that is not known to our node. + UnknownNextPeer, + /// The HTLC amount is below our advertised htlc_minimum_msat. + /// + /// The sender may have outdated gossip, or a bug in its implementation. + AmountBelowMinimum, + /// The HTLC does not pay sufficient fees. + /// + /// The sender may have outdated gossip, or a bug in its implementation. + FeeInsufficient, + /// The HTLC does not meet the cltv_expiry_delta advertised by our node, set by + /// [`ChannelConfig::cltv_expiry_delta`]. + /// + /// The sender may have outdated gossip, or a bug in its implementation. + /// + /// [`ChannelConfig::cltv_expiry_delta`]: crate::util::config::ChannelConfig::cltv_expiry_delta + IncorrectCLTVExpiry, + /// The HTLC expires too close to the current block height to be safely processed. + CLTVExpiryTooSoon, + /// A payment was made to our node that either had incorrect payment information, or was + /// unknown to us. + IncorrectPaymentDetails, + /// The HTLC's expiry is less than the expiry height specified by the sender. + /// + /// The forwarding node has either tampered with this value, or the sending node has an + /// old best block height. + FinalIncorrectCLTVExpiry, + /// The HTLC's amount is less than the amount specified by the sender. + /// + /// The forwarding node has tampered with this value, or has a bug in its implementation. + FinalIncorrectHTLCAmount, + /// The channel has been marked as disabled because the channel peer is offline. + ChannelDisabled, + /// The HTLC expires too far in the future, so it is rejected to avoid the worst-case outcome + /// of funds being held for extended periods of time. + /// + CLTVExpiryTooFar, + /// The HTLC payload contained in the onion packet could not be understood by our node. + InvalidOnionPayload, + /// The total amount for a multi-part payment did not arrive in time, so the HTLCs partially + /// paying the amount were canceled. + MPPTimeout, + /// Our node was selected as part of a blinded path, but the packet we received was not + /// properly constructed, or had incorrect values for the blinded path. + /// + /// This may happen if the forwarding node tamperd with the HTLC or the sender or recipient + /// implementations have a bug. + InvalidOnionBlinding, + /// UnknownFailureCode represents BOLT04 failure codes that we are not familiar with. We will + /// encounter this if: + /// - A peer sends us a new failure code that LDK has not yet been upgraded to understand. + /// - We read a deprecated failure code from disk that LDK no longer uses. + /// + /// See + /// for latest defined error codes. + UnknownFailureCode { + /// The bolt 04 failure code. + code: u16, + }, + /// A HTLC forward was failed back rather than forwarded on the proposed outgoing channel + /// because its expiry is too close to the current block height to leave time to safely claim + /// it on chain if the channel force closes. + ForwardExpiryBuffer, + /// The HTLC was failed because it has invalid trampoline forwarding information. + InvalidTrampolineForward, + /// A HTLC receive was failed back rather than claimed because its expiry is too close to + /// the current block height to leave time to safely claim it on chain if the channel force + /// closes. + PaymentClaimBuffer, + /// The HTLC was failed because accepting it would push our commitment's total amount of dust + /// HTLCs over the limit that we allow to be burned to miner fees if the channel closed while + /// they are unresolved. + DustLimitHolder, + /// The HTLC was failed because accepting it would push our counterparty's total amount of + /// dust (small) HTLCs over the limit that we allow to be burned to miner fees if the channel + /// closes while they are unresolved. + DustLimitCounterparty, + /// The HTLC was failed because it would drop the remote party's channel balance such that it + /// cannot cover the fees it is required to pay at various fee rates. This buffer is maintained + /// so that channels can always maintain reasonable fee rates. + FeeSpikeBuffer, + /// The HTLC that requested to be forwarded over a private channel was rejected to prevent + /// revealing the existence of the channel. + PrivateChannelForward, + /// The HTLC was failed because it made a request to forward over the real channel ID of a + /// channel that implements `option_scid_alias` which is a privacy feature to prevent the + /// real channel ID from being known. + RealSCIDForward, + /// The HTLC was rejected because our channel has not yet reached sufficient depth to be used. + ChannelNotReady, + /// A keysend payment with a preimage that did not match the HTLC has was rejected. + InvalidKeysendPreimage, + /// The HTLC was failed because it had an invalid trampoline payload. + InvalidTrampolinePayload, + /// A payment was rejected because it did not include the correct payment secret from an + /// invoice. + PaymentSecretRequired, + /// The HTLC was failed because its expiry is too close to the current block height, and we + /// expect that it will immediately be failed back by our downstream peer. + OutgoingCLTVTooSoon, + /// The HTLC was failed because it was pending on a channel which is now in the process of + /// being closed. + ChannelClosed, + /// The HTLC was failed back because its expiry height was reached and funds were timed out + /// on chain. + OnChainTimeout, + /// The HTLC was failed because zero amount HTLCs are not allowed. + ZeroAmount, + /// The HTLC was failed because its amount is less than the smallest HTLC that the channel + /// can currently accept. + /// + /// This may occur because the HTLC is smaller than the counterparty's advertised minimum + /// accepted HTLC size, or if we have reached our maximum total dust HTLC exposure. + HTLCMinimum, + /// The HTLC was failed because its amount is more than then largest HTLC that the channel + /// can currently accept. + /// + /// This may occur because the outbound channel has insufficient liquidity to forward the HTLC, + /// we have reached the counterparty's in-flight limits, or the HTLC exceeds our advertised + /// maximum accepted HTLC size. + HTLCMaximum, + /// The HTLC was failed because our remote peer is offline. + PeerOffline, + /// The HTLC was failed because the channel balance was overdrawn. + ChannelBalanceOverdrawn, +} +use lightning::ln::onion_utils::LocalHTLCFailureReason as LocalHTLCFailureReasonImport; +pub(crate) type nativeLocalHTLCFailureReason = LocalHTLCFailureReasonImport; + +impl LocalHTLCFailureReason { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeLocalHTLCFailureReason { + match self { + LocalHTLCFailureReason::TemporaryNodeFailure => nativeLocalHTLCFailureReason::TemporaryNodeFailure, + LocalHTLCFailureReason::PermanentNodeFailure => nativeLocalHTLCFailureReason::PermanentNodeFailure, + LocalHTLCFailureReason::RequiredNodeFeature => nativeLocalHTLCFailureReason::RequiredNodeFeature, + LocalHTLCFailureReason::InvalidOnionVersion => nativeLocalHTLCFailureReason::InvalidOnionVersion, + LocalHTLCFailureReason::InvalidOnionHMAC => nativeLocalHTLCFailureReason::InvalidOnionHMAC, + LocalHTLCFailureReason::InvalidOnionKey => nativeLocalHTLCFailureReason::InvalidOnionKey, + LocalHTLCFailureReason::TemporaryChannelFailure => nativeLocalHTLCFailureReason::TemporaryChannelFailure, + LocalHTLCFailureReason::PermanentChannelFailure => nativeLocalHTLCFailureReason::PermanentChannelFailure, + LocalHTLCFailureReason::RequiredChannelFeature => nativeLocalHTLCFailureReason::RequiredChannelFeature, + LocalHTLCFailureReason::UnknownNextPeer => nativeLocalHTLCFailureReason::UnknownNextPeer, + LocalHTLCFailureReason::AmountBelowMinimum => nativeLocalHTLCFailureReason::AmountBelowMinimum, + LocalHTLCFailureReason::FeeInsufficient => nativeLocalHTLCFailureReason::FeeInsufficient, + LocalHTLCFailureReason::IncorrectCLTVExpiry => nativeLocalHTLCFailureReason::IncorrectCLTVExpiry, + LocalHTLCFailureReason::CLTVExpiryTooSoon => nativeLocalHTLCFailureReason::CLTVExpiryTooSoon, + LocalHTLCFailureReason::IncorrectPaymentDetails => nativeLocalHTLCFailureReason::IncorrectPaymentDetails, + LocalHTLCFailureReason::FinalIncorrectCLTVExpiry => nativeLocalHTLCFailureReason::FinalIncorrectCLTVExpiry, + LocalHTLCFailureReason::FinalIncorrectHTLCAmount => nativeLocalHTLCFailureReason::FinalIncorrectHTLCAmount, + LocalHTLCFailureReason::ChannelDisabled => nativeLocalHTLCFailureReason::ChannelDisabled, + LocalHTLCFailureReason::CLTVExpiryTooFar => nativeLocalHTLCFailureReason::CLTVExpiryTooFar, + LocalHTLCFailureReason::InvalidOnionPayload => nativeLocalHTLCFailureReason::InvalidOnionPayload, + LocalHTLCFailureReason::MPPTimeout => nativeLocalHTLCFailureReason::MPPTimeout, + LocalHTLCFailureReason::InvalidOnionBlinding => nativeLocalHTLCFailureReason::InvalidOnionBlinding, + LocalHTLCFailureReason::UnknownFailureCode {ref code, } => { + let mut code_nonref = Clone::clone(code); + nativeLocalHTLCFailureReason::UnknownFailureCode { + code: code_nonref, + } + }, + LocalHTLCFailureReason::ForwardExpiryBuffer => nativeLocalHTLCFailureReason::ForwardExpiryBuffer, + LocalHTLCFailureReason::InvalidTrampolineForward => nativeLocalHTLCFailureReason::InvalidTrampolineForward, + LocalHTLCFailureReason::PaymentClaimBuffer => nativeLocalHTLCFailureReason::PaymentClaimBuffer, + LocalHTLCFailureReason::DustLimitHolder => nativeLocalHTLCFailureReason::DustLimitHolder, + LocalHTLCFailureReason::DustLimitCounterparty => nativeLocalHTLCFailureReason::DustLimitCounterparty, + LocalHTLCFailureReason::FeeSpikeBuffer => nativeLocalHTLCFailureReason::FeeSpikeBuffer, + LocalHTLCFailureReason::PrivateChannelForward => nativeLocalHTLCFailureReason::PrivateChannelForward, + LocalHTLCFailureReason::RealSCIDForward => nativeLocalHTLCFailureReason::RealSCIDForward, + LocalHTLCFailureReason::ChannelNotReady => nativeLocalHTLCFailureReason::ChannelNotReady, + LocalHTLCFailureReason::InvalidKeysendPreimage => nativeLocalHTLCFailureReason::InvalidKeysendPreimage, + LocalHTLCFailureReason::InvalidTrampolinePayload => nativeLocalHTLCFailureReason::InvalidTrampolinePayload, + LocalHTLCFailureReason::PaymentSecretRequired => nativeLocalHTLCFailureReason::PaymentSecretRequired, + LocalHTLCFailureReason::OutgoingCLTVTooSoon => nativeLocalHTLCFailureReason::OutgoingCLTVTooSoon, + LocalHTLCFailureReason::ChannelClosed => nativeLocalHTLCFailureReason::ChannelClosed, + LocalHTLCFailureReason::OnChainTimeout => nativeLocalHTLCFailureReason::OnChainTimeout, + LocalHTLCFailureReason::ZeroAmount => nativeLocalHTLCFailureReason::ZeroAmount, + LocalHTLCFailureReason::HTLCMinimum => nativeLocalHTLCFailureReason::HTLCMinimum, + LocalHTLCFailureReason::HTLCMaximum => nativeLocalHTLCFailureReason::HTLCMaximum, + LocalHTLCFailureReason::PeerOffline => nativeLocalHTLCFailureReason::PeerOffline, + LocalHTLCFailureReason::ChannelBalanceOverdrawn => nativeLocalHTLCFailureReason::ChannelBalanceOverdrawn, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeLocalHTLCFailureReason { + match self { + LocalHTLCFailureReason::TemporaryNodeFailure => nativeLocalHTLCFailureReason::TemporaryNodeFailure, + LocalHTLCFailureReason::PermanentNodeFailure => nativeLocalHTLCFailureReason::PermanentNodeFailure, + LocalHTLCFailureReason::RequiredNodeFeature => nativeLocalHTLCFailureReason::RequiredNodeFeature, + LocalHTLCFailureReason::InvalidOnionVersion => nativeLocalHTLCFailureReason::InvalidOnionVersion, + LocalHTLCFailureReason::InvalidOnionHMAC => nativeLocalHTLCFailureReason::InvalidOnionHMAC, + LocalHTLCFailureReason::InvalidOnionKey => nativeLocalHTLCFailureReason::InvalidOnionKey, + LocalHTLCFailureReason::TemporaryChannelFailure => nativeLocalHTLCFailureReason::TemporaryChannelFailure, + LocalHTLCFailureReason::PermanentChannelFailure => nativeLocalHTLCFailureReason::PermanentChannelFailure, + LocalHTLCFailureReason::RequiredChannelFeature => nativeLocalHTLCFailureReason::RequiredChannelFeature, + LocalHTLCFailureReason::UnknownNextPeer => nativeLocalHTLCFailureReason::UnknownNextPeer, + LocalHTLCFailureReason::AmountBelowMinimum => nativeLocalHTLCFailureReason::AmountBelowMinimum, + LocalHTLCFailureReason::FeeInsufficient => nativeLocalHTLCFailureReason::FeeInsufficient, + LocalHTLCFailureReason::IncorrectCLTVExpiry => nativeLocalHTLCFailureReason::IncorrectCLTVExpiry, + LocalHTLCFailureReason::CLTVExpiryTooSoon => nativeLocalHTLCFailureReason::CLTVExpiryTooSoon, + LocalHTLCFailureReason::IncorrectPaymentDetails => nativeLocalHTLCFailureReason::IncorrectPaymentDetails, + LocalHTLCFailureReason::FinalIncorrectCLTVExpiry => nativeLocalHTLCFailureReason::FinalIncorrectCLTVExpiry, + LocalHTLCFailureReason::FinalIncorrectHTLCAmount => nativeLocalHTLCFailureReason::FinalIncorrectHTLCAmount, + LocalHTLCFailureReason::ChannelDisabled => nativeLocalHTLCFailureReason::ChannelDisabled, + LocalHTLCFailureReason::CLTVExpiryTooFar => nativeLocalHTLCFailureReason::CLTVExpiryTooFar, + LocalHTLCFailureReason::InvalidOnionPayload => nativeLocalHTLCFailureReason::InvalidOnionPayload, + LocalHTLCFailureReason::MPPTimeout => nativeLocalHTLCFailureReason::MPPTimeout, + LocalHTLCFailureReason::InvalidOnionBlinding => nativeLocalHTLCFailureReason::InvalidOnionBlinding, + LocalHTLCFailureReason::UnknownFailureCode {mut code, } => { + nativeLocalHTLCFailureReason::UnknownFailureCode { + code: code, + } + }, + LocalHTLCFailureReason::ForwardExpiryBuffer => nativeLocalHTLCFailureReason::ForwardExpiryBuffer, + LocalHTLCFailureReason::InvalidTrampolineForward => nativeLocalHTLCFailureReason::InvalidTrampolineForward, + LocalHTLCFailureReason::PaymentClaimBuffer => nativeLocalHTLCFailureReason::PaymentClaimBuffer, + LocalHTLCFailureReason::DustLimitHolder => nativeLocalHTLCFailureReason::DustLimitHolder, + LocalHTLCFailureReason::DustLimitCounterparty => nativeLocalHTLCFailureReason::DustLimitCounterparty, + LocalHTLCFailureReason::FeeSpikeBuffer => nativeLocalHTLCFailureReason::FeeSpikeBuffer, + LocalHTLCFailureReason::PrivateChannelForward => nativeLocalHTLCFailureReason::PrivateChannelForward, + LocalHTLCFailureReason::RealSCIDForward => nativeLocalHTLCFailureReason::RealSCIDForward, + LocalHTLCFailureReason::ChannelNotReady => nativeLocalHTLCFailureReason::ChannelNotReady, + LocalHTLCFailureReason::InvalidKeysendPreimage => nativeLocalHTLCFailureReason::InvalidKeysendPreimage, + LocalHTLCFailureReason::InvalidTrampolinePayload => nativeLocalHTLCFailureReason::InvalidTrampolinePayload, + LocalHTLCFailureReason::PaymentSecretRequired => nativeLocalHTLCFailureReason::PaymentSecretRequired, + LocalHTLCFailureReason::OutgoingCLTVTooSoon => nativeLocalHTLCFailureReason::OutgoingCLTVTooSoon, + LocalHTLCFailureReason::ChannelClosed => nativeLocalHTLCFailureReason::ChannelClosed, + LocalHTLCFailureReason::OnChainTimeout => nativeLocalHTLCFailureReason::OnChainTimeout, + LocalHTLCFailureReason::ZeroAmount => nativeLocalHTLCFailureReason::ZeroAmount, + LocalHTLCFailureReason::HTLCMinimum => nativeLocalHTLCFailureReason::HTLCMinimum, + LocalHTLCFailureReason::HTLCMaximum => nativeLocalHTLCFailureReason::HTLCMaximum, + LocalHTLCFailureReason::PeerOffline => nativeLocalHTLCFailureReason::PeerOffline, + LocalHTLCFailureReason::ChannelBalanceOverdrawn => nativeLocalHTLCFailureReason::ChannelBalanceOverdrawn, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &LocalHTLCFailureReasonImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLocalHTLCFailureReason) }; + match native { + nativeLocalHTLCFailureReason::TemporaryNodeFailure => LocalHTLCFailureReason::TemporaryNodeFailure, + nativeLocalHTLCFailureReason::PermanentNodeFailure => LocalHTLCFailureReason::PermanentNodeFailure, + nativeLocalHTLCFailureReason::RequiredNodeFeature => LocalHTLCFailureReason::RequiredNodeFeature, + nativeLocalHTLCFailureReason::InvalidOnionVersion => LocalHTLCFailureReason::InvalidOnionVersion, + nativeLocalHTLCFailureReason::InvalidOnionHMAC => LocalHTLCFailureReason::InvalidOnionHMAC, + nativeLocalHTLCFailureReason::InvalidOnionKey => LocalHTLCFailureReason::InvalidOnionKey, + nativeLocalHTLCFailureReason::TemporaryChannelFailure => LocalHTLCFailureReason::TemporaryChannelFailure, + nativeLocalHTLCFailureReason::PermanentChannelFailure => LocalHTLCFailureReason::PermanentChannelFailure, + nativeLocalHTLCFailureReason::RequiredChannelFeature => LocalHTLCFailureReason::RequiredChannelFeature, + nativeLocalHTLCFailureReason::UnknownNextPeer => LocalHTLCFailureReason::UnknownNextPeer, + nativeLocalHTLCFailureReason::AmountBelowMinimum => LocalHTLCFailureReason::AmountBelowMinimum, + nativeLocalHTLCFailureReason::FeeInsufficient => LocalHTLCFailureReason::FeeInsufficient, + nativeLocalHTLCFailureReason::IncorrectCLTVExpiry => LocalHTLCFailureReason::IncorrectCLTVExpiry, + nativeLocalHTLCFailureReason::CLTVExpiryTooSoon => LocalHTLCFailureReason::CLTVExpiryTooSoon, + nativeLocalHTLCFailureReason::IncorrectPaymentDetails => LocalHTLCFailureReason::IncorrectPaymentDetails, + nativeLocalHTLCFailureReason::FinalIncorrectCLTVExpiry => LocalHTLCFailureReason::FinalIncorrectCLTVExpiry, + nativeLocalHTLCFailureReason::FinalIncorrectHTLCAmount => LocalHTLCFailureReason::FinalIncorrectHTLCAmount, + nativeLocalHTLCFailureReason::ChannelDisabled => LocalHTLCFailureReason::ChannelDisabled, + nativeLocalHTLCFailureReason::CLTVExpiryTooFar => LocalHTLCFailureReason::CLTVExpiryTooFar, + nativeLocalHTLCFailureReason::InvalidOnionPayload => LocalHTLCFailureReason::InvalidOnionPayload, + nativeLocalHTLCFailureReason::MPPTimeout => LocalHTLCFailureReason::MPPTimeout, + nativeLocalHTLCFailureReason::InvalidOnionBlinding => LocalHTLCFailureReason::InvalidOnionBlinding, + nativeLocalHTLCFailureReason::UnknownFailureCode {ref code, } => { + let mut code_nonref = Clone::clone(code); + LocalHTLCFailureReason::UnknownFailureCode { + code: code_nonref, + } + }, + nativeLocalHTLCFailureReason::ForwardExpiryBuffer => LocalHTLCFailureReason::ForwardExpiryBuffer, + nativeLocalHTLCFailureReason::InvalidTrampolineForward => LocalHTLCFailureReason::InvalidTrampolineForward, + nativeLocalHTLCFailureReason::PaymentClaimBuffer => LocalHTLCFailureReason::PaymentClaimBuffer, + nativeLocalHTLCFailureReason::DustLimitHolder => LocalHTLCFailureReason::DustLimitHolder, + nativeLocalHTLCFailureReason::DustLimitCounterparty => LocalHTLCFailureReason::DustLimitCounterparty, + nativeLocalHTLCFailureReason::FeeSpikeBuffer => LocalHTLCFailureReason::FeeSpikeBuffer, + nativeLocalHTLCFailureReason::PrivateChannelForward => LocalHTLCFailureReason::PrivateChannelForward, + nativeLocalHTLCFailureReason::RealSCIDForward => LocalHTLCFailureReason::RealSCIDForward, + nativeLocalHTLCFailureReason::ChannelNotReady => LocalHTLCFailureReason::ChannelNotReady, + nativeLocalHTLCFailureReason::InvalidKeysendPreimage => LocalHTLCFailureReason::InvalidKeysendPreimage, + nativeLocalHTLCFailureReason::InvalidTrampolinePayload => LocalHTLCFailureReason::InvalidTrampolinePayload, + nativeLocalHTLCFailureReason::PaymentSecretRequired => LocalHTLCFailureReason::PaymentSecretRequired, + nativeLocalHTLCFailureReason::OutgoingCLTVTooSoon => LocalHTLCFailureReason::OutgoingCLTVTooSoon, + nativeLocalHTLCFailureReason::ChannelClosed => LocalHTLCFailureReason::ChannelClosed, + nativeLocalHTLCFailureReason::OnChainTimeout => LocalHTLCFailureReason::OnChainTimeout, + nativeLocalHTLCFailureReason::ZeroAmount => LocalHTLCFailureReason::ZeroAmount, + nativeLocalHTLCFailureReason::HTLCMinimum => LocalHTLCFailureReason::HTLCMinimum, + nativeLocalHTLCFailureReason::HTLCMaximum => LocalHTLCFailureReason::HTLCMaximum, + nativeLocalHTLCFailureReason::PeerOffline => LocalHTLCFailureReason::PeerOffline, + nativeLocalHTLCFailureReason::ChannelBalanceOverdrawn => LocalHTLCFailureReason::ChannelBalanceOverdrawn, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeLocalHTLCFailureReason) -> Self { + match native { + nativeLocalHTLCFailureReason::TemporaryNodeFailure => LocalHTLCFailureReason::TemporaryNodeFailure, + nativeLocalHTLCFailureReason::PermanentNodeFailure => LocalHTLCFailureReason::PermanentNodeFailure, + nativeLocalHTLCFailureReason::RequiredNodeFeature => LocalHTLCFailureReason::RequiredNodeFeature, + nativeLocalHTLCFailureReason::InvalidOnionVersion => LocalHTLCFailureReason::InvalidOnionVersion, + nativeLocalHTLCFailureReason::InvalidOnionHMAC => LocalHTLCFailureReason::InvalidOnionHMAC, + nativeLocalHTLCFailureReason::InvalidOnionKey => LocalHTLCFailureReason::InvalidOnionKey, + nativeLocalHTLCFailureReason::TemporaryChannelFailure => LocalHTLCFailureReason::TemporaryChannelFailure, + nativeLocalHTLCFailureReason::PermanentChannelFailure => LocalHTLCFailureReason::PermanentChannelFailure, + nativeLocalHTLCFailureReason::RequiredChannelFeature => LocalHTLCFailureReason::RequiredChannelFeature, + nativeLocalHTLCFailureReason::UnknownNextPeer => LocalHTLCFailureReason::UnknownNextPeer, + nativeLocalHTLCFailureReason::AmountBelowMinimum => LocalHTLCFailureReason::AmountBelowMinimum, + nativeLocalHTLCFailureReason::FeeInsufficient => LocalHTLCFailureReason::FeeInsufficient, + nativeLocalHTLCFailureReason::IncorrectCLTVExpiry => LocalHTLCFailureReason::IncorrectCLTVExpiry, + nativeLocalHTLCFailureReason::CLTVExpiryTooSoon => LocalHTLCFailureReason::CLTVExpiryTooSoon, + nativeLocalHTLCFailureReason::IncorrectPaymentDetails => LocalHTLCFailureReason::IncorrectPaymentDetails, + nativeLocalHTLCFailureReason::FinalIncorrectCLTVExpiry => LocalHTLCFailureReason::FinalIncorrectCLTVExpiry, + nativeLocalHTLCFailureReason::FinalIncorrectHTLCAmount => LocalHTLCFailureReason::FinalIncorrectHTLCAmount, + nativeLocalHTLCFailureReason::ChannelDisabled => LocalHTLCFailureReason::ChannelDisabled, + nativeLocalHTLCFailureReason::CLTVExpiryTooFar => LocalHTLCFailureReason::CLTVExpiryTooFar, + nativeLocalHTLCFailureReason::InvalidOnionPayload => LocalHTLCFailureReason::InvalidOnionPayload, + nativeLocalHTLCFailureReason::MPPTimeout => LocalHTLCFailureReason::MPPTimeout, + nativeLocalHTLCFailureReason::InvalidOnionBlinding => LocalHTLCFailureReason::InvalidOnionBlinding, + nativeLocalHTLCFailureReason::UnknownFailureCode {mut code, } => { + LocalHTLCFailureReason::UnknownFailureCode { + code: code, + } + }, + nativeLocalHTLCFailureReason::ForwardExpiryBuffer => LocalHTLCFailureReason::ForwardExpiryBuffer, + nativeLocalHTLCFailureReason::InvalidTrampolineForward => LocalHTLCFailureReason::InvalidTrampolineForward, + nativeLocalHTLCFailureReason::PaymentClaimBuffer => LocalHTLCFailureReason::PaymentClaimBuffer, + nativeLocalHTLCFailureReason::DustLimitHolder => LocalHTLCFailureReason::DustLimitHolder, + nativeLocalHTLCFailureReason::DustLimitCounterparty => LocalHTLCFailureReason::DustLimitCounterparty, + nativeLocalHTLCFailureReason::FeeSpikeBuffer => LocalHTLCFailureReason::FeeSpikeBuffer, + nativeLocalHTLCFailureReason::PrivateChannelForward => LocalHTLCFailureReason::PrivateChannelForward, + nativeLocalHTLCFailureReason::RealSCIDForward => LocalHTLCFailureReason::RealSCIDForward, + nativeLocalHTLCFailureReason::ChannelNotReady => LocalHTLCFailureReason::ChannelNotReady, + nativeLocalHTLCFailureReason::InvalidKeysendPreimage => LocalHTLCFailureReason::InvalidKeysendPreimage, + nativeLocalHTLCFailureReason::InvalidTrampolinePayload => LocalHTLCFailureReason::InvalidTrampolinePayload, + nativeLocalHTLCFailureReason::PaymentSecretRequired => LocalHTLCFailureReason::PaymentSecretRequired, + nativeLocalHTLCFailureReason::OutgoingCLTVTooSoon => LocalHTLCFailureReason::OutgoingCLTVTooSoon, + nativeLocalHTLCFailureReason::ChannelClosed => LocalHTLCFailureReason::ChannelClosed, + nativeLocalHTLCFailureReason::OnChainTimeout => LocalHTLCFailureReason::OnChainTimeout, + nativeLocalHTLCFailureReason::ZeroAmount => LocalHTLCFailureReason::ZeroAmount, + nativeLocalHTLCFailureReason::HTLCMinimum => LocalHTLCFailureReason::HTLCMinimum, + nativeLocalHTLCFailureReason::HTLCMaximum => LocalHTLCFailureReason::HTLCMaximum, + nativeLocalHTLCFailureReason::PeerOffline => LocalHTLCFailureReason::PeerOffline, + nativeLocalHTLCFailureReason::ChannelBalanceOverdrawn => LocalHTLCFailureReason::ChannelBalanceOverdrawn, + } + } +} +/// Frees any resources used by the LocalHTLCFailureReason +#[no_mangle] +pub extern "C" fn LocalHTLCFailureReason_free(this_ptr: LocalHTLCFailureReason) { } +/// Creates a copy of the LocalHTLCFailureReason +#[no_mangle] +pub extern "C" fn LocalHTLCFailureReason_clone(orig: &LocalHTLCFailureReason) -> LocalHTLCFailureReason { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn LocalHTLCFailureReason_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LocalHTLCFailureReason)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn LocalHTLCFailureReason_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut LocalHTLCFailureReason) }; +} +#[no_mangle] +/// Utility method to constructs a new TemporaryNodeFailure-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_temporary_node_failure() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::TemporaryNodeFailure} +#[no_mangle] +/// Utility method to constructs a new PermanentNodeFailure-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_permanent_node_failure() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PermanentNodeFailure} +#[no_mangle] +/// Utility method to constructs a new RequiredNodeFeature-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_required_node_feature() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::RequiredNodeFeature} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionVersion-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_onion_version() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidOnionVersion} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionHMAC-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_onion_hmac() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidOnionHMAC} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionKey-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_onion_key() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidOnionKey} +#[no_mangle] +/// Utility method to constructs a new TemporaryChannelFailure-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_temporary_channel_failure() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::TemporaryChannelFailure} +#[no_mangle] +/// Utility method to constructs a new PermanentChannelFailure-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_permanent_channel_failure() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PermanentChannelFailure} +#[no_mangle] +/// Utility method to constructs a new RequiredChannelFeature-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_required_channel_feature() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::RequiredChannelFeature} +#[no_mangle] +/// Utility method to constructs a new UnknownNextPeer-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_unknown_next_peer() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::UnknownNextPeer} +#[no_mangle] +/// Utility method to constructs a new AmountBelowMinimum-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_amount_below_minimum() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::AmountBelowMinimum} +#[no_mangle] +/// Utility method to constructs a new FeeInsufficient-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_fee_insufficient() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::FeeInsufficient} +#[no_mangle] +/// Utility method to constructs a new IncorrectCLTVExpiry-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_incorrect_cltvexpiry() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::IncorrectCLTVExpiry} +#[no_mangle] +/// Utility method to constructs a new CLTVExpiryTooSoon-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_cltvexpiry_too_soon() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::CLTVExpiryTooSoon} +#[no_mangle] +/// Utility method to constructs a new IncorrectPaymentDetails-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_incorrect_payment_details() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::IncorrectPaymentDetails} +#[no_mangle] +/// Utility method to constructs a new FinalIncorrectCLTVExpiry-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_final_incorrect_cltvexpiry() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::FinalIncorrectCLTVExpiry} +#[no_mangle] +/// Utility method to constructs a new FinalIncorrectHTLCAmount-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_final_incorrect_htlcamount() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::FinalIncorrectHTLCAmount} +#[no_mangle] +/// Utility method to constructs a new ChannelDisabled-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_channel_disabled() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ChannelDisabled} +#[no_mangle] +/// Utility method to constructs a new CLTVExpiryTooFar-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_cltvexpiry_too_far() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::CLTVExpiryTooFar} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionPayload-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_onion_payload() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidOnionPayload} +#[no_mangle] +/// Utility method to constructs a new MPPTimeout-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_mpptimeout() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::MPPTimeout} +#[no_mangle] +/// Utility method to constructs a new InvalidOnionBlinding-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_onion_blinding() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidOnionBlinding} +#[no_mangle] +/// Utility method to constructs a new UnknownFailureCode-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_unknown_failure_code(code: u16) -> LocalHTLCFailureReason { + LocalHTLCFailureReason::UnknownFailureCode { + code, + } +} +#[no_mangle] +/// Utility method to constructs a new ForwardExpiryBuffer-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_forward_expiry_buffer() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ForwardExpiryBuffer} +#[no_mangle] +/// Utility method to constructs a new InvalidTrampolineForward-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_trampoline_forward() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidTrampolineForward} +#[no_mangle] +/// Utility method to constructs a new PaymentClaimBuffer-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_payment_claim_buffer() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PaymentClaimBuffer} +#[no_mangle] +/// Utility method to constructs a new DustLimitHolder-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_dust_limit_holder() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::DustLimitHolder} +#[no_mangle] +/// Utility method to constructs a new DustLimitCounterparty-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_dust_limit_counterparty() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::DustLimitCounterparty} +#[no_mangle] +/// Utility method to constructs a new FeeSpikeBuffer-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_fee_spike_buffer() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::FeeSpikeBuffer} +#[no_mangle] +/// Utility method to constructs a new PrivateChannelForward-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_private_channel_forward() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PrivateChannelForward} +#[no_mangle] +/// Utility method to constructs a new RealSCIDForward-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_real_scidforward() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::RealSCIDForward} +#[no_mangle] +/// Utility method to constructs a new ChannelNotReady-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_channel_not_ready() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ChannelNotReady} +#[no_mangle] +/// Utility method to constructs a new InvalidKeysendPreimage-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_keysend_preimage() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidKeysendPreimage} +#[no_mangle] +/// Utility method to constructs a new InvalidTrampolinePayload-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_invalid_trampoline_payload() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::InvalidTrampolinePayload} +#[no_mangle] +/// Utility method to constructs a new PaymentSecretRequired-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_payment_secret_required() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PaymentSecretRequired} +#[no_mangle] +/// Utility method to constructs a new OutgoingCLTVTooSoon-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_outgoing_cltvtoo_soon() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::OutgoingCLTVTooSoon} +#[no_mangle] +/// Utility method to constructs a new ChannelClosed-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_channel_closed() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ChannelClosed} +#[no_mangle] +/// Utility method to constructs a new OnChainTimeout-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_on_chain_timeout() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::OnChainTimeout} +#[no_mangle] +/// Utility method to constructs a new ZeroAmount-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_zero_amount() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ZeroAmount} +#[no_mangle] +/// Utility method to constructs a new HTLCMinimum-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_htlcminimum() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::HTLCMinimum} +#[no_mangle] +/// Utility method to constructs a new HTLCMaximum-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_htlcmaximum() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::HTLCMaximum} +#[no_mangle] +/// Utility method to constructs a new PeerOffline-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_peer_offline() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::PeerOffline} +#[no_mangle] +/// Utility method to constructs a new ChannelBalanceOverdrawn-variant LocalHTLCFailureReason +pub extern "C" fn LocalHTLCFailureReason_channel_balance_overdrawn() -> LocalHTLCFailureReason { + LocalHTLCFailureReason::ChannelBalanceOverdrawn} +/// Get a string which allows debug introspection of a LocalHTLCFailureReason object +pub extern "C" fn LocalHTLCFailureReason_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::onion_utils::LocalHTLCFailureReason }).into()} +/// Generates a non-cryptographic 64-bit hash of the LocalHTLCFailureReason. +#[no_mangle] +pub extern "C" fn LocalHTLCFailureReason_hash(o: &LocalHTLCFailureReason) -> 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 LocalHTLCFailureReasons contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn LocalHTLCFailureReason_eq(a: &LocalHTLCFailureReason, b: &LocalHTLCFailureReason) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +#[no_mangle] +/// Build a LocalHTLCFailureReason from a u16 +pub extern "C" fn LocalHTLCFailureReason_from_u16(f: u16) -> crate::lightning::ln::onion_utils::LocalHTLCFailureReason { + let from_obj = f; + crate::lightning::ln::onion_utils::LocalHTLCFailureReason::native_into((lightning::ln::onion_utils::LocalHTLCFailureReason::from(from_obj))) +} +#[no_mangle] +/// Read a LocalHTLCFailureReason from a byte array, created by LocalHTLCFailureReason_write +pub extern "C" fn LocalHTLCFailureReason_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_LocalHTLCFailureReasonDecodeErrorZ { + 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::onion_utils::LocalHTLCFailureReason::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +#[no_mangle] +/// Serialize the LocalHTLCFailureReason object into a byte array which can be read by LocalHTLCFailureReason_read +pub extern "C" fn LocalHTLCFailureReason_write(obj: &crate::lightning::ln::onion_utils::LocalHTLCFailureReason) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn LocalHTLCFailureReason_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + LocalHTLCFailureReason_write(unsafe { &*(obj as *const LocalHTLCFailureReason) }) +} +/// Build a payment onion, returning the first hop msat and cltv values as well. +/// +/// `cur_block_height` should be set to the best known block height + 1. +/// +/// Note that invoice_request (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn create_payment_onion(path: &crate::lightning::routing::router::Path, session_priv: *const [u8; 32], mut total_msat: u64, recipient_onion: &crate::lightning::ln::outbound_payment::RecipientOnionFields, mut cur_block_height: u32, payment_hash: *const [u8; 32], mut keysend_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, mut prng_seed: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_C3Tuple_OnionPacketu64u32ZAPIErrorZ { + let mut local_keysend_preimage = { /*keysend_preimage*/ let keysend_preimage_opt = keysend_preimage; if keysend_preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ keysend_preimage_opt.take() }.data) }})} }; + let mut local_invoice_request = if invoice_request.inner.is_null() { None } else { Some( { invoice_request.get_native_ref() }) }; + let mut ret = lightning::ln::onion_utils::create_payment_onion(secp256k1::global::SECP256K1, path.get_native_ref(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *session_priv}[..]).unwrap(), total_msat, recipient_onion.get_native_ref(), cur_block_height, &::lightning::types::payment::PaymentHash(unsafe { *payment_hash }), &local_keysend_preimage, local_invoice_request, prng_seed.data); + 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, mut orig_ret_0_2) = o; let mut local_ret_0 = (crate::lightning::ln::msgs::OnionPacket { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, orig_ret_0_1, orig_ret_0_2).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; + local_ret +} + + +use lightning::ln::onion_utils::AttributionData as nativeAttributionDataImport; +pub(crate) type nativeAttributionData = nativeAttributionDataImport; + +/// Attribution data allows the sender of an HTLC to identify which hop failed an HTLC robustly, +/// preventing earlier hops from corrupting the HTLC failure information (or at least allowing the +/// sender to identify the earliest hop which corrupted HTLC failure information). +/// +/// Additionally, it allows a sender to identify how long each hop along a path held an HTLC, with +/// 100ms granularity. +#[must_use] +#[repr(C)] +pub struct AttributionData { + /// 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 nativeAttributionData, + /// 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 core::ops::Deref for AttributionData { + type Target = nativeAttributionData; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for AttributionData { } +unsafe impl core::marker::Sync for AttributionData { } +impl Drop for AttributionData { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeAttributionData>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the AttributionData, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn AttributionData_free(this_obj: AttributionData) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AttributionData_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAttributionData) }; +} +#[allow(unused)] +impl AttributionData { + pub(crate) fn get_native_ref(&self) -> &'static nativeAttributionData { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAttributionData { + 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 nativeAttributionData { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for AttributionData { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeAttributionData>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 AttributionData_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAttributionData) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the AttributionData +pub extern "C" fn AttributionData_clone(orig: &AttributionData) -> AttributionData { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a AttributionData object +pub extern "C" fn AttributionData_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::onion_utils::AttributionData }).into()} +/// Generates a non-cryptographic 64-bit hash of the AttributionData. +#[no_mangle] +pub extern "C" fn AttributionData_hash(o: &AttributionData) -> 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 AttributionDatas 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 AttributionData_eq(a: &AttributionData, b: &AttributionData) -> 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 AttributionData object into a byte array which can be read by AttributionData_read +pub extern "C" fn AttributionData_write(obj: &crate::lightning::ln::onion_utils::AttributionData) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn AttributionData_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::ln::onion_utils::nativeAttributionData) }) +} +#[no_mangle] +/// Read a AttributionData from a byte array, created by AttributionData_write +pub extern "C" fn AttributionData_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AttributionDataDecodeErrorZ { + 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::onion_utils::AttributionData { 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/ln/our_peer_storage.rs b/lightning-c-bindings/src/lightning/ln/our_peer_storage.rs new file mode 100644 index 00000000..c5d7b963 --- /dev/null +++ b/lightning-c-bindings/src/lightning/ln/our_peer_storage.rs @@ -0,0 +1,224 @@ +// 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. + +//! `DecryptedOurPeerStorage` enables storage of encrypted serialized channel data. +//! It provides encryption of data to maintain data integrity and +//! security during transmission. + +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::ln::our_peer_storage::DecryptedOurPeerStorage as nativeDecryptedOurPeerStorageImport; +pub(crate) type nativeDecryptedOurPeerStorage = nativeDecryptedOurPeerStorageImport; + +/// [`DecryptedOurPeerStorage`] is used to store serialised channel information that allows for the creation of a +/// `peer_storage` backup. +/// +/// This structure is designed to serialize channel data for backup and supports encryption +/// using `ChaCha20Poly1305RFC` for transmission. +/// +/// # Key Methods +/// - [`DecryptedOurPeerStorage::new`]: Returns [`DecryptedOurPeerStorage`] with the given data. +/// - [`DecryptedOurPeerStorage::encrypt`]: Returns [`EncryptedOurPeerStorage`] created from encrypting the provided data. +/// - [`DecryptedOurPeerStorage::into_vec`]: Returns the data in [`Vec`] format. +/// +/// ## Example +/// ``` +/// use lightning::ln::our_peer_storage::DecryptedOurPeerStorage; +/// use lightning::sign::{KeysManager, NodeSigner}; +/// let seed = [1u8; 32]; +/// let keys_mgr = KeysManager::new(&seed, 42, 42, true); +/// let key = keys_mgr.get_peer_storage_key(); +/// let decrypted_ops = DecryptedOurPeerStorage::new(vec![1, 2, 3]); +/// let our_peer_storage = decrypted_ops.encrypt(&key, &[0u8; 32]); +/// let decrypted_data = our_peer_storage.decrypt(&key).unwrap(); +/// assert_eq!(decrypted_data.into_vec(), vec![1, 2, 3]); +/// ``` +#[must_use] +#[repr(C)] +pub struct DecryptedOurPeerStorage { + /// 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 nativeDecryptedOurPeerStorage, + /// 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 core::ops::Deref for DecryptedOurPeerStorage { + type Target = nativeDecryptedOurPeerStorage; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for DecryptedOurPeerStorage { } +unsafe impl core::marker::Sync for DecryptedOurPeerStorage { } +impl Drop for DecryptedOurPeerStorage { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeDecryptedOurPeerStorage>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the DecryptedOurPeerStorage, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn DecryptedOurPeerStorage_free(this_obj: DecryptedOurPeerStorage) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DecryptedOurPeerStorage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDecryptedOurPeerStorage) }; +} +#[allow(unused)] +impl DecryptedOurPeerStorage { + pub(crate) fn get_native_ref(&self) -> &'static nativeDecryptedOurPeerStorage { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDecryptedOurPeerStorage { + 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 nativeDecryptedOurPeerStorage { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Returns [`DecryptedOurPeerStorage`] with the given data. +#[must_use] +#[no_mangle] +pub extern "C" fn DecryptedOurPeerStorage_new(mut data: crate::c_types::derived::CVec_u8Z) -> crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage { + let mut local_data = Vec::new(); for mut item in data.into_rust().drain(..) { local_data.push( { item }); }; + let mut ret = lightning::ln::our_peer_storage::DecryptedOurPeerStorage::new(local_data); + crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Returns data stored in [`Vec`] format. +#[must_use] +#[no_mangle] +pub extern "C" fn DecryptedOurPeerStorage_into_vec(mut this_arg: crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage) -> crate::c_types::derived::CVec_u8Z { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_vec(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { item }); }; + local_ret.into() +} + +/// Encrypts the data inside [`DecryptedOurPeerStorage`] using [`PeerStorageKey`] and `random_bytes` +/// and returns [`EncryptedOurPeerStorage`]. +#[must_use] +#[no_mangle] +pub extern "C" fn DecryptedOurPeerStorage_encrypt(mut this_arg: crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage, key: &crate::lightning::sign::PeerStorageKey, random_bytes: *const [u8; 32]) -> crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).encrypt(key.get_native_ref(), unsafe { &*random_bytes}); + crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + + +use lightning::ln::our_peer_storage::EncryptedOurPeerStorage as nativeEncryptedOurPeerStorageImport; +pub(crate) type nativeEncryptedOurPeerStorage = nativeEncryptedOurPeerStorageImport; + +/// [`EncryptedOurPeerStorage`] represents encrypted state of the corresponding [`DecryptedOurPeerStorage`]. +/// +/// # Key Methods +/// - [`EncryptedOurPeerStorage::new`]: Returns [`EncryptedOurPeerStorage`] with the given encrypted cipher. +/// - [`EncryptedOurPeerStorage::decrypt`]: Returns [`DecryptedOurPeerStorage`] created from decrypting the cipher. +/// - [`EncryptedOurPeerStorage::into_vec`]: Returns the cipher in [`Vec`] format. +#[must_use] +#[repr(C)] +pub struct EncryptedOurPeerStorage { + /// 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 nativeEncryptedOurPeerStorage, + /// 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 core::ops::Deref for EncryptedOurPeerStorage { + type Target = nativeEncryptedOurPeerStorage; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for EncryptedOurPeerStorage { } +unsafe impl core::marker::Sync for EncryptedOurPeerStorage { } +impl Drop for EncryptedOurPeerStorage { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeEncryptedOurPeerStorage>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the EncryptedOurPeerStorage, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn EncryptedOurPeerStorage_free(this_obj: EncryptedOurPeerStorage) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn EncryptedOurPeerStorage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeEncryptedOurPeerStorage) }; +} +#[allow(unused)] +impl EncryptedOurPeerStorage { + pub(crate) fn get_native_ref(&self) -> &'static nativeEncryptedOurPeerStorage { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeEncryptedOurPeerStorage { + 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 nativeEncryptedOurPeerStorage { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Returns [`EncryptedOurPeerStorage`] if cipher is of appropriate length, else returns error. +#[must_use] +#[no_mangle] +pub extern "C" fn EncryptedOurPeerStorage_new(mut cipher: crate::c_types::derived::CVec_u8Z) -> crate::c_types::derived::CResult_EncryptedOurPeerStorageNoneZ { + let mut local_cipher = Vec::new(); for mut item in cipher.into_rust().drain(..) { local_cipher.push( { item }); }; + let mut ret = lightning::ln::our_peer_storage::EncryptedOurPeerStorage::new(local_cipher); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Returns cipher in the format [`Vec`]. +#[must_use] +#[no_mangle] +pub extern "C" fn EncryptedOurPeerStorage_into_vec(mut this_arg: crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage) -> crate::c_types::derived::CVec_u8Z { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_vec(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { item }); }; + local_ret.into() +} + +/// Returns [`DecryptedOurPeerStorage`] if it successfully decrypts the ciphertext with the `key`, +/// else returns error. +#[must_use] +#[no_mangle] +pub extern "C" fn EncryptedOurPeerStorage_decrypt(mut this_arg: crate::lightning::ln::our_peer_storage::EncryptedOurPeerStorage, key: &crate::lightning::sign::PeerStorageKey) -> crate::c_types::derived::CResult_DecryptedOurPeerStorageNoneZ { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).decrypt(key.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::our_peer_storage::DecryptedOurPeerStorage { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + diff --git a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs index 96c2f6ce..48c336e3 100644 --- a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs @@ -178,11 +178,14 @@ pub extern "C" fn Retry_read(ser: crate::c_types::u8slice) -> crate::c_types::de #[must_use] #[repr(C)] pub enum RetryableSendFailure { - /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. + /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired or + /// the BOLT 12 invoice paid to via [`ChannelManager::send_payment_for_bolt12_invoice`] was + /// expired. /// ///Note that this error is *not* caused by [`Retry::Timeout`]. /// /// [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time + /// [`ChannelManager::send_payment_for_bolt12_invoice`]: crate::ln::channelmanager::ChannelManager::send_payment_for_bolt12_invoice PaymentExpired, /// We were unable to find a route to the destination. RouteNotFound, @@ -282,6 +285,105 @@ pub extern "C" fn RetryableSendFailure_debug_str_void(o: *const c_void) -> Str { pub extern "C" fn RetryableSendFailure_eq(a: &RetryableSendFailure, b: &RetryableSendFailure) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } +/// An error when attempting to pay a [`Bolt11Invoice`]. +/// +/// [`Bolt11Invoice`]: lightning_invoice::Bolt11Invoice +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum Bolt11PaymentError { + /// Incorrect amount was provided to [`ChannelManager::pay_for_bolt11_invoice`]. + /// This happens when the user-provided amount is less than an amount specified in the [`Bolt11Invoice`]. + /// + /// [`Bolt11Invoice`]: lightning_invoice::Bolt11Invoice + /// [`ChannelManager::pay_for_bolt11_invoice`]: crate::ln::channelmanager::ChannelManager::pay_for_bolt11_invoice + InvalidAmount, + /// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. + SendingFailed( + crate::lightning::ln::outbound_payment::RetryableSendFailure), +} +use lightning::ln::outbound_payment::Bolt11PaymentError as Bolt11PaymentErrorImport; +pub(crate) type nativeBolt11PaymentError = Bolt11PaymentErrorImport; + +impl Bolt11PaymentError { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeBolt11PaymentError { + match self { + Bolt11PaymentError::InvalidAmount => nativeBolt11PaymentError::InvalidAmount, + Bolt11PaymentError::SendingFailed (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeBolt11PaymentError::SendingFailed ( + a_nonref.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeBolt11PaymentError { + match self { + Bolt11PaymentError::InvalidAmount => nativeBolt11PaymentError::InvalidAmount, + Bolt11PaymentError::SendingFailed (mut a, ) => { + nativeBolt11PaymentError::SendingFailed ( + a.into_native(), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &Bolt11PaymentErrorImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt11PaymentError) }; + match native { + nativeBolt11PaymentError::InvalidAmount => Bolt11PaymentError::InvalidAmount, + nativeBolt11PaymentError::SendingFailed (ref a, ) => { + let mut a_nonref = Clone::clone(a); + Bolt11PaymentError::SendingFailed ( + crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a_nonref), + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeBolt11PaymentError) -> Self { + match native { + nativeBolt11PaymentError::InvalidAmount => Bolt11PaymentError::InvalidAmount, + nativeBolt11PaymentError::SendingFailed (mut a, ) => { + Bolt11PaymentError::SendingFailed ( + crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a), + ) + }, + } + } +} +/// Frees any resources used by the Bolt11PaymentError +#[no_mangle] +pub extern "C" fn Bolt11PaymentError_free(this_ptr: Bolt11PaymentError) { } +/// Creates a copy of the Bolt11PaymentError +#[no_mangle] +pub extern "C" fn Bolt11PaymentError_clone(orig: &Bolt11PaymentError) -> Bolt11PaymentError { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Bolt11PaymentError_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt11PaymentError)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Bolt11PaymentError_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt11PaymentError) }; +} +#[no_mangle] +/// Utility method to constructs a new InvalidAmount-variant Bolt11PaymentError +pub extern "C" fn Bolt11PaymentError_invalid_amount() -> Bolt11PaymentError { + Bolt11PaymentError::InvalidAmount} +#[no_mangle] +/// Utility method to constructs a new SendingFailed-variant Bolt11PaymentError +pub extern "C" fn Bolt11PaymentError_sending_failed(a: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> Bolt11PaymentError { + Bolt11PaymentError::SendingFailed(a, ) +} +/// Get a string which allows debug introspection of a Bolt11PaymentError object +pub extern "C" fn Bolt11PaymentError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::Bolt11PaymentError }).into()} /// An error when attempting to pay a [`Bolt12Invoice`]. #[derive(Clone)] #[must_use] @@ -296,6 +398,14 @@ pub enum Bolt12PaymentError { /// The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. SendingFailed( crate::lightning::ln::outbound_payment::RetryableSendFailure), + /// Failed to create a blinded path back to ourselves. + /// + /// We attempted to initiate payment to a [`StaticInvoice`] but failed to create a reply path for + /// our [`HeldHtlcAvailable`] message. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + BlindedPathCreationFailed, } use lightning::ln::outbound_payment::Bolt12PaymentError as Bolt12PaymentErrorImport; pub(crate) type nativeBolt12PaymentError = Bolt12PaymentErrorImport; @@ -313,6 +423,7 @@ impl Bolt12PaymentError { a_nonref.into_native(), ) }, + Bolt12PaymentError::BlindedPathCreationFailed => nativeBolt12PaymentError::BlindedPathCreationFailed, } } #[allow(unused)] @@ -326,6 +437,7 @@ impl Bolt12PaymentError { a.into_native(), ) }, + Bolt12PaymentError::BlindedPathCreationFailed => nativeBolt12PaymentError::BlindedPathCreationFailed, } } #[allow(unused)] @@ -341,6 +453,7 @@ impl Bolt12PaymentError { crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a_nonref), ) }, + nativeBolt12PaymentError::BlindedPathCreationFailed => Bolt12PaymentError::BlindedPathCreationFailed, } } #[allow(unused)] @@ -354,6 +467,7 @@ impl Bolt12PaymentError { crate::lightning::ln::outbound_payment::RetryableSendFailure::native_into(a), ) }, + nativeBolt12PaymentError::BlindedPathCreationFailed => Bolt12PaymentError::BlindedPathCreationFailed, } } } @@ -392,6 +506,10 @@ pub extern "C" fn Bolt12PaymentError_unknown_required_features() -> Bolt12Paymen pub extern "C" fn Bolt12PaymentError_sending_failed(a: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> Bolt12PaymentError { Bolt12PaymentError::SendingFailed(a, ) } +#[no_mangle] +/// Utility method to constructs a new BlindedPathCreationFailed-variant Bolt12PaymentError +pub extern "C" fn Bolt12PaymentError_blinded_path_creation_failed() -> Bolt12PaymentError { + Bolt12PaymentError::BlindedPathCreationFailed} /// Get a string which allows debug introspection of a Bolt12PaymentError object pub extern "C" fn Bolt12PaymentError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::Bolt12PaymentError }).into()} @@ -603,7 +721,7 @@ impl RecipientOnionFields { /// recipient will not reject it. #[no_mangle] 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 inner_val = &mut RecipientOnionFields::get_native_mut_ref(this_ptr).payment_secret; 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 } @@ -639,7 +757,7 @@ pub extern "C" fn RecipientOnionFields_set_payment_secret(this_ptr: &mut Recipie /// Returns a copy of the field. #[no_mangle] pub extern "C" fn RecipientOnionFields_get_payment_metadata(this_ptr: &RecipientOnionFields) -> crate::c_types::derived::COption_CVec_u8ZZ { - let mut inner_val = this_ptr.get_native_mut_ref().payment_metadata.clone(); + let mut inner_val = RecipientOnionFields::get_native_mut_ref(this_ptr).payment_metadata.clone(); 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( { let mut local_inner_val_0 = Vec::new(); for mut item in inner_val.unwrap().drain(..) { local_inner_val_0.push( { item }); }; local_inner_val_0.into() }) }; local_inner_val } @@ -664,7 +782,7 @@ impl Clone for RecipientOnionFields { fn clone(&self) -> Self { Self { inner: if <*mut nativeRecipientOnionFields>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -672,12 +790,12 @@ impl Clone for RecipientOnionFields { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RecipientOnionFields_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRecipientOnionFields)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRecipientOnionFields) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RecipientOnionFields pub extern "C" fn RecipientOnionFields_clone(orig: &RecipientOnionFields) -> RecipientOnionFields { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RecipientOnionFields object pub extern "C" fn RecipientOnionFields_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index 4f512759..fc41b4b0 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -48,9 +48,11 @@ pub struct CustomMessageHandler { pub peer_disconnected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey), /// Handle a peer connecting. /// - /// May return an `Err(())` if the features the peer supports are not sufficient to communicate - /// with us. Implementors should be somewhat conservative about doing so, however, as other - /// message handlers may still wish to communicate with this peer. + /// May return an `Err(())` to indicate that we should immediately disconnect from the peer + /// (e.g. because the features they support are not sufficient to communicate with us). + /// + /// Note, of course, that other message handlers may wish to communicate with the peer, which + /// disconnecting them will prevent. /// /// [`Self::peer_disconnected`] will not be called if `Err(())` is returned. pub peer_connected: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ, @@ -256,33 +258,56 @@ pub extern "C" fn IgnoringMessageHandler_new() -> IgnoringMessageHandler { IgnoringMessageHandler { inner: ObjOps::heap_alloc(nativeIgnoringMessageHandler { }), is_owned: true } } -impl From for crate::lightning::events::MessageSendEventsProvider { +impl From for crate::lightning::ln::msgs::BaseMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&rust_obj); + let mut ret = IgnoringMessageHandler_as_BaseMessageHandler(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); ret.free = Some(IgnoringMessageHandler_free_void); ret } } -/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is #[no_mangle] -pub extern "C" fn IgnoringMessageHandler_as_MessageSendEventsProvider(this_arg: &IgnoringMessageHandler) -> crate::lightning::events::MessageSendEventsProvider { - crate::lightning::events::MessageSendEventsProvider { +pub extern "C" fn IgnoringMessageHandler_as_BaseMessageHandler(this_arg: &IgnoringMessageHandler) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: IgnoringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: IgnoringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: IgnoringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: IgnoringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: IgnoringMessageHandler_BaseMessageHandler_peer_connected, } } #[must_use] -extern "C" fn IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { - let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::events::MessageSendEvent::native_into(item) }); }; +extern "C" fn IgnoringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; local_ret.into() } +extern "C" fn IgnoringMessageHandler_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn IgnoringMessageHandler_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn IgnoringMessageHandler_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn IgnoringMessageHandler_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} impl From for crate::lightning::ln::msgs::RoutingMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { @@ -306,18 +331,19 @@ pub extern "C" fn IgnoringMessageHandler_as_RoutingMessageHandler(this_arg: &Ign handle_channel_update: IgnoringMessageHandler_RoutingMessageHandler_handle_channel_update, get_next_channel_announcement: IgnoringMessageHandler_RoutingMessageHandler_get_next_channel_announcement, get_next_node_announcement: IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announcement, - peer_connected: IgnoringMessageHandler_RoutingMessageHandler_peer_connected, handle_reply_channel_range: IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range, handle_reply_short_channel_ids_end: IgnoringMessageHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end, handle_query_channel_range: IgnoringMessageHandler_RoutingMessageHandler_handle_query_channel_range, handle_query_short_channel_ids: IgnoringMessageHandler_RoutingMessageHandler_handle_query_short_channel_ids, processing_queue_high: IgnoringMessageHandler_RoutingMessageHandler_processing_queue_high, - provided_node_features: IgnoringMessageHandler_RoutingMessageHandler_provided_node_features, - provided_init_features: IgnoringMessageHandler_RoutingMessageHandler_provided_init_features, - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: IgnoringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: IgnoringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: IgnoringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: IgnoringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: IgnoringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: IgnoringMessageHandler_BaseMessageHandler_peer_connected, }, } } @@ -357,12 +383,6 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announc local_ret } #[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), init.get_native_ref(), inbound); - 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 -} -#[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -391,16 +411,6 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_processing_queue_high let mut ret = ::processing_queue_high(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); ret } -#[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} impl From for crate::lightning::ln::msgs::OnionMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { @@ -421,11 +431,16 @@ pub extern "C" fn IgnoringMessageHandler_as_OnionMessageHandler(this_arg: &Ignor free: None, handle_onion_message: IgnoringMessageHandler_OnionMessageHandler_handle_onion_message, next_onion_message_for_peer: IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer, - peer_connected: IgnoringMessageHandler_OnionMessageHandler_peer_connected, - peer_disconnected: IgnoringMessageHandler_OnionMessageHandler_peer_disconnected, timer_tick_occurred: IgnoringMessageHandler_OnionMessageHandler_timer_tick_occurred, - provided_node_features: IgnoringMessageHandler_OnionMessageHandler_provided_node_features, - provided_init_features: IgnoringMessageHandler_OnionMessageHandler_provided_init_features, + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: IgnoringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: IgnoringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: IgnoringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: IgnoringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: IgnoringMessageHandler_BaseMessageHandler_peer_connected, + }, } } @@ -438,28 +453,9 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_ let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; local_ret } -#[must_use] -extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), init.get_native_ref(), inbound); - 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 -} -extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()) -} extern "C" fn IgnoringMessageHandler_OnionMessageHandler_timer_tick_occurred(this_arg: *const c_void) { ::timer_tick_occurred(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ) } -#[must_use] -extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} impl From for crate::lightning::onion_message::offers::OffersMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { @@ -515,6 +511,10 @@ pub extern "C" fn IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(this_arg crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, + handle_offer_paths_request: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_offer_paths_request, + handle_offer_paths: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_offer_paths, + handle_serve_static_invoice: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_serve_static_invoice, + handle_static_invoice_persisted: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_static_invoice_persisted, handle_held_htlc_available: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_held_htlc_available, handle_release_held_htlc: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_release_held_htlc, release_pending_messages: IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_pending_messages, @@ -522,9 +522,30 @@ pub extern "C" fn IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(this_arg } #[must_use] -extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_offer_paths_request(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::OfferPathsRequest, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_offer_paths_request(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +#[must_use] +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_offer_paths(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::OfferPaths, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ { let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; - let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut ret = ::handle_offer_paths(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_serve_static_invoice(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ServeStaticInvoice, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + ::handle_serve_static_invoice(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder) +} +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_static_invoice_persisted(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::StaticInvoicePersisted, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) { + ::handle_static_invoice_persisted(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native()) +} +#[must_use] +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), local_responder); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; local_ret } @@ -613,7 +634,7 @@ extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_handle_custom_mes } #[must_use] extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_read_custom_message(this_arg: *const c_void, mut message_type: u64, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_OnionMessageContentsZDecodeErrorZ { - let mut ret = ::read_custom_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader()); + let mut ret = ::read_custom_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_slice()); 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_OnionMessageContentsZ::None } else { crate::c_types::derived::COption_OnionMessageContentsZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_ret } @@ -624,6 +645,36 @@ extern "C" fn IgnoringMessageHandler_CustomOnionMessageHandler_release_pending_c local_ret.into() } +impl From for crate::lightning::ln::msgs::SendOnlyMessageHandler { + fn from(obj: nativeIgnoringMessageHandler) -> Self { + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = IgnoringMessageHandler_as_SendOnlyMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(IgnoringMessageHandler_free_void); + ret + } +} +/// Constructs a new SendOnlyMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned SendOnlyMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn IgnoringMessageHandler_as_SendOnlyMessageHandler(this_arg: &IgnoringMessageHandler) -> crate::lightning::ln::msgs::SendOnlyMessageHandler { + crate::lightning::ln::msgs::SendOnlyMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: IgnoringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: IgnoringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: IgnoringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: IgnoringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: IgnoringMessageHandler_BaseMessageHandler_peer_connected, + }, + } +} + + impl From for crate::lightning::onion_message::packet::OnionMessageContents { fn from(obj: nativeInfallible) -> Self { unreachable!(); @@ -657,7 +708,7 @@ pub extern "C" fn IgnoringMessageHandler_as_CustomMessageReader(this_arg: &Ignor #[must_use] extern "C" fn IgnoringMessageHandler_CustomMessageReader_read(this_arg: *const c_void, mut message_type: u16, mut buffer: crate::c_types::u8slice) -> crate::c_types::derived::CResult_COption_TypeZDecodeErrorZ { - let mut ret = ::read(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_reader()); + let mut ret = ::read(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, message_type, &mut buffer.to_slice()); 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_TypeZ::None } else { crate::c_types::derived::COption_TypeZ::Some( { Into::into(o.unwrap()) }) }; local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_ret } @@ -792,33 +843,56 @@ pub extern "C" fn ErroringMessageHandler_new() -> crate::lightning::ln::peer_han crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(ret), is_owned: true } } -impl From for crate::lightning::events::MessageSendEventsProvider { +impl From for crate::lightning::ln::msgs::BaseMessageHandler { fn from(obj: nativeErroringMessageHandler) -> Self { let rust_obj = crate::lightning::ln::peer_handler::ErroringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = ErroringMessageHandler_as_MessageSendEventsProvider(&rust_obj); + let mut ret = ErroringMessageHandler_as_BaseMessageHandler(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); ret.free = Some(ErroringMessageHandler_free_void); ret } } -/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is #[no_mangle] -pub extern "C" fn ErroringMessageHandler_as_MessageSendEventsProvider(this_arg: &ErroringMessageHandler) -> crate::lightning::events::MessageSendEventsProvider { - crate::lightning::events::MessageSendEventsProvider { +pub extern "C" fn ErroringMessageHandler_as_BaseMessageHandler(this_arg: &ErroringMessageHandler) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: ErroringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ErroringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: ErroringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: ErroringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: ErroringMessageHandler_BaseMessageHandler_peer_connected, } } #[must_use] -extern "C" fn ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { - let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::events::MessageSendEvent::native_into(item) }); }; +extern "C" fn ErroringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; local_ret.into() } +extern "C" fn ErroringMessageHandler_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn ErroringMessageHandler_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ErroringMessageHandler_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ErroringMessageHandler_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} impl From for crate::lightning::ln::msgs::ChannelMessageHandler { fn from(obj: nativeErroringMessageHandler) -> Self { @@ -844,9 +918,14 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err handle_funding_created: ErroringMessageHandler_ChannelMessageHandler_handle_funding_created, handle_funding_signed: ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed, handle_channel_ready: ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready, + handle_peer_storage: ErroringMessageHandler_ChannelMessageHandler_handle_peer_storage, + handle_peer_storage_retrieval: ErroringMessageHandler_ChannelMessageHandler_handle_peer_storage_retrieval, handle_shutdown: ErroringMessageHandler_ChannelMessageHandler_handle_shutdown, handle_closing_signed: ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed, handle_stfu: ErroringMessageHandler_ChannelMessageHandler_handle_stfu, + handle_splice_init: ErroringMessageHandler_ChannelMessageHandler_handle_splice_init, + handle_splice_ack: ErroringMessageHandler_ChannelMessageHandler_handle_splice_ack, + handle_splice_locked: ErroringMessageHandler_ChannelMessageHandler_handle_splice_locked, handle_tx_add_input: ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_input, handle_tx_add_output: ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_output, handle_tx_remove_input: ErroringMessageHandler_ChannelMessageHandler_handle_tx_remove_input, @@ -861,22 +940,23 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err handle_update_fail_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_htlc, handle_update_fail_malformed_htlc: ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_malformed_htlc, handle_commitment_signed: ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed, + handle_commitment_signed_batch: ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed_batch, handle_revoke_and_ack: ErroringMessageHandler_ChannelMessageHandler_handle_revoke_and_ack, handle_update_fee: ErroringMessageHandler_ChannelMessageHandler_handle_update_fee, handle_announcement_signatures: ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures, - peer_disconnected: ErroringMessageHandler_ChannelMessageHandler_peer_disconnected, - peer_connected: ErroringMessageHandler_ChannelMessageHandler_peer_connected, handle_channel_reestablish: ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish, handle_channel_update: ErroringMessageHandler_ChannelMessageHandler_handle_channel_update, handle_error: ErroringMessageHandler_ChannelMessageHandler_handle_error, - provided_node_features: ErroringMessageHandler_ChannelMessageHandler_provided_node_features, - provided_init_features: ErroringMessageHandler_ChannelMessageHandler_provided_init_features, get_chain_hashes: ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes, message_received: ErroringMessageHandler_ChannelMessageHandler_message_received, - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: ErroringMessageHandler_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: ErroringMessageHandler_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: ErroringMessageHandler_BaseMessageHandler_peer_disconnected, + provided_node_features: ErroringMessageHandler_BaseMessageHandler_provided_node_features, + provided_init_features: ErroringMessageHandler_BaseMessageHandler_provided_init_features, + peer_connected: ErroringMessageHandler_BaseMessageHandler_peer_connected, }, } } @@ -902,6 +982,12 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) { ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_peer_storage(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::PeerStorage) { + ::handle_peer_storage(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_peer_storage_retrieval(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::PeerStorageRetrieval) { + ::handle_peer_storage_retrieval(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) +} extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Shutdown) { ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -911,6 +997,15 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_stfu(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu) { ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice_init(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceInit) { + ::handle_splice_init(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceAck) { + ::handle_splice_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) +} +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_splice_locked(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::SpliceLocked) { + ::handle_splice_locked(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) +} extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput) { ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -941,8 +1036,8 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_abort(this_ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC) { ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC) { - ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::UpdateFulfillHTLC) { + ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC) { ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) @@ -953,6 +1048,10 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_ma extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned) { ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed_batch(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut channel_id: crate::lightning::ln::types::ChannelId, mut batch: crate::c_types::derived::CVec_CommitmentSignedZ) { + let mut local_batch = Vec::new(); for mut item in batch.into_rust().drain(..) { local_batch.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + ::handle_commitment_signed_batch(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(channel_id.take_inner()) }, local_batch) +} extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK) { ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -962,15 +1061,6 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fee(thi extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) { ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()) -} -#[must_use] -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); - 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 -} extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) { ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } @@ -981,16 +1071,6 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_error(this_arg ::handle_error(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } #[must_use] -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes(this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ { let mut ret = ::get_chain_hashes(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ); 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.as_ref() } }); }; local_ret_0.into() }) }; @@ -1002,7 +1082,7 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_message_received(this use lightning::ln::peer_handler::MessageHandler as nativeMessageHandlerImport; -pub(crate) type nativeMessageHandler = nativeMessageHandlerImport; +pub(crate) type nativeMessageHandler = nativeMessageHandlerImport; /// Provides references to trait impls which handle different types of messages. #[must_use] @@ -1066,7 +1146,7 @@ impl MessageHandler { /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager #[no_mangle] pub extern "C" fn MessageHandler_get_chan_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::ChannelMessageHandler { - let mut inner_val = &mut this_ptr.get_native_mut_ref().chan_handler; + let mut inner_val = &mut MessageHandler::get_native_mut_ref(this_ptr).chan_handler; inner_val } /// A message handler which handles messages specific to channels. Usually this is just a @@ -1083,7 +1163,7 @@ pub extern "C" fn MessageHandler_set_chan_handler(this_ptr: &mut MessageHandler, /// [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync #[no_mangle] pub extern "C" fn MessageHandler_get_route_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::RoutingMessageHandler { - let mut inner_val = &mut this_ptr.get_native_mut_ref().route_handler; + let mut inner_val = &mut MessageHandler::get_native_mut_ref(this_ptr).route_handler; inner_val } /// A message handler which handles messages updating our knowledge of the network channel @@ -1100,7 +1180,7 @@ pub extern "C" fn MessageHandler_set_route_handler(this_ptr: &mut MessageHandler /// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger #[no_mangle] pub extern "C" fn MessageHandler_get_onion_message_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::OnionMessageHandler { - let mut inner_val = &mut this_ptr.get_native_mut_ref().onion_message_handler; + let mut inner_val = &mut MessageHandler::get_native_mut_ref(this_ptr).onion_message_handler; inner_val } /// A message handler which handles onion messages. This should generally be an @@ -1115,7 +1195,7 @@ pub extern "C" fn MessageHandler_set_onion_message_handler(this_ptr: &mut Messag /// [`IgnoringMessageHandler`]. #[no_mangle] pub extern "C" fn MessageHandler_get_custom_message_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::peer_handler::CustomMessageHandler { - let mut inner_val = &mut this_ptr.get_native_mut_ref().custom_message_handler; + let mut inner_val = &mut MessageHandler::get_native_mut_ref(this_ptr).custom_message_handler; inner_val } /// A message handler which handles custom messages. The only LDK-provided implementation is @@ -1124,15 +1204,35 @@ pub extern "C" fn MessageHandler_get_custom_message_handler(this_ptr: &MessageHa pub extern "C" fn MessageHandler_set_custom_message_handler(this_ptr: &mut MessageHandler, mut val: crate::lightning::ln::peer_handler::CustomMessageHandler) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.custom_message_handler = val; } +/// A message handler which can be used to send messages. +/// +/// This should generally be a [`ChainMonitor`]. +/// +/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor +#[no_mangle] +pub extern "C" fn MessageHandler_get_send_only_message_handler(this_ptr: &MessageHandler) -> *const crate::lightning::ln::msgs::SendOnlyMessageHandler { + let mut inner_val = &mut MessageHandler::get_native_mut_ref(this_ptr).send_only_message_handler; + inner_val +} +/// A message handler which can be used to send messages. +/// +/// This should generally be a [`ChainMonitor`]. +/// +/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor +#[no_mangle] +pub extern "C" fn MessageHandler_set_send_only_message_handler(this_ptr: &mut MessageHandler, mut val: crate::lightning::ln::msgs::SendOnlyMessageHandler) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.send_only_message_handler = val; +} /// Constructs a new MessageHandler given each field #[must_use] #[no_mangle] -pub extern "C" fn MessageHandler_new(mut chan_handler_arg: crate::lightning::ln::msgs::ChannelMessageHandler, mut route_handler_arg: crate::lightning::ln::msgs::RoutingMessageHandler, mut onion_message_handler_arg: crate::lightning::ln::msgs::OnionMessageHandler, mut custom_message_handler_arg: crate::lightning::ln::peer_handler::CustomMessageHandler) -> MessageHandler { +pub extern "C" fn MessageHandler_new(mut chan_handler_arg: crate::lightning::ln::msgs::ChannelMessageHandler, mut route_handler_arg: crate::lightning::ln::msgs::RoutingMessageHandler, mut onion_message_handler_arg: crate::lightning::ln::msgs::OnionMessageHandler, mut custom_message_handler_arg: crate::lightning::ln::peer_handler::CustomMessageHandler, mut send_only_message_handler_arg: crate::lightning::ln::msgs::SendOnlyMessageHandler) -> MessageHandler { MessageHandler { inner: ObjOps::heap_alloc(nativeMessageHandler { chan_handler: chan_handler_arg, route_handler: route_handler_arg, onion_message_handler: onion_message_handler_arg, custom_message_handler: custom_message_handler_arg, + send_only_message_handler: send_only_message_handler_arg, }), is_owned: true } } /// Provides an object which can be used to send data to and which uniquely identifies a connection @@ -1160,16 +1260,15 @@ pub struct SocketDescriptor { /// /// If the returned size is smaller than `data.len()`, a /// [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be - /// written. Additionally, until a `send_data` event completes fully, no further - /// [`PeerManager::read_event`] calls should be made for the same peer! Because this is to - /// prevent denial-of-service issues, you should not read or buffer any data from the socket - /// until then. + /// written. /// - /// If a [`PeerManager::read_event`] call on this descriptor had previously returned true - /// (indicating that read events should be paused to prevent DoS in the send buffer), - /// `resume_read` may be set indicating that read events on this descriptor should resume. A - /// `resume_read` of false carries no meaning, and should not cause any action. - pub send_data: extern "C" fn (this_arg: *mut c_void, data: crate::c_types::u8slice, resume_read: bool) -> usize, + /// If `continue_read` is *not* set, further [`PeerManager::read_event`] calls should be + /// avoided until another call is made with it set. This allows us to pause read if there are + /// too many outgoing messages queued for a peer to avoid DoS issues where a peer fills our + /// buffer by sending us messages that need response without reading the responses. + /// + /// Note that calls may be made with an empty `data` to update the `continue_read` flag. + pub send_data: extern "C" fn (this_arg: *mut c_void, data: crate::c_types::u8slice, continue_read: bool) -> usize, /// Disconnect the socket pointed to by this SocketDescriptor. /// /// You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this @@ -1236,9 +1335,9 @@ impl Clone for SocketDescriptorRef { use lightning::ln::peer_handler::SocketDescriptor as rustSocketDescriptor; impl rustSocketDescriptor for SocketDescriptor { - fn send_data(&mut self, mut data: &[u8], mut resume_read: bool) -> usize { + fn send_data(&mut self, mut data: &[u8], mut continue_read: bool) -> usize { let mut local_data = crate::c_types::u8slice::from_slice(data); - let mut ret = (self.send_data)(self.this_arg, local_data, resume_read); + let mut ret = (self.send_data)(self.this_arg, local_data, continue_read); ret } fn disconnect_socket(&mut self) { @@ -1248,9 +1347,9 @@ impl rustSocketDescriptor for SocketDescriptor { pub struct SocketDescriptorRef(SocketDescriptor); impl rustSocketDescriptor for SocketDescriptorRef { - fn send_data(&mut self, mut data: &[u8], mut resume_read: bool) -> usize { + fn send_data(&mut self, mut data: &[u8], mut continue_read: bool) -> usize { let mut local_data = crate::c_types::u8slice::from_slice(data); - let mut ret = (self.0.send_data)(self.0.this_arg, local_data, resume_read); + let mut ret = (self.0.send_data)(self.0.this_arg, local_data, continue_read); ret } fn disconnect_socket(&mut self) { @@ -1347,7 +1446,7 @@ impl PeerDetails { /// passed in to [`PeerManager::new_outbound_connection`]. #[no_mangle] pub extern "C" fn PeerDetails_get_counterparty_node_id(this_ptr: &PeerDetails) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_node_id; + let mut inner_val = &mut PeerDetails::get_native_mut_ref(this_ptr).counterparty_node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// The node id of the peer. @@ -1366,7 +1465,7 @@ pub extern "C" fn PeerDetails_set_counterparty_node_id(this_ptr: &mut PeerDetail /// Returns a copy of the field. #[no_mangle] pub extern "C" fn PeerDetails_get_socket_address(this_ptr: &PeerDetails) -> crate::c_types::derived::COption_SocketAddressZ { - let mut inner_val = this_ptr.get_native_mut_ref().socket_address.clone(); + let mut inner_val = PeerDetails::get_native_mut_ref(this_ptr).socket_address.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( { crate::lightning::ln::msgs::SocketAddress::native_into(inner_val.unwrap()) }) }; local_inner_val } @@ -1382,7 +1481,7 @@ pub extern "C" fn PeerDetails_set_socket_address(this_ptr: &mut PeerDetails, mut /// The features the peer provided in the initial handshake. #[no_mangle] pub extern "C" fn PeerDetails_get_init_features(this_ptr: &PeerDetails) -> crate::lightning_types::features::InitFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().init_features; + let mut inner_val = &mut PeerDetails::get_native_mut_ref(this_ptr).init_features; crate::lightning_types::features::InitFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::InitFeatures<>) as *mut _) }, is_owned: false } } /// The features the peer provided in the initial handshake. @@ -1395,7 +1494,7 @@ pub extern "C" fn PeerDetails_set_init_features(this_ptr: &mut PeerDetails, mut /// Will be `true` for inbound connections, and `false` for outbound connections. #[no_mangle] pub extern "C" fn PeerDetails_get_is_inbound_connection(this_ptr: &PeerDetails) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().is_inbound_connection; + let mut inner_val = &mut PeerDetails::get_native_mut_ref(this_ptr).is_inbound_connection; *inner_val } /// Indicates the direction of the peer connection. @@ -1490,7 +1589,7 @@ impl Clone for PeerHandleError { fn clone(&self) -> Self { Self { inner: if <*mut nativePeerHandleError>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1498,12 +1597,12 @@ impl Clone for PeerHandleError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PeerHandleError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePeerHandleError)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePeerHandleError) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PeerHandleError pub extern "C" fn PeerHandleError_clone(orig: &PeerHandleError) -> PeerHandleError { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PeerHandleError object pub extern "C" fn PeerHandleError_debug_str_void(o: *const c_void) -> Str { @@ -1515,7 +1614,7 @@ pub extern "C" fn PeerHandleError_to_str(o: &crate::lightning::ln::peer_handler: } use lightning::ln::peer_handler::PeerManager as nativePeerManagerImport; -pub(crate) type nativePeerManager = nativePeerManagerImport; +pub(crate) type nativePeerManager = nativePeerManagerImport; /// A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls /// socket events into messages which it passes on to its [`MessageHandler`]. @@ -1704,11 +1803,9 @@ pub extern "C" fn PeerManager_write_buffer_space_avail(this_arg: &crate::lightni /// /// Will *not* call back into [`send_data`] on any descriptors to avoid reentrancy complexity. /// Thus, however, you should call [`process_events`] after any `read_event` to generate -/// [`send_data`] calls to handle responses. -/// -/// If `Ok(true)` is returned, further read_events should not be triggered until a -/// [`send_data`] call on this descriptor has `resume_read` set (preventing DoS issues in the -/// send buffer). +/// [`send_data`] calls to handle responses. This is also important to give [`send_data`] calls +/// a chance to pause reads if too many messages have been queued in response allowing a peer +/// to bloat our memory. /// /// In order to avoid processing too many messages at once per peer, `data` should be on the /// order of 4KiB. @@ -1717,9 +1814,9 @@ pub extern "C" fn PeerManager_write_buffer_space_avail(this_arg: &crate::lightni /// [`process_events`]: PeerManager::process_events #[must_use] #[no_mangle] -pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_handler::PeerManager, peer_descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor, mut data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_boolPeerHandleErrorZ { +pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_handler::PeerManager, peer_descriptor: &mut crate::lightning::ln::peer_handler::SocketDescriptor, mut data: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NonePeerHandleErrorZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_event(peer_descriptor, data.to_slice()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::peer_handler::PeerHandleError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -1743,6 +1840,8 @@ pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_h /// [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards /// [`send_data`]: SocketDescriptor::send_data +/// [`lightning-net-tokio`]: https://docs.rs/lightning-net-tokio/latest/lightning_net_tokio +/// [`lightning-background-processor`]: https://docs.rs/lightning-background-processor/latest/lightning_background_processor #[no_mangle] pub extern "C" fn PeerManager_process_events(this_arg: &crate::lightning::ln::peer_handler::PeerManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_events() @@ -1803,7 +1902,7 @@ pub extern "C" fn PeerManager_timer_tick_occurred(this_arg: &crate::lightning::l /// /// Panics if `addresses` is absurdly large (more than 100). /// -/// [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events +/// [`get_and_clear_pending_msg_events`]: BaseMessageHandler::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_SocketAddressZ) { let mut local_addresses = Vec::new(); for mut item in addresses.into_rust().drain(..) { local_addresses.push( { item.into_native() }); }; diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index 9d21f8ac..d2efa4fa 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -83,7 +83,7 @@ impl Clone for ShutdownScript { fn clone(&self) -> Self { Self { inner: if <*mut nativeShutdownScript>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -91,12 +91,12 @@ impl Clone for ShutdownScript { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ShutdownScript_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeShutdownScript)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeShutdownScript) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ShutdownScript pub extern "C" fn ShutdownScript_clone(orig: &ShutdownScript) -> ShutdownScript { - orig.clone() + Clone::clone(orig) } /// Checks if two ShutdownScripts contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -172,7 +172,7 @@ impl InvalidShutdownScript { /// [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md #[no_mangle] pub extern "C" fn InvalidShutdownScript_get_script(this_ptr: &InvalidShutdownScript) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().script; + let mut inner_val = &mut InvalidShutdownScript::get_native_mut_ref(this_ptr).script; inner_val.as_bytes().to_vec().into() } /// The script that did not meet the requirements from [BOLT #2]. @@ -194,7 +194,7 @@ impl Clone for InvalidShutdownScript { fn clone(&self) -> Self { Self { inner: if <*mut nativeInvalidShutdownScript>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -202,12 +202,12 @@ impl Clone for InvalidShutdownScript { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvalidShutdownScript_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvalidShutdownScript)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInvalidShutdownScript) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InvalidShutdownScript pub extern "C" fn InvalidShutdownScript_clone(orig: &InvalidShutdownScript) -> InvalidShutdownScript { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InvalidShutdownScript object pub extern "C" fn InvalidShutdownScript_debug_str_void(o: *const c_void) -> Str { @@ -281,7 +281,8 @@ pub extern "C" fn ShutdownScript_as_legacy_pubkey(this_arg: &crate::lightning::l /// Returns whether the shutdown script is compatible with the features as defined by BOLT #2. /// -/// Specifically, checks for compliance with feature `option_shutdown_anysegwit`. +/// Specifically, checks for compliance with feature `option_shutdown_anysegwit` and/or +/// `option_simple_close`. #[must_use] #[no_mangle] pub extern "C" fn ShutdownScript_is_compatible(this_arg: &crate::lightning::ln::script::ShutdownScript, features: &crate::lightning_types::features::InitFeatures) -> bool { diff --git a/lightning-c-bindings/src/lightning/ln/types.rs b/lightning-c-bindings/src/lightning/ln/types.rs index 21f06c9d..44eb2173 100644 --- a/lightning-c-bindings/src/lightning/ln/types.rs +++ b/lightning-c-bindings/src/lightning/ln/types.rs @@ -86,7 +86,7 @@ impl ChannelId { } #[no_mangle] pub extern "C" fn ChannelId_get_a(this_ptr: &ChannelId) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut ChannelId::get_native_mut_ref(this_ptr).0; inner_val } #[no_mangle] @@ -105,7 +105,7 @@ impl Clone for ChannelId { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelId>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -113,12 +113,12 @@ impl Clone for ChannelId { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelId_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelId)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelId) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelId pub extern "C" fn ChannelId_clone(orig: &ChannelId) -> ChannelId { - orig.clone() + Clone::clone(orig) } /// Checks if two ChannelIds contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -207,6 +207,14 @@ pub extern "C" fn ChannelId_temporary_v2_from_revocation_basepoint(our_revocatio crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Indicates whether this is a V2 channel ID for the given local and remote revocation basepoints. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelId_is_v2_channel_id(this_arg: &crate::lightning::ln::types::ChannelId, ours: &crate::lightning::ln::channel_keys::RevocationBasepoint, theirs: &crate::lightning::ln::channel_keys::RevocationBasepoint) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_v2_channel_id(ours.get_native_ref(), theirs.get_native_ref()); + ret +} + #[no_mangle] /// Serialize the ChannelId object into a byte array which can be read by ChannelId_read pub extern "C" fn ChannelId_write(obj: &crate::lightning::ln::types::ChannelId) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/mod.rs b/lightning-c-bindings/src/lightning/mod.rs index 5f39d010..1e5e8e7c 100644 --- a/lightning-c-bindings/src/lightning/mod.rs +++ b/lightning-c-bindings/src/lightning/mod.rs @@ -37,14 +37,14 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; pub mod util; +pub mod blinded_path; pub mod chain; +pub mod events; pub mod ln; pub mod offers; +pub mod onion_message; pub mod routing; pub mod sign; -pub mod onion_message; -pub mod blinded_path; -pub mod events; pub mod io; mod crypto { @@ -92,7 +92,8 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -mod real_chachapoly { +} +mod poly1305 { use alloc::str::FromStr; use alloc::string::String; @@ -103,9 +104,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -} -} -mod poly1305 { +mod real_poly1305 { use alloc::str::FromStr; use alloc::string::String; @@ -116,6 +115,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +} } mod streams { diff --git a/lightning-c-bindings/src/lightning/offers/async_receive_offer_cache.rs b/lightning-c-bindings/src/lightning/offers/async_receive_offer_cache.rs new file mode 100644 index 00000000..23374118 --- /dev/null +++ b/lightning-c-bindings/src/lightning/offers/async_receive_offer_cache.rs @@ -0,0 +1,139 @@ +// 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 caching offers that we interactively build with a static invoice +//! server as an async recipient. The static invoice server will serve the resulting invoices to +//! payers on our behalf when we're offline. + +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::async_receive_offer_cache::AsyncReceiveOfferCache as nativeAsyncReceiveOfferCacheImport; +pub(crate) type nativeAsyncReceiveOfferCache = nativeAsyncReceiveOfferCacheImport; + +/// If we are an often-offline recipient, we'll want to interactively build offers and static +/// invoices with an always-online node that will serve those static invoices to payers on our +/// behalf when we are offline. +/// +/// This struct is used to cache those interactively built offers, and should be passed into +/// [`OffersMessageFlow`] on startup as well as persisted whenever an offer or invoice is updated. +/// +/// ## Lifecycle of a cached offer +/// +/// 1. On initial startup, recipients will request offer paths from the static invoice server +/// 2. Once a set of offer paths is received, recipients will build an offer and corresponding +/// static invoice, cache the offer as pending, and send the invoice to the server for +/// persistence +/// 3. Once the invoice is confirmed as persisted by the server, the recipient will mark the +/// corresponding offer as ready to receive payments +/// 4. If the offer is later returned to the user, it will be kept cached and its invoice will be +/// kept up-to-date until the offer expires +/// 5. If the offer does not get returned to the user within a certain timeframe, it will be +/// replaced with a new one using fresh offer paths requested from the static invoice server +/// +/// ## Staying in sync with the Static Invoice Server +/// +/// * Pending offers: for a given cached offer where a corresponding invoice is not yet confirmed as +/// persisted by the static invoice server, we will retry persisting an invoice for that offer until +/// it succeeds, once per timer tick +/// * Confirmed offers that have not yet been returned to the user: we will periodically replace an +/// unused confirmed offer with a new one, to try to always have a fresh offer available. We wait +/// several hours in between replacements to ensure the new offer replacement doesn't conflict with +/// the old one +/// * Confirmed offers that have been returned to the user: we will send the server a fresh invoice +/// corresponding to each used offer once per timer tick until the offer expires +/// +/// [`OffersMessageFlow`]: crate::offers::flow::OffersMessageFlow +#[must_use] +#[repr(C)] +pub struct AsyncReceiveOfferCache { + /// 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 nativeAsyncReceiveOfferCache, + /// 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 core::ops::Deref for AsyncReceiveOfferCache { + type Target = nativeAsyncReceiveOfferCache; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for AsyncReceiveOfferCache { } +unsafe impl core::marker::Sync for AsyncReceiveOfferCache { } +impl Drop for AsyncReceiveOfferCache { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeAsyncReceiveOfferCache>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the AsyncReceiveOfferCache, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn AsyncReceiveOfferCache_free(this_obj: AsyncReceiveOfferCache) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AsyncReceiveOfferCache_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAsyncReceiveOfferCache) }; +} +#[allow(unused)] +impl AsyncReceiveOfferCache { + pub(crate) fn get_native_ref(&self) -> &'static nativeAsyncReceiveOfferCache { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAsyncReceiveOfferCache { + 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 nativeAsyncReceiveOfferCache { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Creates an empty [`AsyncReceiveOfferCache`] to be passed into [`OffersMessageFlow`]. +/// +/// [`OffersMessageFlow`]: crate::offers::flow::OffersMessageFlow +#[must_use] +#[no_mangle] +pub extern "C" fn AsyncReceiveOfferCache_new() -> crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache { + let mut ret = lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache::new(); + crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +#[no_mangle] +/// Serialize the AsyncReceiveOfferCache object into a byte array which can be read by AsyncReceiveOfferCache_read +pub extern "C" fn AsyncReceiveOfferCache_write(obj: &crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn AsyncReceiveOfferCache_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::offers::async_receive_offer_cache::nativeAsyncReceiveOfferCache) }) +} +#[no_mangle] +/// Read a AsyncReceiveOfferCache from a byte array, created by AsyncReceiveOfferCache_write +pub extern "C" fn AsyncReceiveOfferCache_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AsyncReceiveOfferCacheDecodeErrorZ { + 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::offers::async_receive_offer_cache::AsyncReceiveOfferCache { 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/offers/flow.rs b/lightning-c-bindings/src/lightning/offers/flow.rs new file mode 100644 index 00000000..21c59a2e --- /dev/null +++ b/lightning-c-bindings/src/lightning/offers/flow.rs @@ -0,0 +1,773 @@ +// 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 data structures and functions for creating and managing Offers messages, +//! facilitating communication, and handling BOLT12 messages and payments. + +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::flow::OffersMessageFlow as nativeOffersMessageFlowImport; +pub(crate) type nativeOffersMessageFlow = nativeOffersMessageFlowImport; + +/// A BOLT12 offers code and flow utility provider, which facilitates +/// BOLT12 builder generation and onion message handling. +/// +/// [`OffersMessageFlow`] is parameterized by a [`MessageRouter`], which is responsible +/// for finding message paths when initiating and retrying onion messages. +#[must_use] +#[repr(C)] +pub struct OffersMessageFlow { + /// 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 nativeOffersMessageFlow, + /// 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 core::ops::Deref for OffersMessageFlow { + type Target = nativeOffersMessageFlow; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OffersMessageFlow { } +unsafe impl core::marker::Sync for OffersMessageFlow { } +impl Drop for OffersMessageFlow { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOffersMessageFlow>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OffersMessageFlow, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OffersMessageFlow_free(this_obj: OffersMessageFlow) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OffersMessageFlow_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOffersMessageFlow) }; +} +#[allow(unused)] +impl OffersMessageFlow { + pub(crate) fn get_native_ref(&self) -> &'static nativeOffersMessageFlow { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOffersMessageFlow { + 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 nativeOffersMessageFlow { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Creates a new [`OffersMessageFlow`] +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_new(mut chain_hash: crate::c_types::ThirtyTwoBytes, mut best_block: crate::lightning::chain::BestBlock, mut our_network_pubkey: crate::c_types::PublicKey, mut current_timestamp: u32, mut inbound_payment_key: crate::lightning::ln::inbound_payment::ExpandedKey, mut receive_auth_key: crate::lightning::sign::ReceiveAuthKey, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::offers::flow::OffersMessageFlow { + let mut ret = lightning::offers::flow::OffersMessageFlow::new(::bitcoin::constants::ChainHash::from(&chain_hash.data), *unsafe { Box::from_raw(best_block.take_inner()) }, our_network_pubkey.into_rust(), current_timestamp, *unsafe { Box::from_raw(inbound_payment_key.take_inner()) }, *unsafe { Box::from_raw(receive_auth_key.take_inner()) }, message_router, logger); + crate::lightning::offers::flow::OffersMessageFlow { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// If we are an async recipient, on startup we'll interactively build offers and static invoices +/// with an always-online node that will serve static invoices on our behalf. Once the offer is +/// built and the static invoice is confirmed as persisted by the server, the underlying +/// [`AsyncReceiveOfferCache`] should be persisted using +/// [`Self::writeable_async_receive_offer_cache`] so we remember the offers we've built. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_with_async_payments_offers_cache(mut this_arg: crate::lightning::offers::flow::OffersMessageFlow, mut async_receive_offer_cache: crate::lightning::offers::async_receive_offer_cache::AsyncReceiveOfferCache) -> crate::lightning::offers::flow::OffersMessageFlow { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).with_async_payments_offers_cache(*unsafe { Box::from_raw(async_receive_offer_cache.take_inner()) }); + crate::lightning::offers::flow::OffersMessageFlow { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Sets the [`BlindedMessagePath`]s that we will use as an async recipient to interactively build +/// [`Offer`]s with a static invoice server, so the server can serve [`StaticInvoice`]s to payers +/// on our behalf when we're offline. +/// +/// This method will also send out messages initiating async offer creation to the static invoice +/// server, if any peers are connected. +/// +/// This method only needs to be called once when the server first takes on the recipient as a +/// client, or when the paths change, e.g. if the paths are set to expire at a particular time. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_set_paths_to_static_invoice_server(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut paths_to_static_invoice_server: crate::c_types::derived::CVec_BlindedMessagePathZ, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut local_paths_to_static_invoice_server = Vec::new(); for mut item in paths_to_static_invoice_server.into_rust().drain(..) { local_paths_to_static_invoice_server.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.set_paths_to_static_invoice_server(local_paths_to_static_invoice_server, local_peers); + 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 +} + +/// Notifies the [`OffersMessageFlow`] that a new block has been observed. +/// +/// This allows the flow to keep in sync with the latest block timestamp, +/// which may be used for time-sensitive operations. +/// +/// Must be called whenever a new chain tip becomes available. May be skipped +/// for intermediary blocks. +#[no_mangle] +pub extern "C" fn OffersMessageFlow_best_block_updated(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, header: *const [u8; 80], mut _height: u32) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.best_block_updated(&::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), _height) +} + +/// The maximum size of a received [`StaticInvoice`] before we'll fail verification in +/// [`OffersMessageFlow::verify_serve_static_invoice_message]. + +#[no_mangle] +pub static MAX_STATIC_INVOICE_SIZE_BYTES: usize = lightning::offers::flow::MAX_STATIC_INVOICE_SIZE_BYTES; +/// [`BlindedMessagePath`]s for an async recipient to communicate with this node and interactively +/// build [`Offer`]s and [`StaticInvoice`]s for receiving async payments. +/// +/// If `relative_expiry` is unset, the [`BlindedMessagePath`]s will never expire. +/// +/// Returns the paths that the recipient should be configured with via +/// [`Self::set_paths_to_static_invoice_server`]. +/// +/// Errors if blinded path creation fails or the provided `recipient_id` is larger than 1KiB. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_blinded_paths_for_async_recipient(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut recipient_id: crate::c_types::derived::CVec_u8Z, mut relative_expiry: crate::c_types::derived::COption_u64Z, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + let mut local_relative_expiry = { /*relative_expiry*/ let relative_expiry_opt = relative_expiry; if relative_expiry_opt.is_none() { None } else { Some({ { core::time::Duration::from_secs({ relative_expiry_opt.take() }) }})} }; + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.blinded_paths_for_async_recipient(local_recipient_id, local_relative_expiry, local_peers); + 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::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Instructions for how to respond to an `InvoiceRequest`. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum InvreqResponseInstructions { + /// We are the recipient of this payment, and a [`Bolt12Invoice`] should be sent in response to + /// the invoice request since it is now verified. + SendInvoice( + crate::lightning::offers::invoice_request::VerifiedInvoiceRequest), + /// We are a static invoice server and should respond to this invoice request by retrieving the + /// [`StaticInvoice`] corresponding to the `recipient_id` and `invoice_slot` and calling + /// [`OffersMessageFlow::enqueue_static_invoice`]. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + SendStaticInvoice { + /// An identifier for the async recipient for whom we are serving [`StaticInvoice`]s. + /// + /// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice + recipient_id: crate::c_types::derived::CVec_u8Z, + /// The slot number for the specific invoice being requested by the payer. + invoice_slot: u16, + /// The invoice request that should be forwarded to the async recipient in case the + /// recipient is online to respond. Should be forwarded by calling + /// [`OffersMessageFlow::enqueue_invoice_request_to_forward`]. + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, + }, +} +use lightning::offers::flow::InvreqResponseInstructions as InvreqResponseInstructionsImport; +pub(crate) type nativeInvreqResponseInstructions = InvreqResponseInstructionsImport; + +impl InvreqResponseInstructions { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeInvreqResponseInstructions { + match self { + InvreqResponseInstructions::SendInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeInvreqResponseInstructions::SendInvoice ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + InvreqResponseInstructions::SendStaticInvoice {ref recipient_id, ref invoice_slot, ref invoice_request, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.into_rust().drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut invoice_request_nonref = Clone::clone(invoice_request); + nativeInvreqResponseInstructions::SendStaticInvoice { + recipient_id: local_recipient_id_nonref, + invoice_slot: invoice_slot_nonref, + invoice_request: *unsafe { Box::from_raw(invoice_request_nonref.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeInvreqResponseInstructions { + match self { + InvreqResponseInstructions::SendInvoice (mut a, ) => { + nativeInvreqResponseInstructions::SendInvoice ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + InvreqResponseInstructions::SendStaticInvoice {mut recipient_id, mut invoice_slot, mut invoice_request, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.into_rust().drain(..) { local_recipient_id.push( { item }); }; + nativeInvreqResponseInstructions::SendStaticInvoice { + recipient_id: local_recipient_id, + invoice_slot: invoice_slot, + invoice_request: *unsafe { Box::from_raw(invoice_request.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &InvreqResponseInstructionsImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeInvreqResponseInstructions) }; + match native { + nativeInvreqResponseInstructions::SendInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + InvreqResponseInstructions::SendInvoice ( + crate::lightning::offers::invoice_request::VerifiedInvoiceRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeInvreqResponseInstructions::SendStaticInvoice {ref recipient_id, ref invoice_slot, ref invoice_request, } => { + let mut recipient_id_nonref = Clone::clone(recipient_id); + let mut local_recipient_id_nonref = Vec::new(); for mut item in recipient_id_nonref.drain(..) { local_recipient_id_nonref.push( { item }); }; + let mut invoice_slot_nonref = Clone::clone(invoice_slot); + let mut invoice_request_nonref = Clone::clone(invoice_request); + InvreqResponseInstructions::SendStaticInvoice { + recipient_id: local_recipient_id_nonref.into(), + invoice_slot: invoice_slot_nonref, + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(invoice_request_nonref), is_owned: true }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeInvreqResponseInstructions) -> Self { + match native { + nativeInvreqResponseInstructions::SendInvoice (mut a, ) => { + InvreqResponseInstructions::SendInvoice ( + crate::lightning::offers::invoice_request::VerifiedInvoiceRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeInvreqResponseInstructions::SendStaticInvoice {mut recipient_id, mut invoice_slot, mut invoice_request, } => { + let mut local_recipient_id = Vec::new(); for mut item in recipient_id.drain(..) { local_recipient_id.push( { item }); }; + InvreqResponseInstructions::SendStaticInvoice { + recipient_id: local_recipient_id.into(), + invoice_slot: invoice_slot, + invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(invoice_request), is_owned: true }, + } + }, + } + } +} +/// Frees any resources used by the InvreqResponseInstructions +#[no_mangle] +pub extern "C" fn InvreqResponseInstructions_free(this_ptr: InvreqResponseInstructions) { } +/// Creates a copy of the InvreqResponseInstructions +#[no_mangle] +pub extern "C" fn InvreqResponseInstructions_clone(orig: &InvreqResponseInstructions) -> InvreqResponseInstructions { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InvreqResponseInstructions_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const InvreqResponseInstructions)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InvreqResponseInstructions_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut InvreqResponseInstructions) }; +} +#[no_mangle] +/// Utility method to constructs a new SendInvoice-variant InvreqResponseInstructions +pub extern "C" fn InvreqResponseInstructions_send_invoice(a: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> InvreqResponseInstructions { + InvreqResponseInstructions::SendInvoice(a, ) +} +#[no_mangle] +/// Utility method to constructs a new SendStaticInvoice-variant InvreqResponseInstructions +pub extern "C" fn InvreqResponseInstructions_send_static_invoice(recipient_id: crate::c_types::derived::CVec_u8Z, invoice_slot: u16, invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest) -> InvreqResponseInstructions { + InvreqResponseInstructions::SendStaticInvoice { + recipient_id, + invoice_slot, + invoice_request, + } +} +/// Parameters for the reply path to a [`HeldHtlcAvailable`] onion message. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum HeldHtlcReplyPath { + /// The reply path to the [`HeldHtlcAvailable`] message should terminate at our node. + ToUs { + /// The id of the payment. + payment_id: crate::c_types::ThirtyTwoBytes, + /// The peers to use when creating this reply path. + peers: crate::c_types::derived::CVec_MessageForwardNodeZ, + }, + /// The reply path to the [`HeldHtlcAvailable`] message should terminate at our next-hop channel + /// counterparty, as they are holding our HTLC until they receive the corresponding + /// [`ReleaseHeldHtlc`] message. + /// + /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + ToCounterparty { + /// The blinded path provided to us by our counterparty. + path: crate::lightning::blinded_path::message::BlindedMessagePath, + }, +} +use lightning::offers::flow::HeldHtlcReplyPath as HeldHtlcReplyPathImport; +pub(crate) type nativeHeldHtlcReplyPath = HeldHtlcReplyPathImport; + +impl HeldHtlcReplyPath { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeHeldHtlcReplyPath { + match self { + HeldHtlcReplyPath::ToUs {ref payment_id, ref peers, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + let mut peers_nonref = Clone::clone(peers); + let mut local_peers_nonref = Vec::new(); for mut item in peers_nonref.into_rust().drain(..) { local_peers_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + nativeHeldHtlcReplyPath::ToUs { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), + peers: local_peers_nonref, + } + }, + HeldHtlcReplyPath::ToCounterparty {ref path, } => { + let mut path_nonref = Clone::clone(path); + nativeHeldHtlcReplyPath::ToCounterparty { + path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeHeldHtlcReplyPath { + match self { + HeldHtlcReplyPath::ToUs {mut payment_id, mut peers, } => { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + nativeHeldHtlcReplyPath::ToUs { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), + peers: local_peers, + } + }, + HeldHtlcReplyPath::ToCounterparty {mut path, } => { + nativeHeldHtlcReplyPath::ToCounterparty { + path: *unsafe { Box::from_raw(path.take_inner()) }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &HeldHtlcReplyPathImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeHeldHtlcReplyPath) }; + match native { + nativeHeldHtlcReplyPath::ToUs {ref payment_id, ref peers, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + let mut peers_nonref = Clone::clone(peers); + let mut local_peers_nonref = Vec::new(); for mut item in peers_nonref.drain(..) { local_peers_nonref.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + HeldHtlcReplyPath::ToUs { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, + peers: local_peers_nonref.into(), + } + }, + nativeHeldHtlcReplyPath::ToCounterparty {ref path, } => { + let mut path_nonref = Clone::clone(path); + HeldHtlcReplyPath::ToCounterparty { + path: crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(path_nonref), is_owned: true }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeHeldHtlcReplyPath) -> Self { + match native { + nativeHeldHtlcReplyPath::ToUs {mut payment_id, mut peers, } => { + let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + HeldHtlcReplyPath::ToUs { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, + peers: local_peers.into(), + } + }, + nativeHeldHtlcReplyPath::ToCounterparty {mut path, } => { + HeldHtlcReplyPath::ToCounterparty { + path: crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(path), is_owned: true }, + } + }, + } + } +} +/// Frees any resources used by the HeldHtlcReplyPath +#[no_mangle] +pub extern "C" fn HeldHtlcReplyPath_free(this_ptr: HeldHtlcReplyPath) { } +/// Creates a copy of the HeldHtlcReplyPath +#[no_mangle] +pub extern "C" fn HeldHtlcReplyPath_clone(orig: &HeldHtlcReplyPath) -> HeldHtlcReplyPath { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HeldHtlcReplyPath_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const HeldHtlcReplyPath)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HeldHtlcReplyPath_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut HeldHtlcReplyPath) }; +} +#[no_mangle] +/// Utility method to constructs a new ToUs-variant HeldHtlcReplyPath +pub extern "C" fn HeldHtlcReplyPath_to_us(payment_id: crate::c_types::ThirtyTwoBytes, peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> HeldHtlcReplyPath { + HeldHtlcReplyPath::ToUs { + payment_id, + peers, + } +} +#[no_mangle] +/// Utility method to constructs a new ToCounterparty-variant HeldHtlcReplyPath +pub extern "C" fn HeldHtlcReplyPath_to_counterparty(path: crate::lightning::blinded_path::message::BlindedMessagePath) -> HeldHtlcReplyPath { + HeldHtlcReplyPath::ToCounterparty { + path, + } +} +/// Verifies an [`InvoiceRequest`] using the provided [`OffersContext`] or the [`InvoiceRequest::metadata`]. +/// +/// - If an [`OffersContext::InvoiceRequest`] with a `nonce` is provided, verification is performed using recipient context data. +/// - If no context is provided but the [`InvoiceRequest`] contains [`Offer`] metadata, verification is performed using that metadata. +/// - If neither is available, verification fails. +/// +/// # Errors +/// +/// Returns an error if: +/// - Both [`OffersContext`] and [`InvoiceRequest`] metadata are absent or invalid. +/// - The verification process (via recipient context data or metadata) fails. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_verify_invoice_request(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, mut context: crate::c_types::derived::COption_OffersContextZ) -> crate::c_types::derived::CResult_InvreqResponseInstructionsNoneZ { + let mut local_context = { /*context*/ let context_opt = context; if context_opt.is_none() { None } else { Some({ { { context_opt.take() }.into_native() }})} }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify_invoice_request(*unsafe { Box::from_raw(invoice_request.take_inner()) }, local_context); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::flow::InvreqResponseInstructions::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Verifies a [`Bolt12Invoice`] using the provided [`OffersContext`] or the invoice's payer metadata, +/// returning the corresponding [`PaymentId`] if successful. +/// +/// - If an [`OffersContext::OutboundPayment`] with a `nonce` is provided, verification is performed +/// using this to form the payer metadata. +/// - If no context is provided and the invoice corresponds to a [`Refund`] without blinded paths, +/// verification is performed using the [`Bolt12Invoice::payer_metadata`]. +/// - If neither condition is met, verification fails. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_verify_bolt12_invoice(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, invoice: &crate::lightning::offers::invoice::Bolt12Invoice, mut context: crate::c_types::derived::COption_OffersContextZ) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { + let mut local_context_base = { /*context*/ let context_opt = context; if context_opt.is_none() { None } else { Some({ { { context_opt.take() }.into_native() }})} }; let mut local_context = local_context_base.as_ref(); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify_bolt12_invoice(invoice.get_native_ref(), local_context); + 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 +} + +/// Verifies the provided [`AsyncPaymentsContext`] for an inbound [`HeldHtlcAvailable`] message. +/// +/// Because blinded path contexts are verified as a part of onion message processing, this only +/// validates that the context is not yet expired based on `path_absolute_expiry`. +/// +/// # Errors +/// +/// Returns `Err(())` if: +/// - The inbound payment context has expired. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_verify_inbound_async_payment_context(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify_inbound_async_payment_context(context.into_native()); + 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 +} + +/// Creates a response for the provided [`VerifiedInvoiceRequest`]. +/// +/// A response can be either an [`OffersMessage::Invoice`] with additional [`MessageContext`], +/// or an [`OffersMessage::InvoiceError`], depending on the [`InvoiceRequest`]. +/// +/// An [`OffersMessage::InvoiceError`] will be generated if: +/// - We fail to generate valid payment paths to include in the [`Bolt12Invoice`]. +/// - We fail to generate a valid signed [`Bolt12Invoice`] for the [`InvoiceRequest`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_create_response_for_invoice_request(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, signer: &crate::lightning::sign::NodeSigner, router: &crate::lightning::routing::router::Router, mut entropy_source: crate::lightning::sign::EntropySource, mut invoice_request: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, mut amount_msats: u64, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut usable_channels: crate::c_types::derived::CVec_ChannelDetailsZ) -> crate::c_types::derived::C2Tuple_OffersMessageCOption_MessageContextZZ { + let mut local_usable_channels = Vec::new(); for mut item in usable_channels.into_rust().drain(..) { local_usable_channels.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_response_for_invoice_request(signer, router, entropy_source, *unsafe { Box::from_raw(invoice_request.take_inner()) }, amount_msats, ::lightning::types::payment::PaymentHash(payment_hash.data), ::lightning::types::payment::PaymentSecret(payment_secret.data), local_usable_channels); + let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_orig_ret_1 = if orig_ret_1.is_none() { crate::c_types::derived::COption_MessageContextZ::None } else { crate::c_types::derived::COption_MessageContextZ::Some( { crate::lightning::blinded_path::message::MessageContext::native_into(orig_ret_1.unwrap()) }) }; let mut local_ret = (crate::lightning::onion_message::offers::OffersMessage::native_into(orig_ret_0), local_orig_ret_1).into(); + local_ret +} + +/// Enqueues the created [`InvoiceRequest`] to be sent to the counterparty. +/// +/// # Payment +/// +/// The provided `payment_id` is used to create a unique [`MessageContext`] for the +/// blinded paths sent to the counterparty. This allows them to respond with an invoice, +/// over those blinded paths, which can be verified against the intended outbound payment, +/// ensuring the invoice corresponds to a payment we actually want to make. +/// +/// # Nonce +/// The nonce is used to create a unique [`MessageContext`] for the reply paths. +/// These will be used to verify the corresponding [`Bolt12Invoice`] when it is received. +/// +/// Note: The provided [`Nonce`] MUST be the same as the [`Nonce`] used for creating the +/// [`InvoiceRequest`] to ensure correct verification of the corresponding [`Bolt12Invoice`]. +/// +/// See [`OffersMessageFlow::create_invoice_request_builder`] for more details. +/// +/// # Peers +/// +/// The user must provide a list of [`MessageForwardNode`] that will be used to generate +/// valid reply paths for the counterparty to send back the corresponding [`Bolt12Invoice`] +/// or [`InvoiceError`]. +/// +/// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_invoice_request(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, mut payment_id: crate::c_types::ThirtyTwoBytes, mut nonce: crate::lightning::offers::nonce::Nonce, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_invoice_request(*unsafe { Box::from_raw(invoice_request.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(nonce.take_inner()) }, local_peers); + 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Enqueues the created [`Bolt12Invoice`] corresponding to a [`Refund`] to be sent +/// to the counterparty. +/// +/// # Peers +/// +/// The user must provide a list of [`MessageForwardNode`] that will be used to generate valid +/// reply paths for the counterparty to send back the corresponding [`InvoiceError`] if we fail +/// to create blinded reply paths +/// +/// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_invoice(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut invoice: crate::lightning::offers::invoice::Bolt12Invoice, refund: &crate::lightning::offers::refund::Refund, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_invoice(*unsafe { Box::from_raw(invoice.take_inner()) }, refund.get_native_ref(), local_peers); + 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Forwards a [`StaticInvoice`] over the provided [`Responder`] in response to an +/// [`InvoiceRequest`] that we as a static invoice server received on behalf of an often-offline +/// recipient. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_static_invoice(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut invoice: crate::lightning::offers::static_invoice::StaticInvoice, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_static_invoice(*unsafe { Box::from_raw(invoice.take_inner()) }, *unsafe { Box::from_raw(responder.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Forwards an [`InvoiceRequest`] to the specified [`BlindedMessagePath`]. If we receive an +/// invoice request as a static invoice server on behalf of an often-offline recipient this +/// can be used to forward the request to give the recipient a chance to provide an +/// invoice if the recipient is online. The reply_path [`Responder`] provided is the path to +/// the sender where the recipient can send the invoice. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath +/// [`Responder`]: crate::onion_message::messenger::Responder +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_invoice_request_to_forward(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut invoice_request: crate::lightning::offers::invoice_request::InvoiceRequest, mut destination: crate::lightning::blinded_path::message::BlindedMessagePath, mut reply_path: crate::lightning::onion_message::messenger::Responder) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_invoice_request_to_forward(*unsafe { Box::from_raw(invoice_request.take_inner()) }, *unsafe { Box::from_raw(destination.take_inner()) }, *unsafe { Box::from_raw(reply_path.take_inner()) }) +} + +/// Enqueues `held_htlc_available` onion messages to be sent to the payee via the reply paths +/// contained within the provided [`StaticInvoice`]. +/// +/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc +/// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_held_htlc_available(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, invoice: &crate::lightning::offers::static_invoice::StaticInvoice, mut reply_path_params: crate::lightning::offers::flow::HeldHtlcReplyPath) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_held_htlc_available(invoice.get_native_ref(), reply_path_params.into_native()); + 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// If we are holding an HTLC on behalf of an often-offline sender, this method allows us to +/// create a path for the sender to use as the reply path when they send the recipient a +/// [`HeldHtlcAvailable`] onion message, so the recipient's [`ReleaseHeldHtlc`] response will be +/// received to our node. +/// +/// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_path_for_release_held_htlc(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut intercept_id: crate::c_types::ThirtyTwoBytes, mut prev_outbound_scid_alias: u64, mut htlc_id: u64, mut entropy: crate::lightning::sign::EntropySource) -> crate::lightning::blinded_path::message::BlindedMessagePath { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.path_for_release_held_htlc(::lightning::ln::channelmanager::InterceptId(intercept_id.data), prev_outbound_scid_alias, htlc_id, entropy); + crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Enqueues the created [`DNSSECQuery`] to be sent to the counterparty. +/// +/// # Peers +/// +/// The user must provide a list of [`MessageForwardNode`] that will be used to generate +/// valid reply paths for the counterparty to send back the corresponding response for +/// the [`DNSSECQuery`] message. +/// +/// [`supports_onion_messages`]: crate::types::features::Features::supports_onion_messages +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_enqueue_dns_onion_message(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut message: crate::lightning::onion_message::dns_resolution::DNSSECQuery, mut context: crate::lightning::blinded_path::message::DNSResolverContext, mut dns_resolvers: crate::c_types::derived::CVec_DestinationZ, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { + let mut local_dns_resolvers = Vec::new(); for mut item in dns_resolvers.into_rust().drain(..) { local_dns_resolvers.push( { item.into_native() }); }; + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.enqueue_dns_onion_message(*unsafe { Box::from_raw(message.take_inner()) }, *unsafe { Box::from_raw(context.take_inner()) }, local_dns_resolvers, local_peers); + 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + +/// Gets the enqueued [`OffersMessage`] with their corresponding [`MessageSendInstructions`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_release_pending_offers_messages(this_arg: &crate::lightning::offers::flow::OffersMessageFlow) -> crate::c_types::derived::CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.release_pending_offers_messages(); + 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_ret_0 = (crate::lightning::onion_message::offers::OffersMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(orig_ret_0_1)).into(); local_ret_0 }); }; + local_ret.into() +} + +/// Gets the enqueued [`AsyncPaymentsMessage`] with their corresponding [`MessageSendInstructions`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_release_pending_async_messages(this_arg: &crate::lightning::offers::flow::OffersMessageFlow) -> crate::c_types::derived::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.release_pending_async_messages(); + 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_ret_0 = (crate::lightning::onion_message::async_payments::AsyncPaymentsMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(orig_ret_0_1)).into(); local_ret_0 }); }; + local_ret.into() +} + +/// Gets the enqueued [`DNSResolverMessage`] with their corresponding [`MessageSendInstructions`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_release_pending_dns_messages(this_arg: &crate::lightning::offers::flow::OffersMessageFlow) -> crate::c_types::derived::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.release_pending_dns_messages(); + 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_ret_0 = (crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(orig_ret_0_1)).into(); local_ret_0 }); }; + local_ret.into() +} + +/// Retrieve an [`Offer`] for receiving async payments as an often-offline recipient. Will only +/// return an offer if [`Self::set_paths_to_static_invoice_server`] was called and we succeeded in +/// interactively building a [`StaticInvoice`] with the static invoice server. +/// +/// Returns the requested offer as well as a bool indicating whether the cache needs to be +/// persisted using [`Self::writeable_async_receive_offer_cache`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_get_async_receive_offer(this_arg: &crate::lightning::offers::flow::OffersMessageFlow) -> crate::c_types::derived::CResult_C2Tuple_OfferboolZNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_async_receive_offer(); + 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::offer::Offer { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, orig_ret_0_1).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Sends out [`OfferPathsRequest`] and [`ServeStaticInvoice`] onion messages if we are an +/// often-offline recipient and are configured to interactively build offers and static invoices +/// with a static invoice server. +/// +/// # Usage +/// +/// This method should be called on peer connection and once per minute or so, to keep the offers +/// cache updated. When calling this method once per minute, SHOULD set `timer_tick_occurred` so +/// the cache can self-regulate the number of messages sent out. +/// +/// Errors if we failed to create blinded reply paths when sending an [`OfferPathsRequest`] message. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_check_refresh_async_receive_offer_cache(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ, mut usable_channels: crate::c_types::derived::CVec_ChannelDetailsZ, mut entropy: crate::lightning::sign::EntropySource, mut router: crate::lightning::routing::router::Router, mut timer_tick_occurred: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_usable_channels = Vec::new(); for mut item in usable_channels.into_rust().drain(..) { local_usable_channels.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.check_refresh_async_receive_offer_cache(local_peers, local_usable_channels, entropy, router, timer_tick_occurred); + 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 +} + +/// Handles an incoming [`OfferPathsRequest`] onion message from an often-offline recipient who +/// wants us (the static invoice server) to serve [`StaticInvoice`]s to payers on their behalf. +/// Sends out [`OfferPaths`] onion messages in response. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_handle_offer_paths_request(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, request: &crate::lightning::onion_message::async_payments::OfferPathsRequest, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::COption_C2Tuple_OfferPathsMessageContextZZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_offer_paths_request(request.get_native_ref(), context.into_native(), local_peers); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_OfferPathsMessageContextZZ::None } else { crate::c_types::derived::COption_C2Tuple_OfferPathsMessageContextZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::blinded_path::message::MessageContext::native_into(orig_ret_0_1)).into(); local_ret_0 }) }; + local_ret +} + +/// Handles an incoming [`OfferPaths`] message from the static invoice server, sending out +/// [`ServeStaticInvoice`] onion messages in response if we've built a new async receive offer and +/// need the corresponding [`StaticInvoice`] to be persisted by the static invoice server. +/// +/// Returns `None` if we have enough offers cached already, verification of `message` fails, or we +/// fail to create blinded paths. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_handle_offer_paths(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut message: crate::lightning::onion_message::async_payments::OfferPaths, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext, mut responder: crate::lightning::onion_message::messenger::Responder, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ, mut usable_channels: crate::c_types::derived::CVec_ChannelDetailsZ, mut entropy: crate::lightning::sign::EntropySource, mut router: crate::lightning::routing::router::Router) -> crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceMessageContextZZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut local_usable_channels = Vec::new(); for mut item in usable_channels.into_rust().drain(..) { local_usable_channels.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_offer_paths(*unsafe { Box::from_raw(message.take_inner()) }, context.into_native(), *unsafe { Box::from_raw(responder.take_inner()) }, local_peers, local_usable_channels, entropy, router); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceMessageContextZZ::None } else { crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceMessageContextZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::blinded_path::message::MessageContext::native_into(orig_ret_0_1)).into(); local_ret_0 }) }; + local_ret +} + +/// Verifies an incoming [`ServeStaticInvoice`] onion message from an often-offline recipient who +/// wants us as a static invoice server to serve the [`ServeStaticInvoice::invoice`] to payers on +/// their behalf. +/// +/// On success, returns `(recipient_id, invoice_slot)` for use in persisting and later retrieving +/// the static invoice from the database. +/// +/// Errors if the [`ServeStaticInvoice::invoice`] is expired or larger than +/// [`MAX_STATIC_INVOICE_SIZE_BYTES`]. +/// +/// [`ServeStaticInvoice::invoice`]: crate::onion_message::async_payments::ServeStaticInvoice::invoice +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_verify_serve_static_invoice_message(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, message: &crate::lightning::onion_message::async_payments::ServeStaticInvoice, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) -> crate::c_types::derived::CResult_C2Tuple_CVec_u8Zu16ZNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.verify_serve_static_invoice_message(message.get_native_ref(), context.into_native()); + 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_0 = Vec::new(); for mut item in orig_ret_0_0.drain(..) { local_orig_ret_0_0.push( { item }); }; let mut local_ret_0 = (local_orig_ret_0_0.into(), orig_ret_0_1).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Indicates that a [`ServeStaticInvoice::invoice`] has been persisted and is ready to be served +/// to payers on behalf of an often-offline recipient. This method must be called after persisting +/// a [`StaticInvoice`] to confirm to the recipient that their corresponding [`Offer`] is ready to +/// receive async payments. +#[no_mangle] +pub extern "C" fn OffersMessageFlow_static_invoice_persisted(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut responder: crate::lightning::onion_message::messenger::Responder) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.static_invoice_persisted(*unsafe { Box::from_raw(responder.take_inner()) }) +} + +/// Handles an incoming [`StaticInvoicePersisted`] onion message from the static invoice server. +/// Returns a bool indicating whether the async receive offer cache needs to be re-persisted using +/// [`Self::writeable_async_receive_offer_cache`]. +/// +/// [`StaticInvoicePersisted`]: crate::onion_message::async_payments::StaticInvoicePersisted +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_handle_static_invoice_persisted(this_arg: &crate::lightning::offers::flow::OffersMessageFlow, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_static_invoice_persisted(context.into_native()); + ret +} + +/// Get the encoded [`AsyncReceiveOfferCache`] for persistence. +#[must_use] +#[no_mangle] +pub extern "C" fn OffersMessageFlow_writeable_async_receive_offer_cache(this_arg: &crate::lightning::offers::flow::OffersMessageFlow) -> crate::c_types::derived::CVec_u8Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.writeable_async_receive_offer_cache(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { item }); }; + local_ret.into() +} + diff --git a/lightning-c-bindings/src/lightning/offers/invoice.rs b/lightning-c-bindings/src/lightning/offers/invoice.rs index 18dd85cb..c715ae43 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice.rs @@ -437,7 +437,7 @@ impl Clone for UnsignedBolt12Invoice { fn clone(&self) -> Self { Self { inner: if <*mut nativeUnsignedBolt12Invoice>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -445,12 +445,12 @@ impl Clone for UnsignedBolt12Invoice { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnsignedBolt12Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedBolt12Invoice)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnsignedBolt12Invoice) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UnsignedBolt12Invoice pub extern "C" fn UnsignedBolt12Invoice_clone(orig: &UnsignedBolt12Invoice) -> UnsignedBolt12Invoice { - orig.clone() + Clone::clone(orig) } /// A function for signing an [`UnsignedBolt12Invoice`]. #[repr(C)] @@ -595,7 +595,7 @@ impl Clone for Bolt12Invoice { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt12Invoice>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -603,12 +603,12 @@ impl Clone for Bolt12Invoice { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt12Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12Invoice)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt12Invoice) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt12Invoice pub extern "C" fn Bolt12Invoice_clone(orig: &Bolt12Invoice) -> Bolt12Invoice { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Bolt12Invoice object pub extern "C" fn Bolt12Invoice_debug_str_void(o: *const c_void) -> Str { @@ -653,6 +653,14 @@ pub extern "C" fn UnsignedBolt12Invoice_is_expired(this_arg: &crate::lightning:: ret } +/// Whether the invoice has expired given the current time as duration since the Unix epoch. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_is_expired_no_std(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice, mut duration_since_epoch: u64) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired_no_std(core::time::Duration::from_secs(duration_since_epoch)); + ret +} + /// Fallback addresses for paying the invoice on-chain, in order of most-preferred to /// least-preferred. #[must_use] @@ -963,6 +971,14 @@ pub extern "C" fn Bolt12Invoice_is_expired(this_arg: &crate::lightning::offers:: ret } +/// Whether the invoice has expired given the current time as duration since the Unix epoch. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_is_expired_no_std(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice, mut duration_since_epoch: u64) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired_no_std(core::time::Duration::from_secs(duration_since_epoch)); + ret +} + /// Fallback addresses for paying the invoice on-chain, in order of most-preferred to /// least-preferred. #[must_use] @@ -1249,6 +1265,19 @@ pub extern "C" fn Bolt12Invoice_signable_hash(this_arg: &crate::lightning::offer crate::c_types::ThirtyTwoBytes { data: ret } } +/// Returns the [`OfferId`] if this invoice corresponds to an [`Offer`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// +/// 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_id(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::offers::offer::OfferId { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_id(); + let mut local_ret = crate::lightning::offers::offer::OfferId { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; + local_ret +} + /// Verifies that the invoice was for a request or refund created using the given key by /// checking the payer metadata from the invoice request. /// @@ -1272,6 +1301,14 @@ pub extern "C" fn Bolt12Invoice_verify_using_payer_data(this_arg: &crate::lightn local_ret } +/// Returns the [`TaggedHash`] of the invoice that was signed. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_tagged_hash(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> 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 } +} + /// Generates a non-cryptographic 64-bit hash of the Bolt12Invoice. #[no_mangle] pub extern "C" fn Bolt12Invoice_hash(o: &Bolt12Invoice) -> u64 { diff --git a/lightning-c-bindings/src/lightning/offers/invoice_error.rs b/lightning-c-bindings/src/lightning/offers/invoice_error.rs index 75574819..2a45dfb2 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_error.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_error.rs @@ -88,7 +88,7 @@ impl InvoiceError { /// 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 InvoiceError_get_erroneous_field(this_ptr: &InvoiceError) -> crate::lightning::offers::invoice_error::ErroneousField { - let mut inner_val = &mut this_ptr.get_native_mut_ref().erroneous_field; + let mut inner_val = &mut InvoiceError::get_native_mut_ref(this_ptr).erroneous_field; let mut local_inner_val = crate::lightning::offers::invoice_error::ErroneousField { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::offers::invoice_error::ErroneousField<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -106,7 +106,7 @@ pub extern "C" fn InvoiceError_set_erroneous_field(this_ptr: &mut InvoiceError, /// An explanation of the error. #[no_mangle] pub extern "C" fn InvoiceError_get_message(this_ptr: &InvoiceError) -> crate::lightning_types::string::UntrustedString { - let mut inner_val = &mut this_ptr.get_native_mut_ref().message; + let mut inner_val = &mut InvoiceError::get_native_mut_ref(this_ptr).message; crate::lightning_types::string::UntrustedString { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::string::UntrustedString<>) as *mut _) }, is_owned: false } } /// An explanation of the error. @@ -130,7 +130,7 @@ impl Clone for InvoiceError { fn clone(&self) -> Self { Self { inner: if <*mut nativeInvoiceError>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -138,12 +138,12 @@ impl Clone for InvoiceError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceError)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInvoiceError) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InvoiceError pub extern "C" fn InvoiceError_clone(orig: &InvoiceError) -> InvoiceError { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InvoiceError object pub extern "C" fn InvoiceError_debug_str_void(o: *const c_void) -> Str { @@ -214,7 +214,7 @@ impl ErroneousField { /// The type number of the TLV field containing the error. #[no_mangle] pub extern "C" fn ErroneousField_get_tlv_fieldnum(this_ptr: &ErroneousField) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().tlv_fieldnum; + let mut inner_val = &mut ErroneousField::get_native_mut_ref(this_ptr).tlv_fieldnum; *inner_val } /// The type number of the TLV field containing the error. @@ -227,7 +227,7 @@ pub extern "C" fn ErroneousField_set_tlv_fieldnum(this_ptr: &mut ErroneousField, /// Returns a copy of the field. #[no_mangle] pub extern "C" fn ErroneousField_get_suggested_value(this_ptr: &ErroneousField) -> crate::c_types::derived::COption_CVec_u8ZZ { - let mut inner_val = this_ptr.get_native_mut_ref().suggested_value.clone(); + let mut inner_val = ErroneousField::get_native_mut_ref(this_ptr).suggested_value.clone(); 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( { let mut local_inner_val_0 = Vec::new(); for mut item in inner_val.unwrap().drain(..) { local_inner_val_0.push( { item }); }; local_inner_val_0.into() }) }; local_inner_val } @@ -251,7 +251,7 @@ impl Clone for ErroneousField { fn clone(&self) -> Self { Self { inner: if <*mut nativeErroneousField>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -259,12 +259,12 @@ impl Clone for ErroneousField { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ErroneousField_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeErroneousField)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeErroneousField) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ErroneousField pub extern "C" fn ErroneousField_clone(orig: &ErroneousField) -> ErroneousField { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ErroneousField object pub extern "C" fn ErroneousField_debug_str_void(o: *const c_void) -> Str { @@ -298,3 +298,15 @@ pub extern "C" fn InvoiceError_read(ser: crate::c_types::u8slice) -> crate::c_ty let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_error::InvoiceError { 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] +/// Build a InvoiceError from a Bolt12SemanticError +pub extern "C" fn InvoiceError_from_Bolt12SemanticError(f: crate::lightning::offers::parse::Bolt12SemanticError) -> crate::lightning::offers::invoice_error::InvoiceError { + let from_obj = f.into_native(); + crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc((lightning::offers::invoice_error::InvoiceError::from(from_obj))), is_owned: true } +} +#[no_mangle] +/// Build a InvoiceError from a SignError +pub extern "C" fn InvoiceError_from_SignError(f: crate::lightning::offers::merkle::SignError) -> crate::lightning::offers::invoice_error::InvoiceError { + let from_obj = f.into_native(); + crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc((lightning::offers::invoice_error::InvoiceError::from(from_obj))), is_owned: true } +} diff --git a/lightning-c-bindings/src/lightning/offers/invoice_request.rs b/lightning-c-bindings/src/lightning/offers/invoice_request.rs index 0661c530..eef58e84 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_request.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_request.rs @@ -274,7 +274,7 @@ impl Clone for UnsignedInvoiceRequest { fn clone(&self) -> Self { Self { inner: if <*mut nativeUnsignedInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -282,12 +282,12 @@ impl Clone for UnsignedInvoiceRequest { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnsignedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnsignedInvoiceRequest)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUnsignedInvoiceRequest) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UnsignedInvoiceRequest pub extern "C" fn UnsignedInvoiceRequest_clone(orig: &UnsignedInvoiceRequest) -> UnsignedInvoiceRequest { - orig.clone() + Clone::clone(orig) } /// A function for signing an [`UnsignedInvoiceRequest`]. #[repr(C)] @@ -431,7 +431,7 @@ impl Clone for InvoiceRequest { fn clone(&self) -> Self { Self { inner: if <*mut nativeInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -439,12 +439,12 @@ impl Clone for InvoiceRequest { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequest)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInvoiceRequest) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InvoiceRequest pub extern "C" fn InvoiceRequest_clone(orig: &InvoiceRequest) -> InvoiceRequest { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InvoiceRequest object pub extern "C" fn InvoiceRequest_debug_str_void(o: *const c_void) -> Str { @@ -514,7 +514,7 @@ impl VerifiedInvoiceRequest { /// The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_get_offer_id(this_ptr: &VerifiedInvoiceRequest) -> crate::lightning::offers::offer::OfferId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().offer_id; + let mut inner_val = &mut VerifiedInvoiceRequest::get_native_mut_ref(this_ptr).offer_id; crate::lightning::offers::offer::OfferId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::offer::OfferId<>) as *mut _) }, is_owned: false } } /// The identifier of the [`Offer`] for which the [`InvoiceRequest`] was made. @@ -526,7 +526,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -534,12 +534,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeVerifiedInvoiceRequest) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the VerifiedInvoiceRequest pub extern "C" fn VerifiedInvoiceRequest_clone(orig: &VerifiedInvoiceRequest) -> VerifiedInvoiceRequest { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a VerifiedInvoiceRequest object pub extern "C" fn VerifiedInvoiceRequest_debug_str_void(o: *const c_void) -> Str { @@ -1435,7 +1435,7 @@ impl InvoiceRequestFields { /// A possibly transient pubkey used to sign the invoice request. #[no_mangle] pub extern "C" fn InvoiceRequestFields_get_payer_signing_pubkey(this_ptr: &InvoiceRequestFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payer_signing_pubkey; + let mut inner_val = &mut InvoiceRequestFields::get_native_mut_ref(this_ptr).payer_signing_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// A possibly transient pubkey used to sign the invoice request. @@ -1446,7 +1446,7 @@ pub extern "C" fn InvoiceRequestFields_set_payer_signing_pubkey(this_ptr: &mut I /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. #[no_mangle] pub extern "C" fn InvoiceRequestFields_get_quantity(this_ptr: &InvoiceRequestFields) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().quantity; + let mut inner_val = &mut InvoiceRequestFields::get_native_mut_ref(this_ptr).quantity; 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 } @@ -1462,7 +1462,7 @@ pub extern "C" fn InvoiceRequestFields_set_quantity(this_ptr: &mut InvoiceReques /// 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 InvoiceRequestFields_get_payer_note_truncated(this_ptr: &InvoiceRequestFields) -> crate::lightning_types::string::UntrustedString { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payer_note_truncated; + let mut inner_val = &mut InvoiceRequestFields::get_native_mut_ref(this_ptr).payer_note_truncated; let mut local_inner_val = crate::lightning_types::string::UntrustedString { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_types::string::UntrustedString<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1480,7 +1480,7 @@ pub extern "C" fn InvoiceRequestFields_set_payer_note_truncated(this_ptr: &mut I /// 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 InvoiceRequestFields_get_human_readable_name(this_ptr: &InvoiceRequestFields) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { - let mut inner_val = &mut this_ptr.get_native_mut_ref().human_readable_name; + let mut inner_val = &mut InvoiceRequestFields::get_native_mut_ref(this_ptr).human_readable_name; let mut local_inner_val = crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1513,7 +1513,7 @@ impl Clone for InvoiceRequestFields { fn clone(&self) -> Self { Self { inner: if <*mut nativeInvoiceRequestFields>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1521,12 +1521,12 @@ impl Clone for InvoiceRequestFields { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceRequestFields_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequestFields)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInvoiceRequestFields) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InvoiceRequestFields pub extern "C" fn InvoiceRequestFields_clone(orig: &InvoiceRequestFields) -> InvoiceRequestFields { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a InvoiceRequestFields object pub extern "C" fn InvoiceRequestFields_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/offers/merkle.rs b/lightning-c-bindings/src/lightning/offers/merkle.rs index 72c80148..d121e343 100644 --- a/lightning-c-bindings/src/lightning/offers/merkle.rs +++ b/lightning-c-bindings/src/lightning/offers/merkle.rs @@ -85,7 +85,7 @@ impl Clone for TaggedHash { fn clone(&self) -> Self { Self { inner: if <*mut nativeTaggedHash>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -93,12 +93,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTaggedHash)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTaggedHash) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TaggedHash pub extern "C" fn TaggedHash_clone(orig: &TaggedHash) -> TaggedHash { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TaggedHash object pub extern "C" fn TaggedHash_debug_str_void(o: *const c_void) -> Str { @@ -220,3 +220,12 @@ pub extern "C" fn SignError_verification(a: crate::c_types::Secp256k1Error) -> S /// Get a string which allows debug introspection of a SignError object pub extern "C" fn SignError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::merkle::SignError }).into()} +/// Verifies the signature with a pubkey over the given message using a tagged hash as the message +/// digest. +#[no_mangle] +pub extern "C" fn verify_signature(mut signature: crate::c_types::SchnorrSignature, message: &crate::lightning::offers::merkle::TaggedHash, mut pubkey: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneSecp256k1ErrorZ { + let mut ret = lightning::offers::merkle::verify_signature(&signature.into_rust(), message.get_native_ref(), pubkey.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::c_types::Secp256k1Error::from_rust(e) }).into() }; + local_ret +} + diff --git a/lightning-c-bindings/src/lightning/offers/mod.rs b/lightning-c-bindings/src/lightning/offers/mod.rs index 9d8e1f26..8e7957fe 100644 --- a/lightning-c-bindings/src/lightning/offers/mod.rs +++ b/lightning-c-bindings/src/lightning/offers/mod.rs @@ -21,6 +21,8 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; pub mod offer; +pub mod flow; +pub mod async_receive_offer_cache; pub mod invoice; pub mod invoice_error; pub mod invoice_request; @@ -28,6 +30,7 @@ pub mod merkle; pub mod nonce; pub mod parse; pub mod refund; +pub mod static_invoice; mod invoice_macros { use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning/offers/nonce.rs b/lightning-c-bindings/src/lightning/offers/nonce.rs index e2df6691..4791ca0b 100644 --- a/lightning-c-bindings/src/lightning/offers/nonce.rs +++ b/lightning-c-bindings/src/lightning/offers/nonce.rs @@ -88,7 +88,7 @@ impl Clone for Nonce { fn clone(&self) -> Self { Self { inner: if <*mut nativeNonce>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -96,12 +96,12 @@ impl Clone for Nonce { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Nonce_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNonce)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNonce) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Nonce pub extern "C" fn Nonce_clone(orig: &Nonce) -> Nonce { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Nonce object pub extern "C" fn Nonce_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/offers/offer.rs b/lightning-c-bindings/src/lightning/offers/offer.rs index f3ce030a..6ef3fa6f 100644 --- a/lightning-c-bindings/src/lightning/offers/offer.rs +++ b/lightning-c-bindings/src/lightning/offers/offer.rs @@ -147,7 +147,7 @@ impl OfferId { } #[no_mangle] pub extern "C" fn OfferId_get_a(this_ptr: &OfferId) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut OfferId::get_native_mut_ref(this_ptr).0; inner_val } #[no_mangle] @@ -166,7 +166,7 @@ impl Clone for OfferId { fn clone(&self) -> Self { Self { inner: if <*mut nativeOfferId>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -174,12 +174,12 @@ impl Clone for OfferId { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OfferId_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOfferId)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferId) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OfferId pub extern "C" fn OfferId_clone(orig: &OfferId) -> OfferId { - orig.clone() + Clone::clone(orig) } /// Checks if two OfferIds contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -274,7 +274,7 @@ impl Clone for OfferWithExplicitMetadataBuilder { fn clone(&self) -> Self { Self { inner: if <*mut nativeOfferWithExplicitMetadataBuilder>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -282,12 +282,12 @@ impl Clone for OfferWithExplicitMetadataBuilder { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OfferWithExplicitMetadataBuilder_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOfferWithExplicitMetadataBuilder)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferWithExplicitMetadataBuilder) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OfferWithExplicitMetadataBuilder pub extern "C" fn OfferWithExplicitMetadataBuilder_clone(orig: &OfferWithExplicitMetadataBuilder) -> OfferWithExplicitMetadataBuilder { - orig.clone() + Clone::clone(orig) } use lightning::offers::offer::OfferWithDerivedMetadataBuilder as nativeOfferWithDerivedMetadataBuilderImport; @@ -357,7 +357,7 @@ impl Clone for OfferWithDerivedMetadataBuilder { fn clone(&self) -> Self { Self { inner: if <*mut nativeOfferWithDerivedMetadataBuilder>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -365,12 +365,12 @@ impl Clone for OfferWithDerivedMetadataBuilder { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OfferWithDerivedMetadataBuilder_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOfferWithDerivedMetadataBuilder)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferWithDerivedMetadataBuilder) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OfferWithDerivedMetadataBuilder pub extern "C" fn OfferWithDerivedMetadataBuilder_clone(orig: &OfferWithDerivedMetadataBuilder) -> OfferWithDerivedMetadataBuilder { - orig.clone() + Clone::clone(orig) } /// Creates a new builder for an offer using the `signing_pubkey` for signing invoices. The /// associated secret key must be remembered while the offer is valid. @@ -597,6 +597,109 @@ pub extern "C" fn OfferWithDerivedMetadataBuilder_build(mut this_arg: crate::lig } +use lightning::offers::offer::OfferFromHrn as nativeOfferFromHrnImport; +pub(crate) type nativeOfferFromHrn = nativeOfferFromHrnImport; + +/// An [`Offer`] which was fetched from a human readable name, ie through BIP 353. +#[must_use] +#[repr(C)] +pub struct OfferFromHrn { + /// 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 nativeOfferFromHrn, + /// 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 core::ops::Deref for OfferFromHrn { + type Target = nativeOfferFromHrn; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OfferFromHrn { } +unsafe impl core::marker::Sync for OfferFromHrn { } +impl Drop for OfferFromHrn { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOfferFromHrn>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OfferFromHrn, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OfferFromHrn_free(this_obj: OfferFromHrn) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OfferFromHrn_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOfferFromHrn) }; +} +#[allow(unused)] +impl OfferFromHrn { + pub(crate) fn get_native_ref(&self) -> &'static nativeOfferFromHrn { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOfferFromHrn { + 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 nativeOfferFromHrn { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The offer itself. +/// +/// When you resolve this into an [`InvoiceRequestBuilder`] you *must* call +/// [`InvoiceRequestBuilder::sourced_from_human_readable_name`]. +/// +/// If you call [`Self::request_invoice`] rather than [`Offer::request_invoice`] this will be +/// handled for you. +#[no_mangle] +pub extern "C" fn OfferFromHrn_get_offer(this_ptr: &OfferFromHrn) -> crate::lightning::offers::offer::Offer { + let mut inner_val = &mut OfferFromHrn::get_native_mut_ref(this_ptr).offer; + crate::lightning::offers::offer::Offer { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::offer::Offer<>) as *mut _) }, is_owned: false } +} +/// The offer itself. +/// +/// When you resolve this into an [`InvoiceRequestBuilder`] you *must* call +/// [`InvoiceRequestBuilder::sourced_from_human_readable_name`]. +/// +/// If you call [`Self::request_invoice`] rather than [`Offer::request_invoice`] this will be +/// handled for you. +#[no_mangle] +pub extern "C" fn OfferFromHrn_set_offer(this_ptr: &mut OfferFromHrn, mut val: crate::lightning::offers::offer::Offer) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.offer = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The human readable name which was resolved to fetch the [`Self::offer`]. +#[no_mangle] +pub extern "C" fn OfferFromHrn_get_hrn(this_ptr: &OfferFromHrn) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { + let mut inner_val = &mut OfferFromHrn::get_native_mut_ref(this_ptr).hrn; + crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _) }, is_owned: false } +} +/// The human readable name which was resolved to fetch the [`Self::offer`]. +#[no_mangle] +pub extern "C" fn OfferFromHrn_set_hrn(this_ptr: &mut OfferFromHrn, mut val: crate::lightning::onion_message::dns_resolution::HumanReadableName) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.hrn = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new OfferFromHrn given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFromHrn_new(mut offer_arg: crate::lightning::offers::offer::Offer, mut hrn_arg: crate::lightning::onion_message::dns_resolution::HumanReadableName) -> OfferFromHrn { + OfferFromHrn { inner: ObjOps::heap_alloc(nativeOfferFromHrn { + offer: *unsafe { Box::from_raw(offer_arg.take_inner()) }, + hrn: *unsafe { Box::from_raw(hrn_arg.take_inner()) }, + }), is_owned: true } +} + use lightning::offers::offer::Offer as nativeOfferImport; pub(crate) type nativeOffer = nativeOfferImport; @@ -672,7 +775,7 @@ impl Clone for Offer { fn clone(&self) -> Self { Self { inner: if <*mut nativeOffer>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -680,12 +783,12 @@ impl Clone for Offer { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Offer_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOffer)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOffer) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Offer pub extern "C" fn Offer_clone(orig: &Offer) -> Offer { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Offer object pub extern "C" fn Offer_debug_str_void(o: *const c_void) -> Str { @@ -876,6 +979,30 @@ pub extern "C" fn Offer_request_invoice(this_arg: &crate::lightning::offers::off local_ret } +/// Creates an [`InvoiceRequestBuilder`] for the offer, which +/// - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used +/// for each request in order to protect the sender's privacy, +/// - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is +/// called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine +/// if the invoice was requested using a base [`ExpandedKey`] from which the payer id was +/// derived, and +/// - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can +/// be used when sending the payment for the requested invoice. +/// +/// Errors if the offer contains unknown required features. +/// +/// [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey +/// [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata +/// [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata +/// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFromHrn_request_invoice(this_arg: &crate::lightning::offers::offer::OfferFromHrn, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_invoice(expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, secp256k1::global::SECP256K1, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; + local_ret +} + /// Generates a non-cryptographic 64-bit hash of the Offer. #[no_mangle] pub extern "C" fn Offer_hash(o: &Offer) -> u64 { @@ -916,8 +1043,8 @@ pub enum Amount { /// An amount of currency specified using ISO 4217. Currency { /// The currency that the amount is denominated in. - iso4217_code: crate::c_types::ThreeBytes, - /// The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). + iso4217_code: crate::lightning::offers::offer::CurrencyCode, + /// The amount in the currency unit adjusted by the ISO 4217 exponent (e.g., USD cents). amount: u64, }, } @@ -938,7 +1065,7 @@ impl Amount { let mut iso4217_code_nonref = Clone::clone(iso4217_code); let mut amount_nonref = Clone::clone(amount); nativeAmount::Currency { - iso4217_code: iso4217_code_nonref.data, + iso4217_code: *unsafe { Box::from_raw(iso4217_code_nonref.take_inner()) }, amount: amount_nonref, } }, @@ -954,7 +1081,7 @@ impl Amount { }, Amount::Currency {mut iso4217_code, mut amount, } => { nativeAmount::Currency { - iso4217_code: iso4217_code.data, + iso4217_code: *unsafe { Box::from_raw(iso4217_code.take_inner()) }, amount: amount, } }, @@ -974,7 +1101,7 @@ impl Amount { let mut iso4217_code_nonref = Clone::clone(iso4217_code); let mut amount_nonref = Clone::clone(amount); Amount::Currency { - iso4217_code: crate::c_types::ThreeBytes { data: iso4217_code_nonref }, + iso4217_code: crate::lightning::offers::offer::CurrencyCode { inner: ObjOps::heap_alloc(iso4217_code_nonref), is_owned: true }, amount: amount_nonref, } }, @@ -990,7 +1117,7 @@ impl Amount { }, nativeAmount::Currency {mut iso4217_code, mut amount, } => { Amount::Currency { - iso4217_code: crate::c_types::ThreeBytes { data: iso4217_code }, + iso4217_code: crate::lightning::offers::offer::CurrencyCode { inner: ObjOps::heap_alloc(iso4217_code), is_owned: true }, amount: amount, } }, @@ -1024,7 +1151,7 @@ pub extern "C" fn Amount_bitcoin(amount_msats: u64) -> Amount { } #[no_mangle] /// Utility method to constructs a new Currency-variant Amount -pub extern "C" fn Amount_currency(iso4217_code: crate::c_types::ThreeBytes, amount: u64) -> Amount { +pub extern "C" fn Amount_currency(iso4217_code: crate::lightning::offers::offer::CurrencyCode, amount: u64) -> Amount { Amount::Currency { iso4217_code, amount, @@ -1033,6 +1160,157 @@ pub extern "C" fn Amount_currency(iso4217_code: crate::c_types::ThreeBytes, amou /// Get a string which allows debug introspection of a Amount object pub extern "C" fn Amount_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::offer::Amount }).into()} + +use lightning::offers::offer::CurrencyCode as nativeCurrencyCodeImport; +pub(crate) type nativeCurrencyCode = nativeCurrencyCodeImport; + +/// An ISO 4217 three-letter currency code (e.g., USD). +/// +/// Currency codes must be exactly 3 ASCII uppercase letters. +#[must_use] +#[repr(C)] +pub struct CurrencyCode { + /// 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 nativeCurrencyCode, + /// 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 core::ops::Deref for CurrencyCode { + type Target = nativeCurrencyCode; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for CurrencyCode { } +unsafe impl core::marker::Sync for CurrencyCode { } +impl Drop for CurrencyCode { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCurrencyCode>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CurrencyCode, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CurrencyCode_free(this_obj: CurrencyCode) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CurrencyCode_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCurrencyCode) }; +} +#[allow(unused)] +impl CurrencyCode { + pub(crate) fn get_native_ref(&self) -> &'static nativeCurrencyCode { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCurrencyCode { + 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 nativeCurrencyCode { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for CurrencyCode { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeCurrencyCode>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 CurrencyCode_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCurrencyCode) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the CurrencyCode +pub extern "C" fn CurrencyCode_clone(orig: &CurrencyCode) -> CurrencyCode { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a CurrencyCode object +pub extern "C" fn CurrencyCode_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::offer::CurrencyCode }).into()} +/// Checks if two CurrencyCodes 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 CurrencyCode_eq(a: &CurrencyCode, b: &CurrencyCode) -> 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 } +} +/// Generates a non-cryptographic 64-bit hash of the CurrencyCode. +#[no_mangle] +pub extern "C" fn CurrencyCode_hash(o: &CurrencyCode) -> 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) +} +/// Creates a new `CurrencyCode` from a 3-byte array. +/// +/// Returns an error if the bytes are not valid UTF-8 or not all ASCII uppercase. +#[must_use] +#[no_mangle] +pub extern "C" fn CurrencyCode_new(mut code: crate::c_types::ThreeBytes) -> crate::c_types::derived::CResult_CurrencyCodeCurrencyCodeErrorZ { + let mut ret = lightning::offers::offer::CurrencyCode::new(code.data); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::offer::CurrencyCode { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::offer::CurrencyCodeError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_ret +} + +/// Returns the currency code as a byte array. +#[must_use] +#[no_mangle] +pub extern "C" fn CurrencyCode_as_bytes(this_arg: &crate::lightning::offers::offer::CurrencyCode) -> *const [u8; 3] { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_bytes(); + ret +} + +/// Returns the currency code as a string slice. +#[must_use] +#[no_mangle] +pub extern "C" fn CurrencyCode_as_str(this_arg: &crate::lightning::offers::offer::CurrencyCode) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_str(); + ret.into() +} + +#[no_mangle] +/// Read a CurrencyCode object from a string +pub extern "C" fn CurrencyCode_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_CurrencyCodeCurrencyCodeErrorZ { + match lightning::offers::offer::CurrencyCode::from_str(s.into_str()) { + Ok(r) => { + crate::c_types::CResultTempl::ok( + crate::lightning::offers::offer::CurrencyCode { inner: ObjOps::heap_alloc(r), is_owned: true } + ) + }, + Err(e) => { + crate::c_types::CResultTempl::err( + crate::lightning::offers::offer::CurrencyCodeError { inner: ObjOps::heap_alloc(e), is_owned: true } + ) + }, + }.into() +} +#[no_mangle] +/// Get the string representation of a CurrencyCode object +pub extern "C" fn CurrencyCode_to_str(o: &crate::lightning::offers::offer::CurrencyCode) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} /// Quantity of items supported by an [`Offer`]. #[derive(Clone)] #[must_use] @@ -1161,3 +1439,109 @@ pub extern "C" fn Offer_from_str(s: crate::c_types::Str) -> crate::c_types::deri pub extern "C" fn Offer_to_str(o: &crate::lightning::offers::offer::Offer) -> Str { alloc::format!("{}", o.get_native_ref()).into() } + +use lightning::offers::offer::CurrencyCodeError as nativeCurrencyCodeErrorImport; +pub(crate) type nativeCurrencyCodeError = nativeCurrencyCodeErrorImport; + +/// An error indicating that a currency code is invalid. +/// +/// A valid currency code must follow the ISO 4217 standard: +/// - Exactly 3 characters in length. +/// - Consist only of uppercase ASCII letters (A–Z). +#[must_use] +#[repr(C)] +pub struct CurrencyCodeError { + /// 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 nativeCurrencyCodeError, + /// 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 core::ops::Deref for CurrencyCodeError { + type Target = nativeCurrencyCodeError; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for CurrencyCodeError { } +unsafe impl core::marker::Sync for CurrencyCodeError { } +impl Drop for CurrencyCodeError { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCurrencyCodeError>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CurrencyCodeError, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CurrencyCodeError_free(this_obj: CurrencyCodeError) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CurrencyCodeError_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCurrencyCodeError) }; +} +#[allow(unused)] +impl CurrencyCodeError { + pub(crate) fn get_native_ref(&self) -> &'static nativeCurrencyCodeError { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCurrencyCodeError { + 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 nativeCurrencyCodeError { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new CurrencyCodeError given each field +#[must_use] +#[no_mangle] +pub extern "C" fn CurrencyCodeError_new() -> CurrencyCodeError { + CurrencyCodeError { inner: ObjOps::heap_alloc(lightning::offers::offer::CurrencyCodeError {}), is_owned: true } +} +impl Clone for CurrencyCodeError { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeCurrencyCodeError>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 CurrencyCodeError_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeCurrencyCodeError) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the CurrencyCodeError +pub extern "C" fn CurrencyCodeError_clone(orig: &CurrencyCodeError) -> CurrencyCodeError { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a CurrencyCodeError object +pub extern "C" fn CurrencyCodeError_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::offer::CurrencyCodeError }).into()} +/// Checks if two CurrencyCodeErrors 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 CurrencyCodeError_eq(a: &CurrencyCodeError, b: &CurrencyCodeError) -> 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] +/// Get the string representation of a CurrencyCodeError object +pub extern "C" fn CurrencyCodeError_to_str(o: &crate::lightning::offers::offer::CurrencyCodeError) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} diff --git a/lightning-c-bindings/src/lightning/offers/parse.rs b/lightning-c-bindings/src/lightning/offers/parse.rs index 83e1a95c..d7cd75b0 100644 --- a/lightning-c-bindings/src/lightning/offers/parse.rs +++ b/lightning-c-bindings/src/lightning/offers/parse.rs @@ -93,7 +93,7 @@ impl Clone for Bolt12ParseError { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt12ParseError>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -101,12 +101,12 @@ impl Clone for Bolt12ParseError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt12ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12ParseError)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt12ParseError) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt12ParseError pub extern "C" fn Bolt12ParseError_clone(orig: &Bolt12ParseError) -> Bolt12ParseError { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Bolt12ParseError object pub extern "C" fn Bolt12ParseError_debug_str_void(o: *const c_void) -> Str { @@ -126,6 +126,8 @@ pub enum Bolt12SemanticError { MissingAmount, /// The amount exceeded the total bitcoin supply or didn't match an expected amount. InvalidAmount, + /// The currency code did not contain valid ASCII uppercase letters. + InvalidCurrencyCode, /// An amount was provided but was not sufficient in value. InsufficientAmount, /// An amount was provided but was not expected. @@ -194,6 +196,7 @@ impl Bolt12SemanticError { Bolt12SemanticError::UnexpectedChain => nativeBolt12SemanticError::UnexpectedChain, Bolt12SemanticError::MissingAmount => nativeBolt12SemanticError::MissingAmount, Bolt12SemanticError::InvalidAmount => nativeBolt12SemanticError::InvalidAmount, + Bolt12SemanticError::InvalidCurrencyCode => nativeBolt12SemanticError::InvalidCurrencyCode, Bolt12SemanticError::InsufficientAmount => nativeBolt12SemanticError::InsufficientAmount, Bolt12SemanticError::UnexpectedAmount => nativeBolt12SemanticError::UnexpectedAmount, Bolt12SemanticError::UnsupportedCurrency => nativeBolt12SemanticError::UnsupportedCurrency, @@ -230,6 +233,7 @@ impl Bolt12SemanticError { Bolt12SemanticError::UnexpectedChain => nativeBolt12SemanticError::UnexpectedChain, Bolt12SemanticError::MissingAmount => nativeBolt12SemanticError::MissingAmount, Bolt12SemanticError::InvalidAmount => nativeBolt12SemanticError::InvalidAmount, + Bolt12SemanticError::InvalidCurrencyCode => nativeBolt12SemanticError::InvalidCurrencyCode, Bolt12SemanticError::InsufficientAmount => nativeBolt12SemanticError::InsufficientAmount, Bolt12SemanticError::UnexpectedAmount => nativeBolt12SemanticError::UnexpectedAmount, Bolt12SemanticError::UnsupportedCurrency => nativeBolt12SemanticError::UnsupportedCurrency, @@ -267,6 +271,7 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::UnexpectedChain => Bolt12SemanticError::UnexpectedChain, nativeBolt12SemanticError::MissingAmount => Bolt12SemanticError::MissingAmount, nativeBolt12SemanticError::InvalidAmount => Bolt12SemanticError::InvalidAmount, + nativeBolt12SemanticError::InvalidCurrencyCode => Bolt12SemanticError::InvalidCurrencyCode, nativeBolt12SemanticError::InsufficientAmount => Bolt12SemanticError::InsufficientAmount, nativeBolt12SemanticError::UnexpectedAmount => Bolt12SemanticError::UnexpectedAmount, nativeBolt12SemanticError::UnsupportedCurrency => Bolt12SemanticError::UnsupportedCurrency, @@ -303,6 +308,7 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::UnexpectedChain => Bolt12SemanticError::UnexpectedChain, nativeBolt12SemanticError::MissingAmount => Bolt12SemanticError::MissingAmount, nativeBolt12SemanticError::InvalidAmount => Bolt12SemanticError::InvalidAmount, + nativeBolt12SemanticError::InvalidCurrencyCode => Bolt12SemanticError::InvalidCurrencyCode, nativeBolt12SemanticError::InsufficientAmount => Bolt12SemanticError::InsufficientAmount, nativeBolt12SemanticError::UnexpectedAmount => Bolt12SemanticError::UnexpectedAmount, nativeBolt12SemanticError::UnsupportedCurrency => Bolt12SemanticError::UnsupportedCurrency, @@ -368,6 +374,10 @@ pub extern "C" fn Bolt12SemanticError_missing_amount() -> Bolt12SemanticError { pub extern "C" fn Bolt12SemanticError_invalid_amount() -> Bolt12SemanticError { Bolt12SemanticError::InvalidAmount} #[no_mangle] +/// Utility method to constructs a new InvalidCurrencyCode-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_invalid_currency_code() -> Bolt12SemanticError { + Bolt12SemanticError::InvalidCurrencyCode} +#[no_mangle] /// Utility method to constructs a new InsufficientAmount-variant Bolt12SemanticError pub extern "C" fn Bolt12SemanticError_insufficient_amount() -> Bolt12SemanticError { Bolt12SemanticError::InsufficientAmount} @@ -474,3 +484,21 @@ pub extern "C" fn Bolt12SemanticError_unexpected_human_readable_name() -> Bolt12 /// Get a string which allows debug introspection of a Bolt12SemanticError object pub extern "C" fn Bolt12SemanticError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12SemanticError }).into()} +#[no_mangle] +/// Build a Bolt12ParseError from a DecodeError +pub extern "C" fn Bolt12ParseError_from_DecodeError(f: crate::lightning::ln::msgs::DecodeError) -> crate::lightning::offers::parse::Bolt12ParseError { + let from_obj = f.into_native(); + crate::lightning::offers::parse::Bolt12ParseError { inner: ObjOps::heap_alloc((lightning::offers::parse::Bolt12ParseError::from(from_obj))), is_owned: true } +} +#[no_mangle] +/// Build a Bolt12ParseError from a Bolt12SemanticError +pub extern "C" fn Bolt12ParseError_from_Bolt12SemanticError(f: crate::lightning::offers::parse::Bolt12SemanticError) -> crate::lightning::offers::parse::Bolt12ParseError { + let from_obj = f.into_native(); + crate::lightning::offers::parse::Bolt12ParseError { inner: ObjOps::heap_alloc((lightning::offers::parse::Bolt12ParseError::from(from_obj))), is_owned: true } +} +#[no_mangle] +/// Build a Bolt12ParseError from a Secp256k1Error +pub extern "C" fn Bolt12ParseError_from_Secp256k1Error(f: crate::c_types::Secp256k1Error) -> crate::lightning::offers::parse::Bolt12ParseError { + let from_obj = f.into_rust(); + crate::lightning::offers::parse::Bolt12ParseError { inner: ObjOps::heap_alloc((lightning::offers::parse::Bolt12ParseError::from(from_obj))), is_owned: true } +} diff --git a/lightning-c-bindings/src/lightning/offers/refund.rs b/lightning-c-bindings/src/lightning/offers/refund.rs index 5642d59a..48fd6c4d 100644 --- a/lightning-c-bindings/src/lightning/offers/refund.rs +++ b/lightning-c-bindings/src/lightning/offers/refund.rs @@ -158,7 +158,7 @@ impl Clone for RefundMaybeWithDerivedMetadataBuilder { fn clone(&self) -> Self { Self { inner: if <*mut nativeRefundMaybeWithDerivedMetadataBuilder>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -166,12 +166,12 @@ impl Clone for RefundMaybeWithDerivedMetadataBuilder { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RefundMaybeWithDerivedMetadataBuilder_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRefundMaybeWithDerivedMetadataBuilder)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRefundMaybeWithDerivedMetadataBuilder) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RefundMaybeWithDerivedMetadataBuilder pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_clone(orig: &RefundMaybeWithDerivedMetadataBuilder) -> RefundMaybeWithDerivedMetadataBuilder { - orig.clone() + Clone::clone(orig) } /// Creates a new builder for a refund using the `signing_pubkey` for the public node id to send /// to if no [`Refund::paths`] are set. Otherwise, `signing_pubkey` may be a transient pubkey. @@ -380,7 +380,7 @@ impl Clone for Refund { fn clone(&self) -> Self { Self { inner: if <*mut nativeRefund>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -388,12 +388,12 @@ impl Clone for Refund { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Refund_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRefund)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRefund) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Refund pub extern "C" fn Refund_clone(orig: &Refund) -> Refund { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Refund object pub extern "C" fn Refund_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning/offers/static_invoice.rs b/lightning-c-bindings/src/lightning/offers/static_invoice.rs new file mode 100644 index 00000000..10199712 --- /dev/null +++ b/lightning-c-bindings/src/lightning/offers/static_invoice.rs @@ -0,0 +1,724 @@ +// 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 encoding for static BOLT 12 invoices. + +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::static_invoice::StaticInvoice as nativeStaticInvoiceImport; +pub(crate) type nativeStaticInvoice = nativeStaticInvoiceImport; + +/// A `StaticInvoice` is a reusable payment request corresponding to an [`Offer`]. +/// +/// A static invoice may be sent in response to an [`InvoiceRequest`] and includes all the +/// information needed to pay the recipient. However, unlike [`Bolt12Invoice`]s, static invoices do +/// not provide proof-of-payment. Therefore, [`Bolt12Invoice`]s should be preferred when the +/// recipient is online to provide one. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +#[must_use] +#[repr(C)] +pub struct StaticInvoice { + /// 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 nativeStaticInvoice, + /// 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 core::ops::Deref for StaticInvoice { + type Target = nativeStaticInvoice; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for StaticInvoice { } +unsafe impl core::marker::Sync for StaticInvoice { } +impl Drop for StaticInvoice { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeStaticInvoice>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the StaticInvoice, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn StaticInvoice_free(this_obj: StaticInvoice) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn StaticInvoice_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStaticInvoice) }; +} +#[allow(unused)] +impl StaticInvoice { + pub(crate) fn get_native_ref(&self) -> &'static nativeStaticInvoice { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeStaticInvoice { + 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 nativeStaticInvoice { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for StaticInvoice { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeStaticInvoice>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 StaticInvoice_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeStaticInvoice) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the StaticInvoice +pub extern "C" fn StaticInvoice_clone(orig: &StaticInvoice) -> StaticInvoice { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a StaticInvoice object +pub extern "C" fn StaticInvoice_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::static_invoice::StaticInvoice }).into()} +/// Generates a non-cryptographic 64-bit hash of the StaticInvoice. +#[no_mangle] +pub extern "C" fn StaticInvoice_hash(o: &StaticInvoice) -> 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) +} + +use lightning::offers::static_invoice::UnsignedStaticInvoice as nativeUnsignedStaticInvoiceImport; +pub(crate) type nativeUnsignedStaticInvoice = nativeUnsignedStaticInvoiceImport; + +/// A semantically valid [`StaticInvoice`] that hasn't been signed. +#[must_use] +#[repr(C)] +pub struct UnsignedStaticInvoice { + /// 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 nativeUnsignedStaticInvoice, + /// 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 core::ops::Deref for UnsignedStaticInvoice { + type Target = nativeUnsignedStaticInvoice; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for UnsignedStaticInvoice { } +unsafe impl core::marker::Sync for UnsignedStaticInvoice { } +impl Drop for UnsignedStaticInvoice { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeUnsignedStaticInvoice>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the UnsignedStaticInvoice, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_free(this_obj: UnsignedStaticInvoice) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn UnsignedStaticInvoice_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedStaticInvoice) }; +} +#[allow(unused)] +impl UnsignedStaticInvoice { + pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedStaticInvoice { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedStaticInvoice { + 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 nativeUnsignedStaticInvoice { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Signs the [`TaggedHash`] of the invoice using the given function. +/// +/// Note: The hash computation may have included unknown, odd TLV records. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_sign(mut this_arg: crate::lightning::offers::static_invoice::UnsignedStaticInvoice, mut sign: crate::lightning::offers::static_invoice::SignStaticInvoiceFn) -> crate::c_types::derived::CResult_StaticInvoiceSignErrorZ { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).sign(sign); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::merkle::SignError::native_into(e) }).into() }; + local_ret +} + +/// Paths to the recipient originating from publicly reachable nodes, including information +/// needed for routing payments across them. +/// +/// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this +/// privacy is lost if a public node id is used for +///[`UnsignedStaticInvoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_payment_paths(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::CVec_BlindedPaymentPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_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::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// Duration since the Unix epoch when the invoice was created. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_created_at(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.created_at(); + ret.as_secs() +} + +/// Duration since +///[`UnsignedStaticInvoice::created_at`] +/// when the invoice has expired and therefore should no longer be paid. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_relative_expiry(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> 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 UnsignedStaticInvoice_is_expired(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); + ret +} + +/// Whether the invoice has expired given the current time as duration since the Unix epoch. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_is_expired_no_std(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice, mut duration_since_epoch: u64) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired_no_std(core::time::Duration::from_secs(duration_since_epoch)); + ret +} + +/// Fallback addresses for paying the invoice on-chain, in order of most-preferred to +/// least-preferred. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_fallbacks(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::CVec_AddressZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fallbacks(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::Address::from_rust(&item) }); }; + local_ret.into() +} + +/// Features pertaining to paying an invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_invoice_features(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::lightning_types::features::Bolt12InvoiceFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_features(); + crate::lightning_types::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } +} + +/// The public key corresponding to the key used to sign the invoice. +/// +/// This will be: +/// - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise +/// - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_signing_pubkey(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// The chain that must be used when paying the invoice. [`StaticInvoice`]s currently can only be +/// created from offers that support a single chain. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_chain(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() } +} + +/// Opaque bytes set by the originating [`Offer::metadata`]. +/// +/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_metadata(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> 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`]. +/// +/// [`Offer::amount`]: crate::offers::offer::Offer::amount +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_amount(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::COption_AmountZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_AmountZ::None } else { crate::c_types::derived::COption_AmountZ::Some( { crate::lightning::offers::offer::Amount::native_into(ret.unwrap()) }) }; + local_ret +} + +/// Features pertaining to the originating [`Offer`], from [`Offer::offer_features`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_offer_features(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::lightning_types::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + crate::lightning_types::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::OfferFeatures<>) as *mut _) }, is_owned: false } +} + +/// A complete description of the purpose of the originating offer, from [`Offer::description`]. +/// +/// [`Offer::description`]: crate::offers::offer::Offer::description +/// +/// 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 UnsignedStaticInvoice_description(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::lightning_types::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + let mut local_ret = crate::lightning_types::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 an invoice should no longer be requested, from +/// [`Offer::absolute_expiry`]. +/// +/// [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_absolute_expiry(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> 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, from [`Offer::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 UnsignedStaticInvoice_issuer(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::lightning_types::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning_types::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 node that may supply the invoice on the recipient's behalf, originating from +/// publicly reachable nodes. Taken from [`Offer::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_offer_message_paths(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::CVec_BlindedMessagePathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_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::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// Paths to the recipient for indicating that a held HTLC is available to claim when they next +/// come online. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_message_paths(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::CVec_BlindedMessagePathZ { + 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::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported, from [`Offer::supported_quantity`]. +/// +/// [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedStaticInvoice_supported_quantity(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + crate::lightning::offers::offer::Quantity::native_into(ret) +} + +/// The public key used by the recipient to sign invoices, from +/// [`Offer::issuer_signing_pubkey`]. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// +/// 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 UnsignedStaticInvoice_issuer_signing_pubkey(this_arg: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); + let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; + local_ret +} + +/// A function for signing an [`UnsignedStaticInvoice`]. +#[repr(C)] +pub struct SignStaticInvoiceFn { + /// 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, + /// Signs a [`TaggedHash`] computed over the merkle root of `message`'s TLV stream. + pub sign_invoice: extern "C" fn (this_arg: *const c_void, message: &crate::lightning::offers::static_invoice::UnsignedStaticInvoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ, + /// 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 SignStaticInvoiceFn {} +unsafe impl Sync for SignStaticInvoiceFn {} +#[allow(unused)] +pub(crate) fn SignStaticInvoiceFn_clone_fields(orig: &SignStaticInvoiceFn) -> SignStaticInvoiceFn { + SignStaticInvoiceFn { + this_arg: orig.this_arg, + sign_invoice: Clone::clone(&orig.sign_invoice), + free: Clone::clone(&orig.free), + } +} + +use lightning::offers::static_invoice::SignStaticInvoiceFn as rustSignStaticInvoiceFn; +impl rustSignStaticInvoiceFn for SignStaticInvoiceFn { + fn sign_invoice(&self, mut message: &lightning::offers::static_invoice::UnsignedStaticInvoice) -> Result { + let mut ret = (self.sign_invoice)(self.this_arg, &crate::lightning::offers::static_invoice::UnsignedStaticInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((message as *const lightning::offers::static_invoice::UnsignedStaticInvoice<>) 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 + } +} + +pub struct SignStaticInvoiceFnRef(SignStaticInvoiceFn); +impl rustSignStaticInvoiceFn for SignStaticInvoiceFnRef { + fn sign_invoice(&self, mut message: &lightning::offers::static_invoice::UnsignedStaticInvoice) -> Result { + let mut ret = (self.0.sign_invoice)(self.0.this_arg, &crate::lightning::offers::static_invoice::UnsignedStaticInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((message as *const lightning::offers::static_invoice::UnsignedStaticInvoice<>) 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 + } +} + +// 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 SignStaticInvoiceFn { + type Target = SignStaticInvoiceFnRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const SignStaticInvoiceFnRef) } + } +} +impl core::ops::DerefMut for SignStaticInvoiceFn { + fn deref_mut(&mut self) -> &mut SignStaticInvoiceFnRef { + unsafe { &mut *(self as *mut _ as *mut SignStaticInvoiceFnRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn SignStaticInvoiceFn_free(this_ptr: SignStaticInvoiceFn) { } +impl Drop for SignStaticInvoiceFn { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// Paths to the recipient originating from publicly reachable nodes, including information +/// needed for routing payments across them. +/// +/// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this +/// privacy is lost if a public node id is used for +///[`StaticInvoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_payment_paths(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::CVec_BlindedPaymentPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_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::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// Duration since the Unix epoch when the invoice was created. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_created_at(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.created_at(); + ret.as_secs() +} + +/// Duration since +///[`StaticInvoice::created_at`] +/// when the invoice has expired and therefore should no longer be paid. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_relative_expiry(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> 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 StaticInvoice_is_expired(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired(); + ret +} + +/// Whether the invoice has expired given the current time as duration since the Unix epoch. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_is_expired_no_std(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice, mut duration_since_epoch: u64) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired_no_std(core::time::Duration::from_secs(duration_since_epoch)); + ret +} + +/// Fallback addresses for paying the invoice on-chain, in order of most-preferred to +/// least-preferred. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_fallbacks(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::CVec_AddressZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fallbacks(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::Address::from_rust(&item) }); }; + local_ret.into() +} + +/// Features pertaining to paying an invoice. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_invoice_features(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning_types::features::Bolt12InvoiceFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_features(); + crate::lightning_types::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } +} + +/// The public key corresponding to the key used to sign the invoice. +/// +/// This will be: +/// - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise +/// - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_signing_pubkey(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); + crate::c_types::PublicKey::from_rust(&ret) +} + +/// The chain that must be used when paying the invoice. [`StaticInvoice`]s currently can only be +/// created from offers that support a single chain. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_chain(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::ThirtyTwoBytes { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain(); + crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() } +} + +/// Opaque bytes set by the originating [`Offer::metadata`]. +/// +/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_metadata(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> 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`]. +/// +/// [`Offer::amount`]: crate::offers::offer::Offer::amount +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_amount(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::COption_AmountZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_AmountZ::None } else { crate::c_types::derived::COption_AmountZ::Some( { crate::lightning::offers::offer::Amount::native_into(ret.unwrap()) }) }; + local_ret +} + +/// Features pertaining to the originating [`Offer`], from [`Offer::offer_features`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_offer_features(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning_types::features::OfferFeatures { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features(); + crate::lightning_types::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::OfferFeatures<>) as *mut _) }, is_owned: false } +} + +/// A complete description of the purpose of the originating offer, from [`Offer::description`]. +/// +/// [`Offer::description`]: crate::offers::offer::Offer::description +/// +/// 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 StaticInvoice_description(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning_types::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description(); + let mut local_ret = crate::lightning_types::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 an invoice should no longer be requested, from +/// [`Offer::absolute_expiry`]. +/// +/// [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_absolute_expiry(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> 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, from [`Offer::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 StaticInvoice_issuer(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning_types::string::PrintableString { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer(); + let mut local_ret = crate::lightning_types::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 node that may supply the invoice on the recipient's behalf, originating from +/// publicly reachable nodes. Taken from [`Offer::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_offer_message_paths(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::CVec_BlindedMessagePathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_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::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// Paths to the recipient for indicating that a held HTLC is available to claim when they next +/// come online. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_message_paths(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::CVec_BlindedMessagePathZ { + 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::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + +/// The quantity of items supported, from [`Offer::supported_quantity`]. +/// +/// [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_supported_quantity(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning::offers::offer::Quantity { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity(); + crate::lightning::offers::offer::Quantity::native_into(ret) +} + +/// The public key used by the recipient to sign invoices, from +/// [`Offer::issuer_signing_pubkey`]. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// +/// 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 StaticInvoice_issuer_signing_pubkey(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); + let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; + local_ret +} + +/// Signature of the invoice verified using [`StaticInvoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_signature(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::SchnorrSignature { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature(); + crate::c_types::SchnorrSignature::from_rust(&ret) +} + +/// Whether the [`Offer`] that this invoice is based on is expired. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_is_offer_expired(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_offer_expired(); + ret +} + +/// Whether the [`Offer`] that this invoice is based on is expired, given the current time as +/// duration since the Unix epoch. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_is_offer_expired_no_std(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice, mut duration_since_epoch: u64) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_offer_expired_no_std(core::time::Duration::from_secs(duration_since_epoch)); + ret +} + +/// Returns the [`OfferId`] corresponding to the originating [`Offer`]. +/// +/// [`Offer`]: crate::offers::offer::Offer +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoice_offer_id(this_arg: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning::offers::offer::OfferId { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_id(); + crate::lightning::offers::offer::OfferId { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +#[no_mangle] +/// Serialize the StaticInvoice object into a byte array which can be read by StaticInvoice_read +pub extern "C" fn StaticInvoice_write(obj: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn StaticInvoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::offers::static_invoice::nativeStaticInvoice) }) +} +#[no_mangle] +/// Read a StaticInvoice from a byte array, created by StaticInvoice_write +pub extern "C" fn StaticInvoice_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StaticInvoiceDecodeErrorZ { + 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::offers::static_invoice::StaticInvoice { 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/onion_message/async_payments.rs b/lightning-c-bindings/src/lightning/onion_message/async_payments.rs index 08dc4627..86877049 100644 --- a/lightning-c-bindings/src/lightning/onion_message/async_payments.rs +++ b/lightning-c-bindings/src/lightning/onion_message/async_payments.rs @@ -19,17 +19,48 @@ use alloc::{vec::Vec, boxed::Box}; /// A handler for an [`OnionMessage`] containing an async payments message as its payload. /// +/// The [`AsyncPaymentsContext`]s provided to each method was authenticated by the +/// [`OnionMessenger`] as coming from a blinded path that we created. +/// /// [`OnionMessage`]: crate::ln::msgs::OnionMessage +/// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger #[repr(C)] pub struct AsyncPaymentsMessageHandler { /// 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, + /// Handle an [`OfferPathsRequest`] message. If we are a static invoice server and the message was + /// sent over paths that we previously provided to an async recipient, an [`OfferPaths`] message + /// should be returned. + /// + /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_offer_paths_request: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::OfferPathsRequest, context: crate::lightning::blinded_path::message::AsyncPaymentsContext, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_OfferPathsResponseInstructionZZ, + /// Handle an [`OfferPaths`] message. If this is in response to an [`OfferPathsRequest`] that + /// we previously sent as an async recipient, we should build an [`Offer`] containing the + /// included [`OfferPaths::paths`] and a corresponding [`StaticInvoice`], and reply with + /// [`ServeStaticInvoice`]. + /// + /// [`Offer`]: crate::offers::offer::Offer + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + /// + /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_offer_paths: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::OfferPaths, context: crate::lightning::blinded_path::message::AsyncPaymentsContext, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ServeStaticInvoiceResponseInstructionZZ, + /// Handle a [`ServeStaticInvoice`] message. If this is in response to an [`OfferPaths`] message + /// we previously sent as a static invoice server, a [`StaticInvoicePersisted`] message should be + /// sent once the message is handled. + /// + /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_serve_static_invoice: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::ServeStaticInvoice, context: crate::lightning::blinded_path::message::AsyncPaymentsContext, responder: crate::lightning::onion_message::messenger::Responder), + /// Handle a [`StaticInvoicePersisted`] message. If this is in response to a + /// [`ServeStaticInvoice`] message we previously sent as an async recipient, then the offer we + /// generated on receipt of a previous [`OfferPaths`] message is now ready to be used for async + /// payments. + pub handle_static_invoice_persisted: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::StaticInvoicePersisted, context: crate::lightning::blinded_path::message::AsyncPaymentsContext), /// Handle a [`HeldHtlcAvailable`] message. A [`ReleaseHeldHtlc`] should be returned to release /// the held funds. /// /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - pub handle_held_htlc_available: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ, + pub handle_held_htlc_available: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, context: crate::lightning::blinded_path::message::AsyncPaymentsContext, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ, /// Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC /// should be released to the corresponding payee. pub handle_release_held_htlc: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, context: crate::lightning::blinded_path::message::AsyncPaymentsContext), @@ -48,6 +79,10 @@ unsafe impl Sync for AsyncPaymentsMessageHandler {} pub(crate) fn AsyncPaymentsMessageHandler_clone_fields(orig: &AsyncPaymentsMessageHandler) -> AsyncPaymentsMessageHandler { AsyncPaymentsMessageHandler { this_arg: orig.this_arg, + handle_offer_paths_request: Clone::clone(&orig.handle_offer_paths_request), + handle_offer_paths: Clone::clone(&orig.handle_offer_paths), + handle_serve_static_invoice: Clone::clone(&orig.handle_serve_static_invoice), + handle_static_invoice_persisted: Clone::clone(&orig.handle_static_invoice_persisted), handle_held_htlc_available: Clone::clone(&orig.handle_held_htlc_available), handle_release_held_htlc: Clone::clone(&orig.handle_release_held_htlc), release_pending_messages: Clone::clone(&orig.release_pending_messages), @@ -57,9 +92,28 @@ pub(crate) fn AsyncPaymentsMessageHandler_clone_fields(orig: &AsyncPaymentsMessa use lightning::onion_message::async_payments::AsyncPaymentsMessageHandler as rustAsyncPaymentsMessageHandler; impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandler { - fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + fn handle_offer_paths_request(&self, mut message: lightning::onion_message::async_payments::OfferPathsRequest, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::OfferPaths, lightning::onion_message::messenger::ResponseInstruction)> { let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; - let mut ret = (self.handle_held_htlc_available)(self.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut ret = (self.handle_offer_paths_request)(self.this_arg, crate::lightning::onion_message::async_payments::OfferPathsRequest { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_offer_paths(&self, mut message: lightning::onion_message::async_payments::OfferPaths, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ServeStaticInvoice, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.handle_offer_paths)(self.this_arg, crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_serve_static_invoice(&self, mut message: lightning::onion_message::async_payments::ServeStaticInvoice, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + (self.handle_serve_static_invoice)(self.this_arg, crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder) + } + fn handle_static_invoice_persisted(&self, mut message: lightning::onion_message::async_payments::StaticInvoicePersisted, mut context: lightning::blinded_path::message::AsyncPaymentsContext) { + (self.handle_static_invoice_persisted)(self.this_arg, crate::lightning::onion_message::async_payments::StaticInvoicePersisted { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context)) + } + fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.handle_held_htlc_available)(self.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; local_ret } @@ -75,9 +129,28 @@ impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandler { pub struct AsyncPaymentsMessageHandlerRef(AsyncPaymentsMessageHandler); impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandlerRef { - fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + fn handle_offer_paths_request(&self, mut message: lightning::onion_message::async_payments::OfferPathsRequest, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::OfferPaths, lightning::onion_message::messenger::ResponseInstruction)> { let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; - let mut ret = (self.0.handle_held_htlc_available)(self.0.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut ret = (self.0.handle_offer_paths_request)(self.0.this_arg, crate::lightning::onion_message::async_payments::OfferPathsRequest { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_offer_paths(&self, mut message: lightning::onion_message::async_payments::OfferPaths, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ServeStaticInvoice, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.0.handle_offer_paths)(self.0.this_arg, crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_serve_static_invoice(&self, mut message: lightning::onion_message::async_payments::ServeStaticInvoice, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + (self.0.handle_serve_static_invoice)(self.0.this_arg, crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder) + } + fn handle_static_invoice_persisted(&self, mut message: lightning::onion_message::async_payments::StaticInvoicePersisted, mut context: lightning::blinded_path::message::AsyncPaymentsContext) { + (self.0.handle_static_invoice_persisted)(self.0.this_arg, crate::lightning::onion_message::async_payments::StaticInvoicePersisted { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context)) + } + fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut context: lightning::blinded_path::message::AsyncPaymentsContext, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.0.handle_held_htlc_available)(self.0.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context), local_responder); let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; local_ret } @@ -121,6 +194,29 @@ impl Drop for AsyncPaymentsMessageHandler { #[must_use] #[repr(C)] pub enum AsyncPaymentsMessage { + /// A request from an async recipient for [`BlindedMessagePath`]s, sent to a static invoice + /// server. + OfferPathsRequest( + crate::lightning::onion_message::async_payments::OfferPathsRequest), + /// [`BlindedMessagePath`]s to be included in an async recipient's [`Offer::paths`], sent by a + /// static invoice server in response to an [`OfferPathsRequest`]. + /// + /// [`Offer::paths`]: crate::offers::offer::Offer::paths + OfferPaths( + crate::lightning::onion_message::async_payments::OfferPaths), + /// A request from an async recipient to a static invoice server that a [`StaticInvoice`] be + /// provided in response to [`InvoiceRequest`]s from payers. + /// + /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + ServeStaticInvoice( + crate::lightning::onion_message::async_payments::ServeStaticInvoice), + /// Confirmation from a static invoice server that a [`StaticInvoice`] was persisted and the + /// corresponding [`Offer`] is ready to be used to receive async payments. Sent to an async + /// recipient in response to a [`ServeStaticInvoice`] message. + /// + /// [`Offer`]: crate::offers::offer::Offer + StaticInvoicePersisted( + crate::lightning::onion_message::async_payments::StaticInvoicePersisted), /// An HTLC is being held upstream for the often-offline recipient, to be released via /// [`ReleaseHeldHtlc`]. HeldHtlcAvailable( @@ -136,6 +232,30 @@ impl AsyncPaymentsMessage { #[allow(unused)] pub(crate) fn to_native(&self) -> nativeAsyncPaymentsMessage { match self { + AsyncPaymentsMessage::OfferPathsRequest (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeAsyncPaymentsMessage::OfferPathsRequest ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + AsyncPaymentsMessage::OfferPaths (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeAsyncPaymentsMessage::OfferPaths ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + AsyncPaymentsMessage::ServeStaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeAsyncPaymentsMessage::ServeStaticInvoice ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + AsyncPaymentsMessage::StaticInvoicePersisted (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeAsyncPaymentsMessage::StaticInvoicePersisted ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, AsyncPaymentsMessage::HeldHtlcAvailable (ref a, ) => { let mut a_nonref = Clone::clone(a); nativeAsyncPaymentsMessage::HeldHtlcAvailable ( @@ -153,6 +273,26 @@ impl AsyncPaymentsMessage { #[allow(unused)] pub(crate) fn into_native(self) -> nativeAsyncPaymentsMessage { match self { + AsyncPaymentsMessage::OfferPathsRequest (mut a, ) => { + nativeAsyncPaymentsMessage::OfferPathsRequest ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + AsyncPaymentsMessage::OfferPaths (mut a, ) => { + nativeAsyncPaymentsMessage::OfferPaths ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + AsyncPaymentsMessage::ServeStaticInvoice (mut a, ) => { + nativeAsyncPaymentsMessage::ServeStaticInvoice ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + AsyncPaymentsMessage::StaticInvoicePersisted (mut a, ) => { + nativeAsyncPaymentsMessage::StaticInvoicePersisted ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, AsyncPaymentsMessage::HeldHtlcAvailable (mut a, ) => { nativeAsyncPaymentsMessage::HeldHtlcAvailable ( *unsafe { Box::from_raw(a.take_inner()) }, @@ -169,6 +309,30 @@ impl AsyncPaymentsMessage { pub(crate) fn from_native(native: &AsyncPaymentsMessageImport) -> Self { let native = unsafe { &*(native as *const _ as *const c_void as *const nativeAsyncPaymentsMessage) }; match native { + nativeAsyncPaymentsMessage::OfferPathsRequest (ref a, ) => { + let mut a_nonref = Clone::clone(a); + AsyncPaymentsMessage::OfferPathsRequest ( + crate::lightning::onion_message::async_payments::OfferPathsRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::OfferPaths (ref a, ) => { + let mut a_nonref = Clone::clone(a); + AsyncPaymentsMessage::OfferPaths ( + crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::ServeStaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + AsyncPaymentsMessage::ServeStaticInvoice ( + crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::StaticInvoicePersisted (ref a, ) => { + let mut a_nonref = Clone::clone(a); + AsyncPaymentsMessage::StaticInvoicePersisted ( + crate::lightning::onion_message::async_payments::StaticInvoicePersisted { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, nativeAsyncPaymentsMessage::HeldHtlcAvailable (ref a, ) => { let mut a_nonref = Clone::clone(a); AsyncPaymentsMessage::HeldHtlcAvailable ( @@ -186,6 +350,26 @@ impl AsyncPaymentsMessage { #[allow(unused)] pub(crate) fn native_into(native: nativeAsyncPaymentsMessage) -> Self { match native { + nativeAsyncPaymentsMessage::OfferPathsRequest (mut a, ) => { + AsyncPaymentsMessage::OfferPathsRequest ( + crate::lightning::onion_message::async_payments::OfferPathsRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::OfferPaths (mut a, ) => { + AsyncPaymentsMessage::OfferPaths ( + crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::ServeStaticInvoice (mut a, ) => { + AsyncPaymentsMessage::ServeStaticInvoice ( + crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeAsyncPaymentsMessage::StaticInvoicePersisted (mut a, ) => { + AsyncPaymentsMessage::StaticInvoicePersisted ( + crate::lightning::onion_message::async_payments::StaticInvoicePersisted { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, nativeAsyncPaymentsMessage::HeldHtlcAvailable (mut a, ) => { AsyncPaymentsMessage::HeldHtlcAvailable ( crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(a), is_owned: true }, @@ -218,6 +402,26 @@ pub(crate) extern "C" fn AsyncPaymentsMessage_free_void(this_ptr: *mut c_void) { let _ = unsafe { Box::from_raw(this_ptr as *mut AsyncPaymentsMessage) }; } #[no_mangle] +/// Utility method to constructs a new OfferPathsRequest-variant AsyncPaymentsMessage +pub extern "C" fn AsyncPaymentsMessage_offer_paths_request(a: crate::lightning::onion_message::async_payments::OfferPathsRequest) -> AsyncPaymentsMessage { + AsyncPaymentsMessage::OfferPathsRequest(a, ) +} +#[no_mangle] +/// Utility method to constructs a new OfferPaths-variant AsyncPaymentsMessage +pub extern "C" fn AsyncPaymentsMessage_offer_paths(a: crate::lightning::onion_message::async_payments::OfferPaths) -> AsyncPaymentsMessage { + AsyncPaymentsMessage::OfferPaths(a, ) +} +#[no_mangle] +/// Utility method to constructs a new ServeStaticInvoice-variant AsyncPaymentsMessage +pub extern "C" fn AsyncPaymentsMessage_serve_static_invoice(a: crate::lightning::onion_message::async_payments::ServeStaticInvoice) -> AsyncPaymentsMessage { + AsyncPaymentsMessage::ServeStaticInvoice(a, ) +} +#[no_mangle] +/// Utility method to constructs a new StaticInvoicePersisted-variant AsyncPaymentsMessage +pub extern "C" fn AsyncPaymentsMessage_static_invoice_persisted(a: crate::lightning::onion_message::async_payments::StaticInvoicePersisted) -> AsyncPaymentsMessage { + AsyncPaymentsMessage::StaticInvoicePersisted(a, ) +} +#[no_mangle] /// Utility method to constructs a new HeldHtlcAvailable-variant AsyncPaymentsMessage pub extern "C" fn AsyncPaymentsMessage_held_htlc_available(a: crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> AsyncPaymentsMessage { AsyncPaymentsMessage::HeldHtlcAvailable(a, ) @@ -231,6 +435,480 @@ pub extern "C" fn AsyncPaymentsMessage_release_held_htlc(a: crate::lightning::on pub extern "C" fn AsyncPaymentsMessage_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::AsyncPaymentsMessage }).into()} +use lightning::onion_message::async_payments::OfferPathsRequest as nativeOfferPathsRequestImport; +pub(crate) type nativeOfferPathsRequest = nativeOfferPathsRequestImport; + +/// A request from an async recipient for [`BlindedMessagePath`]s from a static invoice server. +/// These paths will be used in the async recipient's [`Offer::paths`], so payers can request +/// [`StaticInvoice`]s from the static invoice server. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[repr(C)] +pub struct OfferPathsRequest { + /// 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 nativeOfferPathsRequest, + /// 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 core::ops::Deref for OfferPathsRequest { + type Target = nativeOfferPathsRequest; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OfferPathsRequest { } +unsafe impl core::marker::Sync for OfferPathsRequest { } +impl Drop for OfferPathsRequest { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOfferPathsRequest>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OfferPathsRequest, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OfferPathsRequest_free(this_obj: OfferPathsRequest) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OfferPathsRequest_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOfferPathsRequest) }; +} +#[allow(unused)] +impl OfferPathsRequest { + pub(crate) fn get_native_ref(&self) -> &'static nativeOfferPathsRequest { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOfferPathsRequest { + 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 nativeOfferPathsRequest { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The \"slot\" in the static invoice server's database that this invoice should go into. This +/// allows us as the recipient to replace a specific invoice that is stored by the server, which +/// is useful for limiting the number of invoices stored by the server while also keeping all the +/// invoices persisted with the server fresh. +#[no_mangle] +pub extern "C" fn OfferPathsRequest_get_invoice_slot(this_ptr: &OfferPathsRequest) -> u16 { + let mut inner_val = &mut OfferPathsRequest::get_native_mut_ref(this_ptr).invoice_slot; + *inner_val +} +/// The \"slot\" in the static invoice server's database that this invoice should go into. This +/// allows us as the recipient to replace a specific invoice that is stored by the server, which +/// is useful for limiting the number of invoices stored by the server while also keeping all the +/// invoices persisted with the server fresh. +#[no_mangle] +pub extern "C" fn OfferPathsRequest_set_invoice_slot(this_ptr: &mut OfferPathsRequest, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.invoice_slot = val; +} +/// Constructs a new OfferPathsRequest given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OfferPathsRequest_new(mut invoice_slot_arg: u16) -> OfferPathsRequest { + OfferPathsRequest { inner: ObjOps::heap_alloc(nativeOfferPathsRequest { + invoice_slot: invoice_slot_arg, + }), is_owned: true } +} +impl Clone for OfferPathsRequest { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeOfferPathsRequest>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 OfferPathsRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferPathsRequest) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the OfferPathsRequest +pub extern "C" fn OfferPathsRequest_clone(orig: &OfferPathsRequest) -> OfferPathsRequest { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a OfferPathsRequest object +pub extern "C" fn OfferPathsRequest_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::OfferPathsRequest }).into()} + +use lightning::onion_message::async_payments::OfferPaths as nativeOfferPathsImport; +pub(crate) type nativeOfferPaths = nativeOfferPathsImport; + +/// [`BlindedMessagePath`]s to be included in an async recipient's [`Offer::paths`], sent by a +/// static invoice server in response to an [`OfferPathsRequest`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[must_use] +#[repr(C)] +pub struct OfferPaths { + /// 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 nativeOfferPaths, + /// 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 core::ops::Deref for OfferPaths { + type Target = nativeOfferPaths; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OfferPaths { } +unsafe impl core::marker::Sync for OfferPaths { } +impl Drop for OfferPaths { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOfferPaths>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OfferPaths, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OfferPaths_free(this_obj: OfferPaths) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OfferPaths_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOfferPaths) }; +} +#[allow(unused)] +impl OfferPaths { + pub(crate) fn get_native_ref(&self) -> &'static nativeOfferPaths { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOfferPaths { + 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 nativeOfferPaths { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The paths that should be included in the async recipient's [`Offer::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[no_mangle] +pub extern "C" fn OfferPaths_get_paths(this_ptr: &OfferPaths) -> crate::c_types::derived::CVec_BlindedMessagePathZ { + let mut inner_val = &mut OfferPaths::get_native_mut_ref(this_ptr).paths; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::blinded_path::message::BlindedMessagePath { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::blinded_path::message::BlindedMessagePath<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// The paths that should be included in the async recipient's [`Offer::paths`]. +/// +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +#[no_mangle] +pub extern "C" fn OfferPaths_set_paths(this_ptr: &mut OfferPaths, mut val: crate::c_types::derived::CVec_BlindedMessagePathZ) { + 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 time as seconds since the Unix epoch at which the [`Self::paths`] expire. +#[no_mangle] +pub extern "C" fn OfferPaths_get_paths_absolute_expiry(this_ptr: &OfferPaths) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut OfferPaths::get_native_mut_ref(this_ptr).paths_absolute_expiry; + 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 time as seconds since the Unix epoch at which the [`Self::paths`] expire. +#[no_mangle] +pub extern "C" fn OfferPaths_set_paths_absolute_expiry(this_ptr: &mut OfferPaths, 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) }.paths_absolute_expiry = local_val; +} +/// Constructs a new OfferPaths given each field +#[must_use] +#[no_mangle] +pub extern "C" fn OfferPaths_new(mut paths_arg: crate::c_types::derived::CVec_BlindedMessagePathZ, mut paths_absolute_expiry_arg: crate::c_types::derived::COption_u64Z) -> OfferPaths { + 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_paths_absolute_expiry_arg = if paths_absolute_expiry_arg.is_some() { Some( { paths_absolute_expiry_arg.take() }) } else { None }; + OfferPaths { inner: ObjOps::heap_alloc(nativeOfferPaths { + paths: local_paths_arg, + paths_absolute_expiry: local_paths_absolute_expiry_arg, + }), is_owned: true } +} +impl Clone for OfferPaths { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeOfferPaths>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 OfferPaths_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferPaths) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the OfferPaths +pub extern "C" fn OfferPaths_clone(orig: &OfferPaths) -> OfferPaths { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a OfferPaths object +pub extern "C" fn OfferPaths_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::OfferPaths }).into()} + +use lightning::onion_message::async_payments::ServeStaticInvoice as nativeServeStaticInvoiceImport; +pub(crate) type nativeServeStaticInvoice = nativeServeStaticInvoiceImport; + +/// A request from an async recipient to a static invoice server that a [`StaticInvoice`] be +/// provided in response to [`InvoiceRequest`]s from payers. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +#[must_use] +#[repr(C)] +pub struct ServeStaticInvoice { + /// 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 nativeServeStaticInvoice, + /// 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 core::ops::Deref for ServeStaticInvoice { + type Target = nativeServeStaticInvoice; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ServeStaticInvoice { } +unsafe impl core::marker::Sync for ServeStaticInvoice { } +impl Drop for ServeStaticInvoice { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeServeStaticInvoice>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ServeStaticInvoice, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_free(this_obj: ServeStaticInvoice) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ServeStaticInvoice_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeServeStaticInvoice) }; +} +#[allow(unused)] +impl ServeStaticInvoice { + pub(crate) fn get_native_ref(&self) -> &'static nativeServeStaticInvoice { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeServeStaticInvoice { + 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 nativeServeStaticInvoice { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The invoice that should be served by the static invoice server. Once this invoice has been +/// persisted, the [`Responder`] accompanying this message should be used to send +/// [`StaticInvoicePersisted`] to the recipient to confirm that the offer corresponding to the +/// invoice is ready to receive async payments. +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_get_invoice(this_ptr: &ServeStaticInvoice) -> crate::lightning::offers::static_invoice::StaticInvoice { + let mut inner_val = &mut ServeStaticInvoice::get_native_mut_ref(this_ptr).invoice; + crate::lightning::offers::static_invoice::StaticInvoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::offers::static_invoice::StaticInvoice<>) as *mut _) }, is_owned: false } +} +/// The invoice that should be served by the static invoice server. Once this invoice has been +/// persisted, the [`Responder`] accompanying this message should be used to send +/// [`StaticInvoicePersisted`] to the recipient to confirm that the offer corresponding to the +/// invoice is ready to receive async payments. +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_set_invoice(this_ptr: &mut ServeStaticInvoice, mut val: crate::lightning::offers::static_invoice::StaticInvoice) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.invoice = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// If a static invoice server receives an [`InvoiceRequest`] for a [`StaticInvoice`], they should +/// also forward the [`InvoiceRequest`] to the async recipient so they can respond with a fresh +/// [`Bolt12Invoice`] if the recipient is online at the time. Use this path to forward the +/// [`InvoiceRequest`] to the async recipient. +/// +/// This path's [`BlindedMessagePath::introduction_node`] MUST be set to the static invoice server +/// node or one of its peers. This is because, for DoS protection, invoice requests forwarded over +/// this path are treated by the server node like any other onion message forward and the server +/// will not directly connect to the introduction node if they are not already peers. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_get_forward_invoice_request_path(this_ptr: &ServeStaticInvoice) -> crate::lightning::blinded_path::message::BlindedMessagePath { + let mut inner_val = &mut ServeStaticInvoice::get_native_mut_ref(this_ptr).forward_invoice_request_path; + crate::lightning::blinded_path::message::BlindedMessagePath { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::message::BlindedMessagePath<>) as *mut _) }, is_owned: false } +} +/// If a static invoice server receives an [`InvoiceRequest`] for a [`StaticInvoice`], they should +/// also forward the [`InvoiceRequest`] to the async recipient so they can respond with a fresh +/// [`Bolt12Invoice`] if the recipient is online at the time. Use this path to forward the +/// [`InvoiceRequest`] to the async recipient. +/// +/// This path's [`BlindedMessagePath::introduction_node`] MUST be set to the static invoice server +/// node or one of its peers. This is because, for DoS protection, invoice requests forwarded over +/// this path are treated by the server node like any other onion message forward and the server +/// will not directly connect to the introduction node if they are not already peers. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_set_forward_invoice_request_path(this_ptr: &mut ServeStaticInvoice, mut val: crate::lightning::blinded_path::message::BlindedMessagePath) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forward_invoice_request_path = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// Constructs a new ServeStaticInvoice given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_new(mut invoice_arg: crate::lightning::offers::static_invoice::StaticInvoice, mut forward_invoice_request_path_arg: crate::lightning::blinded_path::message::BlindedMessagePath) -> ServeStaticInvoice { + ServeStaticInvoice { inner: ObjOps::heap_alloc(nativeServeStaticInvoice { + invoice: *unsafe { Box::from_raw(invoice_arg.take_inner()) }, + forward_invoice_request_path: *unsafe { Box::from_raw(forward_invoice_request_path_arg.take_inner()) }, + }), is_owned: true } +} +impl Clone for ServeStaticInvoice { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeServeStaticInvoice>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ServeStaticInvoice_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeServeStaticInvoice) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ServeStaticInvoice +pub extern "C" fn ServeStaticInvoice_clone(orig: &ServeStaticInvoice) -> ServeStaticInvoice { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a ServeStaticInvoice object +pub extern "C" fn ServeStaticInvoice_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::ServeStaticInvoice }).into()} + +use lightning::onion_message::async_payments::StaticInvoicePersisted as nativeStaticInvoicePersistedImport; +pub(crate) type nativeStaticInvoicePersisted = nativeStaticInvoicePersistedImport; + +/// Confirmation from a static invoice server that a [`StaticInvoice`] was persisted and the +/// corresponding [`Offer`] is ready to be used to receive async payments. Sent to an async +/// recipient in response to a [`ServeStaticInvoice`] message. +/// +/// [`Offer`]: crate::offers::offer::Offer +#[must_use] +#[repr(C)] +pub struct StaticInvoicePersisted { + /// 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 nativeStaticInvoicePersisted, + /// 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 core::ops::Deref for StaticInvoicePersisted { + type Target = nativeStaticInvoicePersisted; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for StaticInvoicePersisted { } +unsafe impl core::marker::Sync for StaticInvoicePersisted { } +impl Drop for StaticInvoicePersisted { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeStaticInvoicePersisted>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the StaticInvoicePersisted, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn StaticInvoicePersisted_free(this_obj: StaticInvoicePersisted) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn StaticInvoicePersisted_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStaticInvoicePersisted) }; +} +#[allow(unused)] +impl StaticInvoicePersisted { + pub(crate) fn get_native_ref(&self) -> &'static nativeStaticInvoicePersisted { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeStaticInvoicePersisted { + 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 nativeStaticInvoicePersisted { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new StaticInvoicePersisted given each field +#[must_use] +#[no_mangle] +pub extern "C" fn StaticInvoicePersisted_new() -> StaticInvoicePersisted { + StaticInvoicePersisted { inner: ObjOps::heap_alloc(nativeStaticInvoicePersisted { + }), is_owned: true } +} +impl Clone for StaticInvoicePersisted { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeStaticInvoicePersisted>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 StaticInvoicePersisted_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeStaticInvoicePersisted) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the StaticInvoicePersisted +pub extern "C" fn StaticInvoicePersisted_clone(orig: &StaticInvoicePersisted) -> StaticInvoicePersisted { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a StaticInvoicePersisted object +pub extern "C" fn StaticInvoicePersisted_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::StaticInvoicePersisted }).into()} + use lightning::onion_message::async_payments::HeldHtlcAvailable as nativeHeldHtlcAvailableImport; pub(crate) type nativeHeldHtlcAvailable = nativeHeldHtlcAvailableImport; @@ -303,7 +981,7 @@ impl Clone for HeldHtlcAvailable { fn clone(&self) -> Self { Self { inner: if <*mut nativeHeldHtlcAvailable>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -311,12 +989,12 @@ impl Clone for HeldHtlcAvailable { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HeldHtlcAvailable_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHeldHtlcAvailable)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHeldHtlcAvailable) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HeldHtlcAvailable pub extern "C" fn HeldHtlcAvailable_clone(orig: &HeldHtlcAvailable) -> HeldHtlcAvailable { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HeldHtlcAvailable object pub extern "C" fn HeldHtlcAvailable_debug_str_void(o: *const c_void) -> Str { @@ -392,7 +1070,7 @@ impl Clone for ReleaseHeldHtlc { fn clone(&self) -> Self { Self { inner: if <*mut nativeReleaseHeldHtlc>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -400,16 +1078,96 @@ impl Clone for ReleaseHeldHtlc { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReleaseHeldHtlc_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReleaseHeldHtlc)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReleaseHeldHtlc) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ReleaseHeldHtlc pub extern "C" fn ReleaseHeldHtlc_clone(orig: &ReleaseHeldHtlc) -> ReleaseHeldHtlc { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ReleaseHeldHtlc object pub extern "C" fn ReleaseHeldHtlc_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::async_payments::ReleaseHeldHtlc }).into()} +impl From for crate::lightning::onion_message::packet::OnionMessageContents { + fn from(obj: nativeOfferPaths) -> Self { + let rust_obj = crate::lightning::onion_message::async_payments::OfferPaths { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = OfferPaths_as_OnionMessageContents(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(OfferPaths_free_void); + ret + } +} +/// Constructs a new OnionMessageContents which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is +#[no_mangle] +pub extern "C" fn OfferPaths_as_OnionMessageContents(this_arg: &OfferPaths) -> crate::lightning::onion_message::packet::OnionMessageContents { + crate::lightning::onion_message::packet::OnionMessageContents { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + tlv_type: OfferPaths_OnionMessageContents_tlv_type, + msg_type: OfferPaths_OnionMessageContents_msg_type, + write: OfferPaths_write_void, + debug_str: OfferPaths_debug_str_void, + cloned: Some(OnionMessageContents_OfferPaths_cloned), + } +} + +#[must_use] +extern "C" fn OfferPaths_OnionMessageContents_tlv_type(this_arg: *const c_void) -> u64 { + let mut ret = ::tlv_type(unsafe { &mut *(this_arg as *mut nativeOfferPaths) }, ); + ret +} +#[must_use] +extern "C" fn OfferPaths_OnionMessageContents_msg_type(this_arg: *const c_void) -> crate::c_types::Str { + let mut ret = ::msg_type(unsafe { &mut *(this_arg as *mut nativeOfferPaths) }, ); + ret.into() +} +extern "C" fn OnionMessageContents_OfferPaths_cloned(new_obj: &mut crate::lightning::onion_message::packet::OnionMessageContents) { + new_obj.this_arg = OfferPaths_clone_void(new_obj.this_arg); + new_obj.free = Some(OfferPaths_free_void); +} + +impl From for crate::lightning::onion_message::packet::OnionMessageContents { + fn from(obj: nativeServeStaticInvoice) -> Self { + let rust_obj = crate::lightning::onion_message::async_payments::ServeStaticInvoice { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ServeStaticInvoice_as_OnionMessageContents(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(ServeStaticInvoice_free_void); + ret + } +} +/// Constructs a new OnionMessageContents which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ServeStaticInvoice_as_OnionMessageContents(this_arg: &ServeStaticInvoice) -> crate::lightning::onion_message::packet::OnionMessageContents { + crate::lightning::onion_message::packet::OnionMessageContents { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + tlv_type: ServeStaticInvoice_OnionMessageContents_tlv_type, + msg_type: ServeStaticInvoice_OnionMessageContents_msg_type, + write: ServeStaticInvoice_write_void, + debug_str: ServeStaticInvoice_debug_str_void, + cloned: Some(OnionMessageContents_ServeStaticInvoice_cloned), + } +} + +#[must_use] +extern "C" fn ServeStaticInvoice_OnionMessageContents_tlv_type(this_arg: *const c_void) -> u64 { + let mut ret = ::tlv_type(unsafe { &mut *(this_arg as *mut nativeServeStaticInvoice) }, ); + ret +} +#[must_use] +extern "C" fn ServeStaticInvoice_OnionMessageContents_msg_type(this_arg: *const c_void) -> crate::c_types::Str { + let mut ret = ::msg_type(unsafe { &mut *(this_arg as *mut nativeServeStaticInvoice) }, ); + ret.into() +} +extern "C" fn OnionMessageContents_ServeStaticInvoice_cloned(new_obj: &mut crate::lightning::onion_message::packet::OnionMessageContents) { + new_obj.this_arg = ServeStaticInvoice_clone_void(new_obj.this_arg); + new_obj.free = Some(ServeStaticInvoice_free_void); +} + impl From for crate::lightning::onion_message::packet::OnionMessageContents { fn from(obj: nativeReleaseHeldHtlc) -> Self { let rust_obj = crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -450,6 +1208,70 @@ extern "C" fn OnionMessageContents_ReleaseHeldHtlc_cloned(new_obj: &mut crate::l new_obj.free = Some(ReleaseHeldHtlc_free_void); } +#[no_mangle] +/// Serialize the OfferPathsRequest object into a byte array which can be read by OfferPathsRequest_read +pub extern "C" fn OfferPathsRequest_write(obj: &crate::lightning::onion_message::async_payments::OfferPathsRequest) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn OfferPathsRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::onion_message::async_payments::nativeOfferPathsRequest) }) +} +#[no_mangle] +/// Read a OfferPathsRequest from a byte array, created by OfferPathsRequest_write +pub extern "C" fn OfferPathsRequest_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OfferPathsRequestDecodeErrorZ { + 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::onion_message::async_payments::OfferPathsRequest { 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 OfferPaths object into a byte array which can be read by OfferPaths_read +pub extern "C" fn OfferPaths_write(obj: &crate::lightning::onion_message::async_payments::OfferPaths) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn OfferPaths_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::onion_message::async_payments::nativeOfferPaths) }) +} +#[no_mangle] +/// Read a OfferPaths from a byte array, created by OfferPaths_write +pub extern "C" fn OfferPaths_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OfferPathsDecodeErrorZ { + 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::onion_message::async_payments::OfferPaths { 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 ServeStaticInvoice object into a byte array which can be read by ServeStaticInvoice_read +pub extern "C" fn ServeStaticInvoice_write(obj: &crate::lightning::onion_message::async_payments::ServeStaticInvoice) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ServeStaticInvoice_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::onion_message::async_payments::nativeServeStaticInvoice) }) +} +#[no_mangle] +/// Read a ServeStaticInvoice from a byte array, created by ServeStaticInvoice_write +pub extern "C" fn ServeStaticInvoice_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ServeStaticInvoiceDecodeErrorZ { + 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::onion_message::async_payments::ServeStaticInvoice { 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 StaticInvoicePersisted object into a byte array which can be read by StaticInvoicePersisted_read +pub extern "C" fn StaticInvoicePersisted_write(obj: &crate::lightning::onion_message::async_payments::StaticInvoicePersisted) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn StaticInvoicePersisted_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::onion_message::async_payments::nativeStaticInvoicePersisted) }) +} +#[no_mangle] +/// Read a StaticInvoicePersisted from a byte array, created by StaticInvoicePersisted_write +pub extern "C" fn StaticInvoicePersisted_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StaticInvoicePersistedDecodeErrorZ { + 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::onion_message::async_payments::StaticInvoicePersisted { 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 HeldHtlcAvailable object into a byte array which can be read by HeldHtlcAvailable_read pub extern "C" fn HeldHtlcAvailable_write(obj: &crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> crate::c_types::derived::CVec_u8Z { diff --git a/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs b/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs index 99afd0db..418eaa90 100644 --- a/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs +++ b/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs @@ -45,7 +45,12 @@ pub struct DNSResolverMessageHandler { pub handle_dnssec_query: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::dns_resolution::DNSSECQuery, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ, /// Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). /// + /// The provided [`DNSResolverContext`] was authenticated by the [`OnionMessenger`] as coming from + /// a blinded path that we created. + /// /// With this, we should be able to validate the DNS record we requested. + /// + /// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger pub handle_dnssec_proof: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::dns_resolution::DNSSECProof, context: crate::lightning::blinded_path::message::DNSResolverContext), /// Gets the node feature flags which this handler itself supports. Useful for setting the /// `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response @@ -331,7 +336,7 @@ impl Clone for DNSSECQuery { fn clone(&self) -> Self { Self { inner: if <*mut nativeDNSSECQuery>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -339,12 +344,12 @@ impl Clone for DNSSECQuery { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DNSSECQuery_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSSECQuery)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDNSSECQuery) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DNSSECQuery pub extern "C" fn DNSSECQuery_clone(orig: &DNSSECQuery) -> DNSSECQuery { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DNSSECQuery object pub extern "C" fn DNSSECQuery_debug_str_void(o: *const c_void) -> Str { @@ -435,7 +440,7 @@ impl DNSSECProof { /// Returns a copy of the field. #[no_mangle] pub extern "C" fn DNSSECProof_get_proof(this_ptr: &DNSSECProof) -> crate::c_types::derived::CVec_u8Z { - let mut inner_val = this_ptr.get_native_mut_ref().proof.clone(); + let mut inner_val = DNSSECProof::get_native_mut_ref(this_ptr).proof.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; local_inner_val.into() } @@ -451,7 +456,7 @@ impl Clone for DNSSECProof { fn clone(&self) -> Self { Self { inner: if <*mut nativeDNSSECProof>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -459,12 +464,12 @@ impl Clone for DNSSECProof { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DNSSECProof_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSSECProof)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDNSSECProof) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DNSSECProof pub extern "C" fn DNSSECProof_clone(orig: &DNSSECProof) -> DNSSECProof { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DNSSECProof object pub extern "C" fn DNSSECProof_debug_str_void(o: *const c_void) -> Str { @@ -559,11 +564,14 @@ pub(crate) type nativeHumanReadableName = nativeHumanReadableNameImport; /// A struct containing the two parts of a BIP 353 Human Readable Name - the user and domain parts. /// -/// The `user` and `domain` parts, together, cannot exceed 232 bytes in length, and both must be +/// The `user` and `domain` parts, together, cannot exceed 231 bytes in length, and both must be /// non-empty. /// -/// To protect against [Homograph Attacks], both parts of a Human Readable Name must be plain -/// ASCII. +/// If you intend to handle non-ASCII `user` or `domain` parts, you must handle [Homograph Attacks] +/// and do punycode en-/de-coding yourself. This struct will always handle only plain ASCII `user` +/// and `domain` parts. +/// +/// This struct can also be used for LN-Address recipients. /// /// [Homograph Attacks]: https://en.wikipedia.org/wiki/IDN_homograph_attack #[must_use] @@ -625,7 +633,7 @@ impl Clone for HumanReadableName { fn clone(&self) -> Self { Self { inner: if <*mut nativeHumanReadableName>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -633,12 +641,12 @@ impl Clone for HumanReadableName { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HumanReadableName_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHumanReadableName)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHumanReadableName) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HumanReadableName pub extern "C" fn HumanReadableName_clone(orig: &HumanReadableName) -> HumanReadableName { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HumanReadableName object pub extern "C" fn HumanReadableName_debug_str_void(o: *const c_void) -> Str { @@ -667,7 +675,7 @@ pub extern "C" fn HumanReadableName_eq(a: &HumanReadableName, b: &HumanReadableN #[must_use] #[no_mangle] pub extern "C" fn HumanReadableName_new(mut user: crate::c_types::Str, mut domain: crate::c_types::Str) -> crate::c_types::derived::CResult_HumanReadableNameNoneZ { - let mut ret = lightning::onion_message::dns_resolution::HumanReadableName::new(user.into_string(), domain.into_string()); + let mut ret = lightning::onion_message::dns_resolution::HumanReadableName::new(user.into_str(), domain.into_str()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -716,6 +724,11 @@ pub extern "C" fn HumanReadableName_read(ser: crate::c_types::u8slice) -> crate: let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::dns_resolution::HumanReadableName { 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] +/// Get the string representation of a HumanReadableName object +pub extern "C" fn HumanReadableName_to_str(o: &crate::lightning::onion_message::dns_resolution::HumanReadableName) -> Str { + alloc::format!("{}", o.get_native_ref()).into() +} use lightning::onion_message::dns_resolution::OMNameResolver as nativeOMNameResolverImport; pub(crate) type nativeOMNameResolver = nativeOMNameResolverImport; @@ -791,15 +804,43 @@ pub extern "C" fn OMNameResolver_new(mut latest_block_time: u32, mut latest_bloc crate::lightning::onion_message::dns_resolution::OMNameResolver { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Builds a new [`OMNameResolver`] which will not validate the time limits on DNSSEC proofs +/// (for builds without the \"std\" feature and until [`Self::new_best_block`] is called). +/// +/// If possible, you should prefer [`Self::new`] so that providing stale proofs is not +/// possible, however in no-std environments where there is some trust in the resolver used and +/// no time source is available, this may be acceptable. +/// +/// Note that not calling [`Self::new_best_block`] will result in requests not timing out and +/// unresolved requests leaking memory. You must instead call +/// [`Self::expire_pending_resolution`] as unresolved requests expire. +#[must_use] +#[no_mangle] +pub extern "C" fn OMNameResolver_new_without_no_std_expiry_validation() -> crate::lightning::onion_message::dns_resolution::OMNameResolver { + let mut ret = lightning::onion_message::dns_resolution::OMNameResolver::new_without_no_std_expiry_validation(); + crate::lightning::onion_message::dns_resolution::OMNameResolver { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// Informs the [`OMNameResolver`] of the passage of time in the form of a new best Bitcoin /// block. /// -/// This will call back to resolve some pending queries which have timed out. +/// This is used to prune stale requests (by block height) and keep track of the current time +/// to validate that DNSSEC proofs are current. #[no_mangle] pub extern "C" fn OMNameResolver_new_best_block(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, mut height: u32, mut time: u32) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.new_best_block(height, time) } +/// Removes any pending resolutions for the given `name` and `payment_id`. +/// +/// Any future calls to [`Self::handle_dnssec_proof_for_offer`] or +/// [`Self::handle_dnssec_proof_for_uri`] will no longer return a result for the given +/// resolution. +#[no_mangle] +pub extern "C" fn OMNameResolver_expire_pending_resolution(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, name: &crate::lightning::onion_message::dns_resolution::HumanReadableName, mut payment_id: crate::c_types::ThirtyTwoBytes) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.expire_pending_resolution(name.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data)) +} + /// Begins the process of resolving a BIP 353 Human Readable Name. /// /// Returns a [`DNSSECQuery`] onion message and a [`DNSResolverContext`] which should be sent diff --git a/lightning-c-bindings/src/lightning/onion_message/messenger.rs b/lightning-c-bindings/src/lightning/onion_message/messenger.rs index 67b6723b..df3fab15 100644 --- a/lightning-c-bindings/src/lightning/onion_message/messenger.rs +++ b/lightning-c-bindings/src/lightning/onion_message/messenger.rs @@ -51,6 +51,7 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport( -/// # &self, _recipient: PublicKey, _context: MessageContext, _peers: Vec, _secp_ctx: &Secp256k1 +/// # &self, _recipient: PublicKey, _local_node_receive_key: ReceiveAuthKey, +/// # _context: MessageContext, _peers: Vec, _secp_ctx: &Secp256k1 /// # ) -> Result, ()> { /// # unreachable!() /// # } /// # } /// # let seed = [42u8; 32]; /// # let time = Duration::from_secs(123456); -/// # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); +/// # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos(), true); /// # let logger = Arc::new(FakeLogger {}); /// # let node_secret = SecretKey::from_slice(&>::from_hex(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); /// # let secp_ctx = Secp256k1::new(); @@ -129,7 +131,8 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport Self { Self { inner: if <*mut nativeResponder>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -268,12 +271,12 @@ impl Clone for Responder { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Responder_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeResponder)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeResponder) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Responder pub extern "C" fn Responder_clone(orig: &Responder) -> Responder { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Responder object pub extern "C" fn Responder_debug_str_void(o: *const c_void) -> Str { @@ -387,7 +390,7 @@ impl Clone for ResponseInstruction { fn clone(&self) -> Self { Self { inner: if <*mut nativeResponseInstruction>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -395,12 +398,12 @@ impl Clone for ResponseInstruction { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ResponseInstruction_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeResponseInstruction)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeResponseInstruction) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ResponseInstruction pub extern "C" fn ResponseInstruction_clone(orig: &ResponseInstruction) -> ResponseInstruction { - orig.clone() + Clone::clone(orig) } /// Converts this [`ResponseInstruction`] into a [`MessageSendInstructions`] so that it can be /// used to send the response via a normal message sending method. @@ -444,6 +447,23 @@ pub enum MessageSendInstructions { /// The instructions provided by the [`Responder`]. instructions: crate::lightning::onion_message::messenger::ResponseInstruction, }, + /// Indicates that this onion message did not originate from our node and is being forwarded + /// through us from another node on the network to the destination. + /// + /// We separate out this case because forwarded onion messages are treated differently from + /// outbound onion messages initiated by our node. Outbounds are buffered internally, whereas, for + /// DoS protection, forwards should never be buffered internally and instead will either be + /// dropped or generate an [`Event::OnionMessageIntercepted`] if the next-hop node is + /// disconnected. + ForwardedMessage { + /// The destination where we need to send the forwarded onion message. + destination: crate::lightning::onion_message::messenger::Destination, + /// The reply path which should be included in the message, that terminates at the original + /// sender of this forwarded message. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + reply_path: crate::lightning::blinded_path::message::BlindedMessagePath, + }, } use lightning::onion_message::messenger::MessageSendInstructions as MessageSendInstructionsImport; pub(crate) type nativeMessageSendInstructions = MessageSendInstructionsImport; @@ -480,6 +500,15 @@ impl MessageSendInstructions { instructions: *unsafe { Box::from_raw(instructions_nonref.take_inner()) }, } }, + MessageSendInstructions::ForwardedMessage {ref destination, ref reply_path, } => { + let mut destination_nonref = Clone::clone(destination); + let mut reply_path_nonref = Clone::clone(reply_path); + let mut local_reply_path_nonref = if reply_path_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path_nonref.take_inner()) } }) }; + nativeMessageSendInstructions::ForwardedMessage { + destination: destination_nonref.into_native(), + reply_path: local_reply_path_nonref, + } + }, } } #[allow(unused)] @@ -507,6 +536,13 @@ impl MessageSendInstructions { instructions: *unsafe { Box::from_raw(instructions.take_inner()) }, } }, + MessageSendInstructions::ForwardedMessage {mut destination, mut reply_path, } => { + let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) }; + nativeMessageSendInstructions::ForwardedMessage { + destination: destination.into_native(), + reply_path: local_reply_path, + } + }, } } #[allow(unused)] @@ -541,6 +577,15 @@ impl MessageSendInstructions { instructions: crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(instructions_nonref), is_owned: true }, } }, + nativeMessageSendInstructions::ForwardedMessage {ref destination, ref reply_path, } => { + let mut destination_nonref = Clone::clone(destination); + let mut reply_path_nonref = Clone::clone(reply_path); + let mut local_reply_path_nonref = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if reply_path_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((reply_path_nonref.unwrap())) } }, is_owned: true }; + MessageSendInstructions::ForwardedMessage { + destination: crate::lightning::onion_message::messenger::Destination::native_into(destination_nonref), + reply_path: local_reply_path_nonref, + } + }, } } #[allow(unused)] @@ -568,6 +613,13 @@ impl MessageSendInstructions { instructions: crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(instructions), is_owned: true }, } }, + nativeMessageSendInstructions::ForwardedMessage {mut destination, mut reply_path, } => { + let mut local_reply_path = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if reply_path.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((reply_path.unwrap())) } }, is_owned: true }; + MessageSendInstructions::ForwardedMessage { + destination: crate::lightning::onion_message::messenger::Destination::native_into(destination), + reply_path: local_reply_path, + } + }, } } } @@ -619,6 +671,14 @@ pub extern "C" fn MessageSendInstructions_for_reply(instructions: crate::lightni instructions, } } +#[no_mangle] +/// Utility method to constructs a new ForwardedMessage-variant MessageSendInstructions +pub extern "C" fn MessageSendInstructions_forwarded_message(destination: crate::lightning::onion_message::messenger::Destination, reply_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> MessageSendInstructions { + MessageSendInstructions::ForwardedMessage { + destination, + reply_path, + } +} /// A trait defining behavior for routing an [`OnionMessage`]. #[repr(C)] pub struct MessageRouter { @@ -629,21 +689,7 @@ pub struct MessageRouter { pub find_path: extern "C" fn (this_arg: *const c_void, sender: crate::c_types::PublicKey, peers: crate::c_types::derived::CVec_PublicKeyZ, destination: crate::lightning::onion_message::messenger::Destination) -> crate::c_types::derived::CResult_OnionMessagePathNoneZ, /// Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to /// be direct peers with the `recipient`. - pub create_blinded_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, context: crate::lightning::blinded_path::message::MessageContext, peers: crate::c_types::derived::CVec_PublicKeyZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ, - /// Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are - /// assumed to be direct peers with the `recipient`. - /// - /// Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, - /// which is beneficial when a QR code is used to transport the data. The SCID is passed using - /// a [`MessageForwardNode`] but may be `None` for graceful degradation. - /// - /// Implementations using additional intermediate nodes are responsible for using a - /// [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations - /// should call [`BlindedMessagePath::use_compact_introduction_node`]. - /// - /// The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], - /// ignoring the short channel ids. - pub create_compact_blinded_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, context: crate::lightning::blinded_path::message::MessageContext, peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ, + pub create_blinded_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, context: crate::lightning::blinded_path::message::MessageContext, peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ, /// 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, @@ -656,7 +702,6 @@ pub(crate) fn MessageRouter_clone_fields(orig: &MessageRouter) -> MessageRouter this_arg: orig.this_arg, find_path: Clone::clone(&orig.find_path), create_blinded_paths: Clone::clone(&orig.create_blinded_paths), - create_compact_blinded_paths: Clone::clone(&orig.create_compact_blinded_paths), free: Clone::clone(&orig.free), } } @@ -669,15 +714,9 @@ impl rustMessageRouter for MessageRouter { let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.create_blinded_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_compact_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { + fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut local_node_receive_key: lightning::sign::ReceiveAuthKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.create_compact_blinded_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); + let mut ret = (self.create_blinded_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::sign::ReceiveAuthKey { inner: ObjOps::heap_alloc(local_node_receive_key), is_owned: true }, crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } @@ -691,15 +730,9 @@ impl rustMessageRouter for MessageRouterRef { let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.0.create_blinded_paths)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_compact_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { + fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut local_node_receive_key: lightning::sign::ReceiveAuthKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.0.create_compact_blinded_paths)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); + let mut ret = (self.0.create_blinded_paths)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::sign::ReceiveAuthKey { inner: ObjOps::heap_alloc(local_node_receive_key), is_owned: true }, crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } @@ -734,10 +767,26 @@ pub(crate) type nativeDefaultMessageRouter = nativeDefaultMessageRouterImport<&' /// A [`MessageRouter`] that can only route to a directly connected [`Destination`]. /// +/// [`DefaultMessageRouter`] constructs compact [`BlindedMessagePath`]s on a best-effort basis. +/// That is, if appropriate SCID information is available for the intermediate peers, it will +/// default to creating compact paths. +/// +/// # Compact Blinded Paths +/// +/// Compact blinded paths use short channel IDs (SCIDs) instead of pubkeys, resulting in smaller +/// serialization. This is particularly useful when encoding data into space-constrained formats +/// such as QR codes. The SCID is communicated via a [`MessageForwardNode`], but may be `None` +/// to allow for graceful degradation. +/// +/// **Note:** +/// If any SCID in the blinded path becomes invalid, the entire compact blinded path may fail to route. +/// For the immediate hop, this can happen if the corresponding channel is closed. +/// For other intermediate hops, it can happen if the channel is closed or modified (e.g., due to splicing). +/// /// # Privacy /// /// Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, -/// it will create a one-hop path using the recipient as the introduction node if it is a announced +/// it will create a one-hop path using the recipient as the introduction node if it is an announced /// node. Otherwise, there is no way to find a path to the introduction node in order to send a /// message, and thus an `Err` is returned. #[must_use] @@ -822,7 +871,6 @@ pub extern "C" fn DefaultMessageRouter_as_MessageRouter(this_arg: &DefaultMessag free: None, find_path: DefaultMessageRouter_MessageRouter_find_path, create_blinded_paths: DefaultMessageRouter_MessageRouter_create_blinded_paths, - create_compact_blinded_paths: DefaultMessageRouter_MessageRouter_create_compact_blinded_paths, } } @@ -834,16 +882,243 @@ extern "C" fn DefaultMessageRouter_MessageRouter_find_path(this_arg: *const c_vo local_ret } #[must_use] -extern "C" fn DefaultMessageRouter_MessageRouter_create_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_PublicKeyZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { +extern "C" fn DefaultMessageRouter_MessageRouter_create_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = ::create_blinded_paths(unsafe { &mut *(this_arg as *mut nativeDefaultMessageRouter) }, recipient.into_rust(), *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), local_peers, 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::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + + +use lightning::onion_message::messenger::NodeIdMessageRouter as nativeNodeIdMessageRouterImport; +pub(crate) type nativeNodeIdMessageRouter = nativeNodeIdMessageRouterImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger, crate::lightning::sign::EntropySource, >; + +/// This message router is similar to [`DefaultMessageRouter`], but it always creates +/// full-length blinded paths, using the peer's [`NodeId`]. +/// +/// This message router can only route to a directly connected [`Destination`]. +/// +/// # Privacy +/// +/// Creating [`BlindedMessagePath`]s may affect privacy since, if a suitable path cannot be found, +/// it will create a one-hop path using the recipient as the introduction node if it is an announced +/// node. Otherwise, there is no way to find a path to the introduction node in order to send a +/// message, and thus an `Err` is returned. +#[must_use] +#[repr(C)] +pub struct NodeIdMessageRouter { + /// 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 nativeNodeIdMessageRouter, + /// 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 core::ops::Deref for NodeIdMessageRouter { + type Target = nativeNodeIdMessageRouter; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for NodeIdMessageRouter { } +unsafe impl core::marker::Sync for NodeIdMessageRouter { } +impl Drop for NodeIdMessageRouter { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeNodeIdMessageRouter>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the NodeIdMessageRouter, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn NodeIdMessageRouter_free(this_obj: NodeIdMessageRouter) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn NodeIdMessageRouter_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeIdMessageRouter) }; +} +#[allow(unused)] +impl NodeIdMessageRouter { + pub(crate) fn get_native_ref(&self) -> &'static nativeNodeIdMessageRouter { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNodeIdMessageRouter { + 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 nativeNodeIdMessageRouter { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Creates a [`NodeIdMessageRouter`] using the given [`NetworkGraph`]. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeIdMessageRouter_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut entropy_source: crate::lightning::sign::EntropySource) -> crate::lightning::onion_message::messenger::NodeIdMessageRouter { + let mut ret = lightning::onion_message::messenger::NodeIdMessageRouter::new(network_graph.get_native_ref(), entropy_source); + crate::lightning::onion_message::messenger::NodeIdMessageRouter { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +impl From for crate::lightning::onion_message::messenger::MessageRouter { + fn from(obj: nativeNodeIdMessageRouter) -> Self { + let rust_obj = crate::lightning::onion_message::messenger::NodeIdMessageRouter { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = NodeIdMessageRouter_as_MessageRouter(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(NodeIdMessageRouter_free_void); + ret + } +} +/// Constructs a new MessageRouter which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is +#[no_mangle] +pub extern "C" fn NodeIdMessageRouter_as_MessageRouter(this_arg: &NodeIdMessageRouter) -> crate::lightning::onion_message::messenger::MessageRouter { + crate::lightning::onion_message::messenger::MessageRouter { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + find_path: NodeIdMessageRouter_MessageRouter_find_path, + create_blinded_paths: NodeIdMessageRouter_MessageRouter_create_blinded_paths, + } +} + +#[must_use] +extern "C" fn NodeIdMessageRouter_MessageRouter_find_path(this_arg: *const c_void, mut sender: crate::c_types::PublicKey, mut peers: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination) -> crate::c_types::derived::CResult_OnionMessagePathNoneZ { let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { item.into_rust() }); }; - let mut ret = ::create_blinded_paths(unsafe { &mut *(this_arg as *mut nativeDefaultMessageRouter) }, recipient.into_rust(), context.into_native(), local_peers, secp256k1::global::SECP256K1); + let mut ret = ::find_path(unsafe { &mut *(this_arg as *mut nativeNodeIdMessageRouter) }, sender.into_rust(), local_peers, destination.into_native()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::messenger::OnionMessagePath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} +#[must_use] +extern "C" fn NodeIdMessageRouter_MessageRouter_create_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = ::create_blinded_paths(unsafe { &mut *(this_arg as *mut nativeNodeIdMessageRouter) }, recipient.into_rust(), *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), local_peers, 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::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } + + +use lightning::onion_message::messenger::NullMessageRouter as nativeNullMessageRouterImport; +pub(crate) type nativeNullMessageRouter = nativeNullMessageRouterImport; + +/// A special [`MessageRouter`] that performs no routing and does not create blinded paths. +/// Its purpose is to enable the creation of [`Offer`]s and [`Refund`]s without blinded paths, +/// where the user's `node_id` is used directly as the [`Destination`]. +/// +/// # Note +/// [`NullMessageRouter`] **must not** be used as the type parameter for [`ChannelManager`], +/// since [`ChannelManager`] requires a functioning [`MessageRouter`] to create blinded paths, +/// which are necessary for constructing reply paths in onion message communication. +/// However, [`NullMessageRouter`] *can* still be passed as an argument to [`ChannelManager`] +/// methods that accepts a [`MessageRouter`], such as [`ChannelManager::create_offer_builder_using_router`], +/// when blinded paths are not needed. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Refund`]: crate::offers::refund::Refund +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`ChannelManager::create_offer_builder_using_router`]: crate::ln::channelmanager::ChannelManager::create_offer_builder_using_router +#[must_use] +#[repr(C)] +pub struct NullMessageRouter { + /// 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 nativeNullMessageRouter, + /// 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 core::ops::Deref for NullMessageRouter { + type Target = nativeNullMessageRouter; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for NullMessageRouter { } +unsafe impl core::marker::Sync for NullMessageRouter { } +impl Drop for NullMessageRouter { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeNullMessageRouter>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the NullMessageRouter, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn NullMessageRouter_free(this_obj: NullMessageRouter) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn NullMessageRouter_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNullMessageRouter) }; +} +#[allow(unused)] +impl NullMessageRouter { + pub(crate) fn get_native_ref(&self) -> &'static nativeNullMessageRouter { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNullMessageRouter { + 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 nativeNullMessageRouter { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new NullMessageRouter given each field +#[must_use] +#[no_mangle] +pub extern "C" fn NullMessageRouter_new() -> NullMessageRouter { + NullMessageRouter { inner: ObjOps::heap_alloc(nativeNullMessageRouter { + }), is_owned: true } +} +impl From for crate::lightning::onion_message::messenger::MessageRouter { + fn from(obj: nativeNullMessageRouter) -> Self { + let rust_obj = crate::lightning::onion_message::messenger::NullMessageRouter { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = NullMessageRouter_as_MessageRouter(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(NullMessageRouter_free_void); + ret + } +} +/// Constructs a new MessageRouter which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is +#[no_mangle] +pub extern "C" fn NullMessageRouter_as_MessageRouter(this_arg: &NullMessageRouter) -> crate::lightning::onion_message::messenger::MessageRouter { + crate::lightning::onion_message::messenger::MessageRouter { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + find_path: NullMessageRouter_MessageRouter_find_path, + create_blinded_paths: NullMessageRouter_MessageRouter_create_blinded_paths, + } +} + +#[must_use] +extern "C" fn NullMessageRouter_MessageRouter_find_path(this_arg: *const c_void, mut sender: crate::c_types::PublicKey, mut peers: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination) -> crate::c_types::derived::CResult_OnionMessagePathNoneZ { + let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { item.into_rust() }); }; + let mut ret = ::find_path(unsafe { &mut *(this_arg as *mut nativeNullMessageRouter) }, sender.into_rust(), local_peers, destination.into_native()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::messenger::OnionMessagePath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} #[must_use] -extern "C" fn DefaultMessageRouter_MessageRouter_create_compact_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { +extern "C" fn NullMessageRouter_MessageRouter_create_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut local_node_receive_key: crate::lightning::sign::ReceiveAuthKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = ::create_compact_blinded_paths(unsafe { &mut *(this_arg as *mut nativeDefaultMessageRouter) }, recipient.into_rust(), context.into_native(), local_peers, secp256k1::global::SECP256K1); + let mut ret = ::create_blinded_paths(unsafe { &mut *(this_arg as *mut nativeNullMessageRouter) }, recipient.into_rust(), *unsafe { Box::from_raw(local_node_receive_key.take_inner()) }, context.into_native(), local_peers, 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::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -913,7 +1188,7 @@ impl OnionMessagePath { /// Returns a copy of the field. #[no_mangle] pub extern "C" fn OnionMessagePath_get_intermediate_nodes(this_ptr: &OnionMessagePath) -> crate::c_types::derived::CVec_PublicKeyZ { - let mut inner_val = this_ptr.get_native_mut_ref().intermediate_nodes.clone(); + let mut inner_val = OnionMessagePath::get_native_mut_ref(this_ptr).intermediate_nodes.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { crate::c_types::PublicKey::from_rust(&item) }); }; local_inner_val.into() } @@ -926,7 +1201,7 @@ pub extern "C" fn OnionMessagePath_set_intermediate_nodes(this_ptr: &mut OnionMe /// The recipient of the message. #[no_mangle] pub extern "C" fn OnionMessagePath_get_destination(this_ptr: &OnionMessagePath) -> crate::lightning::onion_message::messenger::Destination { - let mut inner_val = &mut this_ptr.get_native_mut_ref().destination; + let mut inner_val = &mut OnionMessagePath::get_native_mut_ref(this_ptr).destination; crate::lightning::onion_message::messenger::Destination::from_native(inner_val) } /// The recipient of the message. @@ -936,31 +1211,31 @@ pub extern "C" fn OnionMessagePath_set_destination(this_ptr: &mut OnionMessagePa } /// Addresses that may be used to connect to [`OnionMessagePath::first_node`]. /// -/// Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use -/// this to initiate such a connection. +/// Only needs to be filled in if a connection to the node is required and it is not a known peer. +/// [`OnionMessenger`] may use this to initiate such a connection. /// /// Returns a copy of the field. #[no_mangle] -pub extern "C" fn OnionMessagePath_get_first_node_addresses(this_ptr: &OnionMessagePath) -> crate::c_types::derived::COption_CVec_SocketAddressZZ { - let mut inner_val = this_ptr.get_native_mut_ref().first_node_addresses.clone(); - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_CVec_SocketAddressZZ::None } else { crate::c_types::derived::COption_CVec_SocketAddressZZ::Some( { let mut local_inner_val_0 = Vec::new(); for mut item in inner_val.unwrap().drain(..) { local_inner_val_0.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_inner_val_0.into() }) }; - local_inner_val +pub extern "C" fn OnionMessagePath_get_first_node_addresses(this_ptr: &OnionMessagePath) -> crate::c_types::derived::CVec_SocketAddressZ { + let mut inner_val = OnionMessagePath::get_native_mut_ref(this_ptr).first_node_addresses.clone(); + 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() } /// Addresses that may be used to connect to [`OnionMessagePath::first_node`]. /// -/// Only needs to be set if a connection to the node is required. [`OnionMessenger`] may use -/// this to initiate such a connection. +/// Only needs to be filled in if a connection to the node is required and it is not a known peer. +/// [`OnionMessenger`] may use this to initiate such a connection. #[no_mangle] -pub extern "C" fn OnionMessagePath_set_first_node_addresses(this_ptr: &mut OnionMessagePath, mut val: crate::c_types::derived::COption_CVec_SocketAddressZZ) { - 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.into_native() }); }; local_val_0 }})} }; +pub extern "C" fn OnionMessagePath_set_first_node_addresses(this_ptr: &mut OnionMessagePath, 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) }.first_node_addresses = local_val; } /// Constructs a new OnionMessagePath given each field #[must_use] #[no_mangle] -pub extern "C" fn OnionMessagePath_new(mut intermediate_nodes_arg: crate::c_types::derived::CVec_PublicKeyZ, mut destination_arg: crate::lightning::onion_message::messenger::Destination, mut first_node_addresses_arg: crate::c_types::derived::COption_CVec_SocketAddressZZ) -> OnionMessagePath { +pub extern "C" fn OnionMessagePath_new(mut intermediate_nodes_arg: crate::c_types::derived::CVec_PublicKeyZ, mut destination_arg: crate::lightning::onion_message::messenger::Destination, mut first_node_addresses_arg: crate::c_types::derived::CVec_SocketAddressZ) -> OnionMessagePath { let mut local_intermediate_nodes_arg = Vec::new(); for mut item in intermediate_nodes_arg.into_rust().drain(..) { local_intermediate_nodes_arg.push( { item.into_rust() }); }; - let mut local_first_node_addresses_arg = { /*first_node_addresses_arg*/ let first_node_addresses_arg_opt = first_node_addresses_arg; if first_node_addresses_arg_opt.is_none() { None } else { Some({ { let mut local_first_node_addresses_arg_0 = Vec::new(); for mut item in { first_node_addresses_arg_opt.take() }.into_rust().drain(..) { local_first_node_addresses_arg_0.push( { item.into_native() }); }; local_first_node_addresses_arg_0 }})} }; + let mut local_first_node_addresses_arg = Vec::new(); for mut item in first_node_addresses_arg.into_rust().drain(..) { local_first_node_addresses_arg.push( { item.into_native() }); }; OnionMessagePath { inner: ObjOps::heap_alloc(nativeOnionMessagePath { intermediate_nodes: local_intermediate_nodes_arg, destination: destination_arg.into_native(), @@ -971,7 +1246,7 @@ impl Clone for OnionMessagePath { fn clone(&self) -> Self { Self { inner: if <*mut nativeOnionMessagePath>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -979,12 +1254,12 @@ impl Clone for OnionMessagePath { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OnionMessagePath_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOnionMessagePath)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOnionMessagePath) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OnionMessagePath pub extern "C" fn OnionMessagePath_clone(orig: &OnionMessagePath) -> OnionMessagePath { - orig.clone() + Clone::clone(orig) } /// Returns the first node in the path. /// @@ -1485,6 +1760,9 @@ pub struct CustomOnionMessageHandler { pub this_arg: *mut c_void, /// Called with the custom message that was received, returning a response to send, if any. /// + /// If the provided `context` is `Some`, then the message was sent to a blinded path that we + /// created and was authenticated as such by the [`OnionMessenger`]. + /// /// The returned [`Self::CustomMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. /// /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None @@ -1591,10 +1869,33 @@ pub enum PeeledOnion { Forward( crate::lightning::blinded_path::message::NextMessageHop, crate::lightning::ln::msgs::OnionMessage), - /// Received onion message, with decrypted contents, context, and reply path - Receive( - crate::lightning::onion_message::packet::ParsedOnionMessageContents, - crate::c_types::derived::COption_MessageContextZ, + /// Received offers onion message, with decrypted contents, context, and reply path + Offers( + crate::lightning::onion_message::offers::OffersMessage, + crate::c_types::derived::COption_OffersContextZ, + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + crate::lightning::blinded_path::message::BlindedMessagePath), + /// Received async payments onion message, with decrypted contents, context, and reply path + AsyncPayments( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, + crate::lightning::blinded_path::message::AsyncPaymentsContext, + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + crate::lightning::blinded_path::message::BlindedMessagePath), + /// Received DNS resolver onion message, with decrypted contents, context, and reply path + DNSResolver( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage, + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + crate::lightning::blinded_path::message::DNSResolverContext, + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + crate::lightning::blinded_path::message::BlindedMessagePath), + /// Received custom onion message, with decrypted contents, context, and reply path + Custom( + crate::lightning::onion_message::packet::OnionMessageContents, + crate::c_types::derived::COption_CVec_u8ZZ, /// /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None crate::lightning::blinded_path::message::BlindedMessagePath), @@ -1614,18 +1915,53 @@ impl PeeledOnion { *unsafe { Box::from_raw(b_nonref.take_inner()) }, ) }, - PeeledOnion::Receive (ref a, ref b, ref c, ) => { + PeeledOnion::Offers (ref a, ref b, ref c, ) => { let mut a_nonref = Clone::clone(a); let mut b_nonref = Clone::clone(b); let mut local_b_nonref = { /*b_nonref*/ let b_nonref_opt = b_nonref; if b_nonref_opt.is_none() { None } else { Some({ { { b_nonref_opt.take() }.into_native() }})} }; let mut c_nonref = Clone::clone(c); let mut local_c_nonref = if c_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c_nonref.take_inner()) } }) }; - nativePeeledOnion::Receive ( + nativePeeledOnion::Offers ( + a_nonref.into_native(), + local_b_nonref, + local_c_nonref, + ) + }, + PeeledOnion::AsyncPayments (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = if c_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c_nonref.take_inner()) } }) }; + nativePeeledOnion::AsyncPayments ( + a_nonref.into_native(), + b_nonref.into_native(), + local_c_nonref, + ) + }, + PeeledOnion::DNSResolver (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut local_b_nonref = if b_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(b_nonref.take_inner()) } }) }; + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = if c_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c_nonref.take_inner()) } }) }; + nativePeeledOnion::DNSResolver ( a_nonref.into_native(), local_b_nonref, local_c_nonref, ) }, + PeeledOnion::Custom (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut local_b_nonref = { /*b_nonref*/ let b_nonref_opt = b_nonref; if b_nonref_opt.is_none() { None } else { Some({ { let mut local_b_nonref_0 = Vec::new(); for mut item in { b_nonref_opt.take() }.into_rust().drain(..) { local_b_nonref_0.push( { item }); }; local_b_nonref_0 }})} }; + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = if c_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c_nonref.take_inner()) } }) }; + nativePeeledOnion::Custom ( + a_nonref, + local_b_nonref, + local_c_nonref, + ) + }, } } #[allow(unused)] @@ -1637,15 +1973,41 @@ impl PeeledOnion { *unsafe { Box::from_raw(b.take_inner()) }, ) }, - PeeledOnion::Receive (mut a, mut b, mut c, ) => { + PeeledOnion::Offers (mut a, mut b, mut c, ) => { let mut local_b = { /*b*/ let b_opt = b; if b_opt.is_none() { None } else { Some({ { { b_opt.take() }.into_native() }})} }; let mut local_c = if c.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c.take_inner()) } }) }; - nativePeeledOnion::Receive ( + nativePeeledOnion::Offers ( + a.into_native(), + local_b, + local_c, + ) + }, + PeeledOnion::AsyncPayments (mut a, mut b, mut c, ) => { + let mut local_c = if c.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c.take_inner()) } }) }; + nativePeeledOnion::AsyncPayments ( + a.into_native(), + b.into_native(), + local_c, + ) + }, + PeeledOnion::DNSResolver (mut a, mut b, mut c, ) => { + let mut local_b = if b.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(b.take_inner()) } }) }; + let mut local_c = if c.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c.take_inner()) } }) }; + nativePeeledOnion::DNSResolver ( a.into_native(), local_b, local_c, ) }, + PeeledOnion::Custom (mut a, mut b, mut c, ) => { + let mut local_b = { /*b*/ let b_opt = b; if b_opt.is_none() { None } else { Some({ { let mut local_b_0 = Vec::new(); for mut item in { b_opt.take() }.into_rust().drain(..) { local_b_0.push( { item }); }; local_b_0 }})} }; + let mut local_c = if c.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(c.take_inner()) } }) }; + nativePeeledOnion::Custom ( + a, + local_b, + local_c, + ) + }, } } #[allow(unused)] @@ -1660,14 +2022,49 @@ impl PeeledOnion { crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(b_nonref), is_owned: true }, ) }, - nativePeeledOnion::Receive (ref a, ref b, ref c, ) => { + nativePeeledOnion::Offers (ref a, ref b, ref c, ) => { let mut a_nonref = Clone::clone(a); let mut b_nonref = Clone::clone(b); - let mut local_b_nonref = if b_nonref.is_none() { crate::c_types::derived::COption_MessageContextZ::None } else { crate::c_types::derived::COption_MessageContextZ::Some( { crate::lightning::blinded_path::message::MessageContext::native_into(b_nonref.unwrap()) }) }; + let mut local_b_nonref = if b_nonref.is_none() { crate::c_types::derived::COption_OffersContextZ::None } else { crate::c_types::derived::COption_OffersContextZ::Some( { crate::lightning::blinded_path::message::OffersContext::native_into(b_nonref.unwrap()) }) }; let mut c_nonref = Clone::clone(c); let mut local_c_nonref = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c_nonref.unwrap())) } }, is_owned: true }; - PeeledOnion::Receive ( - crate::lightning::onion_message::packet::ParsedOnionMessageContents::native_into(a_nonref), + PeeledOnion::Offers ( + crate::lightning::onion_message::offers::OffersMessage::native_into(a_nonref), + local_b_nonref, + local_c_nonref, + ) + }, + nativePeeledOnion::AsyncPayments (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c_nonref.unwrap())) } }, is_owned: true }; + PeeledOnion::AsyncPayments ( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage::native_into(a_nonref), + crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(b_nonref), + local_c_nonref, + ) + }, + nativePeeledOnion::DNSResolver (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut local_b_nonref = crate::lightning::blinded_path::message::DNSResolverContext { inner: if b_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((b_nonref.unwrap())) } }, is_owned: true }; + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c_nonref.unwrap())) } }, is_owned: true }; + PeeledOnion::DNSResolver ( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(a_nonref), + local_b_nonref, + local_c_nonref, + ) + }, + nativePeeledOnion::Custom (ref a, ref b, ref c, ) => { + let mut a_nonref = Clone::clone(a); + let mut b_nonref = Clone::clone(b); + let mut local_b_nonref = if b_nonref.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { let mut local_b_nonref_0 = Vec::new(); for mut item in b_nonref.unwrap().drain(..) { local_b_nonref_0.push( { item }); }; local_b_nonref_0.into() }) }; + let mut c_nonref = Clone::clone(c); + let mut local_c_nonref = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c_nonref.unwrap())) } }, is_owned: true }; + PeeledOnion::Custom ( + Into::into(a_nonref), local_b_nonref, local_c_nonref, ) @@ -1683,11 +2080,37 @@ impl PeeledOnion { crate::lightning::ln::msgs::OnionMessage { inner: ObjOps::heap_alloc(b), is_owned: true }, ) }, - nativePeeledOnion::Receive (mut a, mut b, mut c, ) => { - let mut local_b = if b.is_none() { crate::c_types::derived::COption_MessageContextZ::None } else { crate::c_types::derived::COption_MessageContextZ::Some( { crate::lightning::blinded_path::message::MessageContext::native_into(b.unwrap()) }) }; + nativePeeledOnion::Offers (mut a, mut b, mut c, ) => { + let mut local_b = if b.is_none() { crate::c_types::derived::COption_OffersContextZ::None } else { crate::c_types::derived::COption_OffersContextZ::Some( { crate::lightning::blinded_path::message::OffersContext::native_into(b.unwrap()) }) }; + let mut local_c = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c.unwrap())) } }, is_owned: true }; + PeeledOnion::Offers ( + crate::lightning::onion_message::offers::OffersMessage::native_into(a), + local_b, + local_c, + ) + }, + nativePeeledOnion::AsyncPayments (mut a, mut b, mut c, ) => { + let mut local_c = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c.unwrap())) } }, is_owned: true }; + PeeledOnion::AsyncPayments ( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage::native_into(a), + crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(b), + local_c, + ) + }, + nativePeeledOnion::DNSResolver (mut a, mut b, mut c, ) => { + let mut local_b = crate::lightning::blinded_path::message::DNSResolverContext { inner: if b.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((b.unwrap())) } }, is_owned: true }; let mut local_c = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c.unwrap())) } }, is_owned: true }; - PeeledOnion::Receive ( - crate::lightning::onion_message::packet::ParsedOnionMessageContents::native_into(a), + PeeledOnion::DNSResolver ( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(a), + local_b, + local_c, + ) + }, + nativePeeledOnion::Custom (mut a, mut b, mut c, ) => { + let mut local_b = if b.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { let mut local_b_0 = Vec::new(); for mut item in b.unwrap().drain(..) { local_b_0.push( { item }); }; local_b_0.into() }) }; + let mut local_c = crate::lightning::blinded_path::message::BlindedMessagePath { inner: if c.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((c.unwrap())) } }, is_owned: true }; + PeeledOnion::Custom ( + Into::into(a), local_b, local_c, ) @@ -1719,9 +2142,24 @@ pub extern "C" fn PeeledOnion_forward(a: crate::lightning::blinded_path::message PeeledOnion::Forward(a, b, ) } #[no_mangle] -/// Utility method to constructs a new Receive-variant PeeledOnion -pub extern "C" fn PeeledOnion_receive(a: crate::lightning::onion_message::packet::ParsedOnionMessageContents,b: crate::c_types::derived::COption_MessageContextZ,c: crate::lightning::blinded_path::message::BlindedMessagePath) -> PeeledOnion { - PeeledOnion::Receive(a, b, c, ) +/// Utility method to constructs a new Offers-variant PeeledOnion +pub extern "C" fn PeeledOnion_offers(a: crate::lightning::onion_message::offers::OffersMessage,b: crate::c_types::derived::COption_OffersContextZ,c: crate::lightning::blinded_path::message::BlindedMessagePath) -> PeeledOnion { + PeeledOnion::Offers(a, b, c, ) +} +#[no_mangle] +/// Utility method to constructs a new AsyncPayments-variant PeeledOnion +pub extern "C" fn PeeledOnion_async_payments(a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage,b: crate::lightning::blinded_path::message::AsyncPaymentsContext,c: crate::lightning::blinded_path::message::BlindedMessagePath) -> PeeledOnion { + PeeledOnion::AsyncPayments(a, b, c, ) +} +#[no_mangle] +/// Utility method to constructs a new DNSResolver-variant PeeledOnion +pub extern "C" fn PeeledOnion_dnsresolver(a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage,b: crate::lightning::blinded_path::message::DNSResolverContext,c: crate::lightning::blinded_path::message::BlindedMessagePath) -> PeeledOnion { + PeeledOnion::DNSResolver(a, b, c, ) +} +#[no_mangle] +/// Utility method to constructs a new Custom-variant PeeledOnion +pub extern "C" fn PeeledOnion_custom(a: crate::lightning::onion_message::packet::OnionMessageContents,b: crate::c_types::derived::COption_CVec_u8ZZ,c: crate::lightning::blinded_path::message::BlindedMessagePath) -> PeeledOnion { + PeeledOnion::Custom(a, b, c, ) } /// Get a string which allows debug introspection of a PeeledOnion object pub extern "C" fn PeeledOnion_debug_str_void(o: *const c_void) -> Str { @@ -1735,10 +2173,10 @@ pub extern "C" fn PeeledOnion_debug_str_void(o: *const c_void) -> Str { /// /// 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_resolving_destination(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, node_id_lookup: &crate::lightning::blinded_path::NodeIdLookUp, network_graph: &crate::lightning::routing::gossip::ReadOnlyNetworkGraph, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> crate::c_types::derived::CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { +pub extern "C" fn create_onion_message_resolving_destination(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, node_id_lookup: &crate::lightning::blinded_path::NodeIdLookUp, network_graph: &crate::lightning::routing::gossip::ReadOnlyNetworkGraph, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> crate::c_types::derived::CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { 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_resolving_destination::(entropy_source, node_signer, node_id_lookup, network_graph.get_native_ref(), secp256k1::global::SECP256K1, *unsafe { Box::from_raw(path.take_inner()) }, contents, 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, mut orig_ret_0_2) = o; let mut local_orig_ret_0_2 = if orig_ret_0_2.is_none() { crate::c_types::derived::COption_CVec_SocketAddressZZ::None } else { crate::c_types::derived::COption_CVec_SocketAddressZZ::Some( { let mut local_orig_ret_0_2_0 = Vec::new(); for mut item in orig_ret_0_2.unwrap().drain(..) { local_orig_ret_0_2_0.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_orig_ret_0_2_0.into() }) }; 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 }, local_orig_ret_0_2).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(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, mut orig_ret_0_2) = o; let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.drain(..) { local_orig_ret_0_2.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; 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 }, local_orig_ret_0_2.into()).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 } @@ -1756,10 +2194,10 @@ pub extern "C" fn create_onion_message_resolving_destination(entropy_source: &cr /// /// 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, node_id_lookup: &crate::lightning::blinded_path::NodeIdLookUp, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> crate::c_types::derived::CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ { +pub extern "C" fn create_onion_message(entropy_source: &crate::lightning::sign::EntropySource, node_signer: &crate::lightning::sign::NodeSigner, node_id_lookup: &crate::lightning::blinded_path::NodeIdLookUp, mut path: crate::lightning::onion_message::messenger::OnionMessagePath, mut contents: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::blinded_path::message::BlindedMessagePath) -> crate::c_types::derived::CResult_C3Tuple_PublicKeyOnionMessageCVec_SocketAddressZZSendErrorZ { 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, node_id_lookup, secp256k1::global::SECP256K1, *unsafe { Box::from_raw(path.take_inner()) }, contents, 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, mut orig_ret_0_2) = o; let mut local_orig_ret_0_2 = if orig_ret_0_2.is_none() { crate::c_types::derived::COption_CVec_SocketAddressZZ::None } else { crate::c_types::derived::COption_CVec_SocketAddressZZ::Some( { let mut local_orig_ret_0_2_0 = Vec::new(); for mut item in orig_ret_0_2.unwrap().drain(..) { local_orig_ret_0_2_0.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; local_orig_ret_0_2_0.into() }) }; 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 }, local_orig_ret_0_2).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(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, mut orig_ret_0_2) = o; let mut local_orig_ret_0_2 = Vec::new(); for mut item in orig_ret_0_2.drain(..) { local_orig_ret_0_2.push( { crate::lightning::ln::msgs::SocketAddress::native_into(item) }); }; 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 }, local_orig_ret_0_2.into()).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 } @@ -1887,6 +2325,57 @@ extern "C" fn OnionMessenger_EventsProvider_process_pending_events(this_arg: *co ::process_pending_events(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, handler) } +impl From for crate::lightning::ln::msgs::BaseMessageHandler { + fn from(obj: nativeOnionMessenger) -> Self { + let rust_obj = crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = OnionMessenger_as_BaseMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(OnionMessenger_free_void); + ret + } +} +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn OnionMessenger_as_BaseMessageHandler(this_arg: &OnionMessenger) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: OnionMessenger_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: OnionMessenger_BaseMessageHandler_peer_disconnected, + provided_node_features: OnionMessenger_BaseMessageHandler_provided_node_features, + provided_init_features: OnionMessenger_BaseMessageHandler_provided_init_features, + peer_connected: OnionMessenger_BaseMessageHandler_peer_connected, + } +} + +#[must_use] +extern "C" fn OnionMessenger_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; + local_ret.into() +} +extern "C" fn OnionMessenger_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn OnionMessenger_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn OnionMessenger_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn OnionMessenger_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} + impl From for crate::lightning::ln::msgs::OnionMessageHandler { fn from(obj: nativeOnionMessenger) -> Self { let rust_obj = crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -1906,11 +2395,16 @@ pub extern "C" fn OnionMessenger_as_OnionMessageHandler(this_arg: &OnionMessenge free: None, handle_onion_message: OnionMessenger_OnionMessageHandler_handle_onion_message, next_onion_message_for_peer: OnionMessenger_OnionMessageHandler_next_onion_message_for_peer, - peer_connected: OnionMessenger_OnionMessageHandler_peer_connected, - peer_disconnected: OnionMessenger_OnionMessageHandler_peer_disconnected, timer_tick_occurred: OnionMessenger_OnionMessageHandler_timer_tick_occurred, - provided_node_features: OnionMessenger_OnionMessageHandler_provided_node_features, - provided_init_features: OnionMessenger_OnionMessageHandler_provided_init_features, + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_and_clear_pending_msg_events: OnionMessenger_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: OnionMessenger_BaseMessageHandler_peer_disconnected, + provided_node_features: OnionMessenger_BaseMessageHandler_provided_node_features, + provided_init_features: OnionMessenger_BaseMessageHandler_provided_init_features, + peer_connected: OnionMessenger_BaseMessageHandler_peer_connected, + }, } } @@ -1923,26 +2417,7 @@ extern "C" fn OnionMessenger_OnionMessageHandler_next_onion_message_for_peer(thi let mut local_ret = crate::lightning::ln::msgs::OnionMessage { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true }; local_ret } -#[must_use] -extern "C" fn OnionMessenger_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust(), init.get_native_ref(), inbound); - 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 -} -extern "C" fn OnionMessenger_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()) -} extern "C" fn OnionMessenger_OnionMessageHandler_timer_tick_occurred(this_arg: *const c_void) { ::timer_tick_occurred(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, ) } -#[must_use] -extern "C" fn OnionMessenger_OnionMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn OnionMessenger_OnionMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} diff --git a/lightning-c-bindings/src/lightning/onion_message/offers.rs b/lightning-c-bindings/src/lightning/onion_message/offers.rs index e99e5fb6..ff8a0c26 100644 --- a/lightning-c-bindings/src/lightning/onion_message/offers.rs +++ b/lightning-c-bindings/src/lightning/onion_message/offers.rs @@ -28,6 +28,14 @@ pub struct OffersMessageHandler { /// Handles the given message by either responding with an [`Bolt12Invoice`], sending a payment, /// or replying with an error. /// + /// If the provided [`OffersContext`] is `Some`, then the message was sent to a blinded path that we + /// created and was authenticated as such by the [`OnionMessenger`]. There is one exception to + /// this: [`OffersContext::InvoiceRequest`]. + /// + /// In order to support offers created prior to LDK 0.2, [`OffersContext::InvoiceRequest`]s are + /// not authenticated by the [`OnionMessenger`]. It is the responsibility of message handling code + /// to authenticate the provided [`OffersContext`] in this case. + /// /// The returned [`OffersMessage`], if any, is enqueued to be sent by [`OnionMessenger`]. /// /// [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger @@ -127,6 +135,9 @@ pub enum OffersMessage { /// [`Refund`]: crate::offers::refund::Refund Invoice( crate::lightning::offers::invoice::Bolt12Invoice), + /// A [`StaticInvoice`] sent in response to an [`InvoiceRequest`]. + StaticInvoice( + crate::lightning::offers::static_invoice::StaticInvoice), /// An error from handling an [`OffersMessage`]. InvoiceError( crate::lightning::offers::invoice_error::InvoiceError), @@ -150,6 +161,12 @@ impl OffersMessage { *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, + OffersMessage::StaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeOffersMessage::StaticInvoice ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, OffersMessage::InvoiceError (ref a, ) => { let mut a_nonref = Clone::clone(a); nativeOffersMessage::InvoiceError ( @@ -171,6 +188,11 @@ impl OffersMessage { *unsafe { Box::from_raw(a.take_inner()) }, ) }, + OffersMessage::StaticInvoice (mut a, ) => { + nativeOffersMessage::StaticInvoice ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, OffersMessage::InvoiceError (mut a, ) => { nativeOffersMessage::InvoiceError ( *unsafe { Box::from_raw(a.take_inner()) }, @@ -194,6 +216,12 @@ impl OffersMessage { crate::lightning::offers::invoice::Bolt12Invoice { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, + nativeOffersMessage::StaticInvoice (ref a, ) => { + let mut a_nonref = Clone::clone(a); + OffersMessage::StaticInvoice ( + crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, nativeOffersMessage::InvoiceError (ref a, ) => { let mut a_nonref = Clone::clone(a); OffersMessage::InvoiceError ( @@ -215,6 +243,11 @@ impl OffersMessage { crate::lightning::offers::invoice::Bolt12Invoice { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, + nativeOffersMessage::StaticInvoice (mut a, ) => { + OffersMessage::StaticInvoice ( + crate::lightning::offers::static_invoice::StaticInvoice { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, nativeOffersMessage::InvoiceError (mut a, ) => { OffersMessage::InvoiceError ( crate::lightning::offers::invoice_error::InvoiceError { inner: ObjOps::heap_alloc(a), is_owned: true }, @@ -252,6 +285,11 @@ pub extern "C" fn OffersMessage_invoice(a: crate::lightning::offers::invoice::Bo OffersMessage::Invoice(a, ) } #[no_mangle] +/// Utility method to constructs a new StaticInvoice-variant OffersMessage +pub extern "C" fn OffersMessage_static_invoice(a: crate::lightning::offers::static_invoice::StaticInvoice) -> OffersMessage { + OffersMessage::StaticInvoice(a, ) +} +#[no_mangle] /// Utility method to constructs a new InvoiceError-variant OffersMessage pub extern "C" fn OffersMessage_invoice_error(a: crate::lightning::offers::invoice_error::InvoiceError) -> OffersMessage { OffersMessage::InvoiceError(a, ) diff --git a/lightning-c-bindings/src/lightning/onion_message/packet.rs b/lightning-c-bindings/src/lightning/onion_message/packet.rs index fa5cf0d3..6f250e12 100644 --- a/lightning-c-bindings/src/lightning/onion_message/packet.rs +++ b/lightning-c-bindings/src/lightning/onion_message/packet.rs @@ -80,7 +80,7 @@ impl Packet { /// 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; + let mut inner_val = &mut Packet::get_native_mut_ref(this_ptr).version; *inner_val } /// Bolt 04 version number @@ -91,7 +91,7 @@ pub extern "C" fn Packet_set_version(this_ptr: &mut Packet, mut val: u8) { /// 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; + let mut inner_val = &mut Packet::get_native_mut_ref(this_ptr).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 @@ -104,7 +104,7 @@ pub extern "C" fn Packet_set_public_key(this_ptr: &mut Packet, mut val: crate::c /// 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 inner_val = Packet::get_native_mut_ref(this_ptr).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() } @@ -117,7 +117,7 @@ pub extern "C" fn Packet_set_hop_data(this_ptr: &mut Packet, mut val: crate::c_t /// 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; + let mut inner_val = &mut Packet::get_native_mut_ref(this_ptr).hmac; inner_val } /// HMAC to verify the integrity of hop_data @@ -141,7 +141,7 @@ 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()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -149,12 +149,12 @@ impl Clone for 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_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePacket)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePacket) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Packet pub extern "C" fn Packet_clone(orig: &Packet) -> Packet { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the Packet. #[no_mangle] @@ -187,6 +187,13 @@ pub extern "C" fn Packet_write(obj: &crate::lightning::onion_message::packet::Pa 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 crate::lightning::onion_message::packet::nativePacket) }) } +#[no_mangle] +/// Read a Packet from a byte array, created by Packet_write +pub extern "C" fn Packet_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_PacketDecodeErrorZ { + 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::onion_message::packet::Packet { 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 +} /// The contents of an [`OnionMessage`] as read from the wire. /// /// [`OnionMessage`]: crate::ln::msgs::OnionMessage @@ -197,6 +204,9 @@ pub enum ParsedOnionMessageContents { /// A message related to BOLT 12 Offers. Offers( crate::lightning::onion_message::offers::OffersMessage), + /// A message related to async payments. + AsyncPayments( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage), /// A message requesting or providing a DNSSEC proof DNSResolver( crate::lightning::onion_message::dns_resolution::DNSResolverMessage), @@ -217,6 +227,12 @@ impl ParsedOnionMessageContents { a_nonref.into_native(), ) }, + ParsedOnionMessageContents::AsyncPayments (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeParsedOnionMessageContents::AsyncPayments ( + a_nonref.into_native(), + ) + }, ParsedOnionMessageContents::DNSResolver (ref a, ) => { let mut a_nonref = Clone::clone(a); nativeParsedOnionMessageContents::DNSResolver ( @@ -239,6 +255,11 @@ impl ParsedOnionMessageContents { a.into_native(), ) }, + ParsedOnionMessageContents::AsyncPayments (mut a, ) => { + nativeParsedOnionMessageContents::AsyncPayments ( + a.into_native(), + ) + }, ParsedOnionMessageContents::DNSResolver (mut a, ) => { nativeParsedOnionMessageContents::DNSResolver ( a.into_native(), @@ -261,6 +282,12 @@ impl ParsedOnionMessageContents { crate::lightning::onion_message::offers::OffersMessage::native_into(a_nonref), ) }, + nativeParsedOnionMessageContents::AsyncPayments (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ParsedOnionMessageContents::AsyncPayments ( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage::native_into(a_nonref), + ) + }, nativeParsedOnionMessageContents::DNSResolver (ref a, ) => { let mut a_nonref = Clone::clone(a); ParsedOnionMessageContents::DNSResolver ( @@ -283,6 +310,11 @@ impl ParsedOnionMessageContents { crate::lightning::onion_message::offers::OffersMessage::native_into(a), ) }, + nativeParsedOnionMessageContents::AsyncPayments (mut a, ) => { + ParsedOnionMessageContents::AsyncPayments ( + crate::lightning::onion_message::async_payments::AsyncPaymentsMessage::native_into(a), + ) + }, nativeParsedOnionMessageContents::DNSResolver (mut a, ) => { ParsedOnionMessageContents::DNSResolver ( crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(a), @@ -320,6 +352,11 @@ pub extern "C" fn ParsedOnionMessageContents_offers(a: crate::lightning::onion_m ParsedOnionMessageContents::Offers(a, ) } #[no_mangle] +/// Utility method to constructs a new AsyncPayments-variant ParsedOnionMessageContents +pub extern "C" fn ParsedOnionMessageContents_async_payments(a: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage) -> ParsedOnionMessageContents { + ParsedOnionMessageContents::AsyncPayments(a, ) +} +#[no_mangle] /// Utility method to constructs a new DNSResolver-variant ParsedOnionMessageContents pub extern "C" fn ParsedOnionMessageContents_dnsresolver(a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage) -> ParsedOnionMessageContents { ParsedOnionMessageContents::DNSResolver(a, ) diff --git a/lightning-c-bindings/src/lightning/routing/gossip.rs b/lightning-c-bindings/src/lightning/routing/gossip.rs index 9f6a7789..f5bd4ee2 100644 --- a/lightning-c-bindings/src/lightning/routing/gossip.rs +++ b/lightning-c-bindings/src/lightning/routing/gossip.rs @@ -21,7 +21,12 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::routing::gossip::NodeId as nativeNodeIdImport; pub(crate) type nativeNodeId = nativeNodeIdImport; -/// Represents the compressed public key of a node +/// A compressed pubkey which a node uses to sign announcements and decode HTLCs routed through it. +/// +/// This type stores a simple byte array which is not checked for validity (i.e. that it describes +/// a point which lies on the secp256k1 curve), unlike [`PublicKey`], as validity checking would +/// otherwise represent a large portion of [`NetworkGraph`] deserialization time (and RGS +/// application). #[must_use] #[repr(C)] pub struct NodeId { @@ -81,7 +86,7 @@ impl Clone for NodeId { fn clone(&self) -> Self { Self { inner: if <*mut nativeNodeId>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -89,12 +94,12 @@ impl Clone for NodeId { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeId_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeId)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeId) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the NodeId pub extern "C" fn NodeId_clone(orig: &NodeId) -> NodeId { - orig.clone() + Clone::clone(orig) } /// Checks if two NodeIds contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. @@ -182,6 +187,12 @@ pub extern "C" fn NodeId_read(ser: crate::c_types::u8slice) -> crate::c_types::d let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::gossip::NodeId { 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] +/// Build a NodeId from a PublicKey +pub extern "C" fn NodeId_from_PublicKey(f: crate::c_types::PublicKey) -> crate::lightning::routing::gossip::NodeId { + let from_obj = f.into_rust(); + crate::lightning::routing::gossip::NodeId { inner: ObjOps::heap_alloc((lightning::routing::gossip::NodeId::from(from_obj))), is_owned: true } +} use lightning::routing::gossip::NetworkGraph as nativeNetworkGraphImport; pub(crate) type nativeNetworkGraph = nativeNetworkGraphImport; @@ -613,18 +624,19 @@ pub extern "C" fn P2PGossipSync_as_RoutingMessageHandler(this_arg: &P2PGossipSyn handle_channel_update: P2PGossipSync_RoutingMessageHandler_handle_channel_update, get_next_channel_announcement: P2PGossipSync_RoutingMessageHandler_get_next_channel_announcement, get_next_node_announcement: P2PGossipSync_RoutingMessageHandler_get_next_node_announcement, - peer_connected: P2PGossipSync_RoutingMessageHandler_peer_connected, handle_reply_channel_range: P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range, handle_reply_short_channel_ids_end: P2PGossipSync_RoutingMessageHandler_handle_reply_short_channel_ids_end, handle_query_channel_range: P2PGossipSync_RoutingMessageHandler_handle_query_channel_range, handle_query_short_channel_ids: P2PGossipSync_RoutingMessageHandler_handle_query_short_channel_ids, processing_queue_high: P2PGossipSync_RoutingMessageHandler_processing_queue_high, - provided_node_features: P2PGossipSync_RoutingMessageHandler_provided_node_features, - provided_init_features: P2PGossipSync_RoutingMessageHandler_provided_init_features, - MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { + BaseMessageHandler: crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: P2PGossipSync_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: P2PGossipSync_BaseMessageHandler_peer_disconnected, + provided_node_features: P2PGossipSync_BaseMessageHandler_provided_node_features, + provided_init_features: P2PGossipSync_BaseMessageHandler_provided_init_features, + peer_connected: P2PGossipSync_BaseMessageHandler_peer_connected, }, } } @@ -664,12 +676,6 @@ extern "C" fn P2PGossipSync_RoutingMessageHandler_get_next_node_announcement(thi local_ret } #[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), init.get_native_ref(), inbound); - 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 -} -#[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; @@ -698,44 +704,57 @@ extern "C" fn P2PGossipSync_RoutingMessageHandler_processing_queue_high(this_arg let mut ret = ::processing_queue_high(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, ); ret } -#[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { - let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, ); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -#[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust()); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} -impl From for crate::lightning::events::MessageSendEventsProvider { +impl From for crate::lightning::ln::msgs::BaseMessageHandler { fn from(obj: nativeP2PGossipSync) -> Self { let rust_obj = crate::lightning::routing::gossip::P2PGossipSync { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = P2PGossipSync_as_MessageSendEventsProvider(&rust_obj); + let mut ret = P2PGossipSync_as_BaseMessageHandler(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); ret.free = Some(P2PGossipSync_free_void); ret } } -/// Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is +/// Constructs a new BaseMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseMessageHandler must be freed before this_arg is #[no_mangle] -pub extern "C" fn P2PGossipSync_as_MessageSendEventsProvider(this_arg: &P2PGossipSync) -> crate::lightning::events::MessageSendEventsProvider { - crate::lightning::events::MessageSendEventsProvider { +pub extern "C" fn P2PGossipSync_as_BaseMessageHandler(this_arg: &P2PGossipSync) -> crate::lightning::ln::msgs::BaseMessageHandler { + crate::lightning::ln::msgs::BaseMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_and_clear_pending_msg_events: P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events, + get_and_clear_pending_msg_events: P2PGossipSync_BaseMessageHandler_get_and_clear_pending_msg_events, + peer_disconnected: P2PGossipSync_BaseMessageHandler_peer_disconnected, + provided_node_features: P2PGossipSync_BaseMessageHandler_provided_node_features, + provided_init_features: P2PGossipSync_BaseMessageHandler_provided_init_features, + peer_connected: P2PGossipSync_BaseMessageHandler_peer_connected, } } #[must_use] -extern "C" fn P2PGossipSync_MessageSendEventsProvider_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { - let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::events::MessageSendEvent::native_into(item) }); }; +extern "C" fn P2PGossipSync_BaseMessageHandler_get_and_clear_pending_msg_events(this_arg: *const c_void) -> crate::c_types::derived::CVec_MessageSendEventZ { + let mut ret = ::get_and_clear_pending_msg_events(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, ); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::ln::msgs::MessageSendEvent::native_into(item) }); }; local_ret.into() } +extern "C" fn P2PGossipSync_BaseMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust()) +} +#[must_use] +extern "C" fn P2PGossipSync_BaseMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn P2PGossipSync_BaseMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust()); + crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn P2PGossipSync_BaseMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); + 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 +} use lightning::routing::gossip::ChannelUpdateInfo as nativeChannelUpdateInfoImport; @@ -800,7 +819,7 @@ impl ChannelUpdateInfo { /// The minimum value, which must be relayed to the next hop via the channel #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_htlc_minimum_msat(this_ptr: &ChannelUpdateInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).htlc_minimum_msat; *inner_val } /// The minimum value, which must be relayed to the next hop via the channel @@ -811,7 +830,7 @@ pub extern "C" fn ChannelUpdateInfo_set_htlc_minimum_msat(this_ptr: &mut Channel /// The maximum value which may be relayed to the next hop via the channel. #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_htlc_maximum_msat(this_ptr: &ChannelUpdateInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).htlc_maximum_msat; *inner_val } /// The maximum value which may be relayed to the next hop via the channel. @@ -822,7 +841,7 @@ pub extern "C" fn ChannelUpdateInfo_set_htlc_maximum_msat(this_ptr: &mut Channel /// Fees charged when the channel is used for routing #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_fees(this_ptr: &ChannelUpdateInfo) -> crate::lightning_types::routing::RoutingFees { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fees; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).fees; crate::lightning_types::routing::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::routing::RoutingFees<>) as *mut _) }, is_owned: false } } /// Fees charged when the channel is used for routing @@ -834,7 +853,7 @@ pub extern "C" fn ChannelUpdateInfo_set_fees(this_ptr: &mut ChannelUpdateInfo, m /// Value is opaque, as set in the announcement. #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_last_update(this_ptr: &ChannelUpdateInfo) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).last_update; *inner_val } /// When the last update to the channel direction was issued. @@ -846,7 +865,7 @@ pub extern "C" fn ChannelUpdateInfo_set_last_update(this_ptr: &mut ChannelUpdate /// The difference in CLTV values that you must have when routing through this channel. #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_cltv_expiry_delta(this_ptr: &ChannelUpdateInfo) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// The difference in CLTV values that you must have when routing through this channel. @@ -857,7 +876,7 @@ pub extern "C" fn ChannelUpdateInfo_set_cltv_expiry_delta(this_ptr: &mut Channel /// Whether the channel can be currently used for payments (in this one direction). #[no_mangle] pub extern "C" fn ChannelUpdateInfo_get_enabled(this_ptr: &ChannelUpdateInfo) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().enabled; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).enabled; *inner_val } /// Whether the channel can be currently used for payments (in this one direction). @@ -873,7 +892,7 @@ pub extern "C" fn ChannelUpdateInfo_set_enabled(this_ptr: &mut ChannelUpdateInfo /// 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 ChannelUpdateInfo_get_last_update_message(this_ptr: &ChannelUpdateInfo) -> crate::lightning::ln::msgs::ChannelUpdate { - let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update_message; + let mut inner_val = &mut ChannelUpdateInfo::get_native_mut_ref(this_ptr).last_update_message; let mut local_inner_val = crate::lightning::ln::msgs::ChannelUpdate { 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::msgs::ChannelUpdate<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -909,7 +928,7 @@ impl Clone for ChannelUpdateInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelUpdateInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -917,12 +936,12 @@ impl Clone for ChannelUpdateInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelUpdateInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUpdateInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelUpdateInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelUpdateInfo pub extern "C" fn ChannelUpdateInfo_clone(orig: &ChannelUpdateInfo) -> ChannelUpdateInfo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelUpdateInfo object pub extern "C" fn ChannelUpdateInfo_debug_str_void(o: *const c_void) -> Str { @@ -1021,7 +1040,7 @@ impl ChannelInfo { /// Protocol features of a channel communicated during its announcement #[no_mangle] pub extern "C" fn ChannelInfo_get_features(this_ptr: &ChannelInfo) -> crate::lightning_types::features::ChannelFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelFeatures<>) as *mut _) }, is_owned: false } } /// Protocol features of a channel communicated during its announcement @@ -1032,7 +1051,7 @@ pub extern "C" fn ChannelInfo_set_features(this_ptr: &mut ChannelInfo, mut val: /// Source node of the first direction of a channel #[no_mangle] pub extern "C" fn ChannelInfo_get_node_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_one; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).node_one; crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } } /// Source node of the first direction of a channel @@ -1043,7 +1062,7 @@ pub extern "C" fn ChannelInfo_set_node_one(this_ptr: &mut ChannelInfo, mut val: /// Source node of the second direction of a channel #[no_mangle] pub extern "C" fn ChannelInfo_get_node_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::NodeId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_two; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).node_two; crate::lightning::routing::gossip::NodeId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeId<>) as *mut _) }, is_owned: false } } /// Source node of the second direction of a channel @@ -1054,7 +1073,7 @@ pub extern "C" fn ChannelInfo_set_node_two(this_ptr: &mut ChannelInfo, mut val: /// The channel capacity as seen on-chain, if chain lookup is available. #[no_mangle] pub extern "C" fn ChannelInfo_get_capacity_sats(this_ptr: &ChannelInfo) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().capacity_sats; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).capacity_sats; 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 } @@ -1069,7 +1088,7 @@ pub extern "C" fn ChannelInfo_set_capacity_sats(this_ptr: &mut ChannelInfo, mut /// 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 ChannelInfo_get_one_to_two(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().one_to_two; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).one_to_two; let mut local_inner_val = crate::lightning::routing::gossip::ChannelUpdateInfo { 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::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1086,7 +1105,7 @@ pub extern "C" fn ChannelInfo_set_one_to_two(this_ptr: &mut ChannelInfo, mut val /// 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 ChannelInfo_get_two_to_one(this_ptr: &ChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().two_to_one; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).two_to_one; let mut local_inner_val = crate::lightning::routing::gossip::ChannelUpdateInfo { 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::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1106,7 +1125,7 @@ pub extern "C" fn ChannelInfo_set_two_to_one(this_ptr: &mut ChannelInfo, mut val /// 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 ChannelInfo_get_announcement_message(this_ptr: &ChannelInfo) -> crate::lightning::ln::msgs::ChannelAnnouncement { - let mut inner_val = &mut this_ptr.get_native_mut_ref().announcement_message; + let mut inner_val = &mut ChannelInfo::get_native_mut_ref(this_ptr).announcement_message; let mut local_inner_val = crate::lightning::ln::msgs::ChannelAnnouncement { 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::msgs::ChannelAnnouncement<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1125,7 +1144,7 @@ impl Clone for ChannelInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1133,12 +1152,12 @@ impl Clone for ChannelInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelInfo pub extern "C" fn ChannelInfo_clone(orig: &ChannelInfo) -> ChannelInfo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelInfo object pub extern "C" fn ChannelInfo_debug_str_void(o: *const c_void) -> Str { @@ -1249,7 +1268,7 @@ impl Clone for DirectedChannelInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeDirectedChannelInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1257,12 +1276,12 @@ impl Clone for DirectedChannelInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DirectedChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDirectedChannelInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDirectedChannelInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DirectedChannelInfo pub extern "C" fn DirectedChannelInfo_clone(orig: &DirectedChannelInfo) -> DirectedChannelInfo { - orig.clone() + Clone::clone(orig) } /// Returns information for the channel. #[must_use] @@ -1624,7 +1643,7 @@ impl NodeAnnouncementDetails { /// Protocol features the node announced support for #[no_mangle] pub extern "C" fn NodeAnnouncementDetails_get_features(this_ptr: &NodeAnnouncementDetails) -> crate::lightning_types::features::NodeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().features; + let mut inner_val = &mut NodeAnnouncementDetails::get_native_mut_ref(this_ptr).features; crate::lightning_types::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::NodeFeatures<>) as *mut _) }, is_owned: false } } /// Protocol features the node announced support for @@ -1636,7 +1655,7 @@ pub extern "C" fn NodeAnnouncementDetails_set_features(this_ptr: &mut NodeAnnoun /// Value is opaque, as set in the announcement. #[no_mangle] pub extern "C" fn NodeAnnouncementDetails_get_last_update(this_ptr: &NodeAnnouncementDetails) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().last_update; + let mut inner_val = &mut NodeAnnouncementDetails::get_native_mut_ref(this_ptr).last_update; *inner_val } /// When the last known update to the node state was issued. @@ -1648,7 +1667,7 @@ pub extern "C" fn NodeAnnouncementDetails_set_last_update(this_ptr: &mut NodeAnn /// Color assigned to the node #[no_mangle] pub extern "C" fn NodeAnnouncementDetails_get_rgb(this_ptr: &NodeAnnouncementDetails) -> *const [u8; 3] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().rgb; + let mut inner_val = &mut NodeAnnouncementDetails::get_native_mut_ref(this_ptr).rgb; inner_val } /// Color assigned to the node @@ -1661,7 +1680,7 @@ pub extern "C" fn NodeAnnouncementDetails_set_rgb(this_ptr: &mut NodeAnnouncemen /// should not be exposed to the user. #[no_mangle] pub extern "C" fn NodeAnnouncementDetails_get_alias(this_ptr: &NodeAnnouncementDetails) -> crate::lightning::routing::gossip::NodeAlias { - let mut inner_val = &mut this_ptr.get_native_mut_ref().alias; + let mut inner_val = &mut NodeAnnouncementDetails::get_native_mut_ref(this_ptr).alias; crate::lightning::routing::gossip::NodeAlias { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::gossip::NodeAlias<>) as *mut _) }, is_owned: false } } /// Moniker assigned to the node. @@ -1676,7 +1695,7 @@ pub extern "C" fn NodeAnnouncementDetails_set_alias(this_ptr: &mut NodeAnnouncem /// Returns a copy of the field. #[no_mangle] pub extern "C" fn NodeAnnouncementDetails_get_addresses(this_ptr: &NodeAnnouncementDetails) -> crate::c_types::derived::CVec_SocketAddressZ { - let mut inner_val = this_ptr.get_native_mut_ref().addresses.clone(); + let mut inner_val = NodeAnnouncementDetails::get_native_mut_ref(this_ptr).addresses.clone(); 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() } @@ -1703,7 +1722,7 @@ impl Clone for NodeAnnouncementDetails { fn clone(&self) -> Self { Self { inner: if <*mut nativeNodeAnnouncementDetails>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1711,12 +1730,12 @@ impl Clone for NodeAnnouncementDetails { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeAnnouncementDetails_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAnnouncementDetails)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeAnnouncementDetails) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the NodeAnnouncementDetails pub extern "C" fn NodeAnnouncementDetails_clone(orig: &NodeAnnouncementDetails) -> NodeAnnouncementDetails { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a NodeAnnouncementDetails object pub extern "C" fn NodeAnnouncementDetails_debug_str_void(o: *const c_void) -> Str { @@ -1990,7 +2009,7 @@ impl NodeAlias { } #[no_mangle] pub extern "C" fn NodeAlias_get_a(this_ptr: &NodeAlias) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut NodeAlias::get_native_mut_ref(this_ptr).0; inner_val } #[no_mangle] @@ -2009,7 +2028,7 @@ impl Clone for NodeAlias { fn clone(&self) -> Self { Self { inner: if <*mut nativeNodeAlias>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2017,12 +2036,12 @@ impl Clone for NodeAlias { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeAlias_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeAlias)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeAlias) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the NodeAlias pub extern "C" fn NodeAlias_clone(orig: &NodeAlias) -> NodeAlias { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a NodeAlias object pub extern "C" fn NodeAlias_debug_str_void(o: *const c_void) -> Str { @@ -2132,7 +2151,7 @@ impl NodeInfo { /// Returns a copy of the field. #[no_mangle] pub extern "C" fn NodeInfo_get_channels(this_ptr: &NodeInfo) -> crate::c_types::derived::CVec_u64Z { - let mut inner_val = this_ptr.get_native_mut_ref().channels.clone(); + let mut inner_val = NodeInfo::get_native_mut_ref(this_ptr).channels.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; local_inner_val.into() } @@ -2149,7 +2168,7 @@ pub extern "C" fn NodeInfo_set_channels(this_ptr: &mut NodeInfo, mut val: crate: /// Returns a copy of the field. #[no_mangle] pub extern "C" fn NodeInfo_get_announcement_info(this_ptr: &NodeInfo) -> crate::c_types::derived::COption_NodeAnnouncementInfoZ { - let mut inner_val = this_ptr.get_native_mut_ref().announcement_info.clone(); + let mut inner_val = NodeInfo::get_native_mut_ref(this_ptr).announcement_info.clone(); let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NodeAnnouncementInfoZ::None } else { crate::c_types::derived::COption_NodeAnnouncementInfoZ::Some( { crate::lightning::routing::gossip::NodeAnnouncementInfo::native_into(inner_val.unwrap()) }) }; local_inner_val } @@ -2165,7 +2184,7 @@ impl Clone for NodeInfo { fn clone(&self) -> Self { Self { inner: if <*mut nativeNodeInfo>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2173,12 +2192,12 @@ impl Clone for NodeInfo { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeInfo)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeInfo) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the NodeInfo pub extern "C" fn NodeInfo_clone(orig: &NodeInfo) -> NodeInfo { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a NodeInfo object pub extern "C" fn NodeInfo_debug_str_void(o: *const c_void) -> Str { @@ -2357,8 +2376,9 @@ pub extern "C" fn NetworkGraph_update_channel_from_unsigned_announcement(this_ar /// All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. #[must_use] #[no_mangle] -pub extern "C" fn NetworkGraph_add_channel_from_partial_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut short_channel_id: u64, mut timestamp: u64, mut features: crate::lightning_types::features::ChannelFeatures, mut node_id_1: crate::c_types::PublicKey, mut node_id_2: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.add_channel_from_partial_announcement(short_channel_id, timestamp, *unsafe { Box::from_raw(features.take_inner()) }, node_id_1.into_rust(), node_id_2.into_rust()); +pub extern "C" fn NetworkGraph_add_channel_from_partial_announcement(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut short_channel_id: u64, mut capacity_sats: crate::c_types::derived::COption_u64Z, mut timestamp: u64, mut features: crate::lightning_types::features::ChannelFeatures, mut node_id_1: crate::lightning::routing::gossip::NodeId, mut node_id_2: crate::lightning::routing::gossip::NodeId) -> crate::c_types::derived::CResult_NoneLightningErrorZ { + let mut local_capacity_sats = if capacity_sats.is_some() { Some( { capacity_sats.take() }) } else { None }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.add_channel_from_partial_announcement(short_channel_id, local_capacity_sats, timestamp, *unsafe { Box::from_raw(features.take_inner()) }, *unsafe { Box::from_raw(node_id_1.take_inner()) }, *unsafe { Box::from_raw(node_id_2.take_inner()) }); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/routing/mod.rs b/lightning-c-bindings/src/lightning/routing/mod.rs index 96c6c3c4..fabefa0b 100644 --- a/lightning-c-bindings/src/lightning/routing/mod.rs +++ b/lightning-c-bindings/src/lightning/routing/mod.rs @@ -17,10 +17,10 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod utxo; pub mod gossip; pub mod router; pub mod scoring; +pub mod utxo; mod log_approx { use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index 64b32854..6484261c 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -26,7 +26,7 @@ pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightni /// # Privacy /// /// Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found, -/// it will create a one-hop path using the recipient as the introduction node if it is a announced +/// it will create a one-hop path using the recipient as the introduction node if it is an announced /// node. Otherwise, there is no way to find a path to the introduction node in order to send a /// payment, and thus an `Err` is returned. #[must_use] @@ -116,23 +116,24 @@ pub extern "C" fn DefaultRouter_as_Router(this_arg: &DefaultRouter) -> crate::li } #[must_use] -extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ { +extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteStrZ { 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 = ::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), route_params.get_native_ref(), local_first_hops, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }); - 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() }; + 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( { e.into() }).into() }; local_ret } #[must_use] -extern "C" fn DefaultRouter_Router_find_route_with_id(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, mut _payment_hash: crate::c_types::ThirtyTwoBytes, mut _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteLightningErrorZ { +extern "C" fn DefaultRouter_Router_find_route_with_id(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, mut _payment_hash: crate::c_types::ThirtyTwoBytes, mut _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteStrZ { 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 = ::find_route_with_id(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), route_params.get_native_ref(), local_first_hops, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }, ::lightning::types::payment::PaymentHash(_payment_hash.data), ::lightning::ln::channelmanager::PaymentId(_payment_id.data)); - 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() }; + 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( { e.into() }).into() }; local_ret } #[must_use] -extern "C" fn DefaultRouter_Router_create_blinded_payment_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut first_hops: crate::c_types::derived::CVec_ChannelDetailsZ, mut tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: u64) -> crate::c_types::derived::CResult_CVec_BlindedPaymentPathZNoneZ { +extern "C" fn DefaultRouter_Router_create_blinded_payment_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut first_hops: crate::c_types::derived::CVec_ChannelDetailsZ, mut tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_BlindedPaymentPathZNoneZ { let mut local_first_hops = Vec::new(); for mut item in first_hops.into_rust().drain(..) { local_first_hops.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = ::create_blinded_payment_paths(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, recipient.into_rust(), local_first_hops, *unsafe { Box::from_raw(tlvs.take_inner()) }, amount_msats, secp256k1::global::SECP256K1); + let mut local_amount_msats = if amount_msats.is_some() { Some( { amount_msats.take() }) } else { None }; + let mut ret = ::create_blinded_payment_paths(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, recipient.into_rust(), local_first_hops, *unsafe { Box::from_raw(tlvs.take_inner()) }, local_amount_msats, 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::lightning::blinded_path::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -149,7 +150,7 @@ pub struct Router { /// and [`RouteParameters::final_value_msat`], respectively. /// /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ, + pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteStrZ, /// Finds a [`Route`] for a payment between the given `payer` and a payee. /// /// The `payee` and the payment's value are given in [`RouteParameters::payment_params`] @@ -159,11 +160,11 @@ pub struct Router { /// payment. /// /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - pub find_route_with_id: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, _payment_hash: crate::c_types::ThirtyTwoBytes, _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteLightningErrorZ, + pub find_route_with_id: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, _payment_hash: crate::c_types::ThirtyTwoBytes, _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteStrZ, /// Creates [`BlindedPaymentPath`]s for payment to the `recipient` node. The channels in `first_hops` /// are assumed to be with the `recipient`'s peers. The payment secret and any constraints are /// given in `tlvs`. - pub create_blinded_payment_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, first_hops: crate::c_types::derived::CVec_ChannelDetailsZ, tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, amount_msats: u64) -> crate::c_types::derived::CResult_CVec_BlindedPaymentPathZNoneZ, + pub create_blinded_payment_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, first_hops: crate::c_types::derived::CVec_ChannelDetailsZ, tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, amount_msats: crate::c_types::derived::COption_u64Z) -> crate::c_types::derived::CResult_CVec_BlindedPaymentPathZNoneZ, /// 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, @@ -183,21 +184,22 @@ pub(crate) fn Router_clone_fields(orig: &Router) -> Router { use lightning::routing::router::Router as rustRouter; impl rustRouter for Router { - fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { + fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_str() })}; local_ret } - fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning_types::payment::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { + fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning_types::payment::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.find_route_with_id)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: _payment_hash.0 }, crate::c_types::ThirtyTwoBytes { data: _payment_id.0 }); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_str() })}; local_ret } - fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { + fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { let mut local_first_hops = Vec::new(); for mut item in first_hops.drain(..) { local_first_hops.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.create_blinded_payment_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), local_first_hops.into(), crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(tlvs), is_owned: true }, amount_msats); + let mut local_amount_msats = if amount_msats.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { amount_msats.unwrap() }) }; + let mut ret = (self.create_blinded_payment_paths)(self.this_arg, crate::c_types::PublicKey::from_rust(&recipient), local_first_hops.into(), crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(tlvs), is_owned: true }, local_amount_msats); 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } @@ -205,21 +207,22 @@ impl rustRouter for Router { pub struct RouterRef(Router); impl rustRouter for RouterRef { - fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { + fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.0.find_route)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_str() })}; local_ret } - fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning_types::payment::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { + fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channel_state::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning_types::payment::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channel_state::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; let mut ret = (self.0.find_route_with_id)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: _payment_hash.0 }, crate::c_types::ThirtyTwoBytes { data: _payment_id.0 }); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_str() })}; local_ret } - fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { + fn create_blinded_payment_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut first_hops: Vec, mut tlvs: lightning::blinded_path::payment::ReceiveTlvs, mut amount_msats: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { let mut local_first_hops = Vec::new(); for mut item in first_hops.drain(..) { local_first_hops.push( { crate::lightning::ln::channel_state::ChannelDetails { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.0.create_blinded_payment_paths)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&recipient), local_first_hops.into(), crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(tlvs), is_owned: true }, amount_msats); + let mut local_amount_msats = if amount_msats.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { amount_msats.unwrap() }) }; + let mut ret = (self.0.create_blinded_payment_paths)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&recipient), local_first_hops.into(), crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(tlvs), is_owned: true }, local_amount_msats); 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( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } @@ -413,7 +416,7 @@ impl Clone for InFlightHtlcs { fn clone(&self) -> Self { Self { inner: if <*mut nativeInFlightHtlcs>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -421,12 +424,12 @@ impl Clone for InFlightHtlcs { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InFlightHtlcs_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInFlightHtlcs)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInFlightHtlcs) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InFlightHtlcs pub extern "C" fn InFlightHtlcs_clone(orig: &InFlightHtlcs) -> InFlightHtlcs { - orig.clone() + Clone::clone(orig) } /// Constructs an empty `InFlightHtlcs`. #[must_use] @@ -539,7 +542,7 @@ impl RouteHop { /// The node_id of the node at this hop. #[no_mangle] pub extern "C" fn RouteHop_get_pubkey(this_ptr: &RouteHop) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().pubkey; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// The node_id of the node at this hop. @@ -551,7 +554,7 @@ pub extern "C" fn RouteHop_set_pubkey(this_ptr: &mut RouteHop, mut val: crate::c /// amended to match the features present in the invoice this node generated. #[no_mangle] pub extern "C" fn RouteHop_get_node_features(this_ptr: &RouteHop) -> crate::lightning_types::features::NodeFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().node_features; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).node_features; crate::lightning_types::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::NodeFeatures<>) as *mut _) }, is_owned: false } } /// The node_announcement features of the node at this hop. For the last hop, these may be @@ -563,7 +566,7 @@ pub extern "C" fn RouteHop_set_node_features(this_ptr: &mut RouteHop, mut val: c /// The channel that should be used from the previous hop to reach this node. #[no_mangle] pub extern "C" fn RouteHop_get_short_channel_id(this_ptr: &RouteHop) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } /// The channel that should be used from the previous hop to reach this node. @@ -575,7 +578,7 @@ pub extern "C" fn RouteHop_set_short_channel_id(this_ptr: &mut RouteHop, mut val /// to reach this node. #[no_mangle] pub extern "C" fn RouteHop_get_channel_features(this_ptr: &RouteHop) -> crate::lightning_types::features::ChannelFeatures { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_features; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).channel_features; crate::lightning_types::features::ChannelFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::ChannelFeatures<>) as *mut _) }, is_owned: false } } /// The channel_announcement features of the channel that should be used from the previous hop @@ -587,17 +590,17 @@ pub extern "C" fn RouteHop_set_channel_features(this_ptr: &mut RouteHop, mut val /// The fee taken on this hop (for paying for the use of the *next* channel in the path). /// If this is the last hop in [`Path::hops`]: /// * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire -/// blinded path +/// blinded path (including any Trampoline hops) /// * otherwise, this is the full value of this [`Path`]'s part of the payment #[no_mangle] pub extern "C" fn RouteHop_get_fee_msat(this_ptr: &RouteHop) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_msat; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).fee_msat; *inner_val } /// The fee taken on this hop (for paying for the use of the *next* channel in the path). /// If this is the last hop in [`Path::hops`]: /// * if we're sending to a [`BlindedPaymentPath`], this is the fee paid for use of the entire -/// blinded path +/// blinded path (including any Trampoline hops) /// * otherwise, this is the full value of this [`Path`]'s part of the payment #[no_mangle] pub extern "C" fn RouteHop_set_fee_msat(this_ptr: &mut RouteHop, mut val: u64) { @@ -606,17 +609,17 @@ pub extern "C" fn RouteHop_set_fee_msat(this_ptr: &mut RouteHop, mut val: u64) { /// The CLTV delta added for this hop. /// If this is the last hop in [`Path::hops`]: /// * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded -/// path +/// path (including any Trampoline hops) /// * otherwise, this is the CLTV delta expected at the destination #[no_mangle] pub extern "C" fn RouteHop_get_cltv_expiry_delta(this_ptr: &RouteHop) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// The CLTV delta added for this hop. /// If this is the last hop in [`Path::hops`]: /// * if we're sending to a [`BlindedPaymentPath`], this is the CLTV delta for the entire blinded -/// path +/// path (including any Trampoline hops) /// * otherwise, this is the CLTV delta expected at the destination #[no_mangle] pub extern "C" fn RouteHop_set_cltv_expiry_delta(this_ptr: &mut RouteHop, mut val: u32) { @@ -632,7 +635,7 @@ pub extern "C" fn RouteHop_set_cltv_expiry_delta(this_ptr: &mut RouteHop, mut va /// 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; + let mut inner_val = &mut RouteHop::get_native_mut_ref(this_ptr).maybe_announced_channel; *inner_val } /// Indicates whether this hop is possibly announced in the public network graph. @@ -665,7 +668,7 @@ impl Clone for RouteHop { fn clone(&self) -> Self { Self { inner: if <*mut nativeRouteHop>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -673,12 +676,12 @@ impl Clone for RouteHop { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHop_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHop)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRouteHop) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RouteHop pub extern "C" fn RouteHop_clone(orig: &RouteHop) -> RouteHop { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RouteHop object pub extern "C" fn RouteHop_debug_str_void(o: *const c_void) -> Str { @@ -719,6 +722,188 @@ pub extern "C" fn RouteHop_read(ser: crate::c_types::u8slice) -> crate::c_types: local_res } +use lightning::routing::router::TrampolineHop as nativeTrampolineHopImport; +pub(crate) type nativeTrampolineHop = nativeTrampolineHopImport; + +/// A Trampoline hop in a route, and additional metadata about it. \"Hop\" is defined as a node. +#[must_use] +#[repr(C)] +pub struct TrampolineHop { + /// 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 nativeTrampolineHop, + /// 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 core::ops::Deref for TrampolineHop { + type Target = nativeTrampolineHop; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for TrampolineHop { } +unsafe impl core::marker::Sync for TrampolineHop { } +impl Drop for TrampolineHop { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeTrampolineHop>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the TrampolineHop, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn TrampolineHop_free(this_obj: TrampolineHop) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn TrampolineHop_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTrampolineHop) }; +} +#[allow(unused)] +impl TrampolineHop { + pub(crate) fn get_native_ref(&self) -> &'static nativeTrampolineHop { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTrampolineHop { + 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 nativeTrampolineHop { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The node_id of the node at this hop. +#[no_mangle] +pub extern "C" fn TrampolineHop_get_pubkey(this_ptr: &TrampolineHop) -> crate::c_types::PublicKey { + let mut inner_val = &mut TrampolineHop::get_native_mut_ref(this_ptr).pubkey; + crate::c_types::PublicKey::from_rust(&inner_val) +} +/// The node_id of the node at this hop. +#[no_mangle] +pub extern "C" fn TrampolineHop_set_pubkey(this_ptr: &mut TrampolineHop, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.pubkey = val.into_rust(); +} +/// The node_announcement features of the node at this hop. +#[no_mangle] +pub extern "C" fn TrampolineHop_get_node_features(this_ptr: &TrampolineHop) -> crate::lightning_types::features::NodeFeatures { + let mut inner_val = &mut TrampolineHop::get_native_mut_ref(this_ptr).node_features; + crate::lightning_types::features::NodeFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::features::NodeFeatures<>) as *mut _) }, is_owned: false } +} +/// The node_announcement features of the node at this hop. +#[no_mangle] +pub extern "C" fn TrampolineHop_set_node_features(this_ptr: &mut TrampolineHop, mut val: crate::lightning_types::features::NodeFeatures) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.node_features = *unsafe { Box::from_raw(val.take_inner()) }; +} +/// The fee this hop should use to pay for routing towards the next Trampoline hop, or to the +/// recipient if this is the last Trampoline hop. +/// If this is the last Trampoline hop within [`BlindedTail`], this is the fee paid for the use of +/// the entire blinded path. +#[no_mangle] +pub extern "C" fn TrampolineHop_get_fee_msat(this_ptr: &TrampolineHop) -> u64 { + let mut inner_val = &mut TrampolineHop::get_native_mut_ref(this_ptr).fee_msat; + *inner_val +} +/// The fee this hop should use to pay for routing towards the next Trampoline hop, or to the +/// recipient if this is the last Trampoline hop. +/// If this is the last Trampoline hop within [`BlindedTail`], this is the fee paid for the use of +/// the entire blinded path. +#[no_mangle] +pub extern "C" fn TrampolineHop_set_fee_msat(this_ptr: &mut TrampolineHop, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_msat = val; +} +/// The CLTV delta added for this hop. +/// If this is the last Trampoline hop within [`BlindedTail`], this is the CLTV delta for the entire +/// blinded path. +#[no_mangle] +pub extern "C" fn TrampolineHop_get_cltv_expiry_delta(this_ptr: &TrampolineHop) -> u32 { + let mut inner_val = &mut TrampolineHop::get_native_mut_ref(this_ptr).cltv_expiry_delta; + *inner_val +} +/// The CLTV delta added for this hop. +/// If this is the last Trampoline hop within [`BlindedTail`], this is the CLTV delta for the entire +/// blinded path. +#[no_mangle] +pub extern "C" fn TrampolineHop_set_cltv_expiry_delta(this_ptr: &mut TrampolineHop, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = val; +} +/// Constructs a new TrampolineHop given each field +#[must_use] +#[no_mangle] +pub extern "C" fn TrampolineHop_new(mut pubkey_arg: crate::c_types::PublicKey, mut node_features_arg: crate::lightning_types::features::NodeFeatures, mut fee_msat_arg: u64, mut cltv_expiry_delta_arg: u32) -> TrampolineHop { + TrampolineHop { inner: ObjOps::heap_alloc(nativeTrampolineHop { + pubkey: pubkey_arg.into_rust(), + node_features: *unsafe { Box::from_raw(node_features_arg.take_inner()) }, + fee_msat: fee_msat_arg, + cltv_expiry_delta: cltv_expiry_delta_arg, + }), is_owned: true } +} +impl Clone for TrampolineHop { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeTrampolineHop>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 TrampolineHop_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTrampolineHop) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the TrampolineHop +pub extern "C" fn TrampolineHop_clone(orig: &TrampolineHop) -> TrampolineHop { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a TrampolineHop object +pub extern "C" fn TrampolineHop_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::router::TrampolineHop }).into()} +/// Generates a non-cryptographic 64-bit hash of the TrampolineHop. +#[no_mangle] +pub extern "C" fn TrampolineHop_hash(o: &TrampolineHop) -> 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 TrampolineHops 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 TrampolineHop_eq(a: &TrampolineHop, b: &TrampolineHop) -> 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 TrampolineHop object into a byte array which can be read by TrampolineHop_read +pub extern "C" fn TrampolineHop_write(obj: &crate::lightning::routing::router::TrampolineHop) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn TrampolineHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::router::nativeTrampolineHop) }) +} +#[no_mangle] +/// Read a TrampolineHop from a byte array, created by TrampolineHop_write +pub extern "C" fn TrampolineHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_TrampolineHopDecodeErrorZ { + 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::routing::router::TrampolineHop { 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::routing::router::BlindedTail as nativeBlindedTailImport; pub(crate) type nativeBlindedTail = nativeBlindedTailImport; @@ -781,10 +966,31 @@ impl BlindedTail { Self { inner: self.inner, is_owned: false } } } +/// The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop. +/// +/// Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node, +/// where the [`RouteHop`]'s fee_msat is the fee paid for use of the entire blinded path, including +/// any Trampoline hops. +#[no_mangle] +pub extern "C" fn BlindedTail_get_trampoline_hops(this_ptr: &BlindedTail) -> crate::c_types::derived::CVec_TrampolineHopZ { + let mut inner_val = &mut BlindedTail::get_native_mut_ref(this_ptr).trampoline_hops; + let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::routing::router::TrampolineHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::TrampolineHop<>) as *mut _) }, is_owned: false } }); }; + local_inner_val.into() +} +/// The list of unblinded Trampoline hops. When using Trampoline, must contain at least one hop. +/// +/// Note that the first [`TrampolineHop`] node must also be present as the last [`RouteHop`] node, +/// where the [`RouteHop`]'s fee_msat is the fee paid for use of the entire blinded path, including +/// any Trampoline hops. +#[no_mangle] +pub extern "C" fn BlindedTail_set_trampoline_hops(this_ptr: &mut BlindedTail, mut val: crate::c_types::derived::CVec_TrampolineHopZ) { + 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) }.trampoline_hops = local_val; +} /// The hops of the [`BlindedPaymentPath`] provided by the recipient. #[no_mangle] pub extern "C" fn BlindedTail_get_hops(this_ptr: &BlindedTail) -> crate::c_types::derived::CVec_BlindedHopZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().hops; + let mut inner_val = &mut BlindedTail::get_native_mut_ref(this_ptr).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() } @@ -797,7 +1003,7 @@ pub extern "C" fn BlindedTail_set_hops(this_ptr: &mut BlindedTail, mut val: crat /// The blinding point of the [`BlindedPaymentPath`] provided by the recipient. #[no_mangle] pub extern "C" fn BlindedTail_get_blinding_point(this_ptr: &BlindedTail) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().blinding_point; + let mut inner_val = &mut BlindedTail::get_native_mut_ref(this_ptr).blinding_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The blinding point of the [`BlindedPaymentPath`] provided by the recipient. @@ -809,7 +1015,7 @@ pub extern "C" fn BlindedTail_set_blinding_point(this_ptr: &mut BlindedTail, mut /// inferring the destination. May be 0. #[no_mangle] pub extern "C" fn BlindedTail_get_excess_final_cltv_expiry_delta(this_ptr: &BlindedTail) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().excess_final_cltv_expiry_delta; + let mut inner_val = &mut BlindedTail::get_native_mut_ref(this_ptr).excess_final_cltv_expiry_delta; *inner_val } /// Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from @@ -821,7 +1027,7 @@ pub extern "C" fn BlindedTail_set_excess_final_cltv_expiry_delta(this_ptr: &mut /// The total amount paid on this [`Path`], excluding the fees. #[no_mangle] pub extern "C" fn BlindedTail_get_final_value_msat(this_ptr: &BlindedTail) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().final_value_msat; + let mut inner_val = &mut BlindedTail::get_native_mut_ref(this_ptr).final_value_msat; *inner_val } /// The total amount paid on this [`Path`], excluding the fees. @@ -832,9 +1038,11 @@ pub extern "C" fn BlindedTail_set_final_value_msat(this_ptr: &mut BlindedTail, m /// Constructs a new BlindedTail given each field #[must_use] #[no_mangle] -pub extern "C" fn BlindedTail_new(mut hops_arg: crate::c_types::derived::CVec_BlindedHopZ, mut blinding_point_arg: crate::c_types::PublicKey, mut excess_final_cltv_expiry_delta_arg: u32, mut final_value_msat_arg: u64) -> BlindedTail { +pub extern "C" fn BlindedTail_new(mut trampoline_hops_arg: crate::c_types::derived::CVec_TrampolineHopZ, mut hops_arg: crate::c_types::derived::CVec_BlindedHopZ, mut blinding_point_arg: crate::c_types::PublicKey, mut excess_final_cltv_expiry_delta_arg: u32, mut final_value_msat_arg: u64) -> BlindedTail { + let mut local_trampoline_hops_arg = Vec::new(); for mut item in trampoline_hops_arg.into_rust().drain(..) { local_trampoline_hops_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; let mut local_hops_arg = Vec::new(); for mut item in hops_arg.into_rust().drain(..) { local_hops_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; BlindedTail { inner: ObjOps::heap_alloc(nativeBlindedTail { + trampoline_hops: local_trampoline_hops_arg, hops: local_hops_arg, blinding_point: blinding_point_arg.into_rust(), excess_final_cltv_expiry_delta: excess_final_cltv_expiry_delta_arg, @@ -845,7 +1053,7 @@ impl Clone for BlindedTail { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedTail>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -853,12 +1061,12 @@ impl Clone for BlindedTail { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedTail_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedTail)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedTail) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedTail pub extern "C" fn BlindedTail_clone(orig: &BlindedTail) -> BlindedTail { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedTail object pub extern "C" fn BlindedTail_debug_str_void(o: *const c_void) -> Str { @@ -962,7 +1170,7 @@ impl Path { /// The list of unblinded hops in this [`Path`]. Must be at least length one. #[no_mangle] pub extern "C" fn Path_get_hops(this_ptr: &Path) -> crate::c_types::derived::CVec_RouteHopZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().hops; + let mut inner_val = &mut Path::get_native_mut_ref(this_ptr).hops; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -977,7 +1185,7 @@ pub extern "C" fn Path_set_hops(this_ptr: &mut Path, mut val: crate::c_types::de /// 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 Path_get_blinded_tail(this_ptr: &Path) -> crate::lightning::routing::router::BlindedTail { - let mut inner_val = &mut this_ptr.get_native_mut_ref().blinded_tail; + let mut inner_val = &mut Path::get_native_mut_ref(this_ptr).blinded_tail; let mut local_inner_val = crate::lightning::routing::router::BlindedTail { 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::BlindedTail<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -1006,7 +1214,7 @@ impl Clone for Path { fn clone(&self) -> Self { Self { inner: if <*mut nativePath>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1014,12 +1222,12 @@ impl Clone for Path { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Path_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePath)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePath) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Path pub extern "C" fn Path_clone(orig: &Path) -> Path { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Path object pub extern "C" fn Path_debug_str_void(o: *const c_void) -> Str { @@ -1068,6 +1276,14 @@ pub extern "C" fn Path_final_cltv_expiry_delta(this_arg: &crate::lightning::rout local_ret } +/// True if this [`Path`] has at least one Trampoline hop. +#[must_use] +#[no_mangle] +pub extern "C" fn Path_has_trampoline_hops(this_arg: &crate::lightning::routing::router::Path) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.has_trampoline_hops(); + ret +} + use lightning::routing::router::Route as nativeRouteImport; pub(crate) type nativeRoute = nativeRouteImport; @@ -1134,7 +1350,7 @@ impl Route { /// the same. #[no_mangle] pub extern "C" fn Route_get_paths(this_ptr: &Route) -> crate::c_types::derived::CVec_PathZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().paths; + let mut inner_val = &mut Route::get_native_mut_ref(this_ptr).paths; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning::routing::router::Path { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning::routing::router::Path<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -1155,7 +1371,7 @@ pub extern "C" fn Route_set_paths(this_ptr: &mut Route, mut val: crate::c_types: /// 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_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 inner_val = &mut Route::get_native_mut_ref(this_ptr).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 } @@ -1188,7 +1404,7 @@ impl Clone for Route { fn clone(&self) -> Self { Self { inner: if <*mut nativeRoute>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1196,12 +1412,12 @@ impl Clone for Route { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Route_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRoute)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRoute) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Route pub extern "C" fn Route_clone(orig: &Route) -> Route { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Route object pub extern "C" fn Route_debug_str_void(o: *const c_void) -> Str { @@ -1338,7 +1554,7 @@ impl RouteParameters { /// The parameters of the failed payment path. #[no_mangle] pub extern "C" fn RouteParameters_get_payment_params(this_ptr: &RouteParameters) -> crate::lightning::routing::router::PaymentParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_params; + let mut inner_val = &mut RouteParameters::get_native_mut_ref(this_ptr).payment_params; crate::lightning::routing::router::PaymentParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::routing::router::PaymentParameters<>) as *mut _) }, is_owned: false } } /// The parameters of the failed payment path. @@ -1349,7 +1565,7 @@ pub extern "C" fn RouteParameters_set_payment_params(this_ptr: &mut RouteParamet /// The amount in msats sent on the failed payment path. #[no_mangle] pub extern "C" fn RouteParameters_get_final_value_msat(this_ptr: &RouteParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().final_value_msat; + let mut inner_val = &mut RouteParameters::get_native_mut_ref(this_ptr).final_value_msat; *inner_val } /// The amount in msats sent on the failed payment path. @@ -1365,7 +1581,7 @@ pub extern "C" fn RouteParameters_set_final_value_msat(this_ptr: &mut RouteParam /// 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 inner_val = &mut RouteParameters::get_native_mut_ref(this_ptr).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 } @@ -1395,7 +1611,7 @@ impl Clone for RouteParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeRouteParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1403,12 +1619,12 @@ impl Clone for RouteParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRouteParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RouteParameters pub extern "C" fn RouteParameters_clone(orig: &RouteParameters) -> RouteParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RouteParameters object pub extern "C" fn RouteParameters_debug_str_void(o: *const c_void) -> Str { @@ -1544,7 +1760,7 @@ impl PaymentParameters { /// Information about the payee, such as their features and route hints for their channels. #[no_mangle] pub extern "C" fn PaymentParameters_get_payee(this_ptr: &PaymentParameters) -> crate::lightning::routing::router::Payee { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payee; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).payee; crate::lightning::routing::router::Payee::from_native(inner_val) } /// Information about the payee, such as their features and route hints for their channels. @@ -1555,7 +1771,7 @@ pub extern "C" fn PaymentParameters_set_payee(this_ptr: &mut PaymentParameters, /// Expiration of a payment to the payee, in seconds relative to the UNIX epoch. #[no_mangle] pub extern "C" fn PaymentParameters_get_expiry_time(this_ptr: &PaymentParameters) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().expiry_time; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).expiry_time; 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 } @@ -1569,7 +1785,7 @@ pub extern "C" fn PaymentParameters_set_expiry_time(this_ptr: &mut PaymentParame /// Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. #[no_mangle] pub extern "C" fn PaymentParameters_get_max_total_cltv_expiry_delta(this_ptr: &PaymentParameters) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_total_cltv_expiry_delta; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).max_total_cltv_expiry_delta; *inner_val } /// The maximum total CLTV delta we accept for the route. @@ -1582,7 +1798,7 @@ pub extern "C" fn PaymentParameters_set_max_total_cltv_expiry_delta(this_ptr: &m /// Defaults to [`DEFAULT_MAX_PATH_COUNT`]. #[no_mangle] pub extern "C" fn PaymentParameters_get_max_path_count(this_ptr: &PaymentParameters) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_path_count; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).max_path_count; *inner_val } /// The maximum number of paths that may be used by (MPP) payments. @@ -1595,7 +1811,7 @@ pub extern "C" fn PaymentParameters_set_max_path_count(this_ptr: &mut PaymentPar /// Defaults to [`MAX_PATH_LENGTH_ESTIMATE`]. #[no_mangle] pub extern "C" fn PaymentParameters_get_max_path_length(this_ptr: &PaymentParameters) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_path_length; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).max_path_length; *inner_val } /// The maximum number of [`Path::hops`] in any returned path. @@ -1619,7 +1835,7 @@ pub extern "C" fn PaymentParameters_set_max_path_length(this_ptr: &mut PaymentPa /// Default value: 2 #[no_mangle] pub extern "C" fn PaymentParameters_get_max_channel_saturation_power_of_half(this_ptr: &PaymentParameters) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_saturation_power_of_half; + let mut inner_val = &mut PaymentParameters::get_native_mut_ref(this_ptr).max_channel_saturation_power_of_half; *inner_val } /// Selects the maximum share of a channel's total capacity which will be sent over a channel, @@ -1646,7 +1862,7 @@ pub extern "C" fn PaymentParameters_set_max_channel_saturation_power_of_half(thi /// Returns a copy of the field. #[no_mangle] pub extern "C" fn PaymentParameters_get_previously_failed_channels(this_ptr: &PaymentParameters) -> crate::c_types::derived::CVec_u64Z { - let mut inner_val = this_ptr.get_native_mut_ref().previously_failed_channels.clone(); + let mut inner_val = PaymentParameters::get_native_mut_ref(this_ptr).previously_failed_channels.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; local_inner_val.into() } @@ -1665,7 +1881,7 @@ pub extern "C" fn PaymentParameters_set_previously_failed_channels(this_ptr: &mu /// Returns a copy of the field. #[no_mangle] pub extern "C" fn PaymentParameters_get_previously_failed_blinded_path_idxs(this_ptr: &PaymentParameters) -> crate::c_types::derived::CVec_u64Z { - let mut inner_val = this_ptr.get_native_mut_ref().previously_failed_blinded_path_idxs.clone(); + let mut inner_val = PaymentParameters::get_native_mut_ref(this_ptr).previously_failed_blinded_path_idxs.clone(); let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; local_inner_val.into() } @@ -1699,7 +1915,7 @@ impl Clone for PaymentParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativePaymentParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1707,12 +1923,12 @@ impl Clone for PaymentParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PaymentParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePaymentParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePaymentParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PaymentParameters pub extern "C" fn PaymentParameters_clone(orig: &PaymentParameters) -> PaymentParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PaymentParameters object pub extern "C" fn PaymentParameters_debug_str_void(o: *const c_void) -> Str { @@ -1782,6 +1998,16 @@ pub extern "C" fn PaymentParameters_for_keysend(mut payee_pubkey: crate::c_types crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Creates parameters for paying to a blinded payee from the provided invoice. Sets +/// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and +/// [`PaymentParameters::expiry_time`]. +#[must_use] +#[no_mangle] +pub extern "C" fn PaymentParameters_from_bolt11_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice) -> crate::lightning::routing::router::PaymentParameters { + let mut ret = lightning::routing::router::PaymentParameters::from_bolt11_invoice(invoice.get_native_ref()); + crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// Creates parameters for paying to a blinded payee from the provided invoice. Sets /// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and /// [`PaymentParameters::expiry_time`]. @@ -1792,6 +2018,16 @@ 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 invoice. Sets +/// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and +/// [`PaymentParameters::expiry_time`]. +#[must_use] +#[no_mangle] +pub extern "C" fn PaymentParameters_from_static_invoice(invoice: &crate::lightning::offers::static_invoice::StaticInvoice) -> crate::lightning::routing::router::PaymentParameters { + let mut ret = lightning::routing::router::PaymentParameters::from_static_invoice(invoice.get_native_ref()); + 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] @@ -1801,6 +2037,210 @@ pub extern "C" fn PaymentParameters_blinded(mut blinded_route_hints: crate::c_ty crate::lightning::routing::router::PaymentParameters { inner: ObjOps::heap_alloc(ret), is_owned: true } } + +use lightning::routing::router::RouteParametersConfig as nativeRouteParametersConfigImport; +pub(crate) type nativeRouteParametersConfig = nativeRouteParametersConfigImport; + +/// A struct for configuring parameters for routing the payment. +#[must_use] +#[repr(C)] +pub struct RouteParametersConfig { + /// 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 nativeRouteParametersConfig, + /// 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 core::ops::Deref for RouteParametersConfig { + type Target = nativeRouteParametersConfig; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for RouteParametersConfig { } +unsafe impl core::marker::Sync for RouteParametersConfig { } +impl Drop for RouteParametersConfig { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeRouteParametersConfig>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the RouteParametersConfig, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn RouteParametersConfig_free(this_obj: RouteParametersConfig) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn RouteParametersConfig_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRouteParametersConfig) }; +} +#[allow(unused)] +impl RouteParametersConfig { + pub(crate) fn get_native_ref(&self) -> &'static nativeRouteParametersConfig { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRouteParametersConfig { + 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 nativeRouteParametersConfig { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// 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. +/// +/// Defaults to 1% of the payment amount + 50 sats +#[no_mangle] +pub extern "C" fn RouteParametersConfig_get_max_total_routing_fee_msat(this_ptr: &RouteParametersConfig) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut RouteParametersConfig::get_native_mut_ref(this_ptr).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. +/// +/// Defaults to 1% of the payment amount + 50 sats +#[no_mangle] +pub extern "C" fn RouteParametersConfig_set_max_total_routing_fee_msat(this_ptr: &mut RouteParametersConfig, 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; +} +/// The maximum total CLTV delta we accept for the route. +/// Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. +#[no_mangle] +pub extern "C" fn RouteParametersConfig_get_max_total_cltv_expiry_delta(this_ptr: &RouteParametersConfig) -> u32 { + let mut inner_val = &mut RouteParametersConfig::get_native_mut_ref(this_ptr).max_total_cltv_expiry_delta; + *inner_val +} +/// The maximum total CLTV delta we accept for the route. +/// Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. +#[no_mangle] +pub extern "C" fn RouteParametersConfig_set_max_total_cltv_expiry_delta(this_ptr: &mut RouteParametersConfig, mut val: u32) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_total_cltv_expiry_delta = val; +} +/// The maximum number of paths that may be used by (MPP) payments. +/// Defaults to [`DEFAULT_MAX_PATH_COUNT`]. +#[no_mangle] +pub extern "C" fn RouteParametersConfig_get_max_path_count(this_ptr: &RouteParametersConfig) -> u8 { + let mut inner_val = &mut RouteParametersConfig::get_native_mut_ref(this_ptr).max_path_count; + *inner_val +} +/// The maximum number of paths that may be used by (MPP) payments. +/// Defaults to [`DEFAULT_MAX_PATH_COUNT`]. +#[no_mangle] +pub extern "C" fn RouteParametersConfig_set_max_path_count(this_ptr: &mut RouteParametersConfig, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_path_count = val; +} +/// Selects the maximum share of a channel's total capacity which will be sent over a channel, +/// as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas +/// a lower value prefers to send larger MPP parts, potentially saturating channels and +/// increasing failure probability for those paths. +/// +/// Note that this restriction will be relaxed during pathfinding after paths which meet this +/// restriction have been found. While paths which meet this criteria will be searched for, it +/// is ultimately up to the scorer to select them over other paths. +/// +/// A value of 0 will allow payments up to and including a channel's total announced usable +/// capacity, a value of one will only use up to half its capacity, two 1/4, etc. +/// +/// Default value: 2 +#[no_mangle] +pub extern "C" fn RouteParametersConfig_get_max_channel_saturation_power_of_half(this_ptr: &RouteParametersConfig) -> u8 { + let mut inner_val = &mut RouteParametersConfig::get_native_mut_ref(this_ptr).max_channel_saturation_power_of_half; + *inner_val +} +/// Selects the maximum share of a channel's total capacity which will be sent over a channel, +/// as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas +/// a lower value prefers to send larger MPP parts, potentially saturating channels and +/// increasing failure probability for those paths. +/// +/// Note that this restriction will be relaxed during pathfinding after paths which meet this +/// restriction have been found. While paths which meet this criteria will be searched for, it +/// is ultimately up to the scorer to select them over other paths. +/// +/// A value of 0 will allow payments up to and including a channel's total announced usable +/// capacity, a value of one will only use up to half its capacity, two 1/4, etc. +/// +/// Default value: 2 +#[no_mangle] +pub extern "C" fn RouteParametersConfig_set_max_channel_saturation_power_of_half(this_ptr: &mut RouteParametersConfig, mut val: u8) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_channel_saturation_power_of_half = val; +} +/// Constructs a new RouteParametersConfig given each field +#[must_use] +#[no_mangle] +pub extern "C" fn RouteParametersConfig_new(mut max_total_routing_fee_msat_arg: crate::c_types::derived::COption_u64Z, mut max_total_cltv_expiry_delta_arg: u32, mut max_path_count_arg: u8, mut max_channel_saturation_power_of_half_arg: u8) -> RouteParametersConfig { + 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 }; + RouteParametersConfig { inner: ObjOps::heap_alloc(nativeRouteParametersConfig { + max_total_routing_fee_msat: local_max_total_routing_fee_msat_arg, + max_total_cltv_expiry_delta: max_total_cltv_expiry_delta_arg, + max_path_count: max_path_count_arg, + max_channel_saturation_power_of_half: max_channel_saturation_power_of_half_arg, + }), is_owned: true } +} +impl Clone for RouteParametersConfig { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeRouteParametersConfig>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 RouteParametersConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRouteParametersConfig) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the RouteParametersConfig +pub extern "C" fn RouteParametersConfig_clone(orig: &RouteParametersConfig) -> RouteParametersConfig { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a RouteParametersConfig object +pub extern "C" fn RouteParametersConfig_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::router::RouteParametersConfig }).into()} +#[no_mangle] +/// Serialize the RouteParametersConfig object into a byte array which can be read by RouteParametersConfig_read +pub extern "C" fn RouteParametersConfig_write(obj: &crate::lightning::routing::router::RouteParametersConfig) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn RouteParametersConfig_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::router::nativeRouteParametersConfig) }) +} +#[no_mangle] +/// Read a RouteParametersConfig from a byte array, created by RouteParametersConfig_write +pub extern "C" fn RouteParametersConfig_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RouteParametersConfigDecodeErrorZ { + 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::routing::router::RouteParametersConfig { 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 +} +/// Creates a "default" RouteParametersConfig. See struct and individual field documentaiton for details on which values are used. +#[must_use] +#[no_mangle] +pub extern "C" fn RouteParametersConfig_default() -> RouteParametersConfig { + RouteParametersConfig { inner: ObjOps::heap_alloc(Default::default()), is_owned: true } +} /// The recipient of a payment, differing based on whether they've hidden their identity with route /// blinding. #[derive(Clone)] @@ -2100,7 +2540,7 @@ impl Clone for FirstHopCandidate { fn clone(&self) -> Self { Self { inner: if <*mut nativeFirstHopCandidate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2108,12 +2548,12 @@ impl Clone for FirstHopCandidate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FirstHopCandidate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFirstHopCandidate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFirstHopCandidate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the FirstHopCandidate pub extern "C" fn FirstHopCandidate_clone(orig: &FirstHopCandidate) -> FirstHopCandidate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a FirstHopCandidate object pub extern "C" fn FirstHopCandidate_debug_str_void(o: *const c_void) -> Str { @@ -2182,7 +2622,7 @@ impl PublicHopCandidate { /// channel. #[no_mangle] pub extern "C" fn PublicHopCandidate_get_short_channel_id(this_ptr: &PublicHopCandidate) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + let mut inner_val = &mut PublicHopCandidate::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } /// The short channel ID of the channel, i.e. the identifier by which we refer to this @@ -2195,7 +2635,7 @@ impl Clone for PublicHopCandidate { fn clone(&self) -> Self { Self { inner: if <*mut nativePublicHopCandidate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2203,12 +2643,12 @@ impl Clone for PublicHopCandidate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PublicHopCandidate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePublicHopCandidate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePublicHopCandidate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PublicHopCandidate pub extern "C" fn PublicHopCandidate_clone(orig: &PublicHopCandidate) -> PublicHopCandidate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PublicHopCandidate object pub extern "C" fn PublicHopCandidate_debug_str_void(o: *const c_void) -> Str { @@ -2277,7 +2717,7 @@ impl Clone for PrivateHopCandidate { fn clone(&self) -> Self { Self { inner: if <*mut nativePrivateHopCandidate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2285,12 +2725,12 @@ impl Clone for PrivateHopCandidate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PrivateHopCandidate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePrivateHopCandidate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePrivateHopCandidate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PrivateHopCandidate pub extern "C" fn PrivateHopCandidate_clone(orig: &PrivateHopCandidate) -> PrivateHopCandidate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PrivateHopCandidate object pub extern "C" fn PrivateHopCandidate_debug_str_void(o: *const c_void) -> Str { @@ -2359,7 +2799,7 @@ impl Clone for BlindedPathCandidate { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedPathCandidate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2367,12 +2807,12 @@ impl Clone for BlindedPathCandidate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedPathCandidate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedPathCandidate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedPathCandidate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedPathCandidate pub extern "C" fn BlindedPathCandidate_clone(orig: &BlindedPathCandidate) -> BlindedPathCandidate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BlindedPathCandidate object pub extern "C" fn BlindedPathCandidate_debug_str_void(o: *const c_void) -> Str { @@ -2441,7 +2881,7 @@ impl Clone for OneHopBlindedPathCandidate { fn clone(&self) -> Self { Self { inner: if <*mut nativeOneHopBlindedPathCandidate>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2449,12 +2889,12 @@ impl Clone for OneHopBlindedPathCandidate { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OneHopBlindedPathCandidate_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOneHopBlindedPathCandidate)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOneHopBlindedPathCandidate) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OneHopBlindedPathCandidate pub extern "C" fn OneHopBlindedPathCandidate_clone(orig: &OneHopBlindedPathCandidate) -> OneHopBlindedPathCandidate { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a OneHopBlindedPathCandidate object pub extern "C" fn OneHopBlindedPathCandidate_debug_str_void(o: *const c_void) -> Str { @@ -2787,10 +3227,10 @@ pub extern "C" fn CandidateRouteHop_target(this_arg: &crate::lightning::routing: /// /// 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::ScoreLookUp, 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_RouteStrZ { 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 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() }; + 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( { e.into() }).into() }; local_ret } @@ -2799,10 +3239,10 @@ pub extern "C" fn find_route(mut our_node_pubkey: crate::c_types::PublicKey, rou /// /// Re-uses logic from `find_route`, so the restrictions described there also apply here. #[no_mangle] -pub extern "C" fn build_route_from_hops(mut our_node_pubkey: crate::c_types::PublicKey, mut hops: crate::c_types::derived::CVec_PublicKeyZ, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteLightningErrorZ { +pub extern "C" fn build_route_from_hops(mut our_node_pubkey: crate::c_types::PublicKey, mut hops: crate::c_types::derived::CVec_PublicKeyZ, route_params: &crate::lightning::routing::router::RouteParameters, network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, random_seed_bytes: *const [u8; 32]) -> crate::c_types::derived::CResult_RouteStrZ { let mut local_hops = Vec::new(); for mut item in hops.into_rust().drain(..) { local_hops.push( { item.into_rust() }); }; let mut ret = lightning::routing::router::build_route_from_hops::(&our_node_pubkey.into_rust(), &local_hops[..], route_params.get_native_ref(), network_graph.get_native_ref(), logger, 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() }; + 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( { e.into() }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/routing/scoring.rs b/lightning-c-bindings/src/lightning/routing/scoring.rs index b1051342..9ab47d68 100644 --- a/lightning-c-bindings/src/lightning/routing/scoring.rs +++ b/lightning-c-bindings/src/lightning/routing/scoring.rs @@ -940,7 +940,7 @@ impl ChannelUsage { /// The amount to send through the channel, denominated in millisatoshis. #[no_mangle] pub extern "C" fn ChannelUsage_get_amount_msat(this_ptr: &ChannelUsage) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msat; + let mut inner_val = &mut ChannelUsage::get_native_mut_ref(this_ptr).amount_msat; *inner_val } /// The amount to send through the channel, denominated in millisatoshis. @@ -952,7 +952,7 @@ pub extern "C" fn ChannelUsage_set_amount_msat(this_ptr: &mut ChannelUsage, mut /// as part of a multi-path payment. #[no_mangle] pub extern "C" fn ChannelUsage_get_inflight_htlc_msat(this_ptr: &ChannelUsage) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().inflight_htlc_msat; + let mut inner_val = &mut ChannelUsage::get_native_mut_ref(this_ptr).inflight_htlc_msat; *inner_val } /// Total amount, denominated in millisatoshis, already allocated to send through the channel @@ -964,7 +964,7 @@ pub extern "C" fn ChannelUsage_set_inflight_htlc_msat(this_ptr: &mut ChannelUsag /// The effective capacity of the channel. #[no_mangle] pub extern "C" fn ChannelUsage_get_effective_capacity(this_ptr: &ChannelUsage) -> crate::lightning::routing::gossip::EffectiveCapacity { - let mut inner_val = &mut this_ptr.get_native_mut_ref().effective_capacity; + let mut inner_val = &mut ChannelUsage::get_native_mut_ref(this_ptr).effective_capacity; crate::lightning::routing::gossip::EffectiveCapacity::from_native(inner_val) } /// The effective capacity of the channel. @@ -986,7 +986,7 @@ impl Clone for ChannelUsage { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelUsage>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -994,12 +994,12 @@ impl Clone for ChannelUsage { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelUsage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelUsage)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelUsage) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelUsage pub extern "C" fn ChannelUsage_clone(orig: &ChannelUsage) -> ChannelUsage { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelUsage object pub extern "C" fn ChannelUsage_debug_str_void(o: *const c_void) -> Str { @@ -1068,7 +1068,7 @@ impl Clone for FixedPenaltyScorer { fn clone(&self) -> Self { Self { inner: if <*mut nativeFixedPenaltyScorer>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1076,12 +1076,12 @@ impl Clone for FixedPenaltyScorer { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FixedPenaltyScorer_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeFixedPenaltyScorer)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFixedPenaltyScorer) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the FixedPenaltyScorer pub extern "C" fn FixedPenaltyScorer_clone(orig: &FixedPenaltyScorer) -> FixedPenaltyScorer { - orig.clone() + Clone::clone(orig) } /// Creates a new scorer using `penalty_msat`. #[must_use] @@ -1267,6 +1267,101 @@ impl ProbabilisticScorer { } } +use lightning::routing::scoring::ChannelLiquidities as nativeChannelLiquiditiesImport; +pub(crate) type nativeChannelLiquidities = nativeChannelLiquiditiesImport; + +/// Container for live and historical liquidity bounds for each channel. +#[must_use] +#[repr(C)] +pub struct ChannelLiquidities { + /// 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 nativeChannelLiquidities, + /// 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 core::ops::Deref for ChannelLiquidities { + type Target = nativeChannelLiquidities; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ChannelLiquidities { } +unsafe impl core::marker::Sync for ChannelLiquidities { } +impl Drop for ChannelLiquidities { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelLiquidities>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelLiquidities, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelLiquidities_free(this_obj: ChannelLiquidities) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelLiquidities_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelLiquidities) }; +} +#[allow(unused)] +impl ChannelLiquidities { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelLiquidities { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelLiquidities { + 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 nativeChannelLiquidities { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for ChannelLiquidities { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelLiquidities>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ChannelLiquidities_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelLiquidities) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelLiquidities +pub extern "C" fn ChannelLiquidities_clone(orig: &ChannelLiquidities) -> ChannelLiquidities { + Clone::clone(orig) +} +#[no_mangle] +/// Read a ChannelLiquidities from a byte array, created by ChannelLiquidities_write +pub extern "C" fn ChannelLiquidities_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelLiquiditiesDecodeErrorZ { + 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::routing::scoring::ChannelLiquidities { 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 ChannelLiquidities object into a byte array which can be read by ChannelLiquidities_read +pub extern "C" fn ChannelLiquidities_write(obj: &crate::lightning::routing::scoring::ChannelLiquidities) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelLiquidities_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeChannelLiquidities) }) +} + use lightning::routing::scoring::ProbabilisticScoringFeeParameters as nativeProbabilisticScoringFeeParametersImport; pub(crate) type nativeProbabilisticScoringFeeParameters = nativeProbabilisticScoringFeeParametersImport; @@ -1343,7 +1438,7 @@ impl ProbabilisticScoringFeeParameters { /// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).base_penalty_msat; *inner_val } /// A fixed penalty in msats to apply to each channel. @@ -1380,7 +1475,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_msat(this_p /// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_amount_multiplier_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).base_penalty_amount_multiplier_msat; *inner_val } /// A multiplier used with the payment amount to calculate a fixed penalty applied to each @@ -1429,7 +1524,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_amount_mult /// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_multiplier_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).liquidity_penalty_multiplier_msat; *inner_val } /// A multiplier used in conjunction with the negative `log10` of the channel's success @@ -1483,7 +1578,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_multip /// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_amount_multiplier_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).liquidity_penalty_amount_multiplier_msat; *inner_val } /// A multiplier used in conjunction with the payment amount and the negative `log10` of the @@ -1531,7 +1626,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount /// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_multiplier_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).historical_liquidity_penalty_multiplier_msat; *inner_val } /// A multiplier used in conjunction with the negative `log10` of the channel's success @@ -1576,7 +1671,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_pen /// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_amount_multiplier_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).historical_liquidity_penalty_amount_multiplier_msat; *inner_val } /// A multiplier used in conjunction with the payment amount and the negative `log10` of the @@ -1613,7 +1708,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_pen /// Default value: 250 msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_anti_probing_penalty_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().anti_probing_penalty_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).anti_probing_penalty_msat; *inner_val } /// This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the @@ -1647,7 +1742,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_anti_probing_penalty_msa /// [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_considered_impossible_penalty_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().considered_impossible_penalty_msat; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).considered_impossible_penalty_msat; *inner_val } /// This penalty is applied when the total amount flowing over a channel exceeds our current @@ -1694,7 +1789,7 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_considered_impossible_pe /// 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; + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).linear_success_probability; *inner_val } /// In order to calculate most of the scores above, we must first convert a lower and upper @@ -1721,11 +1816,62 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_linear_success_probabili 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; } +/// In order to ensure we have knowledge for as many paths as possible, when probing it makes +/// sense to bias away from channels for which we have very recent data. +/// +/// This value is a penalty that is applied based on the last time that we updated the bounds +/// on the available liquidity in a channel. The specified value is the maximum penalty that +/// will be applied. +/// +/// It obviously does not make sense to assign a non-0 value here unless you are using the +/// pathfinding result for background probing. +/// +/// Specifically, the following penalty is applied +/// `probing_diversity_penalty_msat * max(0, (86400 - current time + last update))^2 / 86400^2` is +/// +/// As this is a maximum value, when setting this you should consider it in relation to the +/// other values set to ensure that, at maximum, we strongly avoid paths which we recently +/// tried (similar to if they have a low success probability). For example, you might set this +/// to be the sum of [`Self::base_penalty_msat`] and +/// [`Self::historical_liquidity_penalty_multiplier_msat`] (plus some multiple of their +/// corresponding `amount_multiplier`s). +/// +/// Default value: 0 +#[no_mangle] +pub extern "C" fn ProbabilisticScoringFeeParameters_get_probing_diversity_penalty_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { + let mut inner_val = &mut ProbabilisticScoringFeeParameters::get_native_mut_ref(this_ptr).probing_diversity_penalty_msat; + *inner_val +} +/// In order to ensure we have knowledge for as many paths as possible, when probing it makes +/// sense to bias away from channels for which we have very recent data. +/// +/// This value is a penalty that is applied based on the last time that we updated the bounds +/// on the available liquidity in a channel. The specified value is the maximum penalty that +/// will be applied. +/// +/// It obviously does not make sense to assign a non-0 value here unless you are using the +/// pathfinding result for background probing. +/// +/// Specifically, the following penalty is applied +/// `probing_diversity_penalty_msat * max(0, (86400 - current time + last update))^2 / 86400^2` is +/// +/// As this is a maximum value, when setting this you should consider it in relation to the +/// other values set to ensure that, at maximum, we strongly avoid paths which we recently +/// tried (similar to if they have a low success probability). For example, you might set this +/// to be the sum of [`Self::base_penalty_msat`] and +/// [`Self::historical_liquidity_penalty_multiplier_msat`] (plus some multiple of their +/// corresponding `amount_multiplier`s). +/// +/// Default value: 0 +#[no_mangle] +pub extern "C" fn ProbabilisticScoringFeeParameters_set_probing_diversity_penalty_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.probing_diversity_penalty_msat = val; +} impl Clone for ProbabilisticScoringFeeParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeProbabilisticScoringFeeParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1733,13 +1879,16 @@ impl Clone for ProbabilisticScoringFeeParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ProbabilisticScoringFeeParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeProbabilisticScoringFeeParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeProbabilisticScoringFeeParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ProbabilisticScoringFeeParameters pub extern "C" fn ProbabilisticScoringFeeParameters_clone(orig: &ProbabilisticScoringFeeParameters) -> ProbabilisticScoringFeeParameters { - orig.clone() + Clone::clone(orig) } +/// Get a string which allows debug introspection of a ProbabilisticScoringFeeParameters object +pub extern "C" fn ProbabilisticScoringFeeParameters_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters }).into()} /// Creates a "default" ProbabilisticScoringFeeParameters. See struct and individual field documentaiton for details on which values are used. #[must_use] #[no_mangle] @@ -1862,7 +2011,7 @@ impl ProbabilisticScoringDecayParameters { /// [`historical_estimated_channel_liquidity_probabilities`]: ProbabilisticScorer::historical_estimated_channel_liquidity_probabilities #[no_mangle] pub extern "C" fn ProbabilisticScoringDecayParameters_get_historical_no_updates_half_life(this_ptr: &ProbabilisticScoringDecayParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_no_updates_half_life; + let mut inner_val = &mut ProbabilisticScoringDecayParameters::get_native_mut_ref(this_ptr).historical_no_updates_half_life; inner_val.as_secs() } /// If we aren't learning any new datapoints for a channel, the historical liquidity bounds @@ -1901,7 +2050,7 @@ pub extern "C" fn ProbabilisticScoringDecayParameters_set_historical_no_updates_ /// liquidity knowledge will never decay except when the bounds cross. #[no_mangle] pub extern "C" fn ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(this_ptr: &ProbabilisticScoringDecayParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_offset_half_life; + let mut inner_val = &mut ProbabilisticScoringDecayParameters::get_native_mut_ref(this_ptr).liquidity_offset_half_life; inner_val.as_secs() } /// Whenever this amount of time elapses since the last update to a channel's liquidity bounds, @@ -1940,7 +2089,7 @@ impl Clone for ProbabilisticScoringDecayParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeProbabilisticScoringDecayParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1948,13 +2097,16 @@ impl Clone for ProbabilisticScoringDecayParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ProbabilisticScoringDecayParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeProbabilisticScoringDecayParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeProbabilisticScoringDecayParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ProbabilisticScoringDecayParameters pub extern "C" fn ProbabilisticScoringDecayParameters_clone(orig: &ProbabilisticScoringDecayParameters) -> ProbabilisticScoringDecayParameters { - orig.clone() + Clone::clone(orig) } +/// Get a string which allows debug introspection of a ProbabilisticScoringDecayParameters object +pub extern "C" fn ProbabilisticScoringDecayParameters_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::routing::scoring::ProbabilisticScoringDecayParameters }).into()} /// Creates a "default" ProbabilisticScoringDecayParameters. See struct and individual field documentaiton for details on which values are used. #[must_use] #[no_mangle] @@ -2057,6 +2209,20 @@ pub extern "C" fn ProbabilisticScorer_live_estimated_payment_success_probability local_ret } +/// Overwrite the scorer state with the given external scores. +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_set_scores(this_arg: &mut crate::lightning::routing::scoring::ProbabilisticScorer, mut external_scores: crate::lightning::routing::scoring::ChannelLiquidities) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::scoring::nativeProbabilisticScorer)) }.set_scores(*unsafe { Box::from_raw(external_scores.take_inner()) }) +} + +/// Returns the current scores. +#[must_use] +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_scores(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer) -> crate::lightning::routing::scoring::ChannelLiquidities { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.scores(); + crate::lightning::routing::scoring::ChannelLiquidities { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::scoring::ChannelLiquidities<>) as *mut _) }, is_owned: false } +} + impl From for crate::lightning::routing::scoring::ScoreLookUp { fn from(obj: nativeProbabilisticScorer) -> Self { let rust_obj = crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -2125,6 +2291,173 @@ extern "C" fn ProbabilisticScorer_ScoreUpdate_time_passed(this_arg: *mut c_void, ::time_passed(unsafe { &mut *(this_arg as *mut nativeProbabilisticScorer) }, core::time::Duration::from_secs(duration_since_epoch)) } + +use lightning::routing::scoring::CombinedScorer as nativeCombinedScorerImport; +pub(crate) type nativeCombinedScorer = nativeCombinedScorerImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger, >; + +/// A probabilistic scorer that combines local and external information to score channels. This scorer is +/// shadow-tracking local only scores, so that it becomes possible to cleanly merge external scores when they become +/// available. +/// +/// This is useful for nodes that have a limited local view of the network and need to augment their view with scores +/// from an external source to improve payment reliability. The external source may use something like background +/// probing to gather a more complete view of the network. Merging reduces the likelihood of losing unique local data on +/// particular channels. +/// +/// Note that only the locally acquired data is persisted. After a restart, the external scores will be lost and must be +/// resupplied. +#[must_use] +#[repr(C)] +pub struct CombinedScorer { + /// 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 nativeCombinedScorer, + /// 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 core::ops::Deref for CombinedScorer { + type Target = nativeCombinedScorer; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for CombinedScorer { } +unsafe impl core::marker::Sync for CombinedScorer { } +impl Drop for CombinedScorer { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCombinedScorer>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CombinedScorer, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CombinedScorer_free(this_obj: CombinedScorer) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CombinedScorer_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCombinedScorer) }; +} +#[allow(unused)] +impl CombinedScorer { + pub(crate) fn get_native_ref(&self) -> &'static nativeCombinedScorer { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCombinedScorer { + 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 nativeCombinedScorer { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Create a new combined scorer with the given local scorer. +#[must_use] +#[no_mangle] +pub extern "C" fn CombinedScorer_new(mut local_scorer: crate::lightning::routing::scoring::ProbabilisticScorer) -> crate::lightning::routing::scoring::CombinedScorer { + let mut ret = lightning::routing::scoring::CombinedScorer::new(*unsafe { Box::from_raw(local_scorer.take_inner()) }); + crate::lightning::routing::scoring::CombinedScorer { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Merge external channel liquidity information into the scorer. +#[no_mangle] +pub extern "C" fn CombinedScorer_merge(this_arg: &mut crate::lightning::routing::scoring::CombinedScorer, mut external_scores: crate::lightning::routing::scoring::ChannelLiquidities, mut duration_since_epoch: u64) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::scoring::nativeCombinedScorer)) }.merge(*unsafe { Box::from_raw(external_scores.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch)) +} + +/// Overwrite the scorer state with the given external scores. +#[no_mangle] +pub extern "C" fn CombinedScorer_set_scores(this_arg: &mut crate::lightning::routing::scoring::CombinedScorer, mut external_scores: crate::lightning::routing::scoring::ChannelLiquidities) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::scoring::nativeCombinedScorer)) }.set_scores(*unsafe { Box::from_raw(external_scores.take_inner()) }) +} + +impl From for crate::lightning::routing::scoring::ScoreLookUp { + fn from(obj: nativeCombinedScorer) -> Self { + let rust_obj = crate::lightning::routing::scoring::CombinedScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = CombinedScorer_as_ScoreLookUp(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(CombinedScorer_free_void); + ret + } +} +/// 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 CombinedScorer_as_ScoreLookUp(this_arg: &CombinedScorer) -> 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: CombinedScorer_ScoreLookUp_channel_penalty_msat, + } +} + +#[must_use] +extern "C" fn CombinedScorer_ScoreLookUp_channel_penalty_msat(this_arg: *const c_void, candidate: &crate::lightning::routing::router::CandidateRouteHop, 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 nativeCombinedScorer) }, &candidate.to_native(), *unsafe { Box::from_raw(usage.take_inner()) }, score_params.get_native_ref()); + ret +} + +impl From for crate::lightning::routing::scoring::ScoreUpdate { + fn from(obj: nativeCombinedScorer) -> Self { + let rust_obj = crate::lightning::routing::scoring::CombinedScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = CombinedScorer_as_ScoreUpdate(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(CombinedScorer_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 CombinedScorer_as_ScoreUpdate(this_arg: &CombinedScorer) -> 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: CombinedScorer_ScoreUpdate_payment_path_failed, + payment_path_successful: CombinedScorer_ScoreUpdate_payment_path_successful, + probe_failed: CombinedScorer_ScoreUpdate_probe_failed, + probe_successful: CombinedScorer_ScoreUpdate_probe_successful, + time_passed: CombinedScorer_ScoreUpdate_time_passed, + } +} + +extern "C" fn CombinedScorer_ScoreUpdate_payment_path_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) { + ::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeCombinedScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch)) +} +extern "C" fn CombinedScorer_ScoreUpdate_payment_path_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) { + ::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeCombinedScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch)) +} +extern "C" fn CombinedScorer_ScoreUpdate_probe_failed(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut short_channel_id: u64, mut duration_since_epoch: u64) { + ::probe_failed(unsafe { &mut *(this_arg as *mut nativeCombinedScorer) }, path.get_native_ref(), short_channel_id, core::time::Duration::from_secs(duration_since_epoch)) +} +extern "C" fn CombinedScorer_ScoreUpdate_probe_successful(this_arg: *mut c_void, path: &crate::lightning::routing::router::Path, mut duration_since_epoch: u64) { + ::probe_successful(unsafe { &mut *(this_arg as *mut nativeCombinedScorer) }, path.get_native_ref(), core::time::Duration::from_secs(duration_since_epoch)) +} +extern "C" fn CombinedScorer_ScoreUpdate_time_passed(this_arg: *mut c_void, mut duration_since_epoch: u64) { + ::time_passed(unsafe { &mut *(this_arg as *mut nativeCombinedScorer) }, core::time::Duration::from_secs(duration_since_epoch)) +} + +#[no_mangle] +/// Serialize the CombinedScorer object into a byte array which can be read by CombinedScorer_read +pub extern "C" fn CombinedScorer_write(obj: &crate::lightning::routing::scoring::CombinedScorer) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn CombinedScorer_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::routing::scoring::nativeCombinedScorer) }) +} impl From for crate::lightning::routing::scoring::Score { fn from(obj: nativeProbabilisticScorer) -> Self { let rust_obj = crate::lightning::routing::scoring::ProbabilisticScorer { inner: ObjOps::heap_alloc(obj), is_owned: true }; diff --git a/lightning-c-bindings/src/lightning/routing/utxo.rs b/lightning-c-bindings/src/lightning/routing/utxo.rs index 517d633b..a956a7de 100644 --- a/lightning-c-bindings/src/lightning/routing/utxo.rs +++ b/lightning-c-bindings/src/lightning/routing/utxo.rs @@ -346,7 +346,7 @@ impl Clone for UtxoFuture { fn clone(&self) -> Self { Self { inner: if <*mut nativeUtxoFuture>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -354,12 +354,12 @@ impl Clone for UtxoFuture { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UtxoFuture_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUtxoFuture)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUtxoFuture) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UtxoFuture pub extern "C" fn UtxoFuture_clone(orig: &UtxoFuture) -> UtxoFuture { - orig.clone() + Clone::clone(orig) } /// Builds a new future for later resolution. #[must_use] diff --git a/lightning-c-bindings/src/lightning/sign/ecdsa.rs b/lightning-c-bindings/src/lightning/sign/ecdsa.rs index 23905412..45a3633f 100644 --- a/lightning-c-bindings/src/lightning/sign/ecdsa.rs +++ b/lightning-c-bindings/src/lightning/sign/ecdsa.rs @@ -35,6 +35,273 @@ use alloc::{vec::Vec, boxed::Box}; /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked #[repr(C)] pub struct EcdsaChannelSigner { + /// 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 BaseEcdsaChannelSigner for this object. + pub BaseEcdsaChannelSigner: crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner, + /// Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. + /// The new EcdsaChannelSigner 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 EcdsaChannelSigner {} +unsafe impl Sync for EcdsaChannelSigner {} +#[allow(unused)] +pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { + EcdsaChannelSigner { + this_arg: orig.this_arg, + BaseEcdsaChannelSigner: crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner_clone_fields(&orig.BaseEcdsaChannelSigner), + cloned: Clone::clone(&orig.cloned), + free: Clone::clone(&orig.free), + } +} +impl lightning::sign::ecdsa::BaseEcdsaChannelSigner for EcdsaChannelSigner { + fn sign_counterparty_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { + let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.drain(..) { local_inbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut ret = (self.BaseEcdsaChannelSigner.sign_counterparty_commitment)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn sign_holder_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_holder_commitment)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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_justice_revoked_output(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_justice_revoked_output)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); + 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_justice_revoked_htlc(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_justice_revoked_htlc)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::sign::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_holder_htlc_transaction)(self.BaseEcdsaChannelSigner.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::sign::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::sign::HTLCDescriptor<>) 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_counterparty_htlc_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_counterparty_htlc_transaction)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_closing_transaction)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_holder_keyed_anchor_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_holder_keyed_anchor_input)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); + 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_channel_announcement_with_funding_key(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.sign_channel_announcement_with_funding_key)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_splice_shared_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::ecdsa::Signature { + let mut ret = (self.BaseEcdsaChannelSigner.sign_splice_shared_input)(self.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(tx), input_index); + ret.into_rust() + } +} +impl lightning::sign::ecdsa::BaseEcdsaChannelSigner for EcdsaChannelSignerRef { + fn sign_counterparty_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { + let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.drain(..) { local_inbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_counterparty_commitment)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } + fn sign_holder_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_holder_commitment)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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_justice_revoked_output(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_justice_revoked_output)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); + 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_justice_revoked_htlc(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_justice_revoked_htlc)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_holder_htlc_transaction(&self, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut htlc_descriptor: &lightning::sign::HTLCDescriptor, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_holder_htlc_transaction)(self.0.BaseEcdsaChannelSigner.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, &crate::lightning::sign::HTLCDescriptor { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc_descriptor as *const lightning::sign::HTLCDescriptor<>) 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_counterparty_htlc_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_counterparty_htlc_transaction)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_closing_transaction)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_holder_keyed_anchor_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_holder_keyed_anchor_input)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); + 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_channel_announcement_with_funding_key(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_channel_announcement_with_funding_key)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_splice_shared_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::ecdsa::Signature { + let mut ret = (self.0.BaseEcdsaChannelSigner.sign_splice_shared_input)(self.0.BaseEcdsaChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(tx), input_index); + ret.into_rust() + } +} +impl lightning::sign::ChannelSigner for EcdsaChannelSigner { + fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.get_per_commitment_point)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx); + 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 release_commitment_secret(&self, mut idx: u64) -> Result<[u8; 32], ()> { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.release_commitment_secret)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx); + let mut local_ret = match ret.result_ok { true => Ok( { (*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 + } + fn validate_holder_commitment(&self, mut holder_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut outbound_htlc_preimages: Vec) -> Result<(), ()> { + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.validate_holder_commitment)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false }, local_outbound_htlc_preimages.into()); + 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)) })*/ })}; + local_ret + } + fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::SecretKey) -> Result<(), ()> { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.validate_counterparty_revocation)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx, secret.as_ref()); + 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)) })*/ })}; + local_ret + } + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.pubkeys)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.new_funding_pubkey)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() + } + fn channel_keys_id(&self) -> [u8; 32] { + let mut ret = (self.BaseEcdsaChannelSigner.ChannelSigner.channel_keys_id)(self.BaseEcdsaChannelSigner.ChannelSigner.this_arg); + ret.data + } +} +impl lightning::sign::ChannelSigner for EcdsaChannelSignerRef { + fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.get_per_commitment_point)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx); + 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 release_commitment_secret(&self, mut idx: u64) -> Result<[u8; 32], ()> { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.release_commitment_secret)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx); + let mut local_ret = match ret.result_ok { true => Ok( { (*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 + } + fn validate_holder_commitment(&self, mut holder_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut outbound_htlc_preimages: Vec) -> Result<(), ()> { + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.validate_holder_commitment)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((holder_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false }, local_outbound_htlc_preimages.into()); + 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)) })*/ })}; + local_ret + } + fn validate_counterparty_revocation(&self, mut idx: u64, mut secret: &bitcoin::secp256k1::SecretKey) -> Result<(), ()> { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.validate_counterparty_revocation)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg, idx, secret.as_ref()); + 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)) })*/ })}; + local_ret + } + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.pubkeys)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.new_funding_pubkey)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() + } + fn channel_keys_id(&self) -> [u8; 32] { + let mut ret = (self.0.BaseEcdsaChannelSigner.ChannelSigner.channel_keys_id)(self.0.BaseEcdsaChannelSigner.ChannelSigner.this_arg); + ret.data + } +} +#[no_mangle] +/// Creates a copy of a EcdsaChannelSigner +pub extern "C" fn EcdsaChannelSigner_clone(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { + let mut res = EcdsaChannelSigner_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for EcdsaChannelSigner { + fn clone(&self) -> Self { + EcdsaChannelSigner_clone(self) + } +} +impl Clone for EcdsaChannelSignerRef { + fn clone(&self) -> Self { + Self(EcdsaChannelSigner_clone(&self.0)) + } +} + +use lightning::sign::ecdsa::EcdsaChannelSigner as rustEcdsaChannelSigner; +impl rustEcdsaChannelSigner for EcdsaChannelSigner { +} + +pub struct EcdsaChannelSignerRef(EcdsaChannelSigner); +impl rustEcdsaChannelSigner for EcdsaChannelSignerRef { +} + +// 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 EcdsaChannelSigner { + type Target = EcdsaChannelSignerRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const EcdsaChannelSignerRef) } + } +} +impl core::ops::DerefMut for EcdsaChannelSigner { + fn deref_mut(&mut self) -> &mut EcdsaChannelSignerRef { + unsafe { &mut *(self as *mut _ as *mut EcdsaChannelSignerRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn EcdsaChannelSigner_free(this_ptr: EcdsaChannelSigner) { } +impl Drop for EcdsaChannelSigner { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// A trait to sign Lightning channel transactions as described in +/// [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). +/// +/// Signing services could be implemented on a hardware wallet and should implement signing +/// policies in order to be secure. Please refer to the [VLS Policy +/// Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) +/// for an example of such policies. +/// +/// Like [`ChannelSigner`], many of the methods allow errors to be returned to support async +/// signing. In such cases, the signing operation can be replayed by calling +/// [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual +/// method documentation for which method should be called) once the result is ready, at which +/// point the channel operation will resume. +/// +/// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked +/// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked +#[repr(C)] +pub struct BaseEcdsaChannelSigner { /// 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, @@ -56,7 +323,7 @@ pub struct EcdsaChannelSigner { /// previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. /// /// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked - pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, + pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, /// Creates a signature for a holder's commitment transaction. /// /// This will be called @@ -74,7 +341,7 @@ pub struct EcdsaChannelSigner { /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked - pub sign_holder_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, + pub sign_holder_commitment: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// 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. /// @@ -97,7 +364,7 @@ pub struct EcdsaChannelSigner { /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked - 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, + pub sign_justice_revoked_output: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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. /// @@ -124,7 +391,7 @@ pub struct EcdsaChannelSigner { /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked - 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, + pub sign_justice_revoked_htlc: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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`]. @@ -168,7 +435,7 @@ pub struct EcdsaChannelSigner { /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked - 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, + pub sign_counterparty_htlc_transaction: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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 @@ -179,8 +446,8 @@ pub struct EcdsaChannelSigner { /// previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. /// /// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked - 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 + pub sign_closing_transaction: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, + /// Computes the signature for a commitment transaction's keyed anchor output used as an /// input within `anchor_tx`, which spends the commitment transaction, at index `input`. /// /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid @@ -190,7 +457,7 @@ pub struct EcdsaChannelSigner { /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked - 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, + pub sign_holder_keyed_anchor_input: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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. /// @@ -202,35 +469,30 @@ pub struct EcdsaChannelSigner { /// us for violating the protocol. /// /// [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message - 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, - /// Signs the input of a splicing funding transaction with our funding key. + pub sign_channel_announcement_with_funding_key: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, + /// Signs the shared input of a splice transaction with our funding key. /// /// In splicing, the previous funding transaction output is spent as the input of /// the new funding transaction, and is a 2-of-2 multisig. /// + /// `channel_parameters`: The [`ChannelTransactionParameters`] for the channel's current funding + /// transaction that is being spent in the splice transaction to sign. A new set of + /// [`ChannelTransactionParameters`] will become available for the new funding transaction. + /// /// `input_index`: The index of the input within the new funding transaction `tx`, /// spending the previous funding transaction's output - /// - /// `input_value`: The value of the previous funding transaction output. - /// - /// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately - /// closed. - pub sign_splicing_funding_input: extern "C" fn (this_arg: *const c_void, tx: crate::c_types::Transaction, input_index: usize, input_value: u64) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, + pub sign_splice_shared_input: extern "C" fn (this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, tx: crate::c_types::Transaction, input_index: usize) -> crate::c_types::ECDSASignature, /// Implementation of ChannelSigner for this object. pub ChannelSigner: crate::lightning::sign::ChannelSigner, - /// Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. - /// The new EcdsaChannelSigner 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 EcdsaChannelSigner {} -unsafe impl Sync for EcdsaChannelSigner {} +unsafe impl Send for BaseEcdsaChannelSigner {} +unsafe impl Sync for BaseEcdsaChannelSigner {} #[allow(unused)] -pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { - EcdsaChannelSigner { +pub(crate) fn BaseEcdsaChannelSigner_clone_fields(orig: &BaseEcdsaChannelSigner) -> BaseEcdsaChannelSigner { + BaseEcdsaChannelSigner { this_arg: orig.this_arg, sign_counterparty_commitment: Clone::clone(&orig.sign_counterparty_commitment), sign_holder_commitment: Clone::clone(&orig.sign_holder_commitment), @@ -239,15 +501,14 @@ pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> Ecds sign_holder_htlc_transaction: Clone::clone(&orig.sign_holder_htlc_transaction), sign_counterparty_htlc_transaction: Clone::clone(&orig.sign_counterparty_htlc_transaction), sign_closing_transaction: Clone::clone(&orig.sign_closing_transaction), - sign_holder_anchor_input: Clone::clone(&orig.sign_holder_anchor_input), + sign_holder_keyed_anchor_input: Clone::clone(&orig.sign_holder_keyed_anchor_input), sign_channel_announcement_with_funding_key: Clone::clone(&orig.sign_channel_announcement_with_funding_key), - sign_splicing_funding_input: Clone::clone(&orig.sign_splicing_funding_input), + sign_splice_shared_input: Clone::clone(&orig.sign_splice_shared_input), ChannelSigner: crate::lightning::sign::ChannelSigner_clone_fields(&orig.ChannelSigner), - cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } -impl lightning::sign::ChannelSigner for EcdsaChannelSigner { +impl lightning::sign::ChannelSigner for BaseEcdsaChannelSigner { fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { let mut ret = (self.ChannelSigner.get_per_commitment_point)(self.ChannelSigner.this_arg, idx); 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)) })*/ })}; @@ -269,21 +530,20 @@ impl lightning::sign::ChannelSigner for EcdsaChannelSigner { 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)) })*/ })}; local_ret } - fn pubkeys(&self) -> &lightning::ln::chan_utils::ChannelPublicKeys { - if let Some(f) = self.ChannelSigner.set_pubkeys { - (f)(&self.ChannelSigner); - } - unsafe { &*self.ChannelSigner.pubkeys.get() }.get_native_ref() + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.ChannelSigner.pubkeys)(self.ChannelSigner.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.ChannelSigner.new_funding_pubkey)(self.ChannelSigner.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() } fn channel_keys_id(&self) -> [u8; 32] { let mut ret = (self.ChannelSigner.channel_keys_id)(self.ChannelSigner.this_arg); ret.data } - fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.ChannelSigner.provide_channel_parameters)(self.ChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) - } } -impl lightning::sign::ChannelSigner for EcdsaChannelSignerRef { +impl lightning::sign::ChannelSigner for BaseEcdsaChannelSignerRef { fn get_per_commitment_point(&self, mut idx: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { let mut ret = (self.0.ChannelSigner.get_per_commitment_point)(self.0.ChannelSigner.this_arg, idx); 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)) })*/ })}; @@ -305,59 +565,41 @@ impl lightning::sign::ChannelSigner for EcdsaChannelSignerRef { 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)) })*/ })}; local_ret } - fn pubkeys(&self) -> &lightning::ln::chan_utils::ChannelPublicKeys { - if let Some(f) = self.0.ChannelSigner.set_pubkeys { - (f)(&self.0.ChannelSigner); - } - unsafe { &*self.0.ChannelSigner.pubkeys.get() }.get_native_ref() + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.0.ChannelSigner.pubkeys)(self.0.ChannelSigner.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.0.ChannelSigner.new_funding_pubkey)(self.0.ChannelSigner.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() } fn channel_keys_id(&self) -> [u8; 32] { let mut ret = (self.0.ChannelSigner.channel_keys_id)(self.0.ChannelSigner.this_arg); ret.data } - fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.0.ChannelSigner.provide_channel_parameters)(self.0.ChannelSigner.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) - } -} -#[no_mangle] -/// Creates a copy of a EcdsaChannelSigner -pub extern "C" fn EcdsaChannelSigner_clone(orig: &EcdsaChannelSigner) -> EcdsaChannelSigner { - let mut res = EcdsaChannelSigner_clone_fields(orig); - if let Some(f) = orig.cloned { (f)(&mut res) }; - res -} -impl Clone for EcdsaChannelSigner { - fn clone(&self) -> Self { - EcdsaChannelSigner_clone(self) - } -} -impl Clone for EcdsaChannelSignerRef { - fn clone(&self) -> Self { - Self(EcdsaChannelSigner_clone(&self.0)) - } } -use lightning::sign::ecdsa::EcdsaChannelSigner as rustEcdsaChannelSigner; -impl rustEcdsaChannelSigner for EcdsaChannelSigner { - fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { +use lightning::sign::ecdsa::BaseEcdsaChannelSigner as rustBaseEcdsaChannelSigner; +impl rustBaseEcdsaChannelSigner for BaseEcdsaChannelSigner { + fn sign_counterparty_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.drain(..) { local_inbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; - let mut ret = (self.sign_counterparty_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); + let mut ret = (self.sign_counterparty_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn sign_holder_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_holder_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false }); + fn sign_holder_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_holder_commitment)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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_justice_revoked_output(&self, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_justice_revoked_output)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); + fn sign_justice_revoked_output(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_justice_revoked_output)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); 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_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_justice_revoked_htlc)(self.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }); + fn sign_justice_revoked_htlc(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_justice_revoked_htlc)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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 } @@ -366,54 +608,53 @@ impl rustEcdsaChannelSigner for EcdsaChannelSigner { 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_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }); + fn sign_counterparty_htlc_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_counterparty_htlc_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_closing_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) as *mut _) }, is_owned: false }); + fn sign_closing_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_closing_transaction)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_holder_anchor_input(&self, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_holder_anchor_input)(self.this_arg, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); + fn sign_holder_keyed_anchor_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_holder_keyed_anchor_input)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); 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_channel_announcement_with_funding_key(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false }); + fn sign_channel_announcement_with_funding_key(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_splicing_funding_input(&self, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut input_value: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.sign_splicing_funding_input)(self.this_arg, crate::c_types::Transaction::from_bitcoin(tx), input_index, input_value); - 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_splice_shared_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::ecdsa::Signature { + let mut ret = (self.sign_splice_shared_input)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(tx), input_index); + ret.into_rust() } } -pub struct EcdsaChannelSignerRef(EcdsaChannelSigner); -impl rustEcdsaChannelSigner for EcdsaChannelSignerRef { - fn sign_counterparty_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { +pub struct BaseEcdsaChannelSignerRef(BaseEcdsaChannelSigner); +impl rustBaseEcdsaChannelSigner for BaseEcdsaChannelSignerRef { + fn sign_counterparty_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: Vec, mut outbound_htlc_preimages: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result<(bitcoin::secp256k1::ecdsa::Signature, Vec), ()> { let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.drain(..) { local_inbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.drain(..) { local_outbound_htlc_preimages.push( { crate::c_types::ThirtyTwoBytes { data: item.0 } }); }; - let mut ret = (self.0.sign_counterparty_commitment)(self.0.this_arg, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); + let mut ret = (self.0.sign_counterparty_commitment)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::CommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::CommitmentTransaction<>) as *mut _) }, is_owned: false }, local_inbound_htlc_preimages.into(), local_outbound_htlc_preimages.into()); let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.into_rust().drain(..) { local_orig_ret_0_1.push( { item.into_rust() }); }; let mut local_ret_0 = (orig_ret_0_0.into_rust(), local_orig_ret_0_1); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn sign_holder_commitment(&self, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_holder_commitment)(self.0.this_arg, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) as *mut _) }, is_owned: false }); + fn sign_holder_commitment(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut commitment_tx: &lightning::ln::chan_utils::HolderCommitmentTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_holder_commitment)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::HolderCommitmentTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((commitment_tx as *const lightning::ln::chan_utils::HolderCommitmentTransaction<>) 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_justice_revoked_output(&self, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_justice_revoked_output)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); + fn sign_justice_revoked_output(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_justice_revoked_output)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref()); 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_justice_revoked_htlc(&self, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_justice_revoked_htlc)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }); + fn sign_justice_revoked_htlc(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut justice_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_key: &bitcoin::secp256k1::SecretKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_justice_revoked_htlc)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(justice_tx), input, amount, per_commitment_key.as_ref(), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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 } @@ -422,50 +663,49 @@ impl rustEcdsaChannelSigner for EcdsaChannelSignerRef { 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_counterparty_htlc_transaction(&self, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_counterparty_htlc_transaction)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false }); + fn sign_counterparty_htlc_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut htlc_tx: &bitcoin::transaction::Transaction, mut input: usize, mut amount: u64, mut per_commitment_point: &bitcoin::secp256k1::PublicKey, mut htlc: &lightning::ln::chan_utils::HTLCOutputInCommitment, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_counterparty_htlc_transaction)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(htlc_tx), input, amount, crate::c_types::PublicKey::from_rust(&per_commitment_point), &crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((htlc as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) 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_closing_transaction(&self, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_closing_transaction)(self.0.this_arg, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) as *mut _) }, is_owned: false }); + fn sign_closing_transaction(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut closing_tx: &lightning::ln::chan_utils::ClosingTransaction, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_closing_transaction)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::chan_utils::ClosingTransaction { inner: unsafe { ObjOps::nonnull_ptr_to_inner((closing_tx as *const lightning::ln::chan_utils::ClosingTransaction<>) 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_holder_anchor_input(&self, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_holder_anchor_input)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); + fn sign_holder_keyed_anchor_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut anchor_tx: &bitcoin::transaction::Transaction, mut input: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_holder_keyed_anchor_input)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(anchor_tx), input); 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_channel_announcement_with_funding_key(&self, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_channel_announcement_with_funding_key)(self.0.this_arg, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) as *mut _) }, is_owned: false }); + fn sign_channel_announcement_with_funding_key(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut msg: &lightning::ln::msgs::UnsignedChannelAnnouncement, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_channel_announcement_with_funding_key)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, &crate::lightning::ln::msgs::UnsignedChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UnsignedChannelAnnouncement<>) 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_splicing_funding_input(&self, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut input_value: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { - let mut ret = (self.0.sign_splicing_funding_input)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(tx), input_index, input_value); - 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_splice_shared_input(&self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::ecdsa::Signature { + let mut ret = (self.0.sign_splice_shared_input)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }, crate::c_types::Transaction::from_bitcoin(tx), input_index); + ret.into_rust() } } // 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 EcdsaChannelSigner { - type Target = EcdsaChannelSignerRef; +impl core::ops::Deref for BaseEcdsaChannelSigner { + type Target = BaseEcdsaChannelSignerRef; fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const EcdsaChannelSignerRef) } + unsafe { &*(self as *const _ as *const BaseEcdsaChannelSignerRef) } } } -impl core::ops::DerefMut for EcdsaChannelSigner { - fn deref_mut(&mut self) -> &mut EcdsaChannelSignerRef { - unsafe { &mut *(self as *mut _ as *mut EcdsaChannelSignerRef) } +impl core::ops::DerefMut for BaseEcdsaChannelSigner { + fn deref_mut(&mut self) -> &mut BaseEcdsaChannelSignerRef { + unsafe { &mut *(self as *mut _ as *mut BaseEcdsaChannelSignerRef) } } } /// Calls the free function if one is set #[no_mangle] -pub extern "C" fn EcdsaChannelSigner_free(this_ptr: EcdsaChannelSigner) { } -impl Drop for EcdsaChannelSigner { +pub extern "C" fn BaseEcdsaChannelSigner_free(this_ptr: BaseEcdsaChannelSigner) { } +impl Drop for BaseEcdsaChannelSigner { fn drop(&mut self) { if let Some(f) = self.free { f(self.this_arg); diff --git a/lightning-c-bindings/src/lightning/sign/mod.rs b/lightning-c-bindings/src/lightning/sign/mod.rs index 661ea529..9a9915b5 100644 --- a/lightning-c-bindings/src/lightning/sign/mod.rs +++ b/lightning-c-bindings/src/lightning/sign/mod.rs @@ -21,6 +21,7 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; pub mod ecdsa; +pub mod tx_builder; mod type_resolver { use alloc::str::FromStr; @@ -98,7 +99,7 @@ impl DelayedPaymentOutputDescriptor { /// The outpoint which is spendable. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_outpoint(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).outpoint; crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } /// The outpoint which is spendable. @@ -109,7 +110,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_outpoint(this_ptr: &mut Del /// Per commitment point to derive the delayed payment key by key holder. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_per_commitment_point(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// Per commitment point to derive the delayed payment key by key holder. @@ -121,7 +122,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_per_commitment_point(this_p /// the witness_script. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_to_self_delay(this_ptr: &DelayedPaymentOutputDescriptor) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).to_self_delay; *inner_val } /// The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in @@ -133,7 +134,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_to_self_delay(this_ptr: &mu /// The output which is referenced by the given outpoint. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_output(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::c_types::TxOut { - let mut inner_val = &mut this_ptr.get_native_mut_ref().output; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).output; crate::c_types::TxOut::from_rust(inner_val) } /// The output which is referenced by the given outpoint. @@ -145,7 +146,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_output(this_ptr: &mut Delay /// derive the witnessScript for this output. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_revocation_pubkey(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::ln::channel_keys::RevocationKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_pubkey; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).revocation_pubkey; crate::lightning::ln::channel_keys::RevocationKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::channel_keys::RevocationKey<>) as *mut _) }, is_owned: false } } /// The revocation point specific to the commitment transaction which was broadcast. Used to @@ -158,7 +159,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_revocation_pubkey(this_ptr: /// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &DelayedPaymentOutputDescriptor) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_keys_id; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).channel_keys_id; inner_val } /// Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. @@ -170,7 +171,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_channel_keys_id(this_ptr: & /// The value of the channel which this output originated from, possibly indirectly. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: &DelayedPaymentOutputDescriptor) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).channel_value_satoshis; *inner_val } /// The value of the channel which this output originated from, possibly indirectly. @@ -179,19 +180,19 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_value_satoshis = val; } /// The channel public keys and other parameters needed to generate a spending transaction or -/// to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. +/// to provide to a signer. /// /// Added as optional, but always `Some` if the descriptor was produced in v0.0.123 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 DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_transaction_parameters; + let mut inner_val = &mut DelayedPaymentOutputDescriptor::get_native_mut_ref(this_ptr).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 channel public keys and other parameters needed to generate a spending transaction or -/// to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`]. +/// to provide to a signer. /// /// Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later. /// @@ -223,7 +224,7 @@ impl Clone for DelayedPaymentOutputDescriptor { fn clone(&self) -> Self { Self { inner: if <*mut nativeDelayedPaymentOutputDescriptor>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -231,12 +232,12 @@ impl Clone for DelayedPaymentOutputDescriptor { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDelayedPaymentOutputDescriptor)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDelayedPaymentOutputDescriptor) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the DelayedPaymentOutputDescriptor pub extern "C" fn DelayedPaymentOutputDescriptor_clone(orig: &DelayedPaymentOutputDescriptor) -> DelayedPaymentOutputDescriptor { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a DelayedPaymentOutputDescriptor object pub extern "C" fn DelayedPaymentOutputDescriptor_debug_str_void(o: *const c_void) -> Str { @@ -276,6 +277,16 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_read(ser: crate::c_types::u8sli let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::sign::DelayedPaymentOutputDescriptor { 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 } +/// If a [`KeysManager`] is built with [`KeysManager::new`] with `v2_remote_key_derivation` set +/// (and for all channels after they've been spliced), the script which we receive funds to on-chain +/// when our counterparty force-closes a channel is one of this many possible derivation paths. +/// +/// Keeping this limited allows for scanning the chain to find lost funds if our state is destroyed, +/// while this being more than a handful provides some privacy by not constantly reusing the same +/// scripts on-chain across channels. + +#[no_mangle] +pub static STATIC_PAYMENT_KEY_COUNT: u16 = lightning::sign::STATIC_PAYMENT_KEY_COUNT; use lightning::sign::StaticPaymentOutputDescriptor as nativeStaticPaymentOutputDescriptorImport; pub(crate) type nativeStaticPaymentOutputDescriptor = nativeStaticPaymentOutputDescriptorImport; @@ -341,7 +352,7 @@ impl StaticPaymentOutputDescriptor { /// The outpoint which is spendable. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_outpoint(this_ptr: &StaticPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; + let mut inner_val = &mut StaticPaymentOutputDescriptor::get_native_mut_ref(this_ptr).outpoint; crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } /// The outpoint which is spendable. @@ -352,7 +363,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_set_outpoint(this_ptr: &mut Stat /// The output which is referenced by the given outpoint. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_output(this_ptr: &StaticPaymentOutputDescriptor) -> crate::c_types::TxOut { - let mut inner_val = &mut this_ptr.get_native_mut_ref().output; + let mut inner_val = &mut StaticPaymentOutputDescriptor::get_native_mut_ref(this_ptr).output; crate::c_types::TxOut::from_rust(inner_val) } /// The output which is referenced by the given outpoint. @@ -364,7 +375,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_set_output(this_ptr: &mut Static /// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &StaticPaymentOutputDescriptor) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_keys_id; + let mut inner_val = &mut StaticPaymentOutputDescriptor::get_native_mut_ref(this_ptr).channel_keys_id; inner_val } /// Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`]. @@ -376,7 +387,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_set_channel_keys_id(this_ptr: &m /// The value of the channel which this transactions spends. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_value_satoshis(this_ptr: &StaticPaymentOutputDescriptor) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_value_satoshis; + let mut inner_val = &mut StaticPaymentOutputDescriptor::get_native_mut_ref(this_ptr).channel_value_satoshis; *inner_val } /// The value of the channel which this transactions spends. @@ -384,20 +395,18 @@ 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`]. +/// The necessary channel parameters that need to be provided to the signer. /// /// 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 inner_val = &mut StaticPaymentOutputDescriptor::get_native_mut_ref(this_ptr).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`]. +/// The necessary channel parameters that need to be provided to the signer. /// /// Added as optional, but always `Some` if the descriptor was produced in v0.0.117 or later. /// @@ -426,7 +435,7 @@ impl Clone for StaticPaymentOutputDescriptor { fn clone(&self) -> Self { Self { inner: if <*mut nativeStaticPaymentOutputDescriptor>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -434,12 +443,12 @@ impl Clone for StaticPaymentOutputDescriptor { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn StaticPaymentOutputDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeStaticPaymentOutputDescriptor)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeStaticPaymentOutputDescriptor) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the StaticPaymentOutputDescriptor pub extern "C" fn StaticPaymentOutputDescriptor_clone(orig: &StaticPaymentOutputDescriptor) -> StaticPaymentOutputDescriptor { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a StaticPaymentOutputDescriptor object pub extern "C" fn StaticPaymentOutputDescriptor_debug_str_void(o: *const c_void) -> Str { @@ -476,7 +485,8 @@ pub extern "C" fn StaticPaymentOutputDescriptor_witness_script(this_arg: &crate: } /// 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 +/// +/// Note: If you have the `grind_signatures` feature enabled, this will be at least 1 byte /// shorter. #[must_use] #[no_mangle] @@ -485,6 +495,15 @@ pub extern "C" fn StaticPaymentOutputDescriptor_max_witness_length(this_arg: &cr ret } +/// Returns true if spending this output requires a transaction with a CheckSequenceVerify +/// value of at least 1. +#[must_use] +#[no_mangle] +pub extern "C" fn StaticPaymentOutputDescriptor_needs_csv_1_for_spend(this_arg: &crate::lightning::sign::StaticPaymentOutputDescriptor) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.needs_csv_1_for_spend(); + 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 { @@ -559,16 +578,18 @@ pub enum SpendableOutputDescriptor { /// it is an output from an old state which we broadcast (which should never happen). /// /// To derive the delayed payment key which is used to sign this input, you must pass the - /// holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the - /// [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided - /// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be - /// generated without the secret key using [`DelayedPaymentKey::from_basepoint`] and only the - /// [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`]. + /// holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which + /// corresponds to the [`ChannelPublicKeys::delayed_payment_basepoint`] in + /// [`ChannelSigner::pubkeys`]) and the provided + /// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to + /// [`chan_utils::derive_private_key`]. The DelayedPaymentKey can be generated without the + /// secret key using [`DelayedPaymentKey::from_basepoint`] and only the + /// [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in + /// [`ChannelSigner::pubkeys`]. /// /// To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is /// used in the witness script generation), you must pass the counterparty - /// [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to - /// [`ChannelSigner::provide_channel_parameters`]) and the provided + /// [`ChannelPublicKeys::revocation_basepoint`] and the provided /// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to /// [`RevocationKey`]. /// @@ -876,7 +897,7 @@ impl ChannelDerivationParameters { /// The value in satoshis of the channel we're attempting to spend the anchor output of. #[no_mangle] pub extern "C" fn ChannelDerivationParameters_get_value_satoshis(this_ptr: &ChannelDerivationParameters) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().value_satoshis; + let mut inner_val = &mut ChannelDerivationParameters::get_native_mut_ref(this_ptr).value_satoshis; *inner_val } /// The value in satoshis of the channel we're attempting to spend the anchor output of. @@ -887,7 +908,7 @@ pub extern "C" fn ChannelDerivationParameters_set_value_satoshis(this_ptr: &mut /// The unique identifier to re-derive the signer for the associated channel. #[no_mangle] pub extern "C" fn ChannelDerivationParameters_get_keys_id(this_ptr: &ChannelDerivationParameters) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().keys_id; + let mut inner_val = &mut ChannelDerivationParameters::get_native_mut_ref(this_ptr).keys_id; inner_val } /// The unique identifier to re-derive the signer for the associated channel. @@ -895,15 +916,13 @@ pub extern "C" fn ChannelDerivationParameters_get_keys_id(this_ptr: &ChannelDeri pub extern "C" fn ChannelDerivationParameters_set_keys_id(this_ptr: &mut ChannelDerivationParameters, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys_id = val.data; } -/// The necessary channel parameters that need to be provided to the re-derived signer through -/// [`ChannelSigner::provide_channel_parameters`]. +/// The necessary channel parameters that need to be provided to the signer. #[no_mangle] pub extern "C" fn ChannelDerivationParameters_get_transaction_parameters(this_ptr: &ChannelDerivationParameters) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().transaction_parameters; + let mut inner_val = &mut ChannelDerivationParameters::get_native_mut_ref(this_ptr).transaction_parameters; crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false } } -/// The necessary channel parameters that need to be provided to the re-derived signer through -/// [`ChannelSigner::provide_channel_parameters`]. +/// The necessary channel parameters that need to be provided to the signer. #[no_mangle] pub extern "C" fn ChannelDerivationParameters_set_transaction_parameters(this_ptr: &mut ChannelDerivationParameters, mut val: crate::lightning::ln::chan_utils::ChannelTransactionParameters) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.transaction_parameters = *unsafe { Box::from_raw(val.take_inner()) }; @@ -922,7 +941,7 @@ impl Clone for ChannelDerivationParameters { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelDerivationParameters>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -930,12 +949,12 @@ impl Clone for ChannelDerivationParameters { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelDerivationParameters_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelDerivationParameters)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelDerivationParameters) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelDerivationParameters pub extern "C" fn ChannelDerivationParameters_clone(orig: &ChannelDerivationParameters) -> ChannelDerivationParameters { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelDerivationParameters object pub extern "C" fn ChannelDerivationParameters_debug_str_void(o: *const c_void) -> Str { @@ -1028,7 +1047,7 @@ impl HTLCDescriptor { /// The parameters required to derive the signer for the HTLC input. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_channel_derivation_parameters(this_ptr: &HTLCDescriptor) -> crate::lightning::sign::ChannelDerivationParameters { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_derivation_parameters; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).channel_derivation_parameters; crate::lightning::sign::ChannelDerivationParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::sign::ChannelDerivationParameters<>) as *mut _) }, is_owned: false } } /// The parameters required to derive the signer for the HTLC input. @@ -1039,7 +1058,7 @@ pub extern "C" fn HTLCDescriptor_set_channel_derivation_parameters(this_ptr: &mu /// The txid of the commitment transaction in which the HTLC output lives. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_commitment_txid(this_ptr: &HTLCDescriptor) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_txid; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).commitment_txid; inner_val.as_ref() } /// The txid of the commitment transaction in which the HTLC output lives. @@ -1050,7 +1069,7 @@ pub extern "C" fn HTLCDescriptor_set_commitment_txid(this_ptr: &mut HTLCDescript /// The number of the commitment transaction in which the HTLC output lives. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_per_commitment_number(this_ptr: &HTLCDescriptor) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_number; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).per_commitment_number; *inner_val } /// The number of the commitment transaction in which the HTLC output lives. @@ -1065,7 +1084,7 @@ pub extern "C" fn HTLCDescriptor_set_per_commitment_number(this_ptr: &mut HTLCDe /// See for more info. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_per_commitment_point(this_ptr: &HTLCDescriptor) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } /// The key tweak corresponding to the number of the commitment transaction in which the HTLC @@ -1082,7 +1101,7 @@ pub extern "C" fn HTLCDescriptor_set_per_commitment_point(this_ptr: &mut HTLCDes /// negotiated feerate at the time the commitment transaction was built. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_feerate_per_kw(this_ptr: &HTLCDescriptor) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().feerate_per_kw; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).feerate_per_kw; *inner_val } /// The feerate to use on the HTLC claiming transaction. This is always `0` for HTLCs @@ -1095,7 +1114,7 @@ pub extern "C" fn HTLCDescriptor_set_feerate_per_kw(this_ptr: &mut HTLCDescripto /// The details of the HTLC as it appears in the commitment transaction. #[no_mangle] pub extern "C" fn HTLCDescriptor_get_htlc(this_ptr: &HTLCDescriptor) -> crate::lightning::ln::chan_utils::HTLCOutputInCommitment { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).htlc; crate::lightning::ln::chan_utils::HTLCOutputInCommitment { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::ln::chan_utils::HTLCOutputInCommitment<>) as *mut _) }, is_owned: false } } /// The details of the HTLC as it appears in the commitment transaction. @@ -1107,7 +1126,7 @@ pub extern "C" fn HTLCDescriptor_set_htlc(this_ptr: &mut HTLCDescriptor, mut val /// taken. #[no_mangle] 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 inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).preimage; 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 } @@ -1121,7 +1140,7 @@ pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut /// 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::ECDSASignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().counterparty_sig; + let mut inner_val = &mut HTLCDescriptor::get_native_mut_ref(this_ptr).counterparty_sig; crate::c_types::ECDSASignature::from_rust(&inner_val) } /// The counterparty's signature required to spend the HTLC output. @@ -1149,7 +1168,7 @@ impl Clone for HTLCDescriptor { fn clone(&self) -> Self { Self { inner: if <*mut nativeHTLCDescriptor>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1157,12 +1176,12 @@ impl Clone for HTLCDescriptor { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HTLCDescriptor_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHTLCDescriptor)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHTLCDescriptor) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the HTLCDescriptor pub extern "C" fn HTLCDescriptor_clone(orig: &HTLCDescriptor) -> HTLCDescriptor { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a HTLCDescriptor object pub extern "C" fn HTLCDescriptor_debug_str_void(o: *const c_void) -> Str { @@ -1245,14 +1264,6 @@ pub extern "C" fn HTLCDescriptor_tx_input_witness(this_arg: &crate::lightning::s crate::c_types::Witness::from_bitcoin(&ret) } -/// Derives the channel signer required to sign the HTLC input. -#[must_use] -#[no_mangle] -pub extern "C" fn HTLCDescriptor_derive_channel_signer(this_arg: &crate::lightning::sign::HTLCDescriptor, signer_provider: &crate::lightning::sign::SignerProvider) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_signer(signer_provider); - Into::into(ret) -} - /// A trait to handle Lightning channel key material without concretizing the channel type or /// the signature mechanism. /// @@ -1317,30 +1328,28 @@ pub struct ChannelSigner { /// closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` /// and pause future signing operations until this validation completes. pub validate_counterparty_revocation: extern "C" fn (this_arg: *const c_void, idx: u64, secret: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneNoneZ, - /// Returns the holder's channel public keys and basepoints. + /// Returns the holder channel public keys and basepoints. This should only be called once + /// during channel creation and as such implementations are allowed undefined behavior if + /// called more than once. + /// + /// This method is *not* asynchronous. Instead, the value must be computed locally or in + /// advance and cached. + pub pubkeys: extern "C" fn (this_arg: *const c_void) -> crate::lightning::ln::chan_utils::ChannelPublicKeys, + /// Returns a new funding pubkey (i.e. our public which is used in a 2-of-2 with the + /// counterparty's key to to lock the funds on-chain) for a spliced channel. + /// + /// `splice_parent_funding_txid` can be used to compute a tweak with which to rotate the base + /// key (which will then be available later in signing operations via + /// [`ChannelTransactionParameters::splice_parent_funding_txid`]). /// /// This method is *not* asynchronous. Instead, the value must be cached locally. - pub pubkeys: core::cell::UnsafeCell, - /// Fill in the pubkeys field as a reference to it will be given to Rust after this returns - /// Note that this takes a pointer to this object, not the this_ptr like other methods do - /// This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. - pub set_pubkeys: Option, + pub new_funding_pubkey: extern "C" fn (this_arg: *const c_void, splice_parent_funding_txid: crate::c_types::ThirtyTwoBytes) -> crate::c_types::PublicKey, /// 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 /// [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. /// /// This method is *not* asynchronous. Instead, the value must be cached locally. pub channel_keys_id: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, - /// Set the counterparty static channel data, including basepoints, - /// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. - /// - /// This data is static, and will never change for a channel once set. For a given [`ChannelSigner`] - /// instance, LDK will call this method exactly once - either immediately after construction - /// (not including if done via [`SignerProvider::read_chan_signer`]) or when the funding - /// information has been generated. - /// - /// channel_parameters.is_populated() MUST be true. - pub provide_channel_parameters: extern "C" fn (this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters), /// 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, @@ -1355,10 +1364,9 @@ pub(crate) fn ChannelSigner_clone_fields(orig: &ChannelSigner) -> ChannelSigner release_commitment_secret: Clone::clone(&orig.release_commitment_secret), validate_holder_commitment: Clone::clone(&orig.validate_holder_commitment), validate_counterparty_revocation: Clone::clone(&orig.validate_counterparty_revocation), - pubkeys: Clone::clone(unsafe { &*core::cell::UnsafeCell::get(&orig.pubkeys)}).into(), - set_pubkeys: Clone::clone(&orig.set_pubkeys), + pubkeys: Clone::clone(&orig.pubkeys), + new_funding_pubkey: Clone::clone(&orig.new_funding_pubkey), channel_keys_id: Clone::clone(&orig.channel_keys_id), - provide_channel_parameters: Clone::clone(&orig.provide_channel_parameters), free: Clone::clone(&orig.free), } } @@ -1386,19 +1394,18 @@ impl rustChannelSigner for ChannelSigner { 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)) })*/ })}; local_ret } - fn pubkeys(&self) -> &lightning::ln::chan_utils::ChannelPublicKeys { - if let Some(f) = self.set_pubkeys { - (f)(&self); - } - unsafe { &*self.pubkeys.get() }.get_native_ref() + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.pubkeys)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.new_funding_pubkey)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() } fn channel_keys_id(&self) -> [u8; 32] { let mut ret = (self.channel_keys_id)(self.this_arg); ret.data } - fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.provide_channel_parameters)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) - } } pub struct ChannelSignerRef(ChannelSigner); @@ -1424,19 +1431,18 @@ impl rustChannelSigner for ChannelSignerRef { 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)) })*/ })}; local_ret } - fn pubkeys(&self) -> &lightning::ln::chan_utils::ChannelPublicKeys { - if let Some(f) = self.0.set_pubkeys { - (f)(&self.0); - } - unsafe { &*self.0.pubkeys.get() }.get_native_ref() + fn pubkeys(&self, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> lightning::ln::chan_utils::ChannelPublicKeys { + let mut ret = (self.0.pubkeys)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn new_funding_pubkey(&self, mut splice_parent_funding_txid: bitcoin::Txid, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> bitcoin::secp256k1::PublicKey { + let mut ret = (self.0.new_funding_pubkey)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: *splice_parent_funding_txid.as_ref() }); + ret.into_rust() } fn channel_keys_id(&self) -> [u8; 32] { let mut ret = (self.0.channel_keys_id)(self.0.this_arg); ret.data } - fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.0.provide_channel_parameters)(self.0.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) - } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -1462,6 +1468,223 @@ impl Drop for ChannelSigner { } } } + +use lightning::sign::PeerStorageKey as nativePeerStorageKeyImport; +pub(crate) type nativePeerStorageKey = nativePeerStorageKeyImport; + +/// Represents the secret key material used for encrypting Peer Storage. +#[must_use] +#[repr(C)] +pub struct PeerStorageKey { + /// 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 nativePeerStorageKey, + /// 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 core::ops::Deref for PeerStorageKey { + type Target = nativePeerStorageKey; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for PeerStorageKey { } +unsafe impl core::marker::Sync for PeerStorageKey { } +impl Drop for PeerStorageKey { + fn drop(&mut self) { + if self.is_owned && !<*mut nativePeerStorageKey>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the PeerStorageKey, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn PeerStorageKey_free(this_obj: PeerStorageKey) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PeerStorageKey_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePeerStorageKey) }; +} +#[allow(unused)] +impl PeerStorageKey { + pub(crate) fn get_native_ref(&self) -> &'static nativePeerStorageKey { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePeerStorageKey { + 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 nativePeerStorageKey { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Represents the key used to encrypt and decrypt Peer Storage. +#[no_mangle] +pub extern "C" fn PeerStorageKey_get_inner(this_ptr: &PeerStorageKey) -> *const [u8; 32] { + let mut inner_val = &mut PeerStorageKey::get_native_mut_ref(this_ptr).inner; + inner_val +} +/// Represents the key used to encrypt and decrypt Peer Storage. +#[no_mangle] +pub extern "C" fn PeerStorageKey_set_inner(this_ptr: &mut PeerStorageKey, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.inner = val.data; +} +/// Constructs a new PeerStorageKey given each field +#[must_use] +#[no_mangle] +pub extern "C" fn PeerStorageKey_new(mut inner_arg: crate::c_types::ThirtyTwoBytes) -> PeerStorageKey { + PeerStorageKey { inner: ObjOps::heap_alloc(nativePeerStorageKey { + inner: inner_arg.data, + }), is_owned: true } +} +impl Clone for PeerStorageKey { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativePeerStorageKey>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 PeerStorageKey_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePeerStorageKey) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the PeerStorageKey +pub extern "C" fn PeerStorageKey_clone(orig: &PeerStorageKey) -> PeerStorageKey { + Clone::clone(orig) +} +/// Checks if two PeerStorageKeys 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 PeerStorageKey_eq(a: &PeerStorageKey, b: &PeerStorageKey) -> 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 } +} + +use lightning::sign::ReceiveAuthKey as nativeReceiveAuthKeyImport; +pub(crate) type nativeReceiveAuthKey = nativeReceiveAuthKeyImport; + +/// A secret key used to authenticate message contexts in received [`BlindedMessagePath`]s. +/// +/// This key ensures that a node only accepts incoming messages delivered through +/// blinded paths that it constructed itself. +/// +/// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath +#[must_use] +#[repr(C)] +pub struct ReceiveAuthKey { + /// 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 nativeReceiveAuthKey, + /// 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 core::ops::Deref for ReceiveAuthKey { + type Target = nativeReceiveAuthKey; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ReceiveAuthKey { } +unsafe impl core::marker::Sync for ReceiveAuthKey { } +impl Drop for ReceiveAuthKey { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeReceiveAuthKey>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ReceiveAuthKey, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ReceiveAuthKey_free(this_obj: ReceiveAuthKey) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ReceiveAuthKey_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReceiveAuthKey) }; +} +#[allow(unused)] +impl ReceiveAuthKey { + pub(crate) fn get_native_ref(&self) -> &'static nativeReceiveAuthKey { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeReceiveAuthKey { + 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 nativeReceiveAuthKey { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +#[no_mangle] +pub extern "C" fn ReceiveAuthKey_get_a(this_ptr: &ReceiveAuthKey) -> *const [u8; 32] { + let mut inner_val = &mut ReceiveAuthKey::get_native_mut_ref(this_ptr).0; + inner_val +} +#[no_mangle] +pub extern "C" fn ReceiveAuthKey_set_a(this_ptr: &mut ReceiveAuthKey, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.data; +} +/// Constructs a new ReceiveAuthKey given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ReceiveAuthKey_new(mut a_arg: crate::c_types::ThirtyTwoBytes) -> ReceiveAuthKey { + ReceiveAuthKey { inner: ObjOps::heap_alloc(lightning::sign::ReceiveAuthKey ( + a_arg.data, + )), is_owned: true } +} +impl Clone for ReceiveAuthKey { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeReceiveAuthKey>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ReceiveAuthKey_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeReceiveAuthKey) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ReceiveAuthKey +pub extern "C" fn ReceiveAuthKey_clone(orig: &ReceiveAuthKey) -> ReceiveAuthKey { + Clone::clone(orig) +} +/// Checks if two ReceiveAuthKeys 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 ReceiveAuthKey_eq(a: &ReceiveAuthKey, b: &ReceiveAuthKey) -> 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 } +} /// Specifies the recipient of an invoice. /// /// This indicates to [`NodeSigner::sign_invoice`] what node secret key should be used to sign @@ -1604,16 +1827,45 @@ pub struct NodeSigner { /// 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, - /// Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. + /// Get the [`ExpandedKey`] which provides cryptographic material for various Lightning Network operations. /// - /// If the implementor of this trait supports [phantom node payments], then every node that is - /// intended to be included in the phantom invoice route hints must return the same value from - /// this method. + /// This key set is used for: + /// - Encrypting and decrypting inbound payment metadata + /// - Authenticating payment hashes (both LDK-provided and user-provided) + /// - Supporting BOLT 12 Offers functionality (key derivation and authentication) + /// - Authenticating spontaneous payments' metadata /// /// This method must return the same value each time it is called. /// + /// If the implementor of this trait supports [phantom node payments], then every node that is + /// intended to be included in the phantom invoice route hints must return the same value from + /// this method. This is because LDK avoids storing inbound payment data. Instead, this key + /// is used to construct a payment secret which is received in the payment onion and used to + /// reconstruct the payment preimage. Therefore, for a payment to be receivable by multiple + /// nodes, they must share the same key. + /// /// [phantom node payments]: PhantomKeysManager - pub get_inbound_payment_key: extern "C" fn (this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey, + pub get_expanded_key: extern "C" fn (this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey, + /// Defines a method to derive a 32-byte encryption key for peer storage. + /// + /// Implementations of this method must derive a secure encryption key. + /// The key is used to encrypt or decrypt backups of our state stored with our peers. + /// + /// Thus, if you wish to rely on recovery using this method, you should use a key which + /// can be re-derived from data which would be available after state loss (eg the wallet seed). + pub get_peer_storage_key: extern "C" fn (this_arg: *const c_void) -> crate::lightning::sign::PeerStorageKey, + /// Returns the [`ReceiveAuthKey`] used to authenticate incoming [`BlindedMessagePath`] contexts. + /// + /// This key is used as additional associated data (AAD) during MAC verification of the + /// [`MessageContext`] at the final hop of a blinded path. It ensures that only paths + /// constructed by this node will be accepted, preventing unauthorized parties from forging + /// valid-looking messages. + /// + /// Implementers must ensure that this key remains secret and consistent across invocations. + /// + /// [`BlindedMessagePath`]: crate::blinded_path::message::BlindedMessagePath + /// [`MessageContext`]: crate::blinded_path::message::MessageContext + pub get_receive_auth_key: extern "C" fn (this_arg: *const c_void) -> crate::lightning::sign::ReceiveAuthKey, /// Get node id based on the provided [`Recipient`]. /// /// This method must return the same value each time it is called with a given [`Recipient`] @@ -1658,6 +1910,16 @@ pub struct NodeSigner { /// 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_ECDSASignatureNoneZ, + /// Sign an arbitrary message with the node's secret key. + /// + /// Creates a digital signature of a message given the node's secret. The message is prefixed + /// with \"Lightning Signed Message:\" before signing. See [this description of the format](https://web.archive.org/web/20191010011846/https://twitter.com/rusty_twit/status/1182102005914800128) + /// for more details. + /// + /// A receiver knowing the node's id and the message can be sure that the signature was generated by the caller. + /// An `Err` can be returned to signal that the signer is unavailable / cannot produce a valid + /// signature. + pub sign_message: extern "C" fn (this_arg: *const c_void, msg: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StrNoneZ, /// 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, @@ -1668,20 +1930,31 @@ unsafe impl Sync for NodeSigner {} pub(crate) fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner { NodeSigner { this_arg: orig.this_arg, - get_inbound_payment_key: Clone::clone(&orig.get_inbound_payment_key), + get_expanded_key: Clone::clone(&orig.get_expanded_key), + get_peer_storage_key: Clone::clone(&orig.get_peer_storage_key), + get_receive_auth_key: Clone::clone(&orig.get_receive_auth_key), get_node_id: Clone::clone(&orig.get_node_id), ecdh: Clone::clone(&orig.ecdh), sign_invoice: Clone::clone(&orig.sign_invoice), sign_bolt12_invoice: Clone::clone(&orig.sign_bolt12_invoice), sign_gossip_message: Clone::clone(&orig.sign_gossip_message), + sign_message: Clone::clone(&orig.sign_message), free: Clone::clone(&orig.free), } } use lightning::sign::NodeSigner as rustNodeSigner; impl rustNodeSigner for NodeSigner { - fn get_inbound_payment_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { - let mut ret = (self.get_inbound_payment_key)(self.this_arg); + fn get_expanded_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { + let mut ret = (self.get_expanded_key)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn get_peer_storage_key(&self) -> lightning::sign::PeerStorageKey { + let mut ret = (self.get_peer_storage_key)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn get_receive_auth_key(&self) -> lightning::sign::ReceiveAuthKey { + let mut ret = (self.get_receive_auth_key)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } fn get_node_id(&self, mut recipient: lightning::sign::Recipient) -> Result { @@ -1710,12 +1983,26 @@ 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_message(&self, mut msg: &[u8]) -> Result { + let mut local_msg = crate::c_types::u8slice::from_slice(msg); + let mut ret = (self.sign_message)(self.this_arg, local_msg); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_string() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } } pub struct NodeSignerRef(NodeSigner); impl rustNodeSigner for NodeSignerRef { - fn get_inbound_payment_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { - let mut ret = (self.0.get_inbound_payment_key)(self.0.this_arg); + fn get_expanded_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { + let mut ret = (self.0.get_expanded_key)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn get_peer_storage_key(&self) -> lightning::sign::PeerStorageKey { + let mut ret = (self.0.get_peer_storage_key)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn get_receive_auth_key(&self) -> lightning::sign::ReceiveAuthKey { + let mut ret = (self.0.get_receive_auth_key)(self.0.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } fn get_node_id(&self, mut recipient: lightning::sign::Recipient) -> Result { @@ -1744,6 +2031,12 @@ impl rustNodeSigner for NodeSignerRef { 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_message(&self, mut msg: &[u8]) -> Result { + let mut local_msg = crate::c_types::u8slice::from_slice(msg); + let mut ret = (self.0.sign_message)(self.0.this_arg, local_msg); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_string() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -1806,7 +2099,7 @@ pub(crate) fn OutputSpender_clone_fields(orig: &OutputSpender) -> OutputSpender use lightning::sign::OutputSpender as rustOutputSpender; impl rustOutputSpender for OutputSpender { - fn spend_spendable_outputs(&self, mut descriptors: &[&lightning::sign::SpendableOutputDescriptor], mut outputs: Vec, mut change_destination_script: bitcoin::script::ScriptBuf, mut feerate_sat_per_1000_weight: u32, mut locktime: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + fn spend_spendable_outputs(&self, mut descriptors: &[&lightning::sign::SpendableOutputDescriptor], mut outputs: Vec, mut change_destination_script: bitcoin::script::ScriptBuf, mut feerate_sat_per_1000_weight: u32, mut locktime: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { let mut local_descriptors = Vec::new(); for item in descriptors.iter() { local_descriptors.push( { crate::lightning::sign::SpendableOutputDescriptor::from_native((*item)) }); }; let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::c_types::TxOut::from_rust(&item) }); }; let mut local_locktime = if locktime.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { locktime.unwrap().to_consensus_u32() }) }; @@ -1818,7 +2111,7 @@ impl rustOutputSpender for OutputSpender { pub struct OutputSpenderRef(OutputSpender); impl rustOutputSpender for OutputSpenderRef { - fn spend_spendable_outputs(&self, mut descriptors: &[&lightning::sign::SpendableOutputDescriptor], mut outputs: Vec, mut change_destination_script: bitcoin::script::ScriptBuf, mut feerate_sat_per_1000_weight: u32, mut locktime: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + fn spend_spendable_outputs(&self, mut descriptors: &[&lightning::sign::SpendableOutputDescriptor], mut outputs: Vec, mut change_destination_script: bitcoin::script::ScriptBuf, mut feerate_sat_per_1000_weight: u32, mut locktime: Option, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { let mut local_descriptors = Vec::new(); for item in descriptors.iter() { local_descriptors.push( { crate::lightning::sign::SpendableOutputDescriptor::from_native((*item)) }); }; let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::c_types::TxOut::from_rust(&item) }); }; let mut local_locktime = if locktime.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { locktime.unwrap().to_consensus_u32() }) }; @@ -1863,28 +2156,14 @@ pub struct SignerProvider { /// `channel_keys_id`. /// /// This method must return a different value each time it is called. - pub generate_channel_keys_id: extern "C" fn (this_arg: *const c_void, inbound: bool, channel_value_satoshis: u64, user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes, + pub generate_channel_keys_id: extern "C" fn (this_arg: *const c_void, inbound: bool, user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes, /// Derives the private key material backing a `Signer`. /// /// To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through /// [`SignerProvider::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be /// re-derived from its `channel_keys_id`, which can be obtained through its trait method /// [`ChannelSigner::channel_keys_id`]. - pub derive_channel_signer: extern "C" fn (this_arg: *const c_void, channel_value_satoshis: u64, channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner, - /// Reads a [`Signer`] for this [`SignerProvider`] from the given input stream. - /// This is only called during deserialization of other objects which contain - /// [`EcdsaChannelSigner`]-implementing objects (i.e., [`ChannelMonitor`]s and [`ChannelManager`]s). - /// The bytes are exactly those which `::write()` writes, and - /// contain no versioning scheme. You may wish to include your own version prefix and ensure - /// you've read all of the provided bytes to ensure no corruption occurred. - /// - /// This method is slowly being phased out -- it will only be called when reading objects - /// written by LDK versions prior to 0.0.113. - /// - /// [`Signer`]: Self::EcdsaSigner - /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor - /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - pub read_chan_signer: extern "C" fn (this_arg: *const c_void, reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_EcdsaChannelSignerDecodeErrorZ, + pub derive_channel_signer: extern "C" fn (this_arg: *const c_void, channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner, /// Get a script pubkey which we send funds to when claiming on-chain contestable outputs. /// /// If this function returns an error, this will result in a channel failing to open. @@ -1914,7 +2193,6 @@ pub(crate) fn SignerProvider_clone_fields(orig: &SignerProvider) -> SignerProvid this_arg: orig.this_arg, generate_channel_keys_id: Clone::clone(&orig.generate_channel_keys_id), derive_channel_signer: Clone::clone(&orig.derive_channel_signer), - read_chan_signer: Clone::clone(&orig.read_chan_signer), get_destination_script: Clone::clone(&orig.get_destination_script), get_shutdown_scriptpubkey: Clone::clone(&orig.get_shutdown_scriptpubkey), free: Clone::clone(&orig.free), @@ -1924,20 +2202,14 @@ pub(crate) fn SignerProvider_clone_fields(orig: &SignerProvider) -> SignerProvid use lightning::sign::SignerProvider as rustSignerProvider; impl rustSignerProvider for SignerProvider { type EcdsaSigner = crate::lightning::sign::ecdsa::EcdsaChannelSigner; - fn generate_channel_keys_id(&self, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: u128) -> [u8; 32] { - let mut ret = (self.generate_channel_keys_id)(self.this_arg, inbound, channel_value_satoshis, user_channel_id.into()); + fn generate_channel_keys_id(&self, mut inbound: bool, mut user_channel_id: u128) -> [u8; 32] { + let mut ret = (self.generate_channel_keys_id)(self.this_arg, inbound, user_channel_id.into()); ret.data } - fn derive_channel_signer(&self, mut channel_value_satoshis: u64, mut channel_keys_id: [u8; 32]) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = (self.derive_channel_signer)(self.this_arg, channel_value_satoshis, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); + fn derive_channel_signer(&self, mut channel_keys_id: [u8; 32]) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { + let mut ret = (self.derive_channel_signer)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); ret } - fn read_chan_signer(&self, mut reader: &[u8]) -> Result { - let mut local_reader = crate::c_types::u8slice::from_slice(reader); - let mut ret = (self.read_chan_signer)(self.this_arg, local_reader); - 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)) }).into_native() })}; - local_ret - } fn get_destination_script(&self, mut channel_keys_id: [u8; 32]) -> Result { let mut ret = (self.get_destination_script)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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)) })*/ })}; @@ -1953,20 +2225,14 @@ impl rustSignerProvider for SignerProvider { pub struct SignerProviderRef(SignerProvider); impl rustSignerProvider for SignerProviderRef { type EcdsaSigner = crate::lightning::sign::ecdsa::EcdsaChannelSigner; - fn generate_channel_keys_id(&self, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: u128) -> [u8; 32] { - let mut ret = (self.0.generate_channel_keys_id)(self.0.this_arg, inbound, channel_value_satoshis, user_channel_id.into()); + fn generate_channel_keys_id(&self, mut inbound: bool, mut user_channel_id: u128) -> [u8; 32] { + let mut ret = (self.0.generate_channel_keys_id)(self.0.this_arg, inbound, user_channel_id.into()); ret.data } - fn derive_channel_signer(&self, mut channel_value_satoshis: u64, mut channel_keys_id: [u8; 32]) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = (self.0.derive_channel_signer)(self.0.this_arg, channel_value_satoshis, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); + fn derive_channel_signer(&self, mut channel_keys_id: [u8; 32]) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { + let mut ret = (self.0.derive_channel_signer)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); ret } - fn read_chan_signer(&self, mut reader: &[u8]) -> Result { - let mut local_reader = crate::c_types::u8slice::from_slice(reader); - let mut ret = (self.0.read_chan_signer)(self.0.this_arg, local_reader); - 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)) }).into_native() })}; - local_ret - } fn get_destination_script(&self, mut channel_keys_id: [u8; 32]) -> Result { let mut ret = (self.0.get_destination_script)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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)) })*/ })}; @@ -2002,10 +2268,9 @@ impl Drop for SignerProvider { } } } -/// A helper trait that describes an on-chain wallet capable of returning a (change) destination -/// script. +/// A synchronous helper trait that describes an on-chain wallet capable of returning a (change) destination script. #[repr(C)] -pub struct ChangeDestinationSource { +pub struct ChangeDestinationSourceSync { /// 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, @@ -2019,19 +2284,19 @@ pub struct ChangeDestinationSource { /// 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 ChangeDestinationSource {} -unsafe impl Sync for ChangeDestinationSource {} +unsafe impl Send for ChangeDestinationSourceSync {} +unsafe impl Sync for ChangeDestinationSourceSync {} #[allow(unused)] -pub(crate) fn ChangeDestinationSource_clone_fields(orig: &ChangeDestinationSource) -> ChangeDestinationSource { - ChangeDestinationSource { +pub(crate) fn ChangeDestinationSourceSync_clone_fields(orig: &ChangeDestinationSourceSync) -> ChangeDestinationSourceSync { + ChangeDestinationSourceSync { this_arg: orig.this_arg, get_change_destination_script: Clone::clone(&orig.get_change_destination_script), free: Clone::clone(&orig.free), } } -use lightning::sign::ChangeDestinationSource as rustChangeDestinationSource; -impl rustChangeDestinationSource for ChangeDestinationSource { +use lightning::sign::ChangeDestinationSourceSync as rustChangeDestinationSourceSync; +impl rustChangeDestinationSourceSync for ChangeDestinationSourceSync { fn get_change_destination_script(&self) -> Result { let mut ret = (self.get_change_destination_script)(self.this_arg); let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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)) })*/ })}; @@ -2039,8 +2304,8 @@ impl rustChangeDestinationSource for ChangeDestinationSource { } } -pub struct ChangeDestinationSourceRef(ChangeDestinationSource); -impl rustChangeDestinationSource for ChangeDestinationSourceRef { +pub struct ChangeDestinationSourceSyncRef(ChangeDestinationSourceSync); +impl rustChangeDestinationSourceSync for ChangeDestinationSourceSyncRef { fn get_change_destination_script(&self) -> Result { let mut ret = (self.0.get_change_destination_script)(self.0.this_arg); let mut local_ret = match ret.result_ok { true => Ok( { ::bitcoin::script::ScriptBuf::from((*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)) })*/ })}; @@ -2050,21 +2315,21 @@ impl rustChangeDestinationSource for ChangeDestinationSourceRef { // 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 ChangeDestinationSource { - type Target = ChangeDestinationSourceRef; +impl core::ops::Deref for ChangeDestinationSourceSync { + type Target = ChangeDestinationSourceSyncRef; fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const ChangeDestinationSourceRef) } + unsafe { &*(self as *const _ as *const ChangeDestinationSourceSyncRef) } } } -impl core::ops::DerefMut for ChangeDestinationSource { - fn deref_mut(&mut self) -> &mut ChangeDestinationSourceRef { - unsafe { &mut *(self as *mut _ as *mut ChangeDestinationSourceRef) } +impl core::ops::DerefMut for ChangeDestinationSourceSync { + fn deref_mut(&mut self) -> &mut ChangeDestinationSourceSyncRef { + unsafe { &mut *(self as *mut _ as *mut ChangeDestinationSourceSyncRef) } } } /// Calls the free function if one is set #[no_mangle] -pub extern "C" fn ChangeDestinationSource_free(this_ptr: ChangeDestinationSource) { } -impl Drop for ChangeDestinationSource { +pub extern "C" fn ChangeDestinationSourceSync_free(this_ptr: ChangeDestinationSourceSync) { } +impl Drop for ChangeDestinationSourceSync { fn drop(&mut self) { if let Some(f) = self.free { f(self.this_arg); @@ -2072,6 +2337,111 @@ impl Drop for ChangeDestinationSource { } } +use lightning::sign::ChangeDestinationSourceSyncWrapper as nativeChangeDestinationSourceSyncWrapperImport; +pub(crate) type nativeChangeDestinationSourceSyncWrapper = nativeChangeDestinationSourceSyncWrapperImport; + +/// A wrapper around [`ChangeDestinationSource`] to allow for async calls. +/// +/// You should likely never use this directly but rather allow LDK to build this when required to +/// build higher-level sync wrappers. +#[must_use] +#[repr(C)] +pub struct ChangeDestinationSourceSyncWrapper { + /// 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 nativeChangeDestinationSourceSyncWrapper, + /// 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 core::ops::Deref for ChangeDestinationSourceSyncWrapper { + type Target = nativeChangeDestinationSourceSyncWrapper; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ChangeDestinationSourceSyncWrapper { } +unsafe impl core::marker::Sync for ChangeDestinationSourceSyncWrapper { } +impl Drop for ChangeDestinationSourceSyncWrapper { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChangeDestinationSourceSyncWrapper>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChangeDestinationSourceSyncWrapper, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChangeDestinationSourceSyncWrapper_free(this_obj: ChangeDestinationSourceSyncWrapper) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChangeDestinationSourceSyncWrapper_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChangeDestinationSourceSyncWrapper) }; +} +#[allow(unused)] +impl ChangeDestinationSourceSyncWrapper { + pub(crate) fn get_native_ref(&self) -> &'static nativeChangeDestinationSourceSyncWrapper { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChangeDestinationSourceSyncWrapper { + 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 nativeChangeDestinationSourceSyncWrapper { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Creates a new [`ChangeDestinationSourceSyncWrapper`]. +#[must_use] +#[no_mangle] +pub extern "C" fn ChangeDestinationSourceSyncWrapper_new(mut source: crate::lightning::sign::ChangeDestinationSourceSync) -> crate::lightning::sign::ChangeDestinationSourceSyncWrapper { + let mut ret = lightning::sign::ChangeDestinationSourceSyncWrapper::new(source); + crate::lightning::sign::ChangeDestinationSourceSyncWrapper { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +mod sealed { + +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}; + +} +/// Computes the tweak to apply to the base funding key of a channel. +/// +/// The tweak is computed similar to existing tweaks used in +/// [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation): +/// +/// 1. We use the txid of the funding transaction the splice transaction is spending instead of the +/// `per_commitment_point` to guarantee uniqueness. +/// 2. We include the private key instead of the public key to guarantee only those with knowledge +/// of it can re-derive the new funding key. +/// +/// tweak = SHA256(splice_parent_funding_txid || base_funding_secret_key) +/// tweaked_funding_key = base_funding_key + tweak +/// +/// While the use of this tweak is not required (signers may choose to compute a tweak of their +/// choice), signers must ensure their tweak guarantees the two properties mentioned above: +/// uniqueness and derivable only by one or both of the channel participants. +#[no_mangle] +pub extern "C" fn compute_funding_key_tweak(base_funding_secret_key: *const [u8; 32], splice_parent_funding_txid: *const [u8; 32]) -> crate::c_types::BigEndianScalar { + let mut ret = lightning::sign::compute_funding_key_tweak(&::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *base_funding_secret_key}[..]).unwrap(), &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*splice_parent_funding_txid }[..]).unwrap()); + crate::c_types::BigEndianScalar::from_rust(&ret) +} + + use lightning::sign::InMemorySigner as nativeInMemorySignerImport; pub(crate) type nativeInMemorySigner = nativeInMemorySignerImport; @@ -2134,23 +2504,10 @@ impl InMemorySigner { Self { inner: self.inner, is_owned: false } } } -/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the -/// holder's anchor output in a commitment transaction, if one is present. -#[no_mangle] -pub extern "C" fn InMemorySigner_get_funding_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_key; - inner_val.as_ref() -} -/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the -/// holder's anchor output in a commitment transaction, if one is present. -#[no_mangle] -pub extern "C" fn InMemorySigner_set_funding_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_key = val.into_rust(); -} /// Holder secret key for blinded revocation pubkey. #[no_mangle] pub extern "C" fn InMemorySigner_get_revocation_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_base_key; + let mut inner_val = &mut InMemorySigner::get_native_mut_ref(this_ptr).revocation_base_key; inner_val.as_ref() } /// Holder secret key for blinded revocation pubkey. @@ -2158,21 +2515,10 @@ pub extern "C" fn InMemorySigner_get_revocation_base_key(this_ptr: &InMemorySign pub extern "C" fn InMemorySigner_set_revocation_base_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_base_key = val.into_rust(); } -/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions. -#[no_mangle] -pub extern "C" fn InMemorySigner_get_payment_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_key; - inner_val.as_ref() -} -/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions. -#[no_mangle] -pub extern "C" fn InMemorySigner_set_payment_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_key = val.into_rust(); -} /// Holder secret key used in an HTLC transaction. #[no_mangle] pub extern "C" fn InMemorySigner_get_delayed_payment_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_base_key; + let mut inner_val = &mut InMemorySigner::get_native_mut_ref(this_ptr).delayed_payment_base_key; inner_val.as_ref() } /// Holder secret key used in an HTLC transaction. @@ -2183,7 +2529,7 @@ pub extern "C" fn InMemorySigner_set_delayed_payment_base_key(this_ptr: &mut InM /// Holder HTLC secret key used in commitment transaction HTLC outputs. #[no_mangle] pub extern "C" fn InMemorySigner_get_htlc_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_base_key; + let mut inner_val = &mut InMemorySigner::get_native_mut_ref(this_ptr).htlc_base_key; inner_val.as_ref() } /// Holder HTLC secret key used in commitment transaction HTLC outputs. @@ -2194,7 +2540,7 @@ pub extern "C" fn InMemorySigner_set_htlc_base_key(this_ptr: &mut InMemorySigner /// Commitment seed. #[no_mangle] pub extern "C" fn InMemorySigner_get_commitment_seed(this_ptr: &InMemorySigner) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_seed; + let mut inner_val = &mut InMemorySigner::get_native_mut_ref(this_ptr).commitment_seed; inner_val } /// Commitment seed. @@ -2206,7 +2552,7 @@ impl Clone for InMemorySigner { fn clone(&self) -> Self { Self { inner: if <*mut nativeInMemorySigner>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2214,117 +2560,21 @@ impl Clone for InMemorySigner { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InMemorySigner_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInMemorySigner)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInMemorySigner) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InMemorySigner pub extern "C" fn InMemorySigner_clone(orig: &InMemorySigner) -> InMemorySigner { - orig.clone() + Clone::clone(orig) } -/// Creates a new [`InMemorySigner`]. -#[must_use] -#[no_mangle] -pub extern "C" fn InMemorySigner_new(mut funding_key: crate::c_types::SecretKey, mut revocation_base_key: crate::c_types::SecretKey, mut payment_key: crate::c_types::SecretKey, mut delayed_payment_base_key: crate::c_types::SecretKey, mut htlc_base_key: crate::c_types::SecretKey, mut commitment_seed: crate::c_types::ThirtyTwoBytes, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes, mut rand_bytes_unique_start: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::InMemorySigner { - let mut ret = lightning::sign::InMemorySigner::new(secp256k1::global::SECP256K1, funding_key.into_rust(), revocation_base_key.into_rust(), payment_key.into_rust(), delayed_payment_base_key.into_rust(), htlc_base_key.into_rust(), commitment_seed.data, channel_value_satoshis, channel_keys_id.data, rand_bytes_unique_start.data); - crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Returns the counterparty's pubkeys. -/// -/// 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(); - 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 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) -> crate::c_types::derived::COption_u16Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.counterparty_selected_contest_delay(); - 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 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) -> crate::c_types::derived::COption_u16Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.holder_selected_contest_delay(); - 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 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) -> crate::c_types::derived::COption_boolZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_outbound(); - 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 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(); - 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 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(); - 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 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 +/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the +/// holder's anchor output in a commitment transaction, if one is present. #[must_use] #[no_mangle] -pub extern "C" fn InMemorySigner_channel_type_features(this_arg: &crate::lightning::sign::InMemorySigner) -> crate::lightning_types::features::ChannelTypeFeatures { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_type_features(); - let mut local_ret = crate::lightning_types::features::ChannelTypeFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning_types::features::ChannelTypeFeatures<>) as *mut _ }, is_owned: false }; - local_ret +pub extern "C" fn InMemorySigner_funding_key(this_arg: &crate::lightning::sign::InMemorySigner, mut splice_parent_funding_txid: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> crate::c_types::SecretKey { + let mut local_splice_parent_funding_txid = { /*splice_parent_funding_txid*/ let splice_parent_funding_txid_opt = splice_parent_funding_txid; if splice_parent_funding_txid_opt.is_none() { None } else { Some({ { ::bitcoin::hash_types::Txid::from_slice(&{ splice_parent_funding_txid_opt.take() }.data[..]).unwrap() }})} }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.funding_key(local_splice_parent_funding_txid); + crate::c_types::SecretKey::from_rust(ret) } /// Sign the single input of `spend_tx` at index `input_idx`, which spends the output described @@ -2409,11 +2659,9 @@ pub extern "C" fn InMemorySigner_as_ChannelSigner(this_arg: &InMemorySigner) -> release_commitment_secret: InMemorySigner_ChannelSigner_release_commitment_secret, validate_holder_commitment: InMemorySigner_ChannelSigner_validate_holder_commitment, validate_counterparty_revocation: InMemorySigner_ChannelSigner_validate_counterparty_revocation, - - pubkeys: crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: core::ptr::null_mut(), is_owned: true }.into(), - set_pubkeys: Some(InMemorySigner_ChannelSigner_set_pubkeys), + pubkeys: InMemorySigner_ChannelSigner_pubkeys, + new_funding_pubkey: InMemorySigner_ChannelSigner_new_funding_pubkey, channel_keys_id: InMemorySigner_ChannelSigner_channel_keys_id, - provide_channel_parameters: InMemorySigner_ChannelSigner_provide_channel_parameters, } } @@ -2444,24 +2692,19 @@ extern "C" fn InMemorySigner_ChannelSigner_validate_counterparty_revocation(this } #[must_use] extern "C" fn InMemorySigner_ChannelSigner_pubkeys(this_arg: *const c_void) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { - let mut ret = ::pubkeys(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, ); - 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 ret = ::pubkeys(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, secp256k1::global::SECP256K1); + crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: ObjOps::heap_alloc(ret), is_owned: true } } -extern "C" fn InMemorySigner_ChannelSigner_set_pubkeys(trait_self_arg: &crate::lightning::sign::ChannelSigner) { - // This is a bit race-y in the general case, but for our specific use-cases today, we're safe - // Specifically, we must ensure that the first time we're called it can never be in parallel - if unsafe { &*trait_self_arg.pubkeys.get() }.inner.is_null() { - *unsafe { &mut *(&*(trait_self_arg as *const crate::lightning::sign::ChannelSigner)).pubkeys.get() } = InMemorySigner_ChannelSigner_pubkeys(trait_self_arg.this_arg).into(); - } +#[must_use] +extern "C" fn InMemorySigner_ChannelSigner_new_funding_pubkey(this_arg: *const c_void, mut splice_parent_funding_txid: crate::c_types::ThirtyTwoBytes) -> crate::c_types::PublicKey { + let mut ret = ::new_funding_pubkey(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, ::bitcoin::hash_types::Txid::from_slice(&splice_parent_funding_txid.data[..]).unwrap(), secp256k1::global::SECP256K1); + crate::c_types::PublicKey::from_rust(&ret) } #[must_use] extern "C" fn InMemorySigner_ChannelSigner_channel_keys_id(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes { let mut ret = ::channel_keys_id(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, ); crate::c_types::ThirtyTwoBytes { data: ret } } -extern "C" fn InMemorySigner_ChannelSigner_provide_channel_parameters(this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) { - ::provide_channel_parameters(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref()) -} impl From for crate::lightning::sign::ecdsa::EcdsaChannelSigner { fn from(obj: nativeInMemorySigner) -> Self { @@ -2480,16 +2723,71 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner crate::lightning::sign::ecdsa::EcdsaChannelSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - sign_counterparty_commitment: InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment, - sign_holder_commitment: InMemorySigner_EcdsaChannelSigner_sign_holder_commitment, - sign_justice_revoked_output: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_output, - sign_justice_revoked_htlc: InMemorySigner_EcdsaChannelSigner_sign_justice_revoked_htlc, - sign_holder_htlc_transaction: InMemorySigner_EcdsaChannelSigner_sign_holder_htlc_transaction, - sign_counterparty_htlc_transaction: InMemorySigner_EcdsaChannelSigner_sign_counterparty_htlc_transaction, - sign_closing_transaction: InMemorySigner_EcdsaChannelSigner_sign_closing_transaction, - sign_holder_anchor_input: InMemorySigner_EcdsaChannelSigner_sign_holder_anchor_input, - sign_channel_announcement_with_funding_key: InMemorySigner_EcdsaChannelSigner_sign_channel_announcement_with_funding_key, - sign_splicing_funding_input: InMemorySigner_EcdsaChannelSigner_sign_splicing_funding_input, + BaseEcdsaChannelSigner: crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + sign_counterparty_commitment: InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_commitment, + sign_holder_commitment: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_commitment, + sign_justice_revoked_output: InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_output, + sign_justice_revoked_htlc: InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_htlc, + sign_holder_htlc_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_htlc_transaction, + sign_counterparty_htlc_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_htlc_transaction, + sign_closing_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_closing_transaction, + sign_holder_keyed_anchor_input: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_keyed_anchor_input, + sign_channel_announcement_with_funding_key: InMemorySigner_BaseEcdsaChannelSigner_sign_channel_announcement_with_funding_key, + sign_splice_shared_input: InMemorySigner_BaseEcdsaChannelSigner_sign_splice_shared_input, + ChannelSigner: crate::lightning::sign::ChannelSigner { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + get_per_commitment_point: InMemorySigner_ChannelSigner_get_per_commitment_point, + release_commitment_secret: InMemorySigner_ChannelSigner_release_commitment_secret, + validate_holder_commitment: InMemorySigner_ChannelSigner_validate_holder_commitment, + validate_counterparty_revocation: InMemorySigner_ChannelSigner_validate_counterparty_revocation, + pubkeys: InMemorySigner_ChannelSigner_pubkeys, + new_funding_pubkey: InMemorySigner_ChannelSigner_new_funding_pubkey, + channel_keys_id: InMemorySigner_ChannelSigner_channel_keys_id, + }, + }, + cloned: Some(EcdsaChannelSigner_InMemorySigner_cloned), + } +} + +extern "C" fn EcdsaChannelSigner_InMemorySigner_cloned(new_obj: &mut crate::lightning::sign::ecdsa::EcdsaChannelSigner) { + new_obj.this_arg = InMemorySigner_clone_void(new_obj.this_arg); + new_obj.free = Some(InMemorySigner_free_void); + new_obj.BaseEcdsaChannelSigner.this_arg = new_obj.this_arg; + new_obj.BaseEcdsaChannelSigner.free = None; + new_obj.BaseEcdsaChannelSigner.ChannelSigner.this_arg = new_obj.this_arg; + new_obj.BaseEcdsaChannelSigner.ChannelSigner.free = None; +} + +impl From for crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner { + fn from(obj: nativeInMemorySigner) -> Self { + let rust_obj = crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = InMemorySigner_as_BaseEcdsaChannelSigner(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(InMemorySigner_free_void); + ret + } +} +/// Constructs a new BaseEcdsaChannelSigner which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned BaseEcdsaChannelSigner must be freed before this_arg is +#[no_mangle] +pub extern "C" fn InMemorySigner_as_BaseEcdsaChannelSigner(this_arg: &InMemorySigner) -> crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner { + crate::lightning::sign::ecdsa::BaseEcdsaChannelSigner { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + sign_counterparty_commitment: InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_commitment, + sign_holder_commitment: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_commitment, + sign_justice_revoked_output: InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_output, + sign_justice_revoked_htlc: InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_htlc, + sign_holder_htlc_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_htlc_transaction, + sign_counterparty_htlc_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_htlc_transaction, + sign_closing_transaction: InMemorySigner_BaseEcdsaChannelSigner_sign_closing_transaction, + sign_holder_keyed_anchor_input: InMemorySigner_BaseEcdsaChannelSigner_sign_holder_keyed_anchor_input, + sign_channel_announcement_with_funding_key: InMemorySigner_BaseEcdsaChannelSigner_sign_channel_announcement_with_funding_key, + sign_splice_shared_input: InMemorySigner_BaseEcdsaChannelSigner_sign_splice_shared_input, ChannelSigner: crate::lightning::sign::ChannelSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, @@ -2497,102 +2795,75 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner release_commitment_secret: InMemorySigner_ChannelSigner_release_commitment_secret, validate_holder_commitment: InMemorySigner_ChannelSigner_validate_holder_commitment, validate_counterparty_revocation: InMemorySigner_ChannelSigner_validate_counterparty_revocation, - - pubkeys: crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: core::ptr::null_mut(), is_owned: true }.into(), - set_pubkeys: Some(InMemorySigner_ChannelSigner_set_pubkeys), + pubkeys: InMemorySigner_ChannelSigner_pubkeys, + new_funding_pubkey: InMemorySigner_ChannelSigner_new_funding_pubkey, channel_keys_id: InMemorySigner_ChannelSigner_channel_keys_id, - provide_channel_parameters: InMemorySigner_ChannelSigner_provide_channel_parameters, }, - cloned: Some(EcdsaChannelSigner_InMemorySigner_cloned), } } #[must_use] -extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, mut outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_commitment(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, mut outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.into_rust().drain(..) { local_inbound_htlc_preimages.push( { ::lightning::types::payment::PaymentPreimage(item.data) }); }; let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.into_rust().drain(..) { local_outbound_htlc_preimages.push( { ::lightning::types::payment::PaymentPreimage(item.data) }); }; - let mut ret = ::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), local_inbound_htlc_preimages, local_outbound_htlc_preimages, secp256k1::global::SECP256K1); + let mut ret = ::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref(), commitment_tx.get_native_ref(), local_inbound_htlc_preimages, local_outbound_htlc_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::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_holder_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { - let mut ret = ::sign_holder_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), secp256k1::global::SECP256K1); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_holder_commitment(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { + let mut ret = ::sign_holder_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref(), commitment_tx.get_native_ref(), secp256k1::global::SECP256K1); 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_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); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_output(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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) }, channel_parameters.get_native_ref(), &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::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_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); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_justice_revoked_htlc(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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) }, channel_parameters.get_native_ref(), &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::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::sign::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); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_holder_htlc_transaction(this_arg: *const c_void, mut htlc_tx: crate::c_types::Transaction, mut input: usize, htlc_descriptor: &crate::lightning::sign::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::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_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); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_counterparty_htlc_transaction(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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) }, channel_parameters.get_native_ref(), &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::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_ECDSASignatureNoneZ { - let mut ret = ::sign_closing_transaction(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, closing_tx.get_native_ref(), secp256k1::global::SECP256K1); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_closing_transaction(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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) }, channel_parameters.get_native_ref(), 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::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_ECDSASignatureNoneZ { - let mut ret = ::sign_holder_anchor_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &anchor_tx.into_bitcoin(), input, secp256k1::global::SECP256K1); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_holder_keyed_anchor_input(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, mut anchor_tx: crate::c_types::Transaction, mut input: usize) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { + let mut ret = ::sign_holder_keyed_anchor_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref(), &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::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_ECDSASignatureNoneZ { - let mut ret = ::sign_channel_announcement_with_funding_key(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, msg.get_native_ref(), secp256k1::global::SECP256K1); +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_channel_announcement_with_funding_key(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, 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) }, channel_parameters.get_native_ref(), msg.get_native_ref(), secp256k1::global::SECP256K1); 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_splicing_funding_input(this_arg: *const c_void, mut tx: crate::c_types::Transaction, mut input_index: usize, mut input_value: u64) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { - let mut ret = ::sign_splicing_funding_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &tx.into_bitcoin(), input_index, input_value, secp256k1::global::SECP256K1); - 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 -} -extern "C" fn EcdsaChannelSigner_InMemorySigner_cloned(new_obj: &mut crate::lightning::sign::ecdsa::EcdsaChannelSigner) { - new_obj.this_arg = InMemorySigner_clone_void(new_obj.this_arg); - new_obj.free = Some(InMemorySigner_free_void); - new_obj.ChannelSigner.this_arg = new_obj.this_arg; - new_obj.ChannelSigner.free = None; +extern "C" fn InMemorySigner_BaseEcdsaChannelSigner_sign_splice_shared_input(this_arg: *const c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters, mut tx: crate::c_types::Transaction, mut input_index: usize) -> crate::c_types::ECDSASignature { + let mut ret = ::sign_splice_shared_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref(), &tx.into_bitcoin(), input_index, secp256k1::global::SECP256K1); + crate::c_types::ECDSASignature::from_rust(&ret) } -#[no_mangle] -/// Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read -pub extern "C" fn InMemorySigner_write(obj: &crate::lightning::sign::InMemorySigner) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn InMemorySigner_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::sign::nativeInMemorySigner) }) -} -#[no_mangle] -/// Read a InMemorySigner from a byte array, created by InMemorySigner_write -pub extern "C" fn InMemorySigner_read(ser: crate::c_types::u8slice, arg: crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_InMemorySignerDecodeErrorZ { - let arg_conv = arg; - let res: Result = crate::c_types::deserialize_obj_arg(ser, arg_conv); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::sign::InMemorySigner { 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::sign::KeysManager as nativeKeysManagerImport; pub(crate) type nativeKeysManager = nativeKeysManagerImport; @@ -2681,11 +2952,16 @@ impl KeysManager { /// [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required /// for any channel, and some on-chain during-closing funds. /// +/// If `v2_remote_key_derivation` is set, the `script_pubkey`s which receive funds on-chain when +/// our counterparty force-closes will be one of a static set of [`STATIC_PAYMENT_KEY_COUNT`]*2 +/// possible `script_pubkey`s. This only applies to new or spliced channels, however if this is +/// set you *MUST NOT* downgrade to a version of LDK prior to 0.2. +/// /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32) -> crate::lightning::sign::KeysManager { - let mut ret = lightning::sign::KeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos); +pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32, mut v2_remote_key_derivation: bool) -> crate::lightning::sign::KeysManager { + let mut ret = lightning::sign::KeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos, v2_remote_key_derivation); crate::lightning::sign::KeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2697,11 +2973,30 @@ pub extern "C" fn KeysManager_get_node_secret_key(this_arg: &crate::lightning::s crate::c_types::SecretKey::from_rust(ret) } +/// Gets the set of possible `script_pubkey`s which can appear on chain for our +/// non-HTLC-encumbered balance if our counterparty force-closes a channel. +/// +/// If you've lost all data except your seed, asking your peers nicely to force-close the +/// chanels they had with you (and hoping they don't broadcast a stale state and that there are +/// no pending HTLCs in the latest state) and scanning the chain for these `script_pubkey`s can +/// allow you to recover (some of) your funds. +/// +/// Only channels opened when using a [`KeysManager`] with the `v2_remote_key_derivation` +/// argument to [`KeysManager::new`] set, or any spliced channels will close to such scripts, +/// other channels will close to a randomly-generated `script_pubkey`. +#[must_use] +#[no_mangle] +pub extern "C" fn KeysManager_possible_v2_counterparty_closed_balance_spks(this_arg: &crate::lightning::sign::KeysManager) -> crate::c_types::derived::CVec_CVec_u8ZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.possible_v2_counterparty_closed_balance_spks(secp256k1::global::SECP256K1); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { item.to_bytes().into() }); }; + local_ret.into() +} + /// Derive an old [`EcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. #[must_use] #[no_mangle] -pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::sign::KeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::sign::InMemorySigner { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(channel_value_satoshis, unsafe { &*params}); +pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::sign::KeysManager, params: *const [u8; 32]) -> crate::lightning::sign::InMemorySigner { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(unsafe { &*params}); crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2766,21 +3061,34 @@ pub extern "C" fn KeysManager_as_NodeSigner(this_arg: &KeysManager) -> crate::li crate::lightning::sign::NodeSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_inbound_payment_key: KeysManager_NodeSigner_get_inbound_payment_key, + get_expanded_key: KeysManager_NodeSigner_get_expanded_key, + get_peer_storage_key: KeysManager_NodeSigner_get_peer_storage_key, + get_receive_auth_key: KeysManager_NodeSigner_get_receive_auth_key, get_node_id: KeysManager_NodeSigner_get_node_id, ecdh: KeysManager_NodeSigner_ecdh, sign_invoice: KeysManager_NodeSigner_sign_invoice, sign_bolt12_invoice: KeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: KeysManager_NodeSigner_sign_gossip_message, + sign_message: KeysManager_NodeSigner_sign_message, } } #[must_use] -extern "C" fn KeysManager_NodeSigner_get_inbound_payment_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { - let mut ret = ::get_inbound_payment_key(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); +extern "C" fn KeysManager_NodeSigner_get_expanded_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { + let mut ret = ::get_expanded_key(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] +extern "C" fn KeysManager_NodeSigner_get_peer_storage_key(this_arg: *const c_void) -> crate::lightning::sign::PeerStorageKey { + let mut ret = ::get_peer_storage_key(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); + crate::lightning::sign::PeerStorageKey { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn KeysManager_NodeSigner_get_receive_auth_key(this_arg: *const c_void) -> crate::lightning::sign::ReceiveAuthKey { + let mut ret = ::get_receive_auth_key(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); + crate::lightning::sign::ReceiveAuthKey { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] extern "C" fn KeysManager_NodeSigner_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ { let mut ret = ::get_node_id(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, recipient.into_native()); 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( { () /*e*/ }).into() }; @@ -2811,6 +3119,12 @@ extern "C" fn KeysManager_NodeSigner_sign_gossip_message(this_arg: *const c_void 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 KeysManager_NodeSigner_sign_message(this_arg: *const c_void, mut msg: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StrNoneZ { + let mut ret = ::sign_message(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, msg.to_slice()); + 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( { () /*e*/ }).into() }; + local_ret +} impl From for crate::lightning::sign::OutputSpender { fn from(obj: nativeKeysManager) -> Self { @@ -2862,29 +3176,22 @@ pub extern "C" fn KeysManager_as_SignerProvider(this_arg: &KeysManager) -> crate free: None, generate_channel_keys_id: KeysManager_SignerProvider_generate_channel_keys_id, derive_channel_signer: KeysManager_SignerProvider_derive_channel_signer, - read_chan_signer: KeysManager_SignerProvider_read_chan_signer, get_destination_script: KeysManager_SignerProvider_get_destination_script, get_shutdown_scriptpubkey: KeysManager_SignerProvider_get_shutdown_scriptpubkey, } } #[must_use] -extern "C" fn KeysManager_SignerProvider_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { - let mut ret = ::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, inbound, channel_value_satoshis, user_channel_id.into()); +extern "C" fn KeysManager_SignerProvider_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { + let mut ret = ::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, inbound, user_channel_id.into()); crate::c_types::ThirtyTwoBytes { data: ret } } #[must_use] -extern "C" fn KeysManager_SignerProvider_derive_channel_signer(this_arg: *const c_void, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = ::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, channel_value_satoshis, channel_keys_id.data); +extern "C" fn KeysManager_SignerProvider_derive_channel_signer(this_arg: *const c_void, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { + let mut ret = ::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, channel_keys_id.data); Into::into(ret) } #[must_use] -extern "C" fn KeysManager_SignerProvider_read_chan_signer(this_arg: *const c_void, mut reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_EcdsaChannelSignerDecodeErrorZ { - let mut ret = ::read_chan_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, reader.to_slice()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_ret -} -#[must_use] extern "C" fn KeysManager_SignerProvider_get_destination_script(this_arg: *const c_void, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ { let mut ret = ::get_destination_script(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, channel_keys_id.data); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.to_bytes().into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -3015,21 +3322,34 @@ pub extern "C" fn PhantomKeysManager_as_NodeSigner(this_arg: &PhantomKeysManager crate::lightning::sign::NodeSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_inbound_payment_key: PhantomKeysManager_NodeSigner_get_inbound_payment_key, + get_expanded_key: PhantomKeysManager_NodeSigner_get_expanded_key, + get_peer_storage_key: PhantomKeysManager_NodeSigner_get_peer_storage_key, + get_receive_auth_key: PhantomKeysManager_NodeSigner_get_receive_auth_key, get_node_id: PhantomKeysManager_NodeSigner_get_node_id, ecdh: PhantomKeysManager_NodeSigner_ecdh, sign_invoice: PhantomKeysManager_NodeSigner_sign_invoice, sign_bolt12_invoice: PhantomKeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: PhantomKeysManager_NodeSigner_sign_gossip_message, + sign_message: PhantomKeysManager_NodeSigner_sign_message, } } #[must_use] -extern "C" fn PhantomKeysManager_NodeSigner_get_inbound_payment_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { - let mut ret = ::get_inbound_payment_key(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); +extern "C" fn PhantomKeysManager_NodeSigner_get_expanded_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { + let mut ret = ::get_expanded_key(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] +extern "C" fn PhantomKeysManager_NodeSigner_get_peer_storage_key(this_arg: *const c_void) -> crate::lightning::sign::PeerStorageKey { + let mut ret = ::get_peer_storage_key(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); + crate::lightning::sign::PeerStorageKey { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn PhantomKeysManager_NodeSigner_get_receive_auth_key(this_arg: *const c_void) -> crate::lightning::sign::ReceiveAuthKey { + let mut ret = ::get_receive_auth_key(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); + crate::lightning::sign::ReceiveAuthKey { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] extern "C" fn PhantomKeysManager_NodeSigner_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ { let mut ret = ::get_node_id(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, recipient.into_native()); 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( { () /*e*/ }).into() }; @@ -3060,6 +3380,12 @@ extern "C" fn PhantomKeysManager_NodeSigner_sign_gossip_message(this_arg: *const 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 PhantomKeysManager_NodeSigner_sign_message(this_arg: *const c_void, mut msg: crate::c_types::u8slice) -> crate::c_types::derived::CResult_StrNoneZ { + let mut ret = ::sign_message(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, msg.to_slice()); + 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( { () /*e*/ }).into() }; + local_ret +} impl From for crate::lightning::sign::OutputSpender { fn from(obj: nativePhantomKeysManager) -> Self { @@ -3111,29 +3437,22 @@ pub extern "C" fn PhantomKeysManager_as_SignerProvider(this_arg: &PhantomKeysMan free: None, generate_channel_keys_id: PhantomKeysManager_SignerProvider_generate_channel_keys_id, derive_channel_signer: PhantomKeysManager_SignerProvider_derive_channel_signer, - read_chan_signer: PhantomKeysManager_SignerProvider_read_chan_signer, get_destination_script: PhantomKeysManager_SignerProvider_get_destination_script, get_shutdown_scriptpubkey: PhantomKeysManager_SignerProvider_get_shutdown_scriptpubkey, } } #[must_use] -extern "C" fn PhantomKeysManager_SignerProvider_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { - let mut ret = ::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, inbound, channel_value_satoshis, user_channel_id.into()); +extern "C" fn PhantomKeysManager_SignerProvider_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { + let mut ret = ::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, inbound, user_channel_id.into()); crate::c_types::ThirtyTwoBytes { data: ret } } #[must_use] -extern "C" fn PhantomKeysManager_SignerProvider_derive_channel_signer(this_arg: *const c_void, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { - let mut ret = ::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, channel_value_satoshis, channel_keys_id.data); +extern "C" fn PhantomKeysManager_SignerProvider_derive_channel_signer(this_arg: *const c_void, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::sign::ecdsa::EcdsaChannelSigner { + let mut ret = ::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, channel_keys_id.data); Into::into(ret) } #[must_use] -extern "C" fn PhantomKeysManager_SignerProvider_read_chan_signer(this_arg: *const c_void, mut reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_EcdsaChannelSignerDecodeErrorZ { - let mut ret = ::read_chan_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, reader.to_slice()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { Into::into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_ret -} -#[must_use] extern "C" fn PhantomKeysManager_SignerProvider_get_destination_script(this_arg: *const c_void, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_CVec_u8ZNoneZ { let mut ret = ::get_destination_script(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, channel_keys_id.data); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { o.to_bytes().into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -3150,8 +3469,8 @@ extern "C" fn PhantomKeysManager_SignerProvider_get_shutdown_scriptpubkey(this_a /// that is shared across all nodes that intend to participate in [phantom node payments] /// together. /// -/// See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and -/// `starting_time_nanos`. +/// See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, +/// `starting_time_nanos`, and `v2_remote_key_derivation`. /// /// `cross_node_seed` must be the same across all phantom payment-receiving nodes and also the /// same across restarts, or else inbound payments may fail. @@ -3159,16 +3478,16 @@ extern "C" fn PhantomKeysManager_SignerProvider_get_shutdown_scriptpubkey(this_a /// [phantom node payments]: PhantomKeysManager #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32, cross_node_seed: *const [u8; 32]) -> crate::lightning::sign::PhantomKeysManager { - let mut ret = lightning::sign::PhantomKeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos, unsafe { &*cross_node_seed}); +pub extern "C" fn PhantomKeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32, cross_node_seed: *const [u8; 32], mut v2_remote_key_derivation: bool) -> crate::lightning::sign::PhantomKeysManager { + let mut ret = lightning::sign::PhantomKeysManager::new(unsafe { &*seed}, starting_time_secs, starting_time_nanos, unsafe { &*cross_node_seed}, v2_remote_key_derivation); crate::lightning::sign::PhantomKeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// See [`KeysManager::derive_channel_keys`] for documentation on this method. #[must_use] #[no_mangle] -pub extern "C" fn PhantomKeysManager_derive_channel_keys(this_arg: &crate::lightning::sign::PhantomKeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::sign::InMemorySigner { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(channel_value_satoshis, unsafe { &*params}); +pub extern "C" fn PhantomKeysManager_derive_channel_keys(this_arg: &crate::lightning::sign::PhantomKeysManager, params: *const [u8; 32]) -> crate::lightning::sign::InMemorySigner { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.derive_channel_keys(unsafe { &*params}); crate::lightning::sign::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps1/mod.rs b/lightning-c-bindings/src/lightning/sign/tx_builder.rs similarity index 82% rename from lightning-c-bindings/src/lightning_liquidity/lsps1/mod.rs rename to lightning-c-bindings/src/lightning/sign/tx_builder.rs index 959b6bd7..a4a16fd7 100644 --- a/lightning-c-bindings/src/lightning_liquidity/lsps1/mod.rs +++ b/lightning-c-bindings/src/lightning/sign/tx_builder.rs @@ -6,7 +6,7 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! Types and primitives that implement the bLIP-51 / LSPS1: Channel Request specification. +//! Defines the `TxBuilder` trait, and the `SpecTxBuilder` type use alloc::str::FromStr; use alloc::string::String; @@ -17,6 +17,3 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod client; -pub mod event; -pub mod msgs; diff --git a/lightning-c-bindings/src/lightning/util/anchor_channel_reserves.rs b/lightning-c-bindings/src/lightning/util/anchor_channel_reserves.rs new file mode 100644 index 00000000..27335b39 --- /dev/null +++ b/lightning-c-bindings/src/lightning/util/anchor_channel_reserves.rs @@ -0,0 +1,231 @@ +// 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. + +//! Defines anchor channel reserve requirements. +//! +//! The Lightning protocol advances the state of the channel based on commitment and HTLC +//! transactions, which allow each participant to unilaterally close the channel with the correct +//! state and resolve pending HTLCs on-chain. Originally, these transactions are signed by both +//! counterparties over the entire transaction and therefore contain a fixed fee, which can be +//! updated with the `update_fee` message by the funder. However, these fees can lead to +//! disagreements and can diverge from the prevailing fee rate if a party is disconnected. +//! +//! To address these issues, fees are provided exogenously for anchor output channels. +//! Anchor outputs are negotiated on channel opening to add outputs to each commitment transaction. +//! These outputs can be spent in a child transaction with additional fees to incentivize the +//! mining of the parent transaction, this technique is called Child Pays For Parent (CPFP). +//! Similarly, HTLC transactions will be signed with `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` so +//! additional inputs and outputs can be added to pay for fees. +//! +//! UTXO reserves will therefore be required to supply commitment transactions and HTLC +//! transactions with fees to be confirmed in a timely manner. If HTLCs are not resolved +//! appropriately, it can lead to loss of funds of the in-flight HLTCs as mentioned above. Only +//! partially satisfying UTXO requirements incurs the risk of not being able to resolve a subset of +//! HTLCs. + +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::util::anchor_channel_reserves::AnchorChannelReserveContext as nativeAnchorChannelReserveContextImport; +pub(crate) type nativeAnchorChannelReserveContext = nativeAnchorChannelReserveContextImport; + +/// Parameters defining the context around the anchor channel reserve requirement calculation. +#[must_use] +#[repr(C)] +pub struct AnchorChannelReserveContext { + /// 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 nativeAnchorChannelReserveContext, + /// 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 core::ops::Deref for AnchorChannelReserveContext { + type Target = nativeAnchorChannelReserveContext; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for AnchorChannelReserveContext { } +unsafe impl core::marker::Sync for AnchorChannelReserveContext { } +impl Drop for AnchorChannelReserveContext { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeAnchorChannelReserveContext>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the AnchorChannelReserveContext, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_free(this_obj: AnchorChannelReserveContext) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AnchorChannelReserveContext_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAnchorChannelReserveContext) }; +} +#[allow(unused)] +impl AnchorChannelReserveContext { + pub(crate) fn get_native_ref(&self) -> &'static nativeAnchorChannelReserveContext { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeAnchorChannelReserveContext { + 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 nativeAnchorChannelReserveContext { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The expected number of accepted in-flight HTLCs per channel. +/// +/// Note that malicious counterparties can saturate the number of accepted in-flight HTLCs up to +/// the maximum prior to forcing a unilateral closure. This estimate can include that case as a +/// weighted average, assuming some percentage of channels are controlled by malicious peers and +/// have the maximum number of accepted in-flight HTLCs. +/// +/// See [ChannelHandshakeConfig::our_max_accepted_htlcs] to configure the maximum number of +/// accepted in-flight HTLCs. +/// +/// [ChannelHandshakeConfig::our_max_accepted_htlcs]: crate::util::config::ChannelHandshakeConfig::our_max_accepted_htlcs +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_get_expected_accepted_htlcs(this_ptr: &AnchorChannelReserveContext) -> u16 { + let mut inner_val = &mut AnchorChannelReserveContext::get_native_mut_ref(this_ptr).expected_accepted_htlcs; + *inner_val +} +/// The expected number of accepted in-flight HTLCs per channel. +/// +/// Note that malicious counterparties can saturate the number of accepted in-flight HTLCs up to +/// the maximum prior to forcing a unilateral closure. This estimate can include that case as a +/// weighted average, assuming some percentage of channels are controlled by malicious peers and +/// have the maximum number of accepted in-flight HTLCs. +/// +/// See [ChannelHandshakeConfig::our_max_accepted_htlcs] to configure the maximum number of +/// accepted in-flight HTLCs. +/// +/// [ChannelHandshakeConfig::our_max_accepted_htlcs]: crate::util::config::ChannelHandshakeConfig::our_max_accepted_htlcs +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_set_expected_accepted_htlcs(this_ptr: &mut AnchorChannelReserveContext, mut val: u16) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.expected_accepted_htlcs = val; +} +/// Whether the wallet handling anchor channel reserves creates Taproot P2TR outputs for any new +/// outputs, or Segwit P2WPKH outputs otherwise. +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_get_taproot_wallet(this_ptr: &AnchorChannelReserveContext) -> bool { + let mut inner_val = &mut AnchorChannelReserveContext::get_native_mut_ref(this_ptr).taproot_wallet; + *inner_val +} +/// Whether the wallet handling anchor channel reserves creates Taproot P2TR outputs for any new +/// outputs, or Segwit P2WPKH outputs otherwise. +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_set_taproot_wallet(this_ptr: &mut AnchorChannelReserveContext, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.taproot_wallet = val; +} +impl Clone for AnchorChannelReserveContext { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeAnchorChannelReserveContext>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 AnchorChannelReserveContext_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeAnchorChannelReserveContext) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the AnchorChannelReserveContext +pub extern "C" fn AnchorChannelReserveContext_clone(orig: &AnchorChannelReserveContext) -> AnchorChannelReserveContext { + Clone::clone(orig) +} +/// Get a string which allows debug introspection of a AnchorChannelReserveContext object +pub extern "C" fn AnchorChannelReserveContext_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::anchor_channel_reserves::AnchorChannelReserveContext }).into()} +/// Checks if two AnchorChannelReserveContexts 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 AnchorChannelReserveContext_eq(a: &AnchorChannelReserveContext, b: &AnchorChannelReserveContext) -> 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 } +} +/// Creates a "default" AnchorChannelReserveContext. See struct and individual field documentaiton for details on which values are used. +#[must_use] +#[no_mangle] +pub extern "C" fn AnchorChannelReserveContext_default() -> AnchorChannelReserveContext { + AnchorChannelReserveContext { inner: ObjOps::heap_alloc(Default::default()), is_owned: true } +} +/// Returns the amount that needs to be maintained as a reserve per anchor channel. +/// +/// This reserve currently needs to be allocated as a disjoint set of at least 1 UTXO per channel, +/// as claims are not yet aggregated across channels. +/// +/// To only require 1 UTXO per channel, it is assumed that, on average, transactions are able to +/// get confirmed within 1 block with [ConfirmationTarget::UrgentOnChainSweep], or that only a +/// portion of channels will go through unilateral closure at the same time, allowing UTXOs to be +/// shared. Otherwise, multiple UTXOs would be needed per channel: +/// - HTLC time-out transactions with different expiries cannot be aggregated. This could result in +/// many individual transactions that need to be confirmed starting from different, but potentially +/// sequential block heights. +/// - If each transaction takes N blocks to confirm, at least N UTXOs per channel are needed to +/// provide the necessary concurrency. +/// +/// The returned amount includes the fee to spend a single UTXO of the type indicated by +/// [AnchorChannelReserveContext::taproot_wallet]. Larger sets of UTXOs with more complex witnesses +/// will need to include the corresponding fee required to spend them. +/// +/// [ConfirmationTarget::UrgentOnChainSweep]: crate::chain::chaininterface::ConfirmationTarget::UrgentOnChainSweep +#[no_mangle] +pub extern "C" fn get_reserve_per_channel(context: &crate::lightning::util::anchor_channel_reserves::AnchorChannelReserveContext) -> u64 { + let mut ret = lightning::util::anchor_channel_reserves::get_reserve_per_channel(context.get_native_ref()); + ret.to_sat() +} + +/// Calculates the number of anchor channels that can be supported by the reserve provided +/// by `utxos`. +#[no_mangle] +pub extern "C" fn get_supportable_anchor_channels(context: &crate::lightning::util::anchor_channel_reserves::AnchorChannelReserveContext, mut utxos: crate::c_types::derived::CVec_UtxoZ) -> u64 { + let mut local_utxos = Vec::new(); for mut item in utxos.into_rust().drain(..) { local_utxos.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::util::anchor_channel_reserves::get_supportable_anchor_channels(context.get_native_ref(), &local_utxos[..]); + ret +} + +/// Verifies whether the anchor channel reserve provided by `utxos` is sufficient to support +/// an additional anchor channel. +/// +/// This should be verified: +/// - Before opening a new outbound anchor channel with [ChannelManager::create_channel]. +/// - Before accepting a new inbound anchor channel while handling [Event::OpenChannelRequest]. +/// +/// [ChannelManager::create_channel]: crate::ln::channelmanager::ChannelManager::create_channel +/// [Event::OpenChannelRequest]: crate::events::Event::OpenChannelRequest +#[no_mangle] +pub extern "C" fn can_support_additional_anchor_channel(context: &crate::lightning::util::anchor_channel_reserves::AnchorChannelReserveContext, mut utxos: crate::c_types::derived::CVec_UtxoZ, a_channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor) -> bool { + let mut local_utxos = Vec::new(); for mut item in utxos.into_rust().drain(..) { local_utxos.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; + let mut ret = lightning::util::anchor_channel_reserves::can_support_additional_anchor_channel::, >(context.get_native_ref(), &local_utxos[..], a_channel_manager.as_ref_to(), chain_monitor.get_native_ref()); + ret +} + diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps0/mod.rs b/lightning-c-bindings/src/lightning/util/async_poll.rs similarity index 79% rename from lightning-c-bindings/src/lightning_liquidity/lsps0/mod.rs rename to lightning-c-bindings/src/lightning/util/async_poll.rs index d8911071..c6211b9c 100644 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/mod.rs +++ b/lightning-c-bindings/src/lightning/util/async_poll.rs @@ -6,7 +6,7 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! Types and primitives that implement the bLIP-50 / LSPS0: Transport Layer specification. +//! Some utilities to make working with the standard library's [`Future`]s easier use alloc::str::FromStr; use alloc::string::String; @@ -17,8 +17,3 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod client; -pub mod event; -pub mod msgs; -pub mod ser; -pub mod service; diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index 8baf4250..10be7fba 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -84,6 +84,10 @@ impl ChannelHandshakeConfig { /// Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the /// equivalent limit applied to outbound channels). /// +/// Also used when splicing the channel for the number of confirmations needed before sending a +/// `splice_locked` message to the counterparty. The spliced funds are considered locked in when +/// both parties have exchanged `splice_locked`. +/// /// A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment /// transaction before operation. If you wish to accept channels with zero confirmations, see /// [`UserConfig::manually_accept_inbound_channels`] and @@ -95,13 +99,17 @@ impl ChannelHandshakeConfig { /// [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_minimum_depth(this_ptr: &ChannelHandshakeConfig) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().minimum_depth; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).minimum_depth; *inner_val } /// Confirmations we will wait for before considering the channel locked in. /// Applied only for inbound channels (see [`ChannelHandshakeLimits::max_minimum_depth`] for the /// equivalent limit applied to outbound channels). /// +/// Also used when splicing the channel for the number of confirmations needed before sending a +/// `splice_locked` message to the counterparty. The spliced funds are considered locked in when +/// both parties have exchanged `splice_locked`. +/// /// A lower-bound of `1` is applied, requiring all channels to have a confirmed commitment /// transaction before operation. If you wish to accept channels with zero confirmations, see /// [`UserConfig::manually_accept_inbound_channels`] and @@ -132,7 +140,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_minimum_depth(this_ptr: &mut Channe /// can tweak config to ask for more security, not less.) #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_our_to_self_delay(this_ptr: &ChannelHandshakeConfig) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().our_to_self_delay; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).our_to_self_delay; *inner_val } /// Set to the number of blocks we require our counterparty to wait to claim their money (ie @@ -163,7 +171,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_our_to_self_delay(this_ptr: &mut Ch /// required by the protocol. #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr: &ChannelHandshakeConfig) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().our_htlc_minimum_msat; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).our_htlc_minimum_msat; *inner_val } /// Set to the smallest value HTLC we will accept to process. @@ -204,7 +212,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr: &mu /// Maximum value: `100` (Any values larger will be treated as `100` instead.) #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(this_ptr: &ChannelHandshakeConfig) -> u8 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_inbound_htlc_value_in_flight_percent_of_channel; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).max_inbound_htlc_value_in_flight_percent_of_channel; *inner_val } /// Sets the percentage of the channel value we will cap the total value of outstanding inbound @@ -259,7 +267,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_pe /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_negotiate_scid_privacy(this_ptr: &ChannelHandshakeConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().negotiate_scid_privacy; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).negotiate_scid_privacy; *inner_val } /// If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the @@ -298,7 +306,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_negotiate_scid_privacy(this_ptr: &m /// Default value: `false` #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_announce_for_forwarding(this_ptr: &ChannelHandshakeConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().announce_for_forwarding; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).announce_for_forwarding; *inner_val } /// Set to announce the channel publicly and notify all nodes that they can route via this @@ -329,7 +337,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_announce_for_forwarding(this_ptr: & /// [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(this_ptr: &ChannelHandshakeConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().commit_upfront_shutdown_pubkey; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).commit_upfront_shutdown_pubkey; *inner_val } /// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty @@ -377,7 +385,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(this /// fail in that case.) #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(this_ptr: &ChannelHandshakeConfig) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().their_channel_reserve_proportional_millionths; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).their_channel_reserve_proportional_millionths; *inner_val } /// The Proportion of the channel value to configure as counterparty's channel reserve, @@ -428,19 +436,14 @@ pub extern "C" fn ChannelHandshakeConfig_set_their_channel_reserve_proportional_ /// counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply /// fall back to a `static_remote_key` channel. /// -/// LDK will not support the legacy `option_anchors` commitment version due to a discovered -/// vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee -/// Considered Harmful`] mailing list post. -/// /// Default value: `false` (This value is likely to change to `true` in the future.) /// /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue -/// [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx(this_ptr: &ChannelHandshakeConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().negotiate_anchors_zero_fee_htlc_tx; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).negotiate_anchors_zero_fee_htlc_tx; *inner_val } /// If set, we attempt to negotiate the `anchors_zero_fee_htlc_tx`option for all future @@ -461,20 +464,98 @@ pub extern "C" fn ChannelHandshakeConfig_get_negotiate_anchors_zero_fee_htlc_tx( /// counterparties that do not support the `anchors_zero_fee_htlc_tx` option; we will simply /// fall back to a `static_remote_key` channel. /// -/// LDK will not support the legacy `option_anchors` commitment version due to a discovered -/// vulnerability after its deployment. For more context, see the [`SIGHASH_SINGLE + update_fee -/// Considered Harmful`] mailing list post. -/// /// Default value: `false` (This value is likely to change to `true` in the future.) /// /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel /// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue -/// [`SIGHASH_SINGLE + update_fee Considered Harmful`]: https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx(this_ptr: &mut ChannelHandshakeConfig, mut val: bool) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.negotiate_anchors_zero_fee_htlc_tx = val; } +/// If set, we attempt to negotiate the `zero_fee_commitments` option for all future channels. +/// +/// These channels operate very similarly to the `anchors_zero_fee_htlc` channels but rely on +/// [TRUC] to assign zero fee to the commitment transactions themselves, avoiding many protocol +/// edge-cases involving fee updates and greatly simplifying the concept of your \"balance\" in +/// lightning. +/// +/// Like `anchors_zero_fee_htlc` channels, this feature requires having a reserve of onchain +/// funds readily available to bump transactions in the event of a channel force close to avoid +/// the possibility of losing funds. +/// +/// Note that if you wish accept inbound channels with anchor outputs, you must enable +/// [`UserConfig::manually_accept_inbound_channels`] and manually accept them with +/// [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check +/// whether your reserve of onchain funds is enough to cover the fees for all existing and new +/// channels featuring anchor outputs in the event of a force close. +/// +/// If this option is set, channels may be created that will not be readable by LDK versions +/// prior to 0.2, causing [`ChannelManager`]'s read method to return a +/// [`DecodeError::InvalidValue`]. +/// +/// Note that setting this to true does *not* prevent us from opening channels with +/// counterparties that do not support the `zero_fee_commitments` option; we will simply fall +/// back to a `anchors_zero_fee_htlc` (if [`Self::negotiate_anchors_zero_fee_htlc_tx`] +/// is set) or `static_remote_key` channel. +/// +/// For a force-close transaction to reach miners and get confirmed, +/// zero-fee commitment channels require a path from your Bitcoin node to miners that +/// relays TRUC transactions (BIP 431), P2A outputs, and Ephemeral Dust. Currently, only +/// nodes running Bitcoin Core v29 and above relay transactions with these features. +/// +/// Default value: `false` (This value is likely to change to `true` in the future.) +/// +/// [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/) +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfig_get_negotiate_anchor_zero_fee_commitments(this_ptr: &ChannelHandshakeConfig) -> bool { + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).negotiate_anchor_zero_fee_commitments; + *inner_val +} +/// If set, we attempt to negotiate the `zero_fee_commitments` option for all future channels. +/// +/// These channels operate very similarly to the `anchors_zero_fee_htlc` channels but rely on +/// [TRUC] to assign zero fee to the commitment transactions themselves, avoiding many protocol +/// edge-cases involving fee updates and greatly simplifying the concept of your \"balance\" in +/// lightning. +/// +/// Like `anchors_zero_fee_htlc` channels, this feature requires having a reserve of onchain +/// funds readily available to bump transactions in the event of a channel force close to avoid +/// the possibility of losing funds. +/// +/// Note that if you wish accept inbound channels with anchor outputs, you must enable +/// [`UserConfig::manually_accept_inbound_channels`] and manually accept them with +/// [`ChannelManager::accept_inbound_channel`]. This is done to give you the chance to check +/// whether your reserve of onchain funds is enough to cover the fees for all existing and new +/// channels featuring anchor outputs in the event of a force close. +/// +/// If this option is set, channels may be created that will not be readable by LDK versions +/// prior to 0.2, causing [`ChannelManager`]'s read method to return a +/// [`DecodeError::InvalidValue`]. +/// +/// Note that setting this to true does *not* prevent us from opening channels with +/// counterparties that do not support the `zero_fee_commitments` option; we will simply fall +/// back to a `anchors_zero_fee_htlc` (if [`Self::negotiate_anchors_zero_fee_htlc_tx`] +/// is set) or `static_remote_key` channel. +/// +/// For a force-close transaction to reach miners and get confirmed, +/// zero-fee commitment channels require a path from your Bitcoin node to miners that +/// relays TRUC transactions (BIP 431), P2A outputs, and Ephemeral Dust. Currently, only +/// nodes running Bitcoin Core v29 and above relay transactions with these features. +/// +/// Default value: `false` (This value is likely to change to `true` in the future.) +/// +/// [TRUC]: (https://bitcoinops.org/en/topics/version-3-transaction-relay/) +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel +/// [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfig_set_negotiate_anchor_zero_fee_commitments(this_ptr: &mut ChannelHandshakeConfig, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.negotiate_anchor_zero_fee_commitments = val; +} /// The maximum number of HTLCs in-flight from our counterparty towards us at the same time. /// /// Increasing the value can help improve liquidity and stability in @@ -485,11 +566,13 @@ pub extern "C" fn ChannelHandshakeConfig_set_negotiate_anchors_zero_fee_htlc_tx( /// /// Default value: `50` /// -/// Maximum value: `483` (Any values larger will be treated as `483`. This is the BOLT #2 spec -/// limit on `max_accepted_htlcs`.) +/// Maximum value: depends on channel type, see docs on [`max_htlcs`] (any values over the +/// maximum will be silently reduced to the maximum). +/// +/// [`max_htlcs`]: crate::ln::chan_utils::max_htlcs #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_get_our_max_accepted_htlcs(this_ptr: &ChannelHandshakeConfig) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().our_max_accepted_htlcs; + let mut inner_val = &mut ChannelHandshakeConfig::get_native_mut_ref(this_ptr).our_max_accepted_htlcs; *inner_val } /// The maximum number of HTLCs in-flight from our counterparty towards us at the same time. @@ -502,8 +585,10 @@ pub extern "C" fn ChannelHandshakeConfig_get_our_max_accepted_htlcs(this_ptr: &C /// /// Default value: `50` /// -/// Maximum value: `483` (Any values larger will be treated as `483`. This is the BOLT #2 spec -/// limit on `max_accepted_htlcs`.) +/// Maximum value: depends on channel type, see docs on [`max_htlcs`] (any values over the +/// maximum will be silently reduced to the maximum). +/// +/// [`max_htlcs`]: crate::ln::chan_utils::max_htlcs #[no_mangle] pub extern "C" fn ChannelHandshakeConfig_set_our_max_accepted_htlcs(this_ptr: &mut ChannelHandshakeConfig, mut val: u16) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.our_max_accepted_htlcs = val; @@ -511,7 +596,7 @@ pub extern "C" fn ChannelHandshakeConfig_set_our_max_accepted_htlcs(this_ptr: &m /// Constructs a new ChannelHandshakeConfig given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our_to_self_delay_arg: u16, mut our_htlc_minimum_msat_arg: u64, mut max_inbound_htlc_value_in_flight_percent_of_channel_arg: u8, mut negotiate_scid_privacy_arg: bool, mut announce_for_forwarding_arg: bool, mut commit_upfront_shutdown_pubkey_arg: bool, mut their_channel_reserve_proportional_millionths_arg: u32, mut negotiate_anchors_zero_fee_htlc_tx_arg: bool, mut our_max_accepted_htlcs_arg: u16) -> ChannelHandshakeConfig { +pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our_to_self_delay_arg: u16, mut our_htlc_minimum_msat_arg: u64, mut max_inbound_htlc_value_in_flight_percent_of_channel_arg: u8, mut negotiate_scid_privacy_arg: bool, mut announce_for_forwarding_arg: bool, mut commit_upfront_shutdown_pubkey_arg: bool, mut their_channel_reserve_proportional_millionths_arg: u32, mut negotiate_anchors_zero_fee_htlc_tx_arg: bool, mut negotiate_anchor_zero_fee_commitments_arg: bool, mut our_max_accepted_htlcs_arg: u16) -> ChannelHandshakeConfig { ChannelHandshakeConfig { inner: ObjOps::heap_alloc(nativeChannelHandshakeConfig { minimum_depth: minimum_depth_arg, our_to_self_delay: our_to_self_delay_arg, @@ -522,6 +607,7 @@ pub extern "C" fn ChannelHandshakeConfig_new(mut minimum_depth_arg: u32, mut our commit_upfront_shutdown_pubkey: commit_upfront_shutdown_pubkey_arg, their_channel_reserve_proportional_millionths: their_channel_reserve_proportional_millionths_arg, negotiate_anchors_zero_fee_htlc_tx: negotiate_anchors_zero_fee_htlc_tx_arg, + negotiate_anchor_zero_fee_commitments: negotiate_anchor_zero_fee_commitments_arg, our_max_accepted_htlcs: our_max_accepted_htlcs_arg, }), is_owned: true } } @@ -529,7 +615,7 @@ impl Clone for ChannelHandshakeConfig { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelHandshakeConfig>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -537,12 +623,12 @@ impl Clone for ChannelHandshakeConfig { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelHandshakeConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeConfig)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelHandshakeConfig) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelHandshakeConfig pub extern "C" fn ChannelHandshakeConfig_clone(orig: &ChannelHandshakeConfig) -> ChannelHandshakeConfig { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelHandshakeConfig object pub extern "C" fn ChannelHandshakeConfig_debug_str_void(o: *const c_void) -> Str { @@ -630,7 +716,7 @@ impl ChannelHandshakeLimits { /// (Minimum of [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]) #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_funding_satoshis; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).min_funding_satoshis; *inner_val } /// Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so @@ -648,7 +734,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr: &mut /// Default value: `2^24 - 1` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_max_funding_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_funding_satoshis; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).max_funding_satoshis; *inner_val } /// Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so @@ -665,7 +751,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_funding_satoshis(this_ptr: &mut /// Default value: `u64::max_value` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr: &ChannelHandshakeLimits) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_htlc_minimum_msat; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).max_htlc_minimum_msat; *inner_val } /// The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows @@ -682,7 +768,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr: &mu /// Default value: `0` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr: &ChannelHandshakeLimits) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_max_htlc_value_in_flight_msat; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).min_max_htlc_value_in_flight_msat; *inner_val } /// The remote node sets a limit on the maximum value of pending HTLCs to them at any given @@ -700,7 +786,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(t /// Default value: `u64::max_value`. #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr: &ChannelHandshakeLimits) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_reserve_satoshis; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).max_channel_reserve_satoshis; *inner_val } /// The remote node will require we keep a certain amount in direct payment to ourselves at all @@ -718,7 +804,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_p /// Default value: `0` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr: &ChannelHandshakeLimits) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_max_accepted_htlcs; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).min_max_accepted_htlcs; *inner_val } /// The remote node sets a limit on the maximum number of pending HTLCs to them at any given @@ -737,7 +823,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr: &m /// Default value: `144`, or roughly one day and only applies to outbound channels #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_max_minimum_depth(this_ptr: &ChannelHandshakeLimits) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_minimum_depth; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).max_minimum_depth; *inner_val } /// Before a channel is usable the funding transaction will need to be confirmed by at least a @@ -769,7 +855,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_max_minimum_depth(this_ptr: &mut Ch /// Default value: `true` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_trust_own_funding_0conf(this_ptr: &ChannelHandshakeLimits) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().trust_own_funding_0conf; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).trust_own_funding_0conf; *inner_val } /// Whether we implicitly trust funding transactions generated by us for our own outbound @@ -803,7 +889,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_trust_own_funding_0conf(this_ptr: & /// Default value: `true` #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr: &ChannelHandshakeLimits) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().force_announced_channel_preference; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).force_announced_channel_preference; *inner_val } /// Set to force an incoming channel to match our announced channel preference in @@ -827,7 +913,7 @@ pub extern "C" fn ChannelHandshakeLimits_set_force_announced_channel_preference( /// reduce the loss of having useless locked funds (if your peer accepts) #[no_mangle] pub extern "C" fn ChannelHandshakeLimits_get_their_to_self_delay(this_ptr: &ChannelHandshakeLimits) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().their_to_self_delay; + let mut inner_val = &mut ChannelHandshakeLimits::get_native_mut_ref(this_ptr).their_to_self_delay; *inner_val } /// Set to the amount of time we're willing to wait to claim money back to us. @@ -862,7 +948,7 @@ impl Clone for ChannelHandshakeLimits { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelHandshakeLimits>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -870,12 +956,12 @@ impl Clone for ChannelHandshakeLimits { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelHandshakeLimits_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelHandshakeLimits)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelHandshakeLimits) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelHandshakeLimits pub extern "C" fn ChannelHandshakeLimits_clone(orig: &ChannelHandshakeLimits) -> ChannelHandshakeLimits { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelHandshakeLimits object pub extern "C" fn ChannelHandshakeLimits_debug_str_void(o: *const c_void) -> Str { @@ -923,12 +1009,19 @@ pub enum MaxDustHTLCExposure { /// on HTLC outputs means your channel may be subject to more dust exposure in the event of /// increases in fee rate. /// + /// Note that because zero-commitment-fee anchor channels do not allow for feerate updates (and + /// thus never experience dust exposure changes due to feerate shifts, resulting in no + /// force-closes due to dust exposure limits), such channels will calculate their maximum + /// dust exposure using a constant feerate of 250 sat/KW when using this variant. + /// See [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`] to enable such channels. + /// /// # Backwards Compatibility /// This variant only became available in LDK 0.0.116, so if you downgrade to a prior version /// by default this will be set to a [`Self::FixedLimitMsat`] of 5,000,000 msat. /// /// [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator /// [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate + /// [`ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments`]: ChannelHandshakeConfig::negotiate_anchor_zero_fee_commitments FeeRateMultiplier( u64), } @@ -1124,7 +1217,7 @@ impl ChannelConfig { /// Default value: `0` #[no_mangle] pub extern "C" fn ChannelConfig_get_forwarding_fee_proportional_millionths(this_ptr: &ChannelConfig) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_proportional_millionths; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).forwarding_fee_proportional_millionths; *inner_val } /// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound @@ -1151,7 +1244,7 @@ pub extern "C" fn ChannelConfig_set_forwarding_fee_proportional_millionths(this_ /// [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths #[no_mangle] pub extern "C" fn ChannelConfig_get_forwarding_fee_base_msat(this_ptr: &ChannelConfig) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_base_msat; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).forwarding_fee_base_msat; *inner_val } /// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in @@ -1192,7 +1285,7 @@ pub extern "C" fn ChannelConfig_set_forwarding_fee_base_msat(this_ptr: &mut Chan /// [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA #[no_mangle] pub extern "C" fn ChannelConfig_get_cltv_expiry_delta(this_ptr: &ChannelConfig) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over @@ -1275,7 +1368,7 @@ pub extern "C" fn ChannelConfig_set_cltv_expiry_delta(this_ptr: &mut ChannelConf /// [`ConfirmationTarget::MaximumFeeEstimate`]: crate::chain::chaininterface::ConfirmationTarget::MaximumFeeEstimate #[no_mangle] pub extern "C" fn ChannelConfig_get_max_dust_htlc_exposure(this_ptr: &ChannelConfig) -> crate::lightning::util::config::MaxDustHTLCExposure { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_dust_htlc_exposure; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).max_dust_htlc_exposure; crate::lightning::util::config::MaxDustHTLCExposure::from_native(inner_val) } /// Limit our total exposure to potential loss to on-chain fees on close, including in-flight @@ -1360,7 +1453,7 @@ pub extern "C" fn ChannelConfig_set_max_dust_htlc_exposure(this_ptr: &mut Channe /// [`ChannelCloseMinimum`]: crate::chain::chaininterface::ConfirmationTarget::ChannelCloseMinimum #[no_mangle] pub extern "C" fn ChannelConfig_get_force_close_avoidance_max_fee_satoshis(this_ptr: &ChannelConfig) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_avoidance_max_fee_satoshis; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).force_close_avoidance_max_fee_satoshis; *inner_val } /// The additional fee we're willing to pay to avoid waiting for the counterparty's @@ -1422,7 +1515,7 @@ pub extern "C" fn ChannelConfig_set_force_close_avoidance_max_fee_satoshis(this_ /// [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat #[no_mangle] pub extern "C" fn ChannelConfig_get_accept_underpaying_htlcs(this_ptr: &ChannelConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_underpaying_htlcs; + let mut inner_val = &mut ChannelConfig::get_native_mut_ref(this_ptr).accept_underpaying_htlcs; *inner_val } /// If set, allows this channel's counterparty to skim an additional fee off this node's inbound @@ -1477,7 +1570,7 @@ impl Clone for ChannelConfig { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelConfig>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1485,12 +1578,12 @@ impl Clone for ChannelConfig { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelConfig)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelConfig) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelConfig pub extern "C" fn ChannelConfig_clone(orig: &ChannelConfig) -> ChannelConfig { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ChannelConfig object pub extern "C" fn ChannelConfig_debug_str_void(o: *const c_void) -> Str { @@ -1592,80 +1685,140 @@ impl ChannelConfigUpdate { Self { inner: self.inner, is_owned: false } } } +/// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. See +/// [`ChannelConfig::forwarding_fee_proportional_millionths`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_get_forwarding_fee_proportional_millionths(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_proportional_millionths; + let mut inner_val = &mut ChannelConfigUpdate::get_native_mut_ref(this_ptr).forwarding_fee_proportional_millionths; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } +/// Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. See +/// [`ChannelConfig::forwarding_fee_proportional_millionths`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_set_forwarding_fee_proportional_millionths(this_ptr: &mut ChannelConfigUpdate, mut val: crate::c_types::derived::COption_u32Z) { let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_fee_proportional_millionths = local_val; } +/// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel. See +/// [`ChannelConfig::forwarding_fee_base_msat`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_get_forwarding_fee_base_msat(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_u32Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().forwarding_fee_base_msat; + let mut inner_val = &mut ChannelConfigUpdate::get_native_mut_ref(this_ptr).forwarding_fee_base_msat; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; local_inner_val } +/// Amount (in milli-satoshi) charged for payments forwarded outbound over the channel. See +/// [`ChannelConfig::forwarding_fee_base_msat`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_set_forwarding_fee_base_msat(this_ptr: &mut ChannelConfigUpdate, mut val: crate::c_types::derived::COption_u32Z) { let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.forwarding_fee_base_msat = local_val; } +/// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this +/// config applies to. See [`ChannelConfig::cltv_expiry_delta`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_get_cltv_expiry_delta(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_u16Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut ChannelConfigUpdate::get_native_mut_ref(this_ptr).cltv_expiry_delta; let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; local_inner_val } +/// The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this +/// config applies to. See [`ChannelConfig::cltv_expiry_delta`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_set_cltv_expiry_delta(this_ptr: &mut ChannelConfigUpdate, mut val: crate::c_types::derived::COption_u16Z) { let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.cltv_expiry_delta = local_val; } +/// The total exposure we are willing to allow to dust HTLCs. See [`ChannelConfig::max_dust_htlc_exposure`]. /// /// Returns a copy of the field. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_get_max_dust_htlc_exposure_msat(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_MaxDustHTLCExposureZ { - let mut inner_val = this_ptr.get_native_mut_ref().max_dust_htlc_exposure_msat.clone(); + let mut inner_val = ChannelConfigUpdate::get_native_mut_ref(this_ptr).max_dust_htlc_exposure_msat.clone(); let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_MaxDustHTLCExposureZ::None } else { crate::c_types::derived::COption_MaxDustHTLCExposureZ::Some( { crate::lightning::util::config::MaxDustHTLCExposure::native_into(inner_val.unwrap()) }) }; local_inner_val } +/// The total exposure we are willing to allow to dust HTLCs. See [`ChannelConfig::max_dust_htlc_exposure`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_set_max_dust_htlc_exposure_msat(this_ptr: &mut ChannelConfigUpdate, mut val: crate::c_types::derived::COption_MaxDustHTLCExposureZ) { 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) }.max_dust_htlc_exposure_msat = local_val; } +/// The additional fee we're willing to pay to avoid waiting for the counterparty's `to_self_delay` to reclaim +/// funds. See [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_get_force_close_avoidance_max_fee_satoshis(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().force_close_avoidance_max_fee_satoshis; + let mut inner_val = &mut ChannelConfigUpdate::get_native_mut_ref(this_ptr).force_close_avoidance_max_fee_satoshis; 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 additional fee we're willing to pay to avoid waiting for the counterparty's `to_self_delay` to reclaim +/// funds. See [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]. #[no_mangle] pub extern "C" fn ChannelConfigUpdate_set_force_close_avoidance_max_fee_satoshis(this_ptr: &mut ChannelConfigUpdate, 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) }.force_close_avoidance_max_fee_satoshis = local_val; } +/// If set, allows this channel's counterparty to skim an additional fee off this node's inbound HTLCs. See +/// [`ChannelConfig::accept_underpaying_htlcs`]. +#[no_mangle] +pub extern "C" fn ChannelConfigUpdate_get_accept_underpaying_htlcs(this_ptr: &ChannelConfigUpdate) -> crate::c_types::derived::COption_boolZ { + let mut inner_val = &mut ChannelConfigUpdate::get_native_mut_ref(this_ptr).accept_underpaying_htlcs; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_boolZ::None } else { crate::c_types::derived::COption_boolZ::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// If set, allows this channel's counterparty to skim an additional fee off this node's inbound HTLCs. See +/// [`ChannelConfig::accept_underpaying_htlcs`]. +#[no_mangle] +pub extern "C" fn ChannelConfigUpdate_set_accept_underpaying_htlcs(this_ptr: &mut ChannelConfigUpdate, mut val: crate::c_types::derived::COption_boolZ) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_underpaying_htlcs = local_val; +} /// Constructs a new ChannelConfigUpdate given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelConfigUpdate_new(mut forwarding_fee_proportional_millionths_arg: crate::c_types::derived::COption_u32Z, mut forwarding_fee_base_msat_arg: crate::c_types::derived::COption_u32Z, mut cltv_expiry_delta_arg: crate::c_types::derived::COption_u16Z, mut max_dust_htlc_exposure_msat_arg: crate::c_types::derived::COption_MaxDustHTLCExposureZ, mut force_close_avoidance_max_fee_satoshis_arg: crate::c_types::derived::COption_u64Z) -> ChannelConfigUpdate { +pub extern "C" fn ChannelConfigUpdate_new(mut forwarding_fee_proportional_millionths_arg: crate::c_types::derived::COption_u32Z, mut forwarding_fee_base_msat_arg: crate::c_types::derived::COption_u32Z, mut cltv_expiry_delta_arg: crate::c_types::derived::COption_u16Z, mut max_dust_htlc_exposure_msat_arg: crate::c_types::derived::COption_MaxDustHTLCExposureZ, mut force_close_avoidance_max_fee_satoshis_arg: crate::c_types::derived::COption_u64Z, mut accept_underpaying_htlcs_arg: crate::c_types::derived::COption_boolZ) -> ChannelConfigUpdate { let mut local_forwarding_fee_proportional_millionths_arg = if forwarding_fee_proportional_millionths_arg.is_some() { Some( { forwarding_fee_proportional_millionths_arg.take() }) } else { None }; let mut local_forwarding_fee_base_msat_arg = if forwarding_fee_base_msat_arg.is_some() { Some( { forwarding_fee_base_msat_arg.take() }) } else { None }; let mut local_cltv_expiry_delta_arg = if cltv_expiry_delta_arg.is_some() { Some( { cltv_expiry_delta_arg.take() }) } else { None }; let mut local_max_dust_htlc_exposure_msat_arg = { /*max_dust_htlc_exposure_msat_arg*/ let max_dust_htlc_exposure_msat_arg_opt = max_dust_htlc_exposure_msat_arg; if max_dust_htlc_exposure_msat_arg_opt.is_none() { None } else { Some({ { { max_dust_htlc_exposure_msat_arg_opt.take() }.into_native() }})} }; let mut local_force_close_avoidance_max_fee_satoshis_arg = if force_close_avoidance_max_fee_satoshis_arg.is_some() { Some( { force_close_avoidance_max_fee_satoshis_arg.take() }) } else { None }; + let mut local_accept_underpaying_htlcs_arg = if accept_underpaying_htlcs_arg.is_some() { Some( { accept_underpaying_htlcs_arg.take() }) } else { None }; ChannelConfigUpdate { inner: ObjOps::heap_alloc(nativeChannelConfigUpdate { forwarding_fee_proportional_millionths: local_forwarding_fee_proportional_millionths_arg, forwarding_fee_base_msat: local_forwarding_fee_base_msat_arg, cltv_expiry_delta: local_cltv_expiry_delta_arg, max_dust_htlc_exposure_msat: local_max_dust_htlc_exposure_msat_arg, force_close_avoidance_max_fee_satoshis: local_force_close_avoidance_max_fee_satoshis_arg, + accept_underpaying_htlcs: local_accept_underpaying_htlcs_arg, }), is_owned: true } } +impl Clone for ChannelConfigUpdate { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelConfigUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ChannelConfigUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelConfigUpdate) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelConfigUpdate +pub extern "C" fn ChannelConfigUpdate_clone(orig: &ChannelConfigUpdate) -> ChannelConfigUpdate { + Clone::clone(orig) +} +#[no_mangle] +/// Build a ChannelConfigUpdate from a ChannelConfig +pub extern "C" fn ChannelConfigUpdate_from_ChannelConfig(f: crate::lightning::util::config::ChannelConfig) -> crate::lightning::util::config::ChannelConfigUpdate { + let from_obj = *unsafe { Box::from_raw(f.take_inner()) }; + crate::lightning::util::config::ChannelConfigUpdate { inner: ObjOps::heap_alloc((lightning::util::config::ChannelConfigUpdate::from(from_obj))), is_owned: true } +} use lightning::util::config::UserConfig as nativeUserConfigImport; pub(crate) type nativeUserConfig = nativeUserConfigImport; @@ -1732,7 +1885,7 @@ impl UserConfig { /// Channel handshake config that we propose to our counterparty. #[no_mangle] pub extern "C" fn UserConfig_get_channel_handshake_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeConfig { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_handshake_config; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).channel_handshake_config; crate::lightning::util::config::ChannelHandshakeConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelHandshakeConfig<>) as *mut _) }, is_owned: false } } /// Channel handshake config that we propose to our counterparty. @@ -1743,7 +1896,7 @@ pub extern "C" fn UserConfig_set_channel_handshake_config(this_ptr: &mut UserCon /// Limits applied to our counterparty's proposed channel handshake config settings. #[no_mangle] pub extern "C" fn UserConfig_get_channel_handshake_limits(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelHandshakeLimits { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_handshake_limits; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).channel_handshake_limits; crate::lightning::util::config::ChannelHandshakeLimits { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelHandshakeLimits<>) as *mut _) }, is_owned: false } } /// Limits applied to our counterparty's proposed channel handshake config settings. @@ -1754,7 +1907,7 @@ pub extern "C" fn UserConfig_set_channel_handshake_limits(this_ptr: &mut UserCon /// Channel config which affects behavior during channel lifetime. #[no_mangle] pub extern "C" fn UserConfig_get_channel_config(this_ptr: &UserConfig) -> crate::lightning::util::config::ChannelConfig { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_config; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).channel_config; crate::lightning::util::config::ChannelConfig { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::util::config::ChannelConfig<>) as *mut _) }, is_owned: false } } /// Channel config which affects behavior during channel lifetime. @@ -1777,10 +1930,15 @@ pub extern "C" fn UserConfig_set_channel_config(this_ptr: &mut UserConfig, mut v /// all your channels and open new ones. For privacy, you should also change your node_id /// (swapping all private and public key material for new ones) at that time. /// +/// Note that this setting does not apply for intercepted payments that are surfaced via +/// [`Event::HTLCIntercepted`] and manually forwarded. +/// /// Default value: `false` +/// +/// [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted #[no_mangle] pub extern "C" fn UserConfig_get_accept_forwards_to_priv_channels(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_forwards_to_priv_channels; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).accept_forwards_to_priv_channels; *inner_val } /// If this is set to `false`, we will reject any HTLCs which were to be forwarded over private @@ -1798,7 +1956,12 @@ pub extern "C" fn UserConfig_get_accept_forwards_to_priv_channels(this_ptr: &Use /// all your channels and open new ones. For privacy, you should also change your node_id /// (swapping all private and public key material for new ones) at that time. /// +/// Note that this setting does not apply for intercepted payments that are surfaced via +/// [`Event::HTLCIntercepted`] and manually forwarded. +/// /// Default value: `false` +/// +/// [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted #[no_mangle] pub extern "C" fn UserConfig_set_accept_forwards_to_priv_channels(this_ptr: &mut UserConfig, mut val: bool) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_forwards_to_priv_channels = val; @@ -1808,7 +1971,7 @@ pub extern "C" fn UserConfig_set_accept_forwards_to_priv_channels(this_ptr: &mut /// Default value: `true` #[no_mangle] pub extern "C" fn UserConfig_get_accept_inbound_channels(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_inbound_channels; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).accept_inbound_channels; *inner_val } /// If this is set to `false`, we do not accept inbound requests to open a new channel. @@ -1833,7 +1996,7 @@ pub extern "C" fn UserConfig_set_accept_inbound_channels(this_ptr: &mut UserConf /// [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel #[no_mangle] pub extern "C" fn UserConfig_get_manually_accept_inbound_channels(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().manually_accept_inbound_channels; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).manually_accept_inbound_channels; *inner_val } /// If this is set to `true`, the user needs to manually accept inbound requests to open a new @@ -1865,7 +2028,7 @@ pub extern "C" fn UserConfig_set_manually_accept_inbound_channels(this_ptr: &mut /// [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted #[no_mangle] pub extern "C" fn UserConfig_get_accept_intercept_htlcs(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_intercept_htlcs; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).accept_intercept_htlcs; *inner_val } /// If this is set to `true`, LDK will intercept HTLCs that are attempting to be forwarded over @@ -1897,7 +2060,7 @@ pub extern "C" fn UserConfig_set_accept_intercept_htlcs(this_ptr: &mut UserConfi /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment #[no_mangle] pub extern "C" fn UserConfig_get_manually_handle_bolt12_invoices(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().manually_handle_bolt12_invoices; + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).manually_handle_bolt12_invoices; *inner_val } /// If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. @@ -1917,10 +2080,105 @@ pub extern "C" fn UserConfig_get_manually_handle_bolt12_invoices(this_ptr: &User pub extern "C" fn UserConfig_set_manually_handle_bolt12_invoices(this_ptr: &mut UserConfig, mut val: bool) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.manually_handle_bolt12_invoices = val; } +/// LDK supports a feature for always-online nodes such that these nodes can hold onto an HTLC +/// from an often-offline channel peer until the often-offline payment recipient sends an onion +/// message telling the always-online node to release the HTLC. If this is set to `true`, our node +/// will carry out this feature for channel peers that request it. +/// +/// This should only be set to `true` for nodes which expect to be online reliably. +/// +/// Setting this to `true` may break backwards compatibility with LDK versions < 0.2. +/// +/// Default value: `false` +#[no_mangle] +pub extern "C" fn UserConfig_get_enable_htlc_hold(this_ptr: &UserConfig) -> bool { + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).enable_htlc_hold; + *inner_val +} +/// LDK supports a feature for always-online nodes such that these nodes can hold onto an HTLC +/// from an often-offline channel peer until the often-offline payment recipient sends an onion +/// message telling the always-online node to release the HTLC. If this is set to `true`, our node +/// will carry out this feature for channel peers that request it. +/// +/// This should only be set to `true` for nodes which expect to be online reliably. +/// +/// Setting this to `true` may break backwards compatibility with LDK versions < 0.2. +/// +/// Default value: `false` +#[no_mangle] +pub extern "C" fn UserConfig_set_enable_htlc_hold(this_ptr: &mut UserConfig, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.enable_htlc_hold = val; +} +/// If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to +/// pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel +/// counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once +/// the HTLCs are locked in even though the recipient may not yet be online to receive them. +/// +/// This option is intended for usage by private nodes, and should NOT be set if we are an +/// announced node that is expected to be online at all times. +/// +/// Setting this to `true` may lead to HTLC failures if downgrading to LDK versions < 0.2. +/// +/// Default value: `false` +/// +/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice +#[no_mangle] +pub extern "C" fn UserConfig_get_hold_outbound_htlcs_at_next_hop(this_ptr: &UserConfig) -> bool { + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).hold_outbound_htlcs_at_next_hop; + *inner_val +} +/// If this is set to true, then if we as an often-offline payer receive a [`StaticInvoice`] to +/// pay, we will attempt to hold the corresponding outbound HTLCs with our next-hop channel +/// counterparty(s) that support the `htlc_hold` feature. This allows our node to go offline once +/// the HTLCs are locked in even though the recipient may not yet be online to receive them. +/// +/// This option is intended for usage by private nodes, and should NOT be set if we are an +/// announced node that is expected to be online at all times. +/// +/// Setting this to `true` may lead to HTLC failures if downgrading to LDK versions < 0.2. +/// +/// Default value: `false` +/// +/// [`StaticInvoice`]: crate::offers::static_invoice::StaticInvoice +#[no_mangle] +pub extern "C" fn UserConfig_set_hold_outbound_htlcs_at_next_hop(this_ptr: &mut UserConfig, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.hold_outbound_htlcs_at_next_hop = val; +} +/// If this is set to `true`, then inbound channel splice requests will be rejected. This +/// ensures backwards compatibility is not broken with LDK versions < 0.2 while a splice is +/// pending. +/// +/// Outbound channel splice requests (via [`ChannelManager::splice_channel`], an opt-in API) are +/// still allowed as users should be aware of the backwards compatibility risk prior to using +/// the functionality. +/// +/// Default value: `true` +/// +/// [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel +#[no_mangle] +pub extern "C" fn UserConfig_get_reject_inbound_splices(this_ptr: &UserConfig) -> bool { + let mut inner_val = &mut UserConfig::get_native_mut_ref(this_ptr).reject_inbound_splices; + *inner_val +} +/// If this is set to `true`, then inbound channel splice requests will be rejected. This +/// ensures backwards compatibility is not broken with LDK versions < 0.2 while a splice is +/// pending. +/// +/// Outbound channel splice requests (via [`ChannelManager::splice_channel`], an opt-in API) are +/// still allowed as users should be aware of the backwards compatibility risk prior to using +/// the functionality. +/// +/// Default value: `true` +/// +/// [`ChannelManager::splice_channel`]: crate::ln::channelmanager::ChannelManager::splice_channel +#[no_mangle] +pub extern "C" fn UserConfig_set_reject_inbound_splices(this_ptr: &mut UserConfig, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.reject_inbound_splices = val; +} /// Constructs a new UserConfig given each field #[must_use] #[no_mangle] -pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut channel_handshake_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_config_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool, mut accept_inbound_channels_arg: bool, mut manually_accept_inbound_channels_arg: bool, mut accept_intercept_htlcs_arg: bool, mut manually_handle_bolt12_invoices_arg: bool) -> UserConfig { +pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut channel_handshake_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_config_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool, mut accept_inbound_channels_arg: bool, mut manually_accept_inbound_channels_arg: bool, mut accept_intercept_htlcs_arg: bool, mut manually_handle_bolt12_invoices_arg: bool, mut enable_htlc_hold_arg: bool, mut hold_outbound_htlcs_at_next_hop_arg: bool, mut reject_inbound_splices_arg: bool) -> UserConfig { UserConfig { inner: ObjOps::heap_alloc(nativeUserConfig { channel_handshake_config: *unsafe { Box::from_raw(channel_handshake_config_arg.take_inner()) }, channel_handshake_limits: *unsafe { Box::from_raw(channel_handshake_limits_arg.take_inner()) }, @@ -1930,13 +2188,16 @@ pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightn manually_accept_inbound_channels: manually_accept_inbound_channels_arg, accept_intercept_htlcs: accept_intercept_htlcs_arg, manually_handle_bolt12_invoices: manually_handle_bolt12_invoices_arg, + enable_htlc_hold: enable_htlc_hold_arg, + hold_outbound_htlcs_at_next_hop: hold_outbound_htlcs_at_next_hop_arg, + reject_inbound_splices: reject_inbound_splices_arg, }), is_owned: true } } impl Clone for UserConfig { fn clone(&self) -> Self { Self { inner: if <*mut nativeUserConfig>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1944,12 +2205,12 @@ impl Clone for UserConfig { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UserConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUserConfig)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUserConfig) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UserConfig pub extern "C" fn UserConfig_clone(orig: &UserConfig) -> UserConfig { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a UserConfig object pub extern "C" fn UserConfig_debug_str_void(o: *const c_void) -> Str { @@ -1960,3 +2221,328 @@ pub extern "C" fn UserConfig_debug_str_void(o: *const c_void) -> Str { pub extern "C" fn UserConfig_default() -> UserConfig { UserConfig { inner: ObjOps::heap_alloc(Default::default()), is_owned: true } } + +use lightning::util::config::ChannelConfigOverrides as nativeChannelConfigOverridesImport; +pub(crate) type nativeChannelConfigOverrides = nativeChannelConfigOverridesImport; + +/// Config structure for overriding channel parameters. +#[must_use] +#[repr(C)] +pub struct ChannelConfigOverrides { + /// 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 nativeChannelConfigOverrides, + /// 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 core::ops::Deref for ChannelConfigOverrides { + type Target = nativeChannelConfigOverrides; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ChannelConfigOverrides { } +unsafe impl core::marker::Sync for ChannelConfigOverrides { } +impl Drop for ChannelConfigOverrides { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelConfigOverrides>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelConfigOverrides, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelConfigOverrides_free(this_obj: ChannelConfigOverrides) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelConfigOverrides_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelConfigOverrides) }; +} +#[allow(unused)] +impl ChannelConfigOverrides { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelConfigOverrides { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelConfigOverrides { + 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 nativeChannelConfigOverrides { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Overrides for channel handshake parameters. +/// +/// 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 ChannelConfigOverrides_get_handshake_overrides(this_ptr: &ChannelConfigOverrides) -> crate::lightning::util::config::ChannelHandshakeConfigUpdate { + let mut inner_val = &mut ChannelConfigOverrides::get_native_mut_ref(this_ptr).handshake_overrides; + let mut local_inner_val = crate::lightning::util::config::ChannelHandshakeConfigUpdate { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelHandshakeConfigUpdate<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// Overrides for channel handshake parameters. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelConfigOverrides_set_handshake_overrides(this_ptr: &mut ChannelConfigOverrides, mut val: crate::lightning::util::config::ChannelHandshakeConfigUpdate) { + 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) }.handshake_overrides = local_val; +} +/// Overrides for channel update parameters. +/// +/// 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 ChannelConfigOverrides_get_update_overrides(this_ptr: &ChannelConfigOverrides) -> crate::lightning::util::config::ChannelConfigUpdate { + let mut inner_val = &mut ChannelConfigOverrides::get_native_mut_ref(this_ptr).update_overrides; + let mut local_inner_val = crate::lightning::util::config::ChannelConfigUpdate { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::util::config::ChannelConfigUpdate<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// Overrides for channel update parameters. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn ChannelConfigOverrides_set_update_overrides(this_ptr: &mut ChannelConfigOverrides, mut val: crate::lightning::util::config::ChannelConfigUpdate) { + 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) }.update_overrides = local_val; +} +/// Constructs a new ChannelConfigOverrides given each field +/// +/// Note that handshake_overrides_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that update_overrides_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelConfigOverrides_new(mut handshake_overrides_arg: crate::lightning::util::config::ChannelHandshakeConfigUpdate, mut update_overrides_arg: crate::lightning::util::config::ChannelConfigUpdate) -> ChannelConfigOverrides { + let mut local_handshake_overrides_arg = if handshake_overrides_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(handshake_overrides_arg.take_inner()) } }) }; + let mut local_update_overrides_arg = if update_overrides_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(update_overrides_arg.take_inner()) } }) }; + ChannelConfigOverrides { inner: ObjOps::heap_alloc(nativeChannelConfigOverrides { + handshake_overrides: local_handshake_overrides_arg, + update_overrides: local_update_overrides_arg, + }), is_owned: true } +} +impl Clone for ChannelConfigOverrides { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelConfigOverrides>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ChannelConfigOverrides_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelConfigOverrides) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelConfigOverrides +pub extern "C" fn ChannelConfigOverrides_clone(orig: &ChannelConfigOverrides) -> ChannelConfigOverrides { + Clone::clone(orig) +} +/// Applies given channel config overrides to the user config. +#[no_mangle] +pub extern "C" fn UserConfig_apply(this_arg: &mut crate::lightning::util::config::UserConfig, config: &crate::lightning::util::config::ChannelConfigOverrides) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::util::config::nativeUserConfig)) }.apply(config.get_native_ref()) +} + + +use lightning::util::config::ChannelHandshakeConfigUpdate as nativeChannelHandshakeConfigUpdateImport; +pub(crate) type nativeChannelHandshakeConfigUpdate = nativeChannelHandshakeConfigUpdateImport; + +/// Config structure for overriding channel handshake parameters. +#[must_use] +#[repr(C)] +pub struct ChannelHandshakeConfigUpdate { + /// 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 nativeChannelHandshakeConfigUpdate, + /// 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 core::ops::Deref for ChannelHandshakeConfigUpdate { + type Target = nativeChannelHandshakeConfigUpdate; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for ChannelHandshakeConfigUpdate { } +unsafe impl core::marker::Sync for ChannelHandshakeConfigUpdate { } +impl Drop for ChannelHandshakeConfigUpdate { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeChannelHandshakeConfigUpdate>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ChannelHandshakeConfigUpdate, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_free(this_obj: ChannelHandshakeConfigUpdate) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ChannelHandshakeConfigUpdate_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelHandshakeConfigUpdate) }; +} +#[allow(unused)] +impl ChannelHandshakeConfigUpdate { + pub(crate) fn get_native_ref(&self) -> &'static nativeChannelHandshakeConfigUpdate { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeChannelHandshakeConfigUpdate { + 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 nativeChannelHandshakeConfigUpdate { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Overrides the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. See +/// [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_max_inbound_htlc_value_in_flight_percent_of_channel(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u8Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).max_inbound_htlc_value_in_flight_percent_of_channel; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u8Z::None } else { crate::c_types::derived::COption_u8Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// Overrides the percentage of the channel value we will cap the total value of outstanding inbound HTLCs to. See +/// [`ChannelHandshakeConfig::max_inbound_htlc_value_in_flight_percent_of_channel`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_max_inbound_htlc_value_in_flight_percent_of_channel(this_ptr: &mut ChannelHandshakeConfigUpdate, mut val: crate::c_types::derived::COption_u8Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_inbound_htlc_value_in_flight_percent_of_channel = local_val; +} +/// Overrides the smallest value HTLC we will accept to process. See [`ChannelHandshakeConfig::our_htlc_minimum_msat`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_htlc_minimum_msat(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).htlc_minimum_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 +} +/// Overrides the smallest value HTLC we will accept to process. See [`ChannelHandshakeConfig::our_htlc_minimum_msat`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_htlc_minimum_msat(this_ptr: &mut ChannelHandshakeConfigUpdate, 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) }.htlc_minimum_msat = local_val; +} +/// Overrides confirmations we will wait for before considering the channel locked in. See +/// [`ChannelHandshakeConfig::minimum_depth`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_minimum_depth(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).minimum_depth; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// Overrides confirmations we will wait for before considering the channel locked in. See +/// [`ChannelHandshakeConfig::minimum_depth`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_minimum_depth(this_ptr: &mut ChannelHandshakeConfigUpdate, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.minimum_depth = local_val; +} +/// Overrides the number of blocks we require our counterparty to wait to claim their money. See +/// [`ChannelHandshakeConfig::our_to_self_delay`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_to_self_delay(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u16Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).to_self_delay; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// Overrides the number of blocks we require our counterparty to wait to claim their money. See +/// [`ChannelHandshakeConfig::our_to_self_delay`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_to_self_delay(this_ptr: &mut ChannelHandshakeConfigUpdate, mut val: crate::c_types::derived::COption_u16Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.to_self_delay = local_val; +} +/// The maximum number of HTLCs in-flight from our counterparty towards us at the same time. See +/// [`ChannelHandshakeConfig::our_max_accepted_htlcs`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_max_accepted_htlcs(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u16Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).max_accepted_htlcs; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The maximum number of HTLCs in-flight from our counterparty towards us at the same time. See +/// [`ChannelHandshakeConfig::our_max_accepted_htlcs`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_max_accepted_htlcs(this_ptr: &mut ChannelHandshakeConfigUpdate, mut val: crate::c_types::derived::COption_u16Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_accepted_htlcs = local_val; +} +/// The Proportion of the channel value to configure as counterparty's channel reserve. See +/// [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_get_channel_reserve_proportional_millionths(this_ptr: &ChannelHandshakeConfigUpdate) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut ChannelHandshakeConfigUpdate::get_native_mut_ref(this_ptr).channel_reserve_proportional_millionths; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The Proportion of the channel value to configure as counterparty's channel reserve. See +/// [`ChannelHandshakeConfig::their_channel_reserve_proportional_millionths`]. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_set_channel_reserve_proportional_millionths(this_ptr: &mut ChannelHandshakeConfigUpdate, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_reserve_proportional_millionths = local_val; +} +/// Constructs a new ChannelHandshakeConfigUpdate given each field +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfigUpdate_new(mut max_inbound_htlc_value_in_flight_percent_of_channel_arg: crate::c_types::derived::COption_u8Z, mut htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut minimum_depth_arg: crate::c_types::derived::COption_u32Z, mut to_self_delay_arg: crate::c_types::derived::COption_u16Z, mut max_accepted_htlcs_arg: crate::c_types::derived::COption_u16Z, mut channel_reserve_proportional_millionths_arg: crate::c_types::derived::COption_u32Z) -> ChannelHandshakeConfigUpdate { + let mut local_max_inbound_htlc_value_in_flight_percent_of_channel_arg = if max_inbound_htlc_value_in_flight_percent_of_channel_arg.is_some() { Some( { max_inbound_htlc_value_in_flight_percent_of_channel_arg.take() }) } else { None }; + let mut local_htlc_minimum_msat_arg = if htlc_minimum_msat_arg.is_some() { Some( { htlc_minimum_msat_arg.take() }) } else { None }; + let mut local_minimum_depth_arg = if minimum_depth_arg.is_some() { Some( { minimum_depth_arg.take() }) } else { None }; + let mut local_to_self_delay_arg = if to_self_delay_arg.is_some() { Some( { to_self_delay_arg.take() }) } else { None }; + let mut local_max_accepted_htlcs_arg = if max_accepted_htlcs_arg.is_some() { Some( { max_accepted_htlcs_arg.take() }) } else { None }; + let mut local_channel_reserve_proportional_millionths_arg = if channel_reserve_proportional_millionths_arg.is_some() { Some( { channel_reserve_proportional_millionths_arg.take() }) } else { None }; + ChannelHandshakeConfigUpdate { inner: ObjOps::heap_alloc(nativeChannelHandshakeConfigUpdate { + max_inbound_htlc_value_in_flight_percent_of_channel: local_max_inbound_htlc_value_in_flight_percent_of_channel_arg, + htlc_minimum_msat: local_htlc_minimum_msat_arg, + minimum_depth: local_minimum_depth_arg, + to_self_delay: local_to_self_delay_arg, + max_accepted_htlcs: local_max_accepted_htlcs_arg, + channel_reserve_proportional_millionths: local_channel_reserve_proportional_millionths_arg, + }), is_owned: true } +} +impl Clone for ChannelHandshakeConfigUpdate { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeChannelHandshakeConfigUpdate>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 ChannelHandshakeConfigUpdate_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelHandshakeConfigUpdate) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ChannelHandshakeConfigUpdate +pub extern "C" fn ChannelHandshakeConfigUpdate_clone(orig: &ChannelHandshakeConfigUpdate) -> ChannelHandshakeConfigUpdate { + Clone::clone(orig) +} +/// Applies the provided handshake config update. +#[no_mangle] +pub extern "C" fn ChannelHandshakeConfig_apply(this_arg: &mut crate::lightning::util::config::ChannelHandshakeConfig, config: &crate::lightning::util::config::ChannelHandshakeConfigUpdate) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::util::config::nativeChannelHandshakeConfig)) }.apply(config.get_native_ref()) +} + diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index a2057694..f8e16f34 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -223,7 +223,7 @@ impl Record { /// The verbosity level of the message. #[no_mangle] pub extern "C" fn Record_get_level(this_ptr: &Record) -> crate::lightning::util::logger::Level { - let mut inner_val = &mut this_ptr.get_native_mut_ref().level; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).level; crate::lightning::util::logger::Level::from_native(inner_val) } /// The verbosity level of the message. @@ -240,7 +240,7 @@ pub extern "C" fn Record_set_level(this_ptr: &mut Record, mut val: crate::lightn /// 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 Record_get_peer_id(this_ptr: &Record) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().peer_id; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).peer_id; let mut local_inner_val = if inner_val.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(inner_val.unwrap())) } }; local_inner_val } @@ -262,7 +262,7 @@ pub extern "C" fn Record_set_peer_id(this_ptr: &mut Record, mut val: crate::c_ty /// 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 Record_get_channel_id(this_ptr: &Record) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).channel_id; let mut local_inner_val = crate::lightning::ln::types::ChannelId { 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::types::ChannelId<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -278,7 +278,7 @@ pub extern "C" fn Record_set_channel_id(this_ptr: &mut Record, mut val: crate::l /// The message body. #[no_mangle] pub extern "C" fn Record_get_args(this_ptr: &Record) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().args; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).args; inner_val.as_str().into() } /// The message body. @@ -289,7 +289,7 @@ pub extern "C" fn Record_set_args(this_ptr: &mut Record, mut val: crate::c_types /// The module path of the message. #[no_mangle] pub extern "C" fn Record_get_module_path(this_ptr: &Record) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().module_path; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).module_path; inner_val.into() } /// The module path of the message. @@ -300,7 +300,7 @@ pub extern "C" fn Record_set_module_path(this_ptr: &mut Record, mut val: crate:: /// The source file containing the message. #[no_mangle] pub extern "C" fn Record_get_file(this_ptr: &Record) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().file; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).file; inner_val.into() } /// The source file containing the message. @@ -311,7 +311,7 @@ pub extern "C" fn Record_set_file(this_ptr: &mut Record, mut val: crate::c_types /// The line containing the message. #[no_mangle] pub extern "C" fn Record_get_line(this_ptr: &Record) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().line; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).line; *inner_val } /// The line containing the message. @@ -325,7 +325,7 @@ pub extern "C" fn Record_set_line(this_ptr: &mut Record, mut val: u32) { /// `None` for logs which are not directly related to a payment. #[no_mangle] pub extern "C" fn Record_get_payment_hash(this_ptr: &Record) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut inner_val = &mut Record::get_native_mut_ref(this_ptr).payment_hash; 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 } @@ -363,7 +363,7 @@ impl Clone for Record { fn clone(&self) -> Self { Self { inner: if <*mut nativeRecord>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -371,12 +371,12 @@ impl Clone for Record { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Record_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRecord)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRecord) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Record pub extern "C" fn Record_clone(orig: &Record) -> Record { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Record object pub extern "C" fn Record_debug_str_void(o: *const c_void) -> Str { @@ -389,6 +389,10 @@ pub struct Logger { pub this_arg: *mut c_void, /// Logs the [`Record`]. pub log: extern "C" fn (this_arg: *const c_void, record: crate::lightning::util::logger::Record), + /// Called, if set, after this Logger has been cloned into a duplicate object. + /// The new Logger 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, @@ -400,9 +404,27 @@ pub(crate) fn Logger_clone_fields(orig: &Logger) -> Logger { Logger { this_arg: orig.this_arg, log: Clone::clone(&orig.log), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } +#[no_mangle] +/// Creates a copy of a Logger +pub extern "C" fn Logger_clone(orig: &Logger) -> Logger { + let mut res = Logger_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for Logger { + fn clone(&self) -> Self { + Logger_clone(self) + } +} +impl Clone for LoggerRef { + fn clone(&self) -> Self { + Self(Logger_clone(&self.0)) + } +} use lightning::util::logger::Logger as rustLogger; impl rustLogger for Logger { diff --git a/lightning-c-bindings/src/lightning/util/mod.rs b/lightning-c-bindings/src/lightning/util/mod.rs index 4fedbfb0..c98eb1bb 100644 --- a/lightning-c-bindings/src/lightning/util/mod.rs +++ b/lightning-c-bindings/src/lightning/util/mod.rs @@ -18,18 +18,20 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; pub mod ser_macros; +pub mod anchor_channel_reserves; +pub mod async_poll; pub mod errors; -pub mod ser; pub mod message_signing; +pub mod native_async; pub mod persist; pub mod scid_utils; +pub mod ser; pub mod sweep; pub mod wakers; pub mod hash_tables; pub mod indexed_map; -pub mod logger; pub mod config; -pub mod string; +pub mod logger; mod fuzz_wrappers { use alloc::str::FromStr; @@ -65,18 +67,6 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -} -mod async_poll { - -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 byte_utils { diff --git a/lightning-c-bindings/src/lightning/util/string.rs b/lightning-c-bindings/src/lightning/util/native_async.rs similarity index 75% rename from lightning-c-bindings/src/lightning/util/string.rs rename to lightning-c-bindings/src/lightning/util/native_async.rs index 46568ef6..a96aff3c 100644 --- a/lightning-c-bindings/src/lightning/util/string.rs +++ b/lightning-c-bindings/src/lightning/util/native_async.rs @@ -6,11 +6,8 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! Utilities to wrap untrusted strings and handle them (more) safely -//! -//! These re-exports are deprecated in favor of [`lightning::types::string`]. -//! -//! [`lightning::types::string`]: crate::types::string +//! This module contains a few public utility which are used to run LDK in a native Rust async +//! environment. use alloc::str::FromStr; use alloc::string::String; diff --git a/lightning-c-bindings/src/lightning/util/persist.rs b/lightning-c-bindings/src/lightning/util/persist.rs index 4ce71036..aa8df7df 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 [`KVStore`] that +//! This module contains a simple key-value store trait [`KVStoreSync`] that //! allows one to implement the persistence for [`ChannelManager`], [`NetworkGraph`], //! and [`ChannelMonitor`] all in one place. //! //! [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +//! [`NetworkGraph`]: crate::routing::gossip::NetworkGraph use alloc::str::FromStr; use alloc::string::String; @@ -46,8 +47,10 @@ pub static KVSTORE_NAMESPACE_KEY_MAX_LEN: usize = lightning::util::persist::KVST /// **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`. +/// +/// For an asynchronous version of this trait, see [`KVStore`]. #[repr(C)] -pub struct KVStore { +pub struct KVStoreSync { /// 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, @@ -61,21 +64,25 @@ pub struct KVStore { 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, + /// 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::derived::CVec_u8Z) -> 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. + /// [`KVStoreSync::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. /// + /// All removal operations must complete in a consistent total order with [`Self::write`]s + /// to the same key. Whether a removal operation is `lazy` or not, [`Self::write`] operations + /// to the same key which occur before a removal completes must cancel/overwrite the pending + /// removal. + /// /// 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. @@ -86,34 +93,56 @@ pub struct KVStore { /// 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, + /// Called, if set, after this KVStoreSync has been cloned into a duplicate object. + /// The new KVStoreSync 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 KVStore {} -unsafe impl Sync for KVStore {} +unsafe impl Send for KVStoreSync {} +unsafe impl Sync for KVStoreSync {} #[allow(unused)] -pub(crate) fn KVStore_clone_fields(orig: &KVStore) -> KVStore { - KVStore { +pub(crate) fn KVStoreSync_clone_fields(orig: &KVStoreSync) -> KVStoreSync { + KVStoreSync { 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), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } +#[no_mangle] +/// Creates a copy of a KVStoreSync +pub extern "C" fn KVStoreSync_clone(orig: &KVStoreSync) -> KVStoreSync { + let mut res = KVStoreSync_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for KVStoreSync { + fn clone(&self) -> Self { + KVStoreSync_clone(self) + } +} +impl Clone for KVStoreSyncRef { + fn clone(&self) -> Self { + Self(KVStoreSync_clone(&self.0)) + } +} -use lightning::util::persist::KVStore as rustKVStore; -impl rustKVStore for KVStore { +use lightning::util::persist::KVStoreSync as rustKVStoreSync; +impl rustKVStoreSync for KVStoreSync { 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); + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: Vec) -> Result<(), lightning::io::Error> { + let mut local_buf = Vec::new(); for mut item in buf.drain(..) { local_buf.push( { item }); }; + let mut ret = (self.write)(self.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf.into()); 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 } @@ -129,16 +158,16 @@ impl rustKVStore for KVStore { } } -pub struct KVStoreRef(KVStore); -impl rustKVStore for KVStoreRef { +pub struct KVStoreSyncRef(KVStoreSync); +impl rustKVStoreSync for KVStoreSyncRef { fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { let mut ret = (self.0.read)(self.0.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.0.write)(self.0.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: Vec) -> Result<(), lightning::io::Error> { + let mut local_buf = Vec::new(); for mut item in buf.drain(..) { local_buf.push( { item }); }; + let mut ret = (self.0.write)(self.0.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf.into()); 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 } @@ -156,27 +185,124 @@ impl rustKVStore for KVStoreRef { // 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 = KVStoreRef; +impl core::ops::Deref for KVStoreSync { + type Target = KVStoreSyncRef; fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const KVStoreRef) } + unsafe { &*(self as *const _ as *const KVStoreSyncRef) } } } -impl core::ops::DerefMut for KVStore { - fn deref_mut(&mut self) -> &mut KVStoreRef { - unsafe { &mut *(self as *mut _ as *mut KVStoreRef) } +impl core::ops::DerefMut for KVStoreSync { + fn deref_mut(&mut self) -> &mut KVStoreSyncRef { + unsafe { &mut *(self as *mut _ as *mut KVStoreSyncRef) } } } /// Calls the free function if one is set #[no_mangle] -pub extern "C" fn KVStore_free(this_ptr: KVStore) { } -impl Drop for KVStore { +pub extern "C" fn KVStoreSync_free(this_ptr: KVStoreSync) { } +impl Drop for KVStoreSync { fn drop(&mut self) { if let Some(f) = self.free { f(self.this_arg); } } } + +use lightning::util::persist::KVStoreSyncWrapper as nativeKVStoreSyncWrapperImport; +pub(crate) type nativeKVStoreSyncWrapper = nativeKVStoreSyncWrapperImport; + +/// A wrapper around a [`KVStoreSync`] that implements the [`KVStore`] trait. It is not necessary to use this type +/// directly. +#[must_use] +#[repr(C)] +pub struct KVStoreSyncWrapper { + /// 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 nativeKVStoreSyncWrapper, + /// 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 core::ops::Deref for KVStoreSyncWrapper { + type Target = nativeKVStoreSyncWrapper; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for KVStoreSyncWrapper { } +unsafe impl core::marker::Sync for KVStoreSyncWrapper { } +impl Drop for KVStoreSyncWrapper { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeKVStoreSyncWrapper>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the KVStoreSyncWrapper, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn KVStoreSyncWrapper_free(this_obj: KVStoreSyncWrapper) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn KVStoreSyncWrapper_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeKVStoreSyncWrapper) }; +} +#[allow(unused)] +impl KVStoreSyncWrapper { + pub(crate) fn get_native_ref(&self) -> &'static nativeKVStoreSyncWrapper { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeKVStoreSyncWrapper { + 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 nativeKVStoreSyncWrapper { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +#[no_mangle] +pub extern "C" fn KVStoreSyncWrapper_get_a(this_ptr: &KVStoreSyncWrapper) -> *const crate::lightning::util::persist::KVStoreSync { + let mut inner_val = &mut KVStoreSyncWrapper::get_native_mut_ref(this_ptr).0; + inner_val +} +#[no_mangle] +pub extern "C" fn KVStoreSyncWrapper_set_a(this_ptr: &mut KVStoreSyncWrapper, mut val: crate::lightning::util::persist::KVStoreSync) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val; +} +/// Constructs a new KVStoreSyncWrapper given each field +#[must_use] +#[no_mangle] +pub extern "C" fn KVStoreSyncWrapper_new(mut a_arg: crate::lightning::util::persist::KVStoreSync) -> KVStoreSyncWrapper { + KVStoreSyncWrapper { inner: ObjOps::heap_alloc(lightning::util::persist::KVStoreSyncWrapper ( + a_arg, + )), is_owned: true } +} +impl Clone for KVStoreSyncWrapper { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeKVStoreSyncWrapper>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 KVStoreSyncWrapper_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeKVStoreSyncWrapper) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the KVStoreSyncWrapper +pub extern "C" fn KVStoreSyncWrapper_clone(orig: &KVStoreSyncWrapper) -> KVStoreSyncWrapper { + Clone::clone(orig) +} /// Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`] /// data migration. #[repr(C)] @@ -186,14 +312,18 @@ pub struct MigratableKVStore { pub this_arg: *mut c_void, /// Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. /// - /// This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] + /// This is useful for migrating data from [`KVStoreSync`] implementation to [`KVStoreSync`] /// implementation. /// /// Must exhaustively return all entries known to the store to ensure no data is missed, but /// may return the items in arbitrary order. pub list_all_keys: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, - /// Implementation of KVStore for this object. - pub KVStore: crate::lightning::util::persist::KVStore, + /// Implementation of KVStoreSync for this object. + pub KVStoreSync: crate::lightning::util::persist::KVStoreSync, + /// Called, if set, after this MigratableKVStore has been cloned into a duplicate object. + /// The new MigratableKVStore 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, @@ -205,56 +335,74 @@ pub(crate) fn MigratableKVStore_clone_fields(orig: &MigratableKVStore) -> Migrat MigratableKVStore { this_arg: orig.this_arg, list_all_keys: Clone::clone(&orig.list_all_keys), - KVStore: crate::lightning::util::persist::KVStore_clone_fields(&orig.KVStore), + KVStoreSync: crate::lightning::util::persist::KVStoreSync_clone_fields(&orig.KVStoreSync), + cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } -impl lightning::util::persist::KVStore for MigratableKVStore { +impl lightning::util::persist::KVStoreSync for MigratableKVStore { fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { - let mut ret = (self.KVStore.read)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into()); + let mut ret = (self.KVStoreSync.read)(self.KVStoreSync.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.KVStore.write)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: Vec) -> Result<(), lightning::io::Error> { + let mut local_buf = Vec::new(); for mut item in buf.drain(..) { local_buf.push( { item }); }; + let mut ret = (self.KVStoreSync.write)(self.KVStoreSync.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf.into()); 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.KVStore.remove)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), lazy); + let mut ret = (self.KVStoreSync.remove)(self.KVStoreSync.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.KVStore.list)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into()); + let mut ret = (self.KVStoreSync.list)(self.KVStoreSync.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 } } -impl lightning::util::persist::KVStore for MigratableKVStoreRef { +impl lightning::util::persist::KVStoreSync for MigratableKVStoreRef { fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { - let mut ret = (self.0.KVStore.read)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into()); + let mut ret = (self.0.KVStoreSync.read)(self.0.KVStoreSync.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.0.KVStore.write)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: Vec) -> Result<(), lightning::io::Error> { + let mut local_buf = Vec::new(); for mut item in buf.drain(..) { local_buf.push( { item }); }; + let mut ret = (self.0.KVStoreSync.write)(self.0.KVStoreSync.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf.into()); 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.0.KVStore.remove)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), lazy); + let mut ret = (self.0.KVStoreSync.remove)(self.0.KVStoreSync.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.0.KVStore.list)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into()); + let mut ret = (self.0.KVStoreSync.list)(self.0.KVStoreSync.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 } } +#[no_mangle] +/// Creates a copy of a MigratableKVStore +pub extern "C" fn MigratableKVStore_clone(orig: &MigratableKVStore) -> MigratableKVStore { + let mut res = MigratableKVStore_clone_fields(orig); + if let Some(f) = orig.cloned { (f)(&mut res) }; + res +} +impl Clone for MigratableKVStore { + fn clone(&self) -> Self { + MigratableKVStore_clone(self) + } +} +impl Clone for MigratableKVStoreRef { + fn clone(&self) -> Self { + Self(MigratableKVStore_clone(&self.0)) + } +} use lightning::util::persist::MigratableKVStore as rustMigratableKVStore; impl rustMigratableKVStore for MigratableKVStore { @@ -312,118 +460,24 @@ pub extern "C" fn migrate_kv_store_data(source_store: &mut crate::lightning::uti local_ret } -/// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. -/// -/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager -#[repr(C)] -pub struct Persister { - /// 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, - /// Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. - /// - /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - 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_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_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 {} -#[allow(unused)] -pub(crate) fn Persister_clone_fields(orig: &Persister) -> Persister { - Persister { - this_arg: orig.this_arg, - persist_manager: Clone::clone(&orig.persist_manager), - persist_graph: Clone::clone(&orig.persist_graph), - persist_scorer: Clone::clone(&orig.persist_scorer), - free: Clone::clone(&orig.free), - } -} - -use lightning::util::persist::Persister as rustPersister; -impl<'a> rustPersister<'a, crate::lightning::ln::channelmanager::ChannelManager, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::WriteableScore, > for Persister { - fn persist_manager(&self, mut channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> Result<(), lightning::io::Error> { - let mut ret = (self.persist_manager)(self.this_arg, &channel_manager.as_ref_to()); - 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 persist_graph(&self, mut network_graph: &lightning::routing::gossip::NetworkGraph) -> Result<(), lightning::io::Error> { - let mut ret = (self.persist_graph)(self.this_arg, &crate::lightning::routing::gossip::NetworkGraph { inner: unsafe { ObjOps::nonnull_ptr_to_inner((network_graph as *const lightning::routing::gossip::NetworkGraph<_, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; - local_ret - } - fn persist_scorer(&self, mut scorer: &crate::lightning::routing::scoring::WriteableScore) -> Result<(), lightning::io::Error> { - let mut ret = (self.persist_scorer)(self.this_arg, scorer); - 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 - } -} - -pub struct PersisterRef(Persister); -impl<'a> rustPersister<'a, crate::lightning::ln::channelmanager::ChannelManager, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::WriteableScore, > for PersisterRef { - fn persist_manager(&self, mut channel_manager: &crate::lightning::ln::channelmanager::ChannelManager) -> Result<(), lightning::io::Error> { - let mut ret = (self.0.persist_manager)(self.0.this_arg, &channel_manager.as_ref_to()); - 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 persist_graph(&self, mut network_graph: &lightning::routing::gossip::NetworkGraph) -> Result<(), lightning::io::Error> { - let mut ret = (self.0.persist_graph)(self.0.this_arg, &crate::lightning::routing::gossip::NetworkGraph { inner: unsafe { ObjOps::nonnull_ptr_to_inner((network_graph as *const lightning::routing::gossip::NetworkGraph<_, >) 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)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; - local_ret - } - fn persist_scorer(&self, mut scorer: &crate::lightning::routing::scoring::WriteableScore) -> Result<(), lightning::io::Error> { - let mut ret = (self.0.persist_scorer)(self.0.this_arg, scorer); - 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 - } -} - -// 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 Persister { - type Target = PersisterRef; - fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const PersisterRef) } - } -} -impl core::ops::DerefMut for Persister { - fn deref_mut(&mut self) -> &mut PersisterRef { - unsafe { &mut *(self as *mut _ as *mut PersisterRef) } - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn Persister_free(this_ptr: Persister) { } -impl Drop for Persister { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} /// 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); +pub extern "C" fn read_channel_monitors(mut kv_store: crate::lightning::util::persist::KVStoreSync, 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.as_ref() }, 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_bitcoin(e) }).into() }; local_ret } use lightning::util::persist::MonitorUpdatingPersister as nativeMonitorUpdatingPersisterImport; -pub(crate) type nativeMonitorUpdatingPersister = 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 +/// The main benefit this provides over the [`KVStoreSync`]'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 @@ -431,7 +485,7 @@ pub(crate) type nativeMonitorUpdatingPersister = nativeMonitorUpdatingPersisterI /// 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, +/// the default [`KVStoreSync`]'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 @@ -445,12 +499,13 @@ pub(crate) type nativeMonitorUpdatingPersister = nativeMonitorUpdatingPersisterI /// - [`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`). +/// using the familiar encoding of an [`OutPoint`] (e.g., `[SOME-64-CHAR-HEX-STRING]_1`) for v1 +/// channels or a [`ChannelId`] (e.g., `[SOME-64-CHAR-HEX-STRING]`) for v2 channels. /// /// 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] +/// - secondary namespace: [the monitor's encoded outpoint or channel id name] /// /// Under that secondary namespace, each update is stored with a number string, like `21`, which /// represents its `update_id` value. @@ -482,7 +537,7 @@ pub(crate) type nativeMonitorUpdatingPersister = nativeMonitorUpdatingPersisterI /// /// ## EXTREMELY IMPORTANT /// -/// It is extremely important that your [`KVStore::read`] implementation uses the +/// It is extremely important that your [`KVStoreSync::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 @@ -494,7 +549,7 @@ pub(crate) type nativeMonitorUpdatingPersister = nativeMonitorUpdatingPersisterI /// Stale updates are pruned when the consolidation threshold is reached according to `maximum_pending_updates`. /// Monitor updates in the range between the latest `update_id` and `update_id - maximum_pending_updates` /// are deleted. -/// The `lazy` flag is used on the [`KVStore::remove`] method, so there are no guarantees that the deletions +/// The `lazy` flag is used on the [`KVStoreSync::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`. /// @@ -572,16 +627,20 @@ impl MonitorUpdatingPersister { /// less frequent \"waves.\" /// - [`MonitorUpdatingPersister`] will potentially have more listing to do if you need to run /// [`MonitorUpdatingPersister::cleanup_stale_updates`]. +/// +/// Note that you can disable the update-writing entirely by setting `maximum_pending_updates` +/// to zero, causing this [`Persist`] implementation to behave like the blanket [`Persist`] +/// implementation for all [`KVStoreSync`]s. #[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, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator) -> crate::lightning::util::persist::MonitorUpdatingPersister { +pub extern "C" fn MonitorUpdatingPersister_new(mut kv_store: crate::lightning::util::persist::KVStoreSync, 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, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator) -> crate::lightning::util::persist::MonitorUpdatingPersister { let mut ret = lightning::util::persist::MonitorUpdatingPersister::new(kv_store, logger, maximum_pending_updates, entropy_source, signer_provider, broadcaster, fee_estimator); 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 +/// It is extremely important that your [`KVStoreSync::read`] implementation uses the /// [`io::ErrorKind::NotFound`] variant correctly. For more information, please see the /// documentation for [`MonitorUpdatingPersister`]. #[must_use] @@ -594,12 +653,12 @@ pub extern "C" fn MonitorUpdatingPersister_read_all_channel_monitors_with_update /// Read a single channel monitor, along with any stored updates for it. /// -/// It is extremely important that your [`KVStore::read`] implementation uses the +/// It is extremely important that your [`KVStoreSync::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: +/// For `monitor_key`, channel storage keys can be the channel's funding [`OutPoint`], with an +/// underscore `_` between txid and index for v1 channels. For example, given: /// /// - Transaction ID: `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef` /// - Index: `1` @@ -607,12 +666,14 @@ pub extern "C" fn MonitorUpdatingPersister_read_all_channel_monitors_with_update /// The correct `monitor_key` would be: /// `deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1` /// +/// For v2 channels, the hex-encoded [`ChannelId`] is used directly for `monitor_key` instead. +/// /// 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, 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(monitor_key.into_string()); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.read_channel_monitor_with_updates(monitor_key.into_str()); 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.as_ref() }, 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_bitcoin(e) }).into() }; local_ret } @@ -622,7 +683,7 @@ pub extern "C" fn MonitorUpdatingPersister_read_channel_monitor_with_updates(thi /// 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`]. +/// be passed to [`KVStoreSync::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 { @@ -651,140 +712,206 @@ pub extern "C" fn MonitorUpdatingPersister_as_Persist(this_arg: &MonitorUpdating persist_new_channel: MonitorUpdatingPersister_Persist_persist_new_channel, update_persisted_channel: MonitorUpdatingPersister_Persist_update_persisted_channel, archive_persisted_channel: MonitorUpdatingPersister_Persist_archive_persisted_channel, + get_and_clear_completed_updates: MonitorUpdatingPersister_Persist_get_and_clear_completed_updates, } } #[must_use] -extern "C" fn MonitorUpdatingPersister_Persist_persist_new_channel(this_arg: *const c_void, mut channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus { - let mut ret = >::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_funding_outpoint.take_inner()) }, monitor.get_native_ref()); +extern "C" fn MonitorUpdatingPersister_Persist_persist_new_channel(this_arg: *const c_void, mut monitor_name: crate::lightning::util::persist::MonitorName, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus { + let mut ret = >::persist_new_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, monitor_name.into_native(), monitor.get_native_ref()); crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) } #[must_use] -extern "C" fn MonitorUpdatingPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint, mut monitor_update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus { +extern "C" fn MonitorUpdatingPersister_Persist_update_persisted_channel(this_arg: *const c_void, mut monitor_name: crate::lightning::util::persist::MonitorName, mut monitor_update: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, monitor: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::lightning::chain::ChannelMonitorUpdateStatus { let mut local_monitor_update = if monitor_update.inner.is_null() { None } else { Some( { monitor_update.get_native_ref() }) }; - let mut ret = >::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_funding_outpoint.take_inner()) }, local_monitor_update, monitor.get_native_ref()); + let mut ret = >::update_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, monitor_name.into_native(), local_monitor_update, monitor.get_native_ref()); crate::lightning::chain::ChannelMonitorUpdateStatus::native_into(ret) } -extern "C" fn MonitorUpdatingPersister_Persist_archive_persisted_channel(this_arg: *const c_void, mut channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint) { - >::archive_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_funding_outpoint.take_inner()) }) +extern "C" fn MonitorUpdatingPersister_Persist_archive_persisted_channel(this_arg: *const c_void, mut monitor_name: crate::lightning::util::persist::MonitorName) { + >::archive_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, monitor_name.into_native()) +} +#[must_use] +extern "C" fn MonitorUpdatingPersister_Persist_get_and_clear_completed_updates(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_ChannelIdu64ZZ { + let mut ret = >::get_and_clear_completed_updates(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, ); + 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_ret_0 = (crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, orig_ret_0_1).into(); local_ret_0 }); }; + local_ret.into() } - - -use lightning::util::persist::MonitorName as nativeMonitorNameImport; -pub(crate) type nativeMonitorName = nativeMonitorNameImport; /// A struct representing a name for a channel monitor. /// /// `MonitorName` is primarily used within the [`MonitorUpdatingPersister`] -/// in functions that store or retrieve channel monitor snapshots. +/// in functions that store or retrieve [`ChannelMonitor`] snapshots. /// It provides a consistent way to generate a unique key for channel -/// monitors based on their funding outpoints. +/// monitors based on the channel's funding [`OutPoint`] for v1 channels or +/// [`ChannelId`] for v2 channels. Use [`ChannelMonitor::persistence_key`] to +/// obtain the correct `MonitorName`. /// /// While users of the Lightning Dev Kit library generally won't need /// to interact with [`MonitorName`] directly, it can be useful for: /// - Custom persistence implementations /// - Debugging or logging channel monitor operations /// - Extending the functionality of the `MonitorUpdatingPersister` +/// /// # Examples /// /// ``` /// use std::str::FromStr; /// /// use bitcoin::Txid; +/// use bitcoin::hashes::hex::FromHex; /// /// use lightning::util::persist::MonitorName; /// use lightning::chain::transaction::OutPoint; +/// use lightning::ln::types::ChannelId; /// +/// // v1 channel /// let outpoint = OutPoint { ///\t txid: Txid::from_str(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap(), ///\t index: 1, /// }; -/// let monitor_name = MonitorName::from(outpoint); -/// assert_eq!(monitor_name.as_str(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); +/// let monitor_name = MonitorName::V1Channel(outpoint); +/// assert_eq!(&monitor_name.to_string(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); +/// +/// // v2 channel +/// let channel_id = ChannelId(<[u8; 32]>::from_hex(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap()); +/// let monitor_name = MonitorName::V2Channel(channel_id); +/// assert_eq!(&monitor_name.to_string(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\"); /// /// // Using MonitorName to generate a storage key -/// let storage_key = format!(\"channel_monitors/{}\", monitor_name.as_str()); +/// let storage_key = format!(\"channel_monitors/{}\", monitor_name); /// ``` +#[derive(Clone)] #[must_use] #[repr(C)] -pub struct MonitorName { - /// 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 nativeMonitorName, - /// 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, +pub enum MonitorName { + /// The outpoint of the channel's funding transaction. + V1Channel( + crate::lightning::chain::transaction::OutPoint), + /// The id of the channel produced by [`ChannelId::v2_from_revocation_basepoints`]. + V2Channel( + crate::lightning::ln::types::ChannelId), } +use lightning::util::persist::MonitorName as MonitorNameImport; +pub(crate) type nativeMonitorName = MonitorNameImport; -impl core::ops::Deref for MonitorName { - type Target = nativeMonitorName; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for MonitorName { } -unsafe impl core::marker::Sync for MonitorName { } -impl Drop for MonitorName { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeMonitorName>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; +impl MonitorName { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeMonitorName { + match self { + MonitorName::V1Channel (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeMonitorName::V1Channel ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + MonitorName::V2Channel (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeMonitorName::V2Channel ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeMonitorName { + match self { + MonitorName::V1Channel (mut a, ) => { + nativeMonitorName::V1Channel ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + MonitorName::V2Channel (mut a, ) => { + nativeMonitorName::V2Channel ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &MonitorNameImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeMonitorName) }; + match native { + nativeMonitorName::V1Channel (ref a, ) => { + let mut a_nonref = Clone::clone(a); + MonitorName::V1Channel ( + crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeMonitorName::V2Channel (ref a, ) => { + let mut a_nonref = Clone::clone(a); + MonitorName::V2Channel ( + crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeMonitorName) -> Self { + match native { + nativeMonitorName::V1Channel (mut a, ) => { + MonitorName::V1Channel ( + crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeMonitorName::V2Channel (mut a, ) => { + MonitorName::V2Channel ( + crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, } } } -/// Frees any resources used by the MonitorName, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the MonitorName #[no_mangle] -pub extern "C" fn MonitorName_free(this_obj: MonitorName) { } +pub extern "C" fn MonitorName_free(this_ptr: MonitorName) { } +/// Creates a copy of the MonitorName +#[no_mangle] +pub extern "C" fn MonitorName_clone(orig: &MonitorName) -> MonitorName { + orig.clone() +} #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn MonitorName_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMonitorName) }; +pub(crate) extern "C" fn MonitorName_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const MonitorName)).clone() })) as *mut c_void } #[allow(unused)] -impl MonitorName { - pub(crate) fn get_native_ref(&self) -> &'static nativeMonitorName { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMonitorName { - 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 nativeMonitorName { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn MonitorName_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut MonitorName) }; +} +#[no_mangle] +/// Utility method to constructs a new V1Channel-variant MonitorName +pub extern "C" fn MonitorName_v1_channel(a: crate::lightning::chain::transaction::OutPoint) -> MonitorName { + MonitorName::V1Channel(a, ) +} +#[no_mangle] +/// Utility method to constructs a new V2Channel-variant MonitorName +pub extern "C" fn MonitorName_v2_channel(a: crate::lightning::ln::types::ChannelId) -> MonitorName { + MonitorName::V2Channel(a, ) } /// Get a string which allows debug introspection of a MonitorName object pub extern "C" fn MonitorName_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::persist::MonitorName }).into()} -/// Constructs a [`MonitorName`], after verifying that an [`OutPoint`] can -/// be formed from the given `name`. -/// This method is useful if you have a String and you want to verify that -/// it's a valid storage key for a channel monitor. -#[must_use] +/// Checks if two MonitorNames contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] -pub extern "C" fn MonitorName_new(mut name: crate::c_types::Str) -> crate::c_types::derived::CResult_MonitorNameIOErrorZ { - let mut ret = lightning::util::persist::MonitorName::new(name.into_string()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::persist::MonitorName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_bitcoin(e) }).into() }; - local_ret +pub extern "C" fn MonitorName_eq(a: &MonitorName, b: &MonitorName) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } } - -/// Convert this monitor name to a str. -/// This method is particularly useful when you need to use the monitor name -/// as a key in a key-value store or when logging. -#[must_use] +/// Generates a non-cryptographic 64-bit hash of the MonitorName. #[no_mangle] -pub extern "C" fn MonitorName_as_str(this_arg: &crate::lightning::util::persist::MonitorName) -> crate::c_types::Str { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_str(); - ret.into() +pub extern "C" fn MonitorName_hash(o: &MonitorName) -> 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) +} +#[no_mangle] +/// Get the string representation of a MonitorName object +pub extern "C" fn MonitorName_to_str(o: &crate::lightning::util::persist::MonitorName) -> Str { + alloc::format!("{}", &o.to_native()).into() } - use lightning::util::persist::UpdateName as nativeUpdateNameImport; pub(crate) type nativeUpdateName = nativeUpdateNameImport; @@ -879,7 +1006,7 @@ impl UpdateName { } #[no_mangle] pub extern "C" fn UpdateName_get_a(this_ptr: &UpdateName) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut UpdateName::get_native_mut_ref(this_ptr).0; *inner_val } #[no_mangle] @@ -919,3 +1046,9 @@ pub extern "C" fn UpdateName_as_str(this_arg: &crate::lightning::util::persist:: ret.into() } +#[no_mangle] +/// Build a UpdateName from a u64 +pub extern "C" fn UpdateName_from_u64(f: u64) -> crate::lightning::util::persist::UpdateName { + let from_obj = f; + crate::lightning::util::persist::UpdateName { inner: ObjOps::heap_alloc((lightning::util::persist::UpdateName::from(from_obj))), is_owned: true } +} diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index a7922291..5a77d51f 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -93,7 +93,7 @@ impl BigSize { } #[no_mangle] pub extern "C" fn BigSize_get_a(this_ptr: &BigSize) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut BigSize::get_native_mut_ref(this_ptr).0; *inner_val } #[no_mangle] @@ -112,7 +112,7 @@ impl Clone for BigSize { fn clone(&self) -> Self { Self { inner: if <*mut nativeBigSize>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -120,12 +120,12 @@ impl Clone for BigSize { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BigSize_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBigSize)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBigSize) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BigSize pub extern "C" fn BigSize_clone(orig: &BigSize) -> BigSize { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a BigSize object pub extern "C" fn BigSize_debug_str_void(o: *const c_void) -> Str { @@ -165,6 +165,107 @@ pub extern "C" fn BigSize_read(ser: crate::c_types::u8slice) -> crate::c_types:: let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::ser::BigSize { 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::util::ser::CollectionLength as nativeCollectionLengthImport; +pub(crate) type nativeCollectionLength = nativeCollectionLengthImport; + +/// The lightning protocol uses u16s for lengths in most cases. As our serialization framework +/// primarily targets that, we must as well. However, because we may serialize objects that have +/// more than 65K entries, we need to be able to store larger values. Thus, we define a variable +/// length integer here that is backwards-compatible for values < 0xffff. We treat 0xffff as +/// \"read eight more bytes\". +/// +/// To ensure we only have one valid encoding per value, we add 0xffff to values written as eight +/// bytes. Thus, 0xfffe is serialized as 0xfffe, whereas 0xffff is serialized as +/// 0xffff0000000000000000 (i.e. read-eight-bytes then zero). +#[must_use] +#[repr(C)] +pub struct CollectionLength { + /// 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 nativeCollectionLength, + /// 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 core::ops::Deref for CollectionLength { + type Target = nativeCollectionLength; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for CollectionLength { } +unsafe impl core::marker::Sync for CollectionLength { } +impl Drop for CollectionLength { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeCollectionLength>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the CollectionLength, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn CollectionLength_free(this_obj: CollectionLength) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn CollectionLength_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCollectionLength) }; +} +#[allow(unused)] +impl CollectionLength { + pub(crate) fn get_native_ref(&self) -> &'static nativeCollectionLength { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeCollectionLength { + 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 nativeCollectionLength { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +#[no_mangle] +pub extern "C" fn CollectionLength_get_a(this_ptr: &CollectionLength) -> u64 { + let mut inner_val = &mut CollectionLength::get_native_mut_ref(this_ptr).0; + *inner_val +} +#[no_mangle] +pub extern "C" fn CollectionLength_set_a(this_ptr: &mut CollectionLength, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val; +} +/// Constructs a new CollectionLength given each field +#[must_use] +#[no_mangle] +pub extern "C" fn CollectionLength_new(mut a_arg: u64) -> CollectionLength { + CollectionLength { inner: ObjOps::heap_alloc(lightning::util::ser::CollectionLength ( + a_arg, + )), is_owned: true } +} +#[no_mangle] +/// Serialize the CollectionLength object into a byte array which can be read by CollectionLength_read +pub extern "C" fn CollectionLength_write(obj: &crate::lightning::util::ser::CollectionLength) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn CollectionLength_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::util::ser::nativeCollectionLength) }) +} +#[no_mangle] +/// Read a CollectionLength from a byte array, created by CollectionLength_write +pub extern "C" fn CollectionLength_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_CollectionLengthDecodeErrorZ { + 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::util::ser::CollectionLength { 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 UntrustedString object into a byte array which can be read by UntrustedString_read pub extern "C" fn UntrustedString_write(obj: &crate::lightning_types::string::UntrustedString) -> crate::c_types::derived::CVec_u8Z { @@ -251,7 +352,7 @@ impl Clone for Hostname { fn clone(&self) -> Self { Self { inner: if <*mut nativeHostname>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -259,12 +360,12 @@ impl Clone for Hostname { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Hostname_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHostname)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeHostname) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Hostname pub extern "C" fn Hostname_clone(orig: &Hostname) -> Hostname { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Hostname object pub extern "C" fn Hostname_debug_str_void(o: *const c_void) -> Str { @@ -317,149 +418,3 @@ pub extern "C" fn Hostname_read(ser: crate::c_types::u8slice) -> crate::c_types: let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::ser::Hostname { 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::util::ser::TransactionU16LenLimited as nativeTransactionU16LenLimitedImport; -pub(crate) type nativeTransactionU16LenLimited = nativeTransactionU16LenLimitedImport; - -/// A wrapper for a `Transaction` which can only be constructed with [`TransactionU16LenLimited::new`] -/// if the `Transaction`'s consensus-serialized length is <= u16::MAX. -/// -/// Use [`TransactionU16LenLimited::into_transaction`] to convert into the contained `Transaction`. -#[must_use] -#[repr(C)] -pub struct TransactionU16LenLimited { - /// 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 nativeTransactionU16LenLimited, - /// 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 core::ops::Deref for TransactionU16LenLimited { - type Target = nativeTransactionU16LenLimited; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for TransactionU16LenLimited { } -unsafe impl core::marker::Sync for TransactionU16LenLimited { } -impl Drop for TransactionU16LenLimited { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeTransactionU16LenLimited>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the TransactionU16LenLimited, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn TransactionU16LenLimited_free(this_obj: TransactionU16LenLimited) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn TransactionU16LenLimited_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTransactionU16LenLimited) }; -} -#[allow(unused)] -impl TransactionU16LenLimited { - pub(crate) fn get_native_ref(&self) -> &'static nativeTransactionU16LenLimited { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeTransactionU16LenLimited { - 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 nativeTransactionU16LenLimited { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -impl Clone for TransactionU16LenLimited { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeTransactionU16LenLimited>::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 TransactionU16LenLimited_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTransactionU16LenLimited)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the TransactionU16LenLimited -pub extern "C" fn TransactionU16LenLimited_clone(orig: &TransactionU16LenLimited) -> TransactionU16LenLimited { - orig.clone() -} -/// Get a string which allows debug introspection of a TransactionU16LenLimited object -pub extern "C" fn TransactionU16LenLimited_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::ser::TransactionU16LenLimited }).into()} -/// Generates a non-cryptographic 64-bit hash of the TransactionU16LenLimited. -#[no_mangle] -pub extern "C" fn TransactionU16LenLimited_hash(o: &TransactionU16LenLimited) -> 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 TransactionU16LenLimiteds 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 TransactionU16LenLimited_eq(a: &TransactionU16LenLimited, b: &TransactionU16LenLimited) -> 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 } -} -/// Constructs a new `TransactionU16LenLimited` from a `Transaction` only if it's consensus- -/// serialized length is <= u16::MAX. -#[must_use] -#[no_mangle] -pub extern "C" fn TransactionU16LenLimited_new(mut transaction: crate::c_types::Transaction) -> crate::c_types::derived::CResult_TransactionU16LenLimitedNoneZ { - let mut ret = lightning::util::ser::TransactionU16LenLimited::new(transaction.into_bitcoin()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::ser::TransactionU16LenLimited { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} - -/// Consumes this `TransactionU16LenLimited` and returns its contained `Transaction`. -#[must_use] -#[no_mangle] -pub extern "C" fn TransactionU16LenLimited_into_transaction(mut this_arg: crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::Transaction { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_transaction(); - crate::c_types::Transaction::from_bitcoin(&ret) -} - -/// Returns a reference to the contained `Transaction` -#[must_use] -#[no_mangle] -pub extern "C" fn TransactionU16LenLimited_as_transaction(this_arg: &crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::Transaction { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_transaction(); - crate::c_types::Transaction::from_bitcoin(ret) -} - -#[no_mangle] -/// Serialize the TransactionU16LenLimited object into a byte array which can be read by TransactionU16LenLimited_read -pub extern "C" fn TransactionU16LenLimited_write(obj: &crate::lightning::util::ser::TransactionU16LenLimited) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn TransactionU16LenLimited_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::util::ser::nativeTransactionU16LenLimited) }) -} -#[no_mangle] -/// Read a TransactionU16LenLimited from a byte array, created by TransactionU16LenLimited_write -pub extern "C" fn TransactionU16LenLimited_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_TransactionU16LenLimitedDecodeErrorZ { - 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::util::ser::TransactionU16LenLimited { 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/util/sweep.rs b/lightning-c-bindings/src/lightning/util/sweep.rs index 1f2adfe8..b2a8fc2d 100644 --- a/lightning-c-bindings/src/lightning/util/sweep.rs +++ b/lightning-c-bindings/src/lightning/util/sweep.rs @@ -7,7 +7,7 @@ // source was automatically generated. //! This module contains an [`OutputSweeper`] utility that keeps track of -//! [`SpendableOutputDescriptor`]s, i.e., persists them in a given [`KVStore`] and regularly retries +//! [`SpendableOutputDescriptor`]s, i.e., persists them in a given [`KVStoreSync`] and regularly retries //! sweeping them. use alloc::str::FromStr; @@ -86,7 +86,7 @@ impl TrackedSpendableOutput { /// The tracked output descriptor. #[no_mangle] pub extern "C" fn TrackedSpendableOutput_get_descriptor(this_ptr: &TrackedSpendableOutput) -> crate::lightning::sign::SpendableOutputDescriptor { - let mut inner_val = &mut this_ptr.get_native_mut_ref().descriptor; + let mut inner_val = &mut TrackedSpendableOutput::get_native_mut_ref(this_ptr).descriptor; crate::lightning::sign::SpendableOutputDescriptor::from_native(inner_val) } /// The tracked output descriptor. @@ -101,7 +101,7 @@ pub extern "C" fn TrackedSpendableOutput_set_descriptor(this_ptr: &mut TrackedSp /// 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 TrackedSpendableOutput_get_channel_id(this_ptr: &TrackedSpendableOutput) -> crate::lightning::ln::types::ChannelId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_id; + let mut inner_val = &mut TrackedSpendableOutput::get_native_mut_ref(this_ptr).channel_id; let mut local_inner_val = crate::lightning::ln::types::ChannelId { 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::types::ChannelId<>) as *mut _ }, is_owned: false }; local_inner_val } @@ -118,7 +118,7 @@ pub extern "C" fn TrackedSpendableOutput_set_channel_id(this_ptr: &mut TrackedSp /// The current status of the output spend. #[no_mangle] pub extern "C" fn TrackedSpendableOutput_get_status(this_ptr: &TrackedSpendableOutput) -> crate::lightning::util::sweep::OutputSpendStatus { - let mut inner_val = &mut this_ptr.get_native_mut_ref().status; + let mut inner_val = &mut TrackedSpendableOutput::get_native_mut_ref(this_ptr).status; crate::lightning::util::sweep::OutputSpendStatus::from_native(inner_val) } /// The current status of the output spend. @@ -143,7 +143,7 @@ impl Clone for TrackedSpendableOutput { fn clone(&self) -> Self { Self { inner: if <*mut nativeTrackedSpendableOutput>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -151,12 +151,12 @@ impl Clone for TrackedSpendableOutput { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TrackedSpendableOutput_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeTrackedSpendableOutput)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeTrackedSpendableOutput) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the TrackedSpendableOutput pub extern "C" fn TrackedSpendableOutput_clone(orig: &TrackedSpendableOutput) -> TrackedSpendableOutput { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a TrackedSpendableOutput object pub extern "C" fn TrackedSpendableOutput_debug_str_void(o: *const c_void) -> Str { @@ -435,15 +435,139 @@ pub extern "C" fn OutputSpendStatus_read(ser: crate::c_types::u8slice) -> crate: let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::sweep::OutputSpendStatus::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +/// A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a +/// future block height is reached. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum SpendingDelay { + /// A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks` + /// is reached. + Relative { + /// The number of blocks until we'll generate and broadcast the spending transaction. + num_blocks: u32, + }, + /// An absolute delay indicating we shouldn't spend the output before `height` is reached. + Absolute { + /// The height at which we'll generate and broadcast the spending transaction. + height: u32, + }, +} +use lightning::util::sweep::SpendingDelay as SpendingDelayImport; +pub(crate) type nativeSpendingDelay = SpendingDelayImport; + +impl SpendingDelay { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeSpendingDelay { + match self { + SpendingDelay::Relative {ref num_blocks, } => { + let mut num_blocks_nonref = Clone::clone(num_blocks); + nativeSpendingDelay::Relative { + num_blocks: num_blocks_nonref, + } + }, + SpendingDelay::Absolute {ref height, } => { + let mut height_nonref = Clone::clone(height); + nativeSpendingDelay::Absolute { + height: height_nonref, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeSpendingDelay { + match self { + SpendingDelay::Relative {mut num_blocks, } => { + nativeSpendingDelay::Relative { + num_blocks: num_blocks, + } + }, + SpendingDelay::Absolute {mut height, } => { + nativeSpendingDelay::Absolute { + height: height, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &SpendingDelayImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSpendingDelay) }; + match native { + nativeSpendingDelay::Relative {ref num_blocks, } => { + let mut num_blocks_nonref = Clone::clone(num_blocks); + SpendingDelay::Relative { + num_blocks: num_blocks_nonref, + } + }, + nativeSpendingDelay::Absolute {ref height, } => { + let mut height_nonref = Clone::clone(height); + SpendingDelay::Absolute { + height: height_nonref, + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeSpendingDelay) -> Self { + match native { + nativeSpendingDelay::Relative {mut num_blocks, } => { + SpendingDelay::Relative { + num_blocks: num_blocks, + } + }, + nativeSpendingDelay::Absolute {mut height, } => { + SpendingDelay::Absolute { + height: height, + } + }, + } + } +} +/// Frees any resources used by the SpendingDelay +#[no_mangle] +pub extern "C" fn SpendingDelay_free(this_ptr: SpendingDelay) { } +/// Creates a copy of the SpendingDelay +#[no_mangle] +pub extern "C" fn SpendingDelay_clone(orig: &SpendingDelay) -> SpendingDelay { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SpendingDelay_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SpendingDelay)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn SpendingDelay_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut SpendingDelay) }; +} +#[no_mangle] +/// Utility method to constructs a new Relative-variant SpendingDelay +pub extern "C" fn SpendingDelay_relative(num_blocks: u32) -> SpendingDelay { + SpendingDelay::Relative { + num_blocks, + } +} +#[no_mangle] +/// Utility method to constructs a new Absolute-variant SpendingDelay +pub extern "C" fn SpendingDelay_absolute(height: u32) -> SpendingDelay { + SpendingDelay::Absolute { + height, + } +} +/// Get a string which allows debug introspection of a SpendingDelay object +pub extern "C" fn SpendingDelay_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::sweep::SpendingDelay }).into()} -use lightning::util::sweep::OutputSweeper as nativeOutputSweeperImport; -pub(crate) type nativeOutputSweeper = nativeOutputSweeperImport; +use lightning::util::sweep::OutputSweeperSync as nativeOutputSweeperSyncImport; +pub(crate) type nativeOutputSweeperSync = nativeOutputSweeperSyncImport; /// A utility that keeps track of [`SpendableOutputDescriptor`]s, persists them in a given -/// [`KVStore`] and regularly retries sweeping them based on a callback given to the constructor +/// [`KVStoreSync`] and regularly retries sweeping them based on a callback given to the constructor /// methods. /// -/// Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s received via [`Event::SpendableOutputs`]. +/// Users should call [`Self::track_spendable_outputs`] for any [`SpendableOutputDescriptor`]s +/// received via [`Event::SpendableOutputs`]. /// /// This needs to be notified of chain state changes either via its [`Listen`] or [`Confirm`] /// implementation and hence has to be connected with the utilized chain data sources. @@ -452,15 +576,17 @@ pub(crate) type nativeOutputSweeper = nativeOutputSweeperImport &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for OutputSweeper { } -unsafe impl core::marker::Sync for OutputSweeper { } -impl Drop for OutputSweeper { +unsafe impl core::marker::Send for OutputSweeperSync { } +unsafe impl core::marker::Sync for OutputSweeperSync { } +impl Drop for OutputSweeperSync { fn drop(&mut self) { - if self.is_owned && !<*mut nativeOutputSweeper>::is_null(self.inner) { + if self.is_owned && !<*mut nativeOutputSweeperSync>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the OutputSweeper, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the OutputSweeperSync, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn OutputSweeper_free(this_obj: OutputSweeper) { } +pub extern "C" fn OutputSweeperSync_free(this_obj: OutputSweeperSync) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn OutputSweeper_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOutputSweeper) }; +pub(crate) extern "C" fn OutputSweeperSync_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOutputSweeperSync) }; } #[allow(unused)] -impl OutputSweeper { - pub(crate) fn get_native_ref(&self) -> &'static nativeOutputSweeper { +impl OutputSweeperSync { + pub(crate) fn get_native_ref(&self) -> &'static nativeOutputSweeperSync { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOutputSweeper { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOutputSweeperSync { 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 nativeOutputSweeper { + pub(crate) fn take_inner(mut self) -> *mut nativeOutputSweeperSync { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -508,16 +634,16 @@ impl OutputSweeper { Self { inner: self.inner, is_owned: false } } } -/// Constructs a new [`OutputSweeper`]. +/// Constructs a new [`OutputSweeperSync`] instance. /// /// If chain data is provided via the [`Confirm`] interface or via filtered blocks, users also /// need to register their [`Filter`] implementation via the given `chain_data_source`. #[must_use] #[no_mangle] -pub extern "C" fn OutputSweeper_new(mut best_block: crate::lightning::chain::BestBlock, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_data_source: crate::c_types::derived::COption_FilterZ, mut output_spender: crate::lightning::sign::OutputSpender, mut change_destination_source: crate::lightning::sign::ChangeDestinationSource, mut kv_store: crate::lightning::util::persist::KVStore, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::util::sweep::OutputSweeper { +pub extern "C" fn OutputSweeperSync_new(mut best_block: crate::lightning::chain::BestBlock, mut broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_data_source: crate::c_types::derived::COption_FilterZ, mut output_spender: crate::lightning::sign::OutputSpender, mut change_destination_source: crate::lightning::sign::ChangeDestinationSourceSync, mut kv_store: crate::lightning::util::persist::KVStoreSync, mut logger: crate::lightning::util::logger::Logger) -> crate::lightning::util::sweep::OutputSweeperSync { let mut local_chain_data_source = { /*chain_data_source*/ let chain_data_source_opt = chain_data_source; if chain_data_source_opt.is_none() { None } else { Some({ { { chain_data_source_opt.take() } }})} }; - let mut ret = lightning::util::sweep::OutputSweeper::new(*unsafe { Box::from_raw(best_block.take_inner()) }, broadcaster, fee_estimator, local_chain_data_source, output_spender, change_destination_source, kv_store, logger); - crate::lightning::util::sweep::OutputSweeper { inner: ObjOps::heap_alloc(ret), is_owned: true } + let mut ret = lightning::util::sweep::OutputSweeperSync::new(*unsafe { Box::from_raw(best_block.take_inner()) }, broadcaster, fee_estimator, local_chain_data_source, output_spender, change_destination_source, kv_store, logger); + crate::lightning::util::sweep::OutputSweeperSync { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Tells the sweeper to track the given outputs descriptors. @@ -539,7 +665,7 @@ pub extern "C" fn OutputSweeper_new(mut best_block: crate::lightning::chain::Bes /// Note that channel_id (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn OutputSweeper_track_spendable_outputs(this_arg: &crate::lightning::util::sweep::OutputSweeper, mut output_descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut channel_id: crate::lightning::ln::types::ChannelId, mut exclude_static_outputs: bool, mut delay_until_height: crate::c_types::derived::COption_u32Z) -> crate::c_types::derived::CResult_NoneNoneZ { +pub extern "C" fn OutputSweeperSync_track_spendable_outputs(this_arg: &crate::lightning::util::sweep::OutputSweeperSync, mut output_descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut channel_id: crate::lightning::ln::types::ChannelId, mut exclude_static_outputs: bool, mut delay_until_height: crate::c_types::derived::COption_u32Z) -> crate::c_types::derived::CResult_NoneNoneZ { let mut local_output_descriptors = Vec::new(); for mut item in output_descriptors.into_rust().drain(..) { local_output_descriptors.push( { item.into_native() }); }; let mut local_channel_id = if channel_id.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_id.take_inner()) } }) }; let mut local_delay_until_height = if delay_until_height.is_some() { Some( { delay_until_height.take() }) } else { None }; @@ -549,240 +675,115 @@ pub extern "C" fn OutputSweeper_track_spendable_outputs(this_arg: &crate::lightn } /// Returns a list of the currently tracked spendable outputs. +/// +/// Wraps [`OutputSweeper::tracked_spendable_outputs`]. #[must_use] #[no_mangle] -pub extern "C" fn OutputSweeper_tracked_spendable_outputs(this_arg: &crate::lightning::util::sweep::OutputSweeper) -> crate::c_types::derived::CVec_TrackedSpendableOutputZ { +pub extern "C" fn OutputSweeperSync_tracked_spendable_outputs(this_arg: &crate::lightning::util::sweep::OutputSweeperSync) -> crate::c_types::derived::CVec_TrackedSpendableOutputZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tracked_spendable_outputs(); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::util::sweep::TrackedSpendableOutput { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret.into() } -/// Gets the latest best block which was connected either via the [`Listen`] or -/// [`Confirm`] interfaces. +/// Gets the latest best block which was connected either via [`Listen`] or [`Confirm`] +/// interfaces. #[must_use] #[no_mangle] -pub extern "C" fn OutputSweeper_current_best_block(this_arg: &crate::lightning::util::sweep::OutputSweeper) -> crate::lightning::chain::BestBlock { +pub extern "C" fn OutputSweeperSync_current_best_block(this_arg: &crate::lightning::util::sweep::OutputSweeperSync) -> crate::lightning::chain::BestBlock { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.current_best_block(); crate::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(ret), is_owned: true } } -impl From for crate::lightning::chain::Listen { - fn from(obj: nativeOutputSweeper) -> Self { - let rust_obj = crate::lightning::util::sweep::OutputSweeper { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = OutputSweeper_as_Listen(&rust_obj); +/// Regenerates and broadcasts the spending transaction for any outputs that are pending. This method will be a +/// no-op if a sweep is already pending. +/// +/// Wraps [`OutputSweeper::regenerate_and_broadcast_spend_if_necessary`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OutputSweeperSync_regenerate_and_broadcast_spend_if_necessary(this_arg: &crate::lightning::util::sweep::OutputSweeperSync) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.regenerate_and_broadcast_spend_if_necessary(); + 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 +} + +impl From for crate::lightning::chain::Listen { + fn from(obj: nativeOutputSweeperSync) -> Self { + let rust_obj = crate::lightning::util::sweep::OutputSweeperSync { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = OutputSweeperSync_as_Listen(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); - ret.free = Some(OutputSweeper_free_void); + ret.free = Some(OutputSweeperSync_free_void); ret } } /// Constructs a new Listen which calls the relevant methods on this_arg. /// This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is #[no_mangle] -pub extern "C" fn OutputSweeper_as_Listen(this_arg: &OutputSweeper) -> crate::lightning::chain::Listen { +pub extern "C" fn OutputSweeperSync_as_Listen(this_arg: &OutputSweeperSync) -> crate::lightning::chain::Listen { crate::lightning::chain::Listen { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - filtered_block_connected: OutputSweeper_Listen_filtered_block_connected, - block_connected: OutputSweeper_Listen_block_connected, - block_disconnected: OutputSweeper_Listen_block_disconnected, + filtered_block_connected: OutputSweeperSync_Listen_filtered_block_connected, + block_connected: OutputSweeperSync_Listen_block_connected, + blocks_disconnected: OutputSweeperSync_Listen_blocks_disconnected, } } -extern "C" fn OutputSweeper_Listen_filtered_block_connected(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) { +extern "C" fn OutputSweeperSync_Listen_filtered_block_connected(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) { let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); }; - ::filtered_block_connected(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height) + ::filtered_block_connected(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height) } -extern "C" fn OutputSweeper_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) { - ::block_connected(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height) +extern "C" fn OutputSweeperSync_Listen_block_connected(this_arg: *const c_void, mut block: crate::c_types::u8slice, mut height: u32) { + ::block_connected(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, &::bitcoin::consensus::encode::deserialize(block.to_slice()).unwrap(), height) } -extern "C" fn OutputSweeper_Listen_block_disconnected(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) { - ::block_disconnected(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) +extern "C" fn OutputSweeperSync_Listen_blocks_disconnected(this_arg: *const c_void, mut fork_point_block: crate::lightning::chain::BestBlock) { + ::blocks_disconnected(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, *unsafe { Box::from_raw(fork_point_block.take_inner()) }) } -impl From for crate::lightning::chain::Confirm { - fn from(obj: nativeOutputSweeper) -> Self { - let rust_obj = crate::lightning::util::sweep::OutputSweeper { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = OutputSweeper_as_Confirm(&rust_obj); +impl From for crate::lightning::chain::Confirm { + fn from(obj: nativeOutputSweeperSync) -> Self { + let rust_obj = crate::lightning::util::sweep::OutputSweeperSync { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = OutputSweeperSync_as_Confirm(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); - ret.free = Some(OutputSweeper_free_void); + ret.free = Some(OutputSweeperSync_free_void); ret } } /// Constructs a new Confirm which calls the relevant methods on this_arg. /// This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is #[no_mangle] -pub extern "C" fn OutputSweeper_as_Confirm(this_arg: &OutputSweeper) -> crate::lightning::chain::Confirm { +pub extern "C" fn OutputSweeperSync_as_Confirm(this_arg: &OutputSweeperSync) -> crate::lightning::chain::Confirm { crate::lightning::chain::Confirm { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - transactions_confirmed: OutputSweeper_Confirm_transactions_confirmed, - transaction_unconfirmed: OutputSweeper_Confirm_transaction_unconfirmed, - best_block_updated: OutputSweeper_Confirm_best_block_updated, - get_relevant_txids: OutputSweeper_Confirm_get_relevant_txids, + transactions_confirmed: OutputSweeperSync_Confirm_transactions_confirmed, + transaction_unconfirmed: OutputSweeperSync_Confirm_transaction_unconfirmed, + best_block_updated: OutputSweeperSync_Confirm_best_block_updated, + get_relevant_txids: OutputSweeperSync_Confirm_get_relevant_txids, } } -extern "C" fn OutputSweeper_Confirm_transactions_confirmed(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) { +extern "C" fn OutputSweeperSync_Confirm_transactions_confirmed(this_arg: *const c_void, header: *const [u8; 80], mut txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, mut height: u32) { let mut local_txdata = Vec::new(); for mut item in txdata.into_rust().drain(..) { local_txdata.push( { let (mut orig_txdata_0_0, mut orig_txdata_0_1) = item.to_rust(); let mut local_txdata_0 = (orig_txdata_0_0, orig_txdata_0_1.into_bitcoin()); local_txdata_0 }); }; - ::transactions_confirmed(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height) + ::transactions_confirmed(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), &local_txdata.iter().map(|(a, b)| (*a, b)).collect::>()[..], height) } -extern "C" fn OutputSweeper_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) { - ::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap()) +extern "C" fn OutputSweeperSync_Confirm_transaction_unconfirmed(this_arg: *const c_void, txid: *const [u8; 32]) { + ::transaction_unconfirmed(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, &::bitcoin::hash_types::Txid::from_slice(&unsafe { &*txid }[..]).unwrap()) } -extern "C" fn OutputSweeper_Confirm_best_block_updated(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) { - ::best_block_updated(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) +extern "C" fn OutputSweeperSync_Confirm_best_block_updated(this_arg: *const c_void, header: *const [u8; 80], mut height: u32) { + ::best_block_updated(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) } #[must_use] -extern "C" fn OutputSweeper_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { - let mut ret = ::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeOutputSweeper) }, ); +extern "C" fn OutputSweeperSync_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + let mut ret = ::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeOutputSweeperSync) }, ); 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, mut orig_ret_0_2) = item; let mut local_orig_ret_0_2 = if orig_ret_0_2.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_2.unwrap().as_ref() } }) }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: *orig_ret_0_0.as_ref() }, orig_ret_0_1, local_orig_ret_0_2).into(); local_ret_0 }); }; local_ret.into() } -/// A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a -/// future block height is reached. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum SpendingDelay { - /// A relative delay indicating we shouldn't spend the output before `cur_height + num_blocks` - /// is reached. - Relative { - /// The number of blocks until we'll generate and broadcast the spending transaction. - num_blocks: u32, - }, - /// An absolute delay indicating we shouldn't spend the output before `height` is reached. - Absolute { - /// The height at which we'll generate and broadcast the spending transaction. - height: u32, - }, -} -use lightning::util::sweep::SpendingDelay as SpendingDelayImport; -pub(crate) type nativeSpendingDelay = SpendingDelayImport; - -impl SpendingDelay { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeSpendingDelay { - match self { - SpendingDelay::Relative {ref num_blocks, } => { - let mut num_blocks_nonref = Clone::clone(num_blocks); - nativeSpendingDelay::Relative { - num_blocks: num_blocks_nonref, - } - }, - SpendingDelay::Absolute {ref height, } => { - let mut height_nonref = Clone::clone(height); - nativeSpendingDelay::Absolute { - height: height_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeSpendingDelay { - match self { - SpendingDelay::Relative {mut num_blocks, } => { - nativeSpendingDelay::Relative { - num_blocks: num_blocks, - } - }, - SpendingDelay::Absolute {mut height, } => { - nativeSpendingDelay::Absolute { - height: height, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &SpendingDelayImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeSpendingDelay) }; - match native { - nativeSpendingDelay::Relative {ref num_blocks, } => { - let mut num_blocks_nonref = Clone::clone(num_blocks); - SpendingDelay::Relative { - num_blocks: num_blocks_nonref, - } - }, - nativeSpendingDelay::Absolute {ref height, } => { - let mut height_nonref = Clone::clone(height); - SpendingDelay::Absolute { - height: height_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeSpendingDelay) -> Self { - match native { - nativeSpendingDelay::Relative {mut num_blocks, } => { - SpendingDelay::Relative { - num_blocks: num_blocks, - } - }, - nativeSpendingDelay::Absolute {mut height, } => { - SpendingDelay::Absolute { - height: height, - } - }, - } - } -} -/// Frees any resources used by the SpendingDelay -#[no_mangle] -pub extern "C" fn SpendingDelay_free(this_ptr: SpendingDelay) { } -/// Creates a copy of the SpendingDelay -#[no_mangle] -pub extern "C" fn SpendingDelay_clone(orig: &SpendingDelay) -> SpendingDelay { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SpendingDelay_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const SpendingDelay)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn SpendingDelay_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut SpendingDelay) }; -} -#[no_mangle] -/// Utility method to constructs a new Relative-variant SpendingDelay -pub extern "C" fn SpendingDelay_relative(num_blocks: u32) -> SpendingDelay { - SpendingDelay::Relative { - num_blocks, - } -} -#[no_mangle] -/// Utility method to constructs a new Absolute-variant SpendingDelay -pub extern "C" fn SpendingDelay_absolute(height: u32) -> SpendingDelay { - SpendingDelay::Absolute { - height, - } -} -/// Get a string which allows debug introspection of a SpendingDelay object -pub extern "C" fn SpendingDelay_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::sweep::SpendingDelay }).into()} -#[no_mangle] -/// Read a OutputSweeper from a byte array, created by OutputSweeper_write -pub extern "C" fn OutputSweeper_read(ser: crate::c_types::u8slice, arg_a: crate::lightning::chain::chaininterface::BroadcasterInterface, arg_b: crate::lightning::chain::chaininterface::FeeEstimator, arg_c: crate::c_types::derived::COption_FilterZ, arg_d: crate::lightning::sign::OutputSpender, arg_e: crate::lightning::sign::ChangeDestinationSource, arg_f: crate::lightning::util::persist::KVStore, arg_g: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_OutputSweeperDecodeErrorZ { - let arg_a_conv = arg_a; - let arg_b_conv = arg_b; - let mut local_arg_c = { /*arg_c*/ let arg_c_opt = arg_c; if arg_c_opt.is_none() { None } else { Some({ { { arg_c_opt.take() } }})} }; - let arg_c_conv = local_arg_c; - let arg_d_conv = arg_d; - let arg_e_conv = arg_e; - let arg_f_conv = arg_f; - let arg_g_conv = arg_g; - let arg_conv = (arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv); - let res: Result, 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( { crate::lightning::util::sweep::OutputSweeper { 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] -/// Read a C2Tuple_BestBlockOutputSweeperZ from a byte array, created by C2Tuple_BestBlockOutputSweeperZ_write -pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_read(ser: crate::c_types::u8slice, arg_a: crate::lightning::chain::chaininterface::BroadcasterInterface, arg_b: crate::lightning::chain::chaininterface::FeeEstimator, arg_c: crate::c_types::derived::COption_FilterZ, arg_d: crate::lightning::sign::OutputSpender, arg_e: crate::lightning::sign::ChangeDestinationSource, arg_f: crate::lightning::util::persist::KVStore, arg_g: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { +/// Read a C2Tuple_BestBlockOutputSweeperSyncZ from a byte array, created by C2Tuple_BestBlockOutputSweeperSyncZ_write +pub extern "C" fn C2Tuple_BestBlockOutputSweeperSyncZ_read(ser: crate::c_types::u8slice, arg_a: crate::lightning::chain::chaininterface::BroadcasterInterface, arg_b: crate::lightning::chain::chaininterface::FeeEstimator, arg_c: crate::c_types::derived::COption_FilterZ, arg_d: crate::lightning::sign::OutputSpender, arg_e: crate::lightning::sign::ChangeDestinationSourceSync, arg_f: crate::lightning::util::persist::KVStoreSync, arg_g: crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_C2Tuple_BestBlockOutputSweeperSyncZDecodeErrorZ { let arg_a_conv = arg_a; let arg_b_conv = arg_b; let mut local_arg_c = { /*arg_c*/ let arg_c_opt = arg_c; if arg_c_opt.is_none() { None } else { Some({ { { arg_c_opt.take() } }})} }; @@ -792,7 +793,7 @@ pub extern "C" fn C2Tuple_BestBlockOutputSweeperZ_read(ser: crate::c_types::u8sl let arg_f_conv = arg_f; let arg_g_conv = arg_g; let arg_conv = (arg_a_conv, arg_b_conv, arg_c_conv, arg_d_conv, arg_e_conv, arg_f_conv, arg_g_conv); - let res: Result<(lightning::chain::BestBlock, lightning::util::sweep::OutputSweeper), 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::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(orig_res_0_0), is_owned: true }, crate::lightning::util::sweep::OutputSweeper { 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() }; + let res: Result<(lightning::chain::BestBlock, lightning::util::sweep::OutputSweeperSync), 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::lightning::chain::BestBlock { inner: ObjOps::heap_alloc(orig_res_0_0), is_owned: true }, crate::lightning::util::sweep::OutputSweeperSync { 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() }; local_res } diff --git a/lightning-c-bindings/src/lightning/util/wakers.rs b/lightning-c-bindings/src/lightning/util/wakers.rs index 62aee3b1..28593291 100644 --- a/lightning-c-bindings/src/lightning/util/wakers.rs +++ b/lightning-c-bindings/src/lightning/util/wakers.rs @@ -21,6 +21,99 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; + +use lightning::util::wakers::Notifier as nativeNotifierImport; +pub(crate) type nativeNotifier = nativeNotifierImport; + +/// Used to signal to one of many waiters that the condition they're waiting on has happened. +/// +/// This is usually used by LDK objects such as [`ChannelManager`] or [`PeerManager`] to signal to +/// the background processor that it should wake up and process pending events. +/// +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`PeerManager`]: crate::ln::peer_handler::PeerManager +#[must_use] +#[repr(C)] +pub struct Notifier { + /// 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 nativeNotifier, + /// 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 core::ops::Deref for Notifier { + type Target = nativeNotifier; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for Notifier { } +unsafe impl core::marker::Sync for Notifier { } +impl Drop for Notifier { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeNotifier>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the Notifier, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn Notifier_free(this_obj: Notifier) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Notifier_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNotifier) }; +} +#[allow(unused)] +impl Notifier { + pub(crate) fn get_native_ref(&self) -> &'static nativeNotifier { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeNotifier { + 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 nativeNotifier { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Constructs a new notifier. +#[must_use] +#[no_mangle] +pub extern "C" fn Notifier_new() -> crate::lightning::util::wakers::Notifier { + let mut ret = lightning::util::wakers::Notifier::new(); + crate::lightning::util::wakers::Notifier { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Wake waiters, tracking that wake needs to occur even if there are currently no waiters. +/// +/// We deem the notification successful either directly after any callbacks were made, or after +/// the user [`poll`]ed a previously-generated [`Future`]. +/// +/// [`poll`]: core::future::Future::poll +#[no_mangle] +pub extern "C" fn Notifier_notify(this_arg: &crate::lightning::util::wakers::Notifier) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.notify() +} + +/// Gets a [`Future`] that will get woken up with any waiters +#[must_use] +#[no_mangle] +pub extern "C" fn Notifier_get_future(this_arg: &crate::lightning::util::wakers::Notifier) -> crate::lightning::util::wakers::Future { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_future(); + crate::lightning::util::wakers::Future { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// A callback which is called when a [`Future`] completes. /// /// Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be @@ -256,6 +349,15 @@ pub extern "C" fn Sleeper_from_three_futures(fut_a: &crate::lightning::util::wak crate::lightning::util::wakers::Sleeper { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Constructs a new sleeper from four futures, allowing blocking on all four at once. +/// +#[must_use] +#[no_mangle] +pub extern "C" fn Sleeper_from_four_futures(fut_a: &crate::lightning::util::wakers::Future, fut_b: &crate::lightning::util::wakers::Future, fut_c: &crate::lightning::util::wakers::Future, fut_d: &crate::lightning::util::wakers::Future) -> crate::lightning::util::wakers::Sleeper { + let mut ret = lightning::util::wakers::Sleeper::from_four_futures(fut_a.get_native_ref(), fut_b.get_native_ref(), fut_c.get_native_ref(), fut_d.get_native_ref()); + crate::lightning::util::wakers::Sleeper { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// Constructs a new sleeper on many futures, allowing blocking on all at once. #[must_use] #[no_mangle] diff --git a/lightning-c-bindings/src/lightning_background_processor.rs b/lightning-c-bindings/src/lightning_background_processor.rs index 6f77b1b4..4e027390 100644 --- a/lightning-c-bindings/src/lightning_background_processor.rs +++ b/lightning-c-bindings/src/lightning_background_processor.rs @@ -19,6 +19,18 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +mod fwd_batch { + +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_background_processor::BackgroundProcessor as nativeBackgroundProcessorImport; pub(crate) type nativeBackgroundProcessor = nativeBackgroundProcessorImport; @@ -181,25 +193,37 @@ pub extern "C" fn GossipSync_rapid(a: &crate::lightning_rapid_gossip_sync::Rapid /// Utility method to constructs a new None-variant GossipSync pub extern "C" fn GossipSync_none() -> GossipSync { GossipSync::None} +mod futures_util { + +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}; + +} /// Start a background thread that takes care of responsibilities enumerated in the [top-level /// documentation]. /// /// The thread runs indefinitely unless the object is dropped, [`stop`] is called, or -/// [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling +/// [`KVStoreSync`] returns an error. In case of an error, the error is retrieved by calling /// either [`join`] or [`stop`]. /// /// # Data Persistence /// -/// [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or +/// [`KVStoreSync`] is responsible for writing out the [`ChannelManager`] to disk, and/or /// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a /// [`ChannelManager`]. See the `lightning-persister` crate for LDK's /// provided implementation. /// -/// [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if +/// [`KVStoreSync`] is also responsible for writing out the [`NetworkGraph`] to disk, if /// [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. /// See the `lightning-persister` crate for LDK's provided implementation. /// -/// Typically, users should either implement [`Persister::persist_manager`] to never return an +/// Typically, users should either implement [`KVStoreSync`] to never return an /// error or call [`join`] and handle any error that may arise. For the latter case, /// `BackgroundProcessor` must be restarted by calling `start` again after handling the error. /// @@ -221,15 +245,16 @@ pub extern "C" fn GossipSync_none() -> GossipSync { /// [`stop`]: Self::stop /// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager /// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable -/// [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager -/// [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph /// [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph /// [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable +/// +/// Note that sweeper (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn BackgroundProcessor_start(mut persister: crate::lightning::util::persist::Persister, mut event_handler: crate::lightning::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, onion_messenger: &crate::lightning::onion_message::messenger::OnionMessenger, mut gossip_sync: crate::lightning_background_processor::GossipSync, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut logger: crate::lightning::util::logger::Logger, mut scorer: crate::c_types::derived::COption_WriteableScoreZ) -> crate::lightning_background_processor::BackgroundProcessor { +pub extern "C" fn BackgroundProcessor_start(mut kv_store: crate::lightning::util::persist::KVStoreSync, mut event_handler: crate::lightning::events::EventHandler, chain_monitor: &crate::lightning::chain::chainmonitor::ChainMonitor, channel_manager: &crate::lightning::ln::channelmanager::ChannelManager, onion_messenger: &crate::lightning::onion_message::messenger::OnionMessenger, mut gossip_sync: crate::lightning_background_processor::GossipSync, peer_manager: &crate::lightning::ln::peer_handler::PeerManager, mut sweeper: crate::lightning::util::sweep::OutputSweeperSync, mut logger: crate::lightning::util::logger::Logger, mut scorer: crate::c_types::derived::COption_WriteableScoreZ) -> crate::lightning_background_processor::BackgroundProcessor { + let mut local_sweeper = if sweeper.inner.is_null() { None } else { Some( { sweeper.get_native_ref() }) }; let mut local_scorer = { /*scorer*/ let scorer_opt = scorer; if scorer_opt.is_none() { None } else { Some({ { { scorer_opt.take() } }})} }; - let mut ret = lightning_background_processor::BackgroundProcessor::start(persister, event_handler, chain_monitor.get_native_ref(), channel_manager.as_ref_to(), onion_messenger.as_ref_to(), gossip_sync.into_native(), peer_manager.as_ref_to(), logger, local_scorer); + let mut ret = lightning_background_processor::BackgroundProcessor::start(kv_store, event_handler, chain_monitor.get_native_ref(), channel_manager.as_ref_to(), onion_messenger.as_ref_to(), gossip_sync.into_native(), peer_manager.as_ref_to(), local_sweeper, logger, local_scorer); crate::lightning_background_processor::BackgroundProcessor { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning_invoice/mod.rs b/lightning-c-bindings/src/lightning_invoice/mod.rs index d9ebaa5b..388634bc 100644 --- a/lightning-c-bindings/src/lightning_invoice/mod.rs +++ b/lightning-c-bindings/src/lightning_invoice/mod.rs @@ -108,6 +108,30 @@ pub extern "C" fn Bolt11ParseError_to_str(o: &crate::lightning_invoice::Bolt11Pa pub extern "C" fn ParseOrSemanticError_to_str(o: &crate::lightning_invoice::ParseOrSemanticError) -> Str { alloc::format!("{}", &o.to_native()).into() } +#[no_mangle] +/// Build a Bolt11ParseError from a Secp256k1Error +pub extern "C" fn Bolt11ParseError_from_Secp256k1Error(f: crate::c_types::Secp256k1Error) -> crate::lightning_invoice::Bolt11ParseError { + let from_obj = f.into_rust(); + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc((lightning_invoice::Bolt11ParseError::from(from_obj))), is_owned: true } +} +#[no_mangle] +/// Build a Bolt11ParseError from a Error +pub extern "C" fn Bolt11ParseError_from_Error(f: crate::c_types::Error) -> crate::lightning_invoice::Bolt11ParseError { + let from_obj = u8::from_str_radix(" a", 10).unwrap_err() /*f*/; + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc((lightning_invoice::Bolt11ParseError::from(from_obj))), is_owned: true } +} +#[no_mangle] +/// Build a ParseOrSemanticError from a Bolt11ParseError +pub extern "C" fn ParseOrSemanticError_from_Bolt11ParseError(f: crate::lightning_invoice::Bolt11ParseError) -> crate::lightning_invoice::ParseOrSemanticError { + let from_obj = *unsafe { Box::from_raw(f.take_inner()) }; + crate::lightning_invoice::ParseOrSemanticError::native_into((lightning_invoice::ParseOrSemanticError::from(from_obj))) +} +#[no_mangle] +/// Build a ParseOrSemanticError from a Bolt11SemanticError +pub extern "C" fn ParseOrSemanticError_from_Bolt11SemanticError(f: crate::lightning_invoice::Bolt11SemanticError) -> crate::lightning_invoice::ParseOrSemanticError { + let from_obj = f.into_native(); + crate::lightning_invoice::ParseOrSemanticError::native_into((lightning_invoice::ParseOrSemanticError::from(from_obj))) +} } mod ser { @@ -242,7 +266,7 @@ impl Clone for Bolt11ParseError { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt11ParseError>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -250,12 +274,12 @@ impl Clone for Bolt11ParseError { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt11ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11ParseError)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt11ParseError) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt11ParseError pub extern "C" fn Bolt11ParseError_clone(orig: &Bolt11ParseError) -> Bolt11ParseError { - orig.clone() + Clone::clone(orig) } /// Indicates that something went wrong while parsing or validating the invoice. Parsing errors /// should be mostly seen as opaque and are only there for debugging reasons. Semantic errors @@ -493,7 +517,7 @@ impl Clone for Bolt11Invoice { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt11Invoice>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -501,12 +525,12 @@ impl Clone for Bolt11Invoice { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11Invoice)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt11Invoice) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt11Invoice pub extern "C" fn Bolt11Invoice_clone(orig: &Bolt11Invoice) -> Bolt11Invoice { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the Bolt11Invoice. #[no_mangle] @@ -723,7 +747,7 @@ impl Clone for SignedRawBolt11Invoice { fn clone(&self) -> Self { Self { inner: if <*mut nativeSignedRawBolt11Invoice>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -731,12 +755,12 @@ impl Clone for SignedRawBolt11Invoice { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn SignedRawBolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSignedRawBolt11Invoice)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeSignedRawBolt11Invoice) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the SignedRawBolt11Invoice pub extern "C" fn SignedRawBolt11Invoice_clone(orig: &SignedRawBolt11Invoice) -> SignedRawBolt11Invoice { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the SignedRawBolt11Invoice. #[no_mangle] @@ -815,7 +839,7 @@ impl RawBolt11Invoice { /// data part #[no_mangle] pub extern "C" fn RawBolt11Invoice_get_data(this_ptr: &RawBolt11Invoice) -> crate::lightning_invoice::RawDataPart { - let mut inner_val = &mut this_ptr.get_native_mut_ref().data; + let mut inner_val = &mut RawBolt11Invoice::get_native_mut_ref(this_ptr).data; crate::lightning_invoice::RawDataPart { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_invoice::RawDataPart<>) as *mut _) }, is_owned: false } } /// data part @@ -839,7 +863,7 @@ impl Clone for RawBolt11Invoice { fn clone(&self) -> Self { Self { inner: if <*mut nativeRawBolt11Invoice>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -847,12 +871,12 @@ impl Clone for RawBolt11Invoice { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RawBolt11Invoice_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRawBolt11Invoice)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRawBolt11Invoice) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RawBolt11Invoice pub extern "C" fn RawBolt11Invoice_clone(orig: &RawBolt11Invoice) -> RawBolt11Invoice { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the RawBolt11Invoice. #[no_mangle] @@ -927,7 +951,7 @@ impl RawDataPart { /// generation time of the invoice #[no_mangle] pub extern "C" fn RawDataPart_get_timestamp(this_ptr: &RawDataPart) -> crate::lightning_invoice::PositiveTimestamp { - let mut inner_val = &mut this_ptr.get_native_mut_ref().timestamp; + let mut inner_val = &mut RawDataPart::get_native_mut_ref(this_ptr).timestamp; crate::lightning_invoice::PositiveTimestamp { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_invoice::PositiveTimestamp<>) as *mut _) }, is_owned: false } } /// generation time of the invoice @@ -951,7 +975,7 @@ impl Clone for RawDataPart { fn clone(&self) -> Self { Self { inner: if <*mut nativeRawDataPart>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -959,12 +983,12 @@ impl Clone for RawDataPart { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RawDataPart_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRawDataPart)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRawDataPart) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RawDataPart pub extern "C" fn RawDataPart_clone(orig: &RawDataPart) -> RawDataPart { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the RawDataPart. #[no_mangle] @@ -1057,7 +1081,7 @@ impl Clone for PositiveTimestamp { fn clone(&self) -> Self { Self { inner: if <*mut nativePositiveTimestamp>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1065,12 +1089,12 @@ impl Clone for PositiveTimestamp { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PositiveTimestamp_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePositiveTimestamp)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePositiveTimestamp) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PositiveTimestamp pub extern "C" fn PositiveTimestamp_clone(orig: &PositiveTimestamp) -> PositiveTimestamp { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the PositiveTimestamp. #[no_mangle] @@ -1375,7 +1399,7 @@ impl Clone for Sha256 { fn clone(&self) -> Self { Self { inner: if <*mut nativeSha256>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1383,12 +1407,12 @@ impl Clone for Sha256 { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Sha256_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeSha256)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeSha256) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Sha256 pub extern "C" fn Sha256_clone(orig: &Sha256) -> Sha256 { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Sha256 object pub extern "C" fn Sha256_debug_str_void(o: *const c_void) -> Str { @@ -1488,7 +1512,7 @@ impl Clone for Description { fn clone(&self) -> Self { Self { inner: if <*mut nativeDescription>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1496,12 +1520,12 @@ impl Clone for Description { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Description_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDescription)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeDescription) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Description pub extern "C" fn Description_clone(orig: &Description) -> Description { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Description object pub extern "C" fn Description_debug_str_void(o: *const c_void) -> Str { @@ -1587,7 +1611,7 @@ impl PayeePubKey { } #[no_mangle] pub extern "C" fn PayeePubKey_get_a(this_ptr: &PayeePubKey) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut PayeePubKey::get_native_mut_ref(this_ptr).0; crate::c_types::PublicKey::from_rust(&inner_val) } #[no_mangle] @@ -1606,7 +1630,7 @@ impl Clone for PayeePubKey { fn clone(&self) -> Self { Self { inner: if <*mut nativePayeePubKey>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1614,12 +1638,12 @@ impl Clone for PayeePubKey { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PayeePubKey_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePayeePubKey)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePayeePubKey) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PayeePubKey pub extern "C" fn PayeePubKey_clone(orig: &PayeePubKey) -> PayeePubKey { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PayeePubKey object pub extern "C" fn PayeePubKey_debug_str_void(o: *const c_void) -> Str { @@ -1708,7 +1732,7 @@ impl Clone for ExpiryTime { fn clone(&self) -> Self { Self { inner: if <*mut nativeExpiryTime>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1716,12 +1740,12 @@ impl Clone for ExpiryTime { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ExpiryTime_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeExpiryTime)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeExpiryTime) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ExpiryTime pub extern "C" fn ExpiryTime_clone(orig: &ExpiryTime) -> ExpiryTime { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a ExpiryTime object pub extern "C" fn ExpiryTime_debug_str_void(o: *const c_void) -> Str { @@ -1807,7 +1831,7 @@ impl MinFinalCltvExpiryDelta { } #[no_mangle] pub extern "C" fn MinFinalCltvExpiryDelta_get_a(this_ptr: &MinFinalCltvExpiryDelta) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut MinFinalCltvExpiryDelta::get_native_mut_ref(this_ptr).0; *inner_val } #[no_mangle] @@ -1826,7 +1850,7 @@ impl Clone for MinFinalCltvExpiryDelta { fn clone(&self) -> Self { Self { inner: if <*mut nativeMinFinalCltvExpiryDelta>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1834,12 +1858,12 @@ impl Clone for MinFinalCltvExpiryDelta { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MinFinalCltvExpiryDelta_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeMinFinalCltvExpiryDelta)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeMinFinalCltvExpiryDelta) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the MinFinalCltvExpiryDelta pub extern "C" fn MinFinalCltvExpiryDelta_clone(orig: &MinFinalCltvExpiryDelta) -> MinFinalCltvExpiryDelta { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a MinFinalCltvExpiryDelta object pub extern "C" fn MinFinalCltvExpiryDelta_debug_str_void(o: *const c_void) -> Str { @@ -2095,7 +2119,7 @@ impl Bolt11InvoiceSignature { } #[no_mangle] pub extern "C" fn Bolt11InvoiceSignature_get_a(this_ptr: &Bolt11InvoiceSignature) -> crate::c_types::RecoverableSignature { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut Bolt11InvoiceSignature::get_native_mut_ref(this_ptr).0; crate::c_types::RecoverableSignature::from_rust(&inner_val) } #[no_mangle] @@ -2114,7 +2138,7 @@ impl Clone for Bolt11InvoiceSignature { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt11InvoiceSignature>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2122,12 +2146,12 @@ impl Clone for Bolt11InvoiceSignature { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt11InvoiceSignature_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11InvoiceSignature)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt11InvoiceSignature) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt11InvoiceSignature pub extern "C" fn Bolt11InvoiceSignature_clone(orig: &Bolt11InvoiceSignature) -> Bolt11InvoiceSignature { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a Bolt11InvoiceSignature object pub extern "C" fn Bolt11InvoiceSignature_debug_str_void(o: *const c_void) -> Str { @@ -2219,7 +2243,7 @@ impl Clone for PrivateRoute { fn clone(&self) -> Self { Self { inner: if <*mut nativePrivateRoute>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -2227,12 +2251,12 @@ impl Clone for PrivateRoute { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PrivateRoute_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativePrivateRoute)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativePrivateRoute) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the PrivateRoute pub extern "C" fn PrivateRoute_clone(orig: &PrivateRoute) -> PrivateRoute { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a PrivateRoute object pub extern "C" fn PrivateRoute_debug_str_void(o: *const c_void) -> Str { @@ -2302,7 +2326,7 @@ pub extern "C" fn SignedRawBolt11Invoice_recover_payee_pub_key(this_arg: &crate: } /// Checks if the signature is valid for the included payee public key or if none exists if it's -/// valid for the recovered signature (which should always be true?). +/// possible to recover the public key from the signature. #[must_use] #[no_mangle] pub extern "C" fn SignedRawBolt11Invoice_check_signature(this_arg: &crate::lightning_invoice::SignedRawBolt11Invoice) -> bool { @@ -2507,7 +2531,7 @@ pub extern "C" fn Bolt11Invoice_into_signed_raw(mut this_arg: crate::lightning_i crate::lightning_invoice::SignedRawBolt11Invoice { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Check that the invoice is signed correctly and that key recovery works +/// Check that the invoice is signed correctly #[must_use] #[no_mangle] pub extern "C" fn Bolt11Invoice_check_signature(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::CResult_NoneBolt11SemanticErrorZ { @@ -2694,6 +2718,17 @@ pub extern "C" fn Bolt11Invoice_fallback_addresses(this_arg: &crate::lightning_i local_ret.into() } +/// Returns the first fallback address as an [`Address`]. +/// +/// See [`Self::fallback_addresses`] to fetch all addresses of known type. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11Invoice_first_fallback_address(this_arg: &crate::lightning_invoice::Bolt11Invoice) -> crate::c_types::derived::COption_AddressZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.first_fallback_address(); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_AddressZ::None } else { crate::c_types::derived::COption_AddressZ::Some( { crate::c_types::Address::from_rust(&ret.unwrap()) }) }; + local_ret +} + /// Returns a list of all routes included in the invoice #[must_use] #[no_mangle] @@ -2770,6 +2805,12 @@ pub extern "C" fn Description_as_inner(this_arg: &crate::lightning_invoice::Desc pub extern "C" fn Description_to_str(o: &crate::lightning_invoice::Description) -> Str { alloc::format!("{}", o.get_native_ref()).into() } +#[no_mangle] +/// Build a PayeePubKey from a PublicKey +pub extern "C" fn PayeePubKey_from_PublicKey(f: crate::c_types::PublicKey) -> crate::lightning_invoice::PayeePubKey { + let from_obj = f.into_rust(); + crate::lightning_invoice::PayeePubKey { inner: ObjOps::heap_alloc((lightning_invoice::PayeePubKey::from(from_obj))), is_owned: true } +} /// Construct an `ExpiryTime` from seconds. #[must_use] #[no_mangle] @@ -2819,6 +2860,12 @@ pub extern "C" fn PrivateRoute_into_inner(mut this_arg: crate::lightning_invoice crate::lightning_types::routing::RouteHint { inner: ObjOps::heap_alloc(ret), is_owned: true } } +#[no_mangle] +/// Build a RouteHint from a PrivateRoute +pub extern "C" fn RouteHint_from_PrivateRoute(f: crate::lightning_invoice::PrivateRoute) -> crate::lightning_types::routing::RouteHint { + let from_obj = *unsafe { Box::from_raw(f.take_inner()) }; + crate::lightning_types::routing::RouteHint { inner: ObjOps::heap_alloc((lightning_types::routing::RouteHint::from(from_obj))), is_owned: true } +} /// Errors that may occur when constructing a new [`RawBolt11Invoice`] or [`Bolt11Invoice`] #[derive(Clone)] #[must_use] @@ -2961,8 +3008,6 @@ pub enum Bolt11SemanticError { MultiplePaymentSecrets, /// The invoice's features are invalid InvalidFeatures, - /// The recovery id doesn't fit the signature/pub key - InvalidRecoveryId, /// The invoice's signature is invalid InvalidSignature, /// The invoice's amount was not a whole number of millisatoshis @@ -2982,7 +3027,6 @@ impl Bolt11SemanticError { Bolt11SemanticError::NoPaymentSecret => nativeBolt11SemanticError::NoPaymentSecret, Bolt11SemanticError::MultiplePaymentSecrets => nativeBolt11SemanticError::MultiplePaymentSecrets, Bolt11SemanticError::InvalidFeatures => nativeBolt11SemanticError::InvalidFeatures, - Bolt11SemanticError::InvalidRecoveryId => nativeBolt11SemanticError::InvalidRecoveryId, Bolt11SemanticError::InvalidSignature => nativeBolt11SemanticError::InvalidSignature, Bolt11SemanticError::ImpreciseAmount => nativeBolt11SemanticError::ImpreciseAmount, } @@ -2997,7 +3041,6 @@ impl Bolt11SemanticError { Bolt11SemanticError::NoPaymentSecret => nativeBolt11SemanticError::NoPaymentSecret, Bolt11SemanticError::MultiplePaymentSecrets => nativeBolt11SemanticError::MultiplePaymentSecrets, Bolt11SemanticError::InvalidFeatures => nativeBolt11SemanticError::InvalidFeatures, - Bolt11SemanticError::InvalidRecoveryId => nativeBolt11SemanticError::InvalidRecoveryId, Bolt11SemanticError::InvalidSignature => nativeBolt11SemanticError::InvalidSignature, Bolt11SemanticError::ImpreciseAmount => nativeBolt11SemanticError::ImpreciseAmount, } @@ -3013,7 +3056,6 @@ impl Bolt11SemanticError { nativeBolt11SemanticError::NoPaymentSecret => Bolt11SemanticError::NoPaymentSecret, nativeBolt11SemanticError::MultiplePaymentSecrets => Bolt11SemanticError::MultiplePaymentSecrets, nativeBolt11SemanticError::InvalidFeatures => Bolt11SemanticError::InvalidFeatures, - nativeBolt11SemanticError::InvalidRecoveryId => Bolt11SemanticError::InvalidRecoveryId, nativeBolt11SemanticError::InvalidSignature => Bolt11SemanticError::InvalidSignature, nativeBolt11SemanticError::ImpreciseAmount => Bolt11SemanticError::ImpreciseAmount, } @@ -3028,7 +3070,6 @@ impl Bolt11SemanticError { nativeBolt11SemanticError::NoPaymentSecret => Bolt11SemanticError::NoPaymentSecret, nativeBolt11SemanticError::MultiplePaymentSecrets => Bolt11SemanticError::MultiplePaymentSecrets, nativeBolt11SemanticError::InvalidFeatures => Bolt11SemanticError::InvalidFeatures, - nativeBolt11SemanticError::InvalidRecoveryId => Bolt11SemanticError::InvalidRecoveryId, nativeBolt11SemanticError::InvalidSignature => Bolt11SemanticError::InvalidSignature, nativeBolt11SemanticError::ImpreciseAmount => Bolt11SemanticError::ImpreciseAmount, } @@ -3078,10 +3119,6 @@ pub extern "C" fn Bolt11SemanticError_multiple_payment_secrets() -> Bolt11Semant pub extern "C" fn Bolt11SemanticError_invalid_features() -> Bolt11SemanticError { Bolt11SemanticError::InvalidFeatures} #[no_mangle] -/// Utility method to constructs a new InvalidRecoveryId-variant Bolt11SemanticError -pub extern "C" fn Bolt11SemanticError_invalid_recovery_id() -> Bolt11SemanticError { - Bolt11SemanticError::InvalidRecoveryId} -#[no_mangle] /// Utility method to constructs a new InvalidSignature-variant Bolt11SemanticError pub extern "C" fn Bolt11SemanticError_invalid_signature() -> Bolt11SemanticError { Bolt11SemanticError::InvalidSignature} diff --git a/lightning-c-bindings/src/lightning_liquidity/events.rs b/lightning-c-bindings/src/lightning_liquidity/events.rs deleted file mode 100644 index 82ffac2c..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/events.rs +++ /dev/null @@ -1,208 +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. - -//! Events are surfaced by the library to indicate some action must be taken -//! by the end-user. -//! -//! Because we don't have a built-in runtime, it's up to the end-user to poll -//! [`LiquidityManager::get_and_clear_pending_events`] to receive events. -//! -//! [`LiquidityManager::get_and_clear_pending_events`]: crate::LiquidityManager::get_and_clear_pending_events - -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}; - -/// The maximum queue size we allow before starting to drop events. - -#[no_mangle] -pub static MAX_EVENT_QUEUE_SIZE: usize = lightning_liquidity::events::MAX_EVENT_QUEUE_SIZE; -/// An event which you should probably take some action in response to. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LiquidityEvent { - /// An LSPS0 client event. - LSPS0Client( - crate::lightning_liquidity::lsps0::event::LSPS0ClientEvent), - /// An LSPS1 (Channel Request) client event. - LSPS1Client( - crate::lightning_liquidity::lsps1::event::LSPS1ClientEvent), - /// An LSPS2 (JIT Channel) client event. - LSPS2Client( - crate::lightning_liquidity::lsps2::event::LSPS2ClientEvent), - /// An LSPS2 (JIT Channel) server event. - LSPS2Service( - crate::lightning_liquidity::lsps2::event::LSPS2ServiceEvent), -} -use lightning_liquidity::events::LiquidityEvent as LiquidityEventImport; -pub(crate) type nativeLiquidityEvent = LiquidityEventImport; - -impl LiquidityEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLiquidityEvent { - match self { - LiquidityEvent::LSPS0Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLiquidityEvent::LSPS0Client ( - a_nonref.into_native(), - ) - }, - LiquidityEvent::LSPS1Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLiquidityEvent::LSPS1Client ( - a_nonref.into_native(), - ) - }, - LiquidityEvent::LSPS2Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLiquidityEvent::LSPS2Client ( - a_nonref.into_native(), - ) - }, - LiquidityEvent::LSPS2Service (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLiquidityEvent::LSPS2Service ( - a_nonref.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLiquidityEvent { - match self { - LiquidityEvent::LSPS0Client (mut a, ) => { - nativeLiquidityEvent::LSPS0Client ( - a.into_native(), - ) - }, - LiquidityEvent::LSPS1Client (mut a, ) => { - nativeLiquidityEvent::LSPS1Client ( - a.into_native(), - ) - }, - LiquidityEvent::LSPS2Client (mut a, ) => { - nativeLiquidityEvent::LSPS2Client ( - a.into_native(), - ) - }, - LiquidityEvent::LSPS2Service (mut a, ) => { - nativeLiquidityEvent::LSPS2Service ( - a.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LiquidityEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLiquidityEvent) }; - match native { - nativeLiquidityEvent::LSPS0Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LiquidityEvent::LSPS0Client ( - crate::lightning_liquidity::lsps0::event::LSPS0ClientEvent::native_into(a_nonref), - ) - }, - nativeLiquidityEvent::LSPS1Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LiquidityEvent::LSPS1Client ( - crate::lightning_liquidity::lsps1::event::LSPS1ClientEvent::native_into(a_nonref), - ) - }, - nativeLiquidityEvent::LSPS2Client (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LiquidityEvent::LSPS2Client ( - crate::lightning_liquidity::lsps2::event::LSPS2ClientEvent::native_into(a_nonref), - ) - }, - nativeLiquidityEvent::LSPS2Service (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LiquidityEvent::LSPS2Service ( - crate::lightning_liquidity::lsps2::event::LSPS2ServiceEvent::native_into(a_nonref), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLiquidityEvent) -> Self { - match native { - nativeLiquidityEvent::LSPS0Client (mut a, ) => { - LiquidityEvent::LSPS0Client ( - crate::lightning_liquidity::lsps0::event::LSPS0ClientEvent::native_into(a), - ) - }, - nativeLiquidityEvent::LSPS1Client (mut a, ) => { - LiquidityEvent::LSPS1Client ( - crate::lightning_liquidity::lsps1::event::LSPS1ClientEvent::native_into(a), - ) - }, - nativeLiquidityEvent::LSPS2Client (mut a, ) => { - LiquidityEvent::LSPS2Client ( - crate::lightning_liquidity::lsps2::event::LSPS2ClientEvent::native_into(a), - ) - }, - nativeLiquidityEvent::LSPS2Service (mut a, ) => { - LiquidityEvent::LSPS2Service ( - crate::lightning_liquidity::lsps2::event::LSPS2ServiceEvent::native_into(a), - ) - }, - } - } -} -/// Frees any resources used by the LiquidityEvent -#[no_mangle] -pub extern "C" fn LiquidityEvent_free(this_ptr: LiquidityEvent) { } -/// Creates a copy of the LiquidityEvent -#[no_mangle] -pub extern "C" fn LiquidityEvent_clone(orig: &LiquidityEvent) -> LiquidityEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LiquidityEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LiquidityEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LiquidityEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LiquidityEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new LSPS0Client-variant LiquidityEvent -pub extern "C" fn LiquidityEvent_lsps0_client(a: crate::lightning_liquidity::lsps0::event::LSPS0ClientEvent) -> LiquidityEvent { - LiquidityEvent::LSPS0Client(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS1Client-variant LiquidityEvent -pub extern "C" fn LiquidityEvent_lsps1_client(a: crate::lightning_liquidity::lsps1::event::LSPS1ClientEvent) -> LiquidityEvent { - LiquidityEvent::LSPS1Client(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS2Client-variant LiquidityEvent -pub extern "C" fn LiquidityEvent_lsps2_client(a: crate::lightning_liquidity::lsps2::event::LSPS2ClientEvent) -> LiquidityEvent { - LiquidityEvent::LSPS2Client(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS2Service-variant LiquidityEvent -pub extern "C" fn LiquidityEvent_lsps2_service(a: crate::lightning_liquidity::lsps2::event::LSPS2ServiceEvent) -> LiquidityEvent { - LiquidityEvent::LSPS2Service(a, ) -} -/// Get a string which allows debug introspection of a LiquidityEvent object -pub extern "C" fn LiquidityEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::events::LiquidityEvent }).into()} -/// Checks if two LiquidityEvents contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LiquidityEvent_eq(a: &LiquidityEvent, b: &LiquidityEvent) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps0/client.rs b/lightning-c-bindings/src/lightning_liquidity/lsps0/client.rs deleted file mode 100644 index f7006b3e..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/client.rs +++ /dev/null @@ -1,93 +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. - -//! Contains the main bLIP-50 / LSPS0 client-side object, [`LSPS0ClientHandler`]. -//! -//! Please refer to the [bLIP-50 / LSPS0 -//! specifcation](https://github.com/lightning/blips/blob/master/blip-0050.md) for more -//! information. - -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_liquidity::lsps0::client::LSPS0ClientHandler as nativeLSPS0ClientHandlerImport; -pub(crate) type nativeLSPS0ClientHandler = nativeLSPS0ClientHandlerImport; - -/// A message handler capable of sending and handling bLIP-50 / LSPS0 messages. -#[must_use] -#[repr(C)] -pub struct LSPS0ClientHandler { - /// 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 nativeLSPS0ClientHandler, - /// 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 core::ops::Deref for LSPS0ClientHandler { - type Target = nativeLSPS0ClientHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS0ClientHandler { } -unsafe impl core::marker::Sync for LSPS0ClientHandler { } -impl Drop for LSPS0ClientHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS0ClientHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS0ClientHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS0ClientHandler_free(this_obj: LSPS0ClientHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ClientHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS0ClientHandler) }; -} -#[allow(unused)] -impl LSPS0ClientHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS0ClientHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS0ClientHandler { - 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 nativeLSPS0ClientHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Calls bLIP-50 / LSPS0's `list_protocols`. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specifcation](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[no_mangle] -pub extern "C" fn LSPS0ClientHandler_list_protocols(this_arg: &crate::lightning_liquidity::lsps0::client::LSPS0ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_protocols(&counterparty_node_id.into_rust()) -} - diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps0/event.rs b/lightning-c-bindings/src/lightning_liquidity/lsps0/event.rs deleted file mode 100644 index 8f76d916..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/event.rs +++ /dev/null @@ -1,125 +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. - -//! Contains bLIP-50 / LSPS0 event types. - -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}; - -/// An event which an bLIP-50 / LSPS0 client may want to take some action in response to. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS0ClientEvent { - /// Information from the LSP about the protocols they support. - ListProtocolsResponse { - /// The node id of the LSP. - counterparty_node_id: crate::c_types::PublicKey, - /// A list of supported protocols. - protocols: crate::c_types::derived::CVec_u16Z, - }, -} -use lightning_liquidity::lsps0::event::LSPS0ClientEvent as LSPS0ClientEventImport; -pub(crate) type nativeLSPS0ClientEvent = LSPS0ClientEventImport; - -impl LSPS0ClientEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS0ClientEvent { - match self { - LSPS0ClientEvent::ListProtocolsResponse {ref counterparty_node_id, ref protocols, } => { - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut protocols_nonref = Clone::clone(protocols); - let mut local_protocols_nonref = Vec::new(); for mut item in protocols_nonref.into_rust().drain(..) { local_protocols_nonref.push( { item }); }; - nativeLSPS0ClientEvent::ListProtocolsResponse { - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - protocols: local_protocols_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS0ClientEvent { - match self { - LSPS0ClientEvent::ListProtocolsResponse {mut counterparty_node_id, mut protocols, } => { - let mut local_protocols = Vec::new(); for mut item in protocols.into_rust().drain(..) { local_protocols.push( { item }); }; - nativeLSPS0ClientEvent::ListProtocolsResponse { - counterparty_node_id: counterparty_node_id.into_rust(), - protocols: local_protocols, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS0ClientEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS0ClientEvent) }; - match native { - nativeLSPS0ClientEvent::ListProtocolsResponse {ref counterparty_node_id, ref protocols, } => { - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut protocols_nonref = Clone::clone(protocols); - let mut local_protocols_nonref = Vec::new(); for mut item in protocols_nonref.drain(..) { local_protocols_nonref.push( { item }); }; - LSPS0ClientEvent::ListProtocolsResponse { - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - protocols: local_protocols_nonref.into(), - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS0ClientEvent) -> Self { - match native { - nativeLSPS0ClientEvent::ListProtocolsResponse {mut counterparty_node_id, mut protocols, } => { - let mut local_protocols = Vec::new(); for mut item in protocols.drain(..) { local_protocols.push( { item }); }; - LSPS0ClientEvent::ListProtocolsResponse { - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - protocols: local_protocols.into(), - } - }, - } - } -} -/// Frees any resources used by the LSPS0ClientEvent -#[no_mangle] -pub extern "C" fn LSPS0ClientEvent_free(this_ptr: LSPS0ClientEvent) { } -/// Creates a copy of the LSPS0ClientEvent -#[no_mangle] -pub extern "C" fn LSPS0ClientEvent_clone(orig: &LSPS0ClientEvent) -> LSPS0ClientEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ClientEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS0ClientEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ClientEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS0ClientEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new ListProtocolsResponse-variant LSPS0ClientEvent -pub extern "C" fn LSPS0ClientEvent_list_protocols_response(counterparty_node_id: crate::c_types::PublicKey, protocols: crate::c_types::derived::CVec_u16Z) -> LSPS0ClientEvent { - LSPS0ClientEvent::ListProtocolsResponse { - counterparty_node_id, - protocols, - } -} -/// Get a string which allows debug introspection of a LSPS0ClientEvent object -pub extern "C" fn LSPS0ClientEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::event::LSPS0ClientEvent }).into()} -/// Checks if two LSPS0ClientEvents contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS0ClientEvent_eq(a: &LSPS0ClientEvent, b: &LSPS0ClientEvent) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps0/msgs.rs b/lightning-c-bindings/src/lightning_liquidity/lsps0/msgs.rs deleted file mode 100644 index b6ea4cd5..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/msgs.rs +++ /dev/null @@ -1,601 +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. - -//! Message, request, and other primitive types used to implement LSPS0. - -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_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest as nativeLSPS0ListProtocolsRequestImport; -pub(crate) type nativeLSPS0ListProtocolsRequest = nativeLSPS0ListProtocolsRequestImport; - -/// A `list_protocols` request. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[must_use] -#[repr(C)] -pub struct LSPS0ListProtocolsRequest { - /// 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 nativeLSPS0ListProtocolsRequest, - /// 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 core::ops::Deref for LSPS0ListProtocolsRequest { - type Target = nativeLSPS0ListProtocolsRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS0ListProtocolsRequest { } -unsafe impl core::marker::Sync for LSPS0ListProtocolsRequest { } -impl Drop for LSPS0ListProtocolsRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS0ListProtocolsRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS0ListProtocolsRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsRequest_free(this_obj: LSPS0ListProtocolsRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ListProtocolsRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS0ListProtocolsRequest) }; -} -#[allow(unused)] -impl LSPS0ListProtocolsRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS0ListProtocolsRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS0ListProtocolsRequest { - 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 nativeLSPS0ListProtocolsRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Constructs a new LSPS0ListProtocolsRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsRequest_new() -> LSPS0ListProtocolsRequest { - LSPS0ListProtocolsRequest { inner: ObjOps::heap_alloc(nativeLSPS0ListProtocolsRequest { - }), is_owned: true } -} -impl Clone for LSPS0ListProtocolsRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS0ListProtocolsRequest>::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 LSPS0ListProtocolsRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS0ListProtocolsRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS0ListProtocolsRequest -pub extern "C" fn LSPS0ListProtocolsRequest_clone(orig: &LSPS0ListProtocolsRequest) -> LSPS0ListProtocolsRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS0ListProtocolsRequest object -pub extern "C" fn LSPS0ListProtocolsRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest }).into()} -/// Checks if two LSPS0ListProtocolsRequests 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 LSPS0ListProtocolsRequest_eq(a: &LSPS0ListProtocolsRequest, b: &LSPS0ListProtocolsRequest) -> 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 } -} - -use lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse as nativeLSPS0ListProtocolsResponseImport; -pub(crate) type nativeLSPS0ListProtocolsResponse = nativeLSPS0ListProtocolsResponseImport; - -/// A response to a `list_protocols` request. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[must_use] -#[repr(C)] -pub struct LSPS0ListProtocolsResponse { - /// 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 nativeLSPS0ListProtocolsResponse, - /// 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 core::ops::Deref for LSPS0ListProtocolsResponse { - type Target = nativeLSPS0ListProtocolsResponse; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS0ListProtocolsResponse { } -unsafe impl core::marker::Sync for LSPS0ListProtocolsResponse { } -impl Drop for LSPS0ListProtocolsResponse { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS0ListProtocolsResponse>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS0ListProtocolsResponse, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsResponse_free(this_obj: LSPS0ListProtocolsResponse) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ListProtocolsResponse_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS0ListProtocolsResponse) }; -} -#[allow(unused)] -impl LSPS0ListProtocolsResponse { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS0ListProtocolsResponse { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS0ListProtocolsResponse { - 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 nativeLSPS0ListProtocolsResponse { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// A list of supported protocols. -/// -/// Returns a copy of the field. -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsResponse_get_protocols(this_ptr: &LSPS0ListProtocolsResponse) -> crate::c_types::derived::CVec_u16Z { - let mut inner_val = this_ptr.get_native_mut_ref().protocols.clone(); - let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; - local_inner_val.into() -} -/// A list of supported protocols. -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsResponse_set_protocols(this_ptr: &mut LSPS0ListProtocolsResponse, mut val: crate::c_types::derived::CVec_u16Z) { - 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) }.protocols = local_val; -} -/// Constructs a new LSPS0ListProtocolsResponse given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS0ListProtocolsResponse_new(mut protocols_arg: crate::c_types::derived::CVec_u16Z) -> LSPS0ListProtocolsResponse { - let mut local_protocols_arg = Vec::new(); for mut item in protocols_arg.into_rust().drain(..) { local_protocols_arg.push( { item }); }; - LSPS0ListProtocolsResponse { inner: ObjOps::heap_alloc(nativeLSPS0ListProtocolsResponse { - protocols: local_protocols_arg, - }), is_owned: true } -} -impl Clone for LSPS0ListProtocolsResponse { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS0ListProtocolsResponse>::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 LSPS0ListProtocolsResponse_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS0ListProtocolsResponse)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS0ListProtocolsResponse -pub extern "C" fn LSPS0ListProtocolsResponse_clone(orig: &LSPS0ListProtocolsResponse) -> LSPS0ListProtocolsResponse { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS0ListProtocolsResponse object -pub extern "C" fn LSPS0ListProtocolsResponse_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse }).into()} -/// Checks if two LSPS0ListProtocolsResponses 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 LSPS0ListProtocolsResponse_eq(a: &LSPS0ListProtocolsResponse, b: &LSPS0ListProtocolsResponse) -> 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 } -} -/// An bLIP-50 / LSPS0 protocol request. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS0Request { - /// A request calling `list_protocols`. - ListProtocols( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest), -} -use lightning_liquidity::lsps0::msgs::LSPS0Request as LSPS0RequestImport; -pub(crate) type nativeLSPS0Request = LSPS0RequestImport; - -impl LSPS0Request { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS0Request { - match self { - LSPS0Request::ListProtocols (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS0Request::ListProtocols ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS0Request { - match self { - LSPS0Request::ListProtocols (mut a, ) => { - nativeLSPS0Request::ListProtocols ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS0RequestImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS0Request) }; - match native { - nativeLSPS0Request::ListProtocols (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS0Request::ListProtocols ( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS0Request) -> Self { - match native { - nativeLSPS0Request::ListProtocols (mut a, ) => { - LSPS0Request::ListProtocols ( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS0Request -#[no_mangle] -pub extern "C" fn LSPS0Request_free(this_ptr: LSPS0Request) { } -/// Creates a copy of the LSPS0Request -#[no_mangle] -pub extern "C" fn LSPS0Request_clone(orig: &LSPS0Request) -> LSPS0Request { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Request_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS0Request)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Request_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS0Request) }; -} -#[no_mangle] -/// Utility method to constructs a new ListProtocols-variant LSPS0Request -pub extern "C" fn LSPS0Request_list_protocols(a: crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsRequest) -> LSPS0Request { - LSPS0Request::ListProtocols(a, ) -} -/// Get a string which allows debug introspection of a LSPS0Request object -pub extern "C" fn LSPS0Request_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::msgs::LSPS0Request }).into()} -/// Checks if two LSPS0Requests contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS0Request_eq(a: &LSPS0Request, b: &LSPS0Request) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// Returns the method name associated with the given request variant. -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS0Request_method(this_arg: &crate::lightning_liquidity::lsps0::msgs::LSPS0Request) -> crate::c_types::Str { - let mut ret = this_arg.to_native().method(); - ret.into() -} - -/// An bLIP-50 / LSPS0 protocol request. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS0Response { - /// A response to a `list_protocols` request. - ListProtocols( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse), - /// An error response to a `list_protocols` request. - ListProtocolsError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), -} -use lightning_liquidity::lsps0::msgs::LSPS0Response as LSPS0ResponseImport; -pub(crate) type nativeLSPS0Response = LSPS0ResponseImport; - -impl LSPS0Response { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS0Response { - match self { - LSPS0Response::ListProtocols (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS0Response::ListProtocols ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS0Response::ListProtocolsError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS0Response::ListProtocolsError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS0Response { - match self { - LSPS0Response::ListProtocols (mut a, ) => { - nativeLSPS0Response::ListProtocols ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS0Response::ListProtocolsError (mut a, ) => { - nativeLSPS0Response::ListProtocolsError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS0ResponseImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS0Response) }; - match native { - nativeLSPS0Response::ListProtocols (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS0Response::ListProtocols ( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS0Response::ListProtocolsError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS0Response::ListProtocolsError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS0Response) -> Self { - match native { - nativeLSPS0Response::ListProtocols (mut a, ) => { - LSPS0Response::ListProtocols ( - crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS0Response::ListProtocolsError (mut a, ) => { - LSPS0Response::ListProtocolsError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS0Response -#[no_mangle] -pub extern "C" fn LSPS0Response_free(this_ptr: LSPS0Response) { } -/// Creates a copy of the LSPS0Response -#[no_mangle] -pub extern "C" fn LSPS0Response_clone(orig: &LSPS0Response) -> LSPS0Response { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Response_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS0Response)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Response_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS0Response) }; -} -#[no_mangle] -/// Utility method to constructs a new ListProtocols-variant LSPS0Response -pub extern "C" fn LSPS0Response_list_protocols(a: crate::lightning_liquidity::lsps0::msgs::LSPS0ListProtocolsResponse) -> LSPS0Response { - LSPS0Response::ListProtocols(a, ) -} -#[no_mangle] -/// Utility method to constructs a new ListProtocolsError-variant LSPS0Response -pub extern "C" fn LSPS0Response_list_protocols_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS0Response { - LSPS0Response::ListProtocolsError(a, ) -} -/// Get a string which allows debug introspection of a LSPS0Response object -pub extern "C" fn LSPS0Response_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::msgs::LSPS0Response }).into()} -/// Checks if two LSPS0Responses contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS0Response_eq(a: &LSPS0Response, b: &LSPS0Response) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An bLIP-50 / LSPS0 protocol message. -/// -/// Please refer to the [bLIP-50 / LSPS0 -/// specification](https://github.com/lightning/blips/blob/master/blip-0050.md#lsps-specification-support-query) -/// for more information. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS0Message { - /// A request variant. - Request( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps0::msgs::LSPS0Request), - /// A response variant. - Response( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps0::msgs::LSPS0Response), -} -use lightning_liquidity::lsps0::msgs::LSPS0Message as LSPS0MessageImport; -pub(crate) type nativeLSPS0Message = LSPS0MessageImport; - -impl LSPS0Message { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS0Message { - match self { - LSPS0Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS0Message::Request ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - LSPS0Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS0Message::Response ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS0Message { - match self { - LSPS0Message::Request (mut a, mut b, ) => { - nativeLSPS0Message::Request ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - LSPS0Message::Response (mut a, mut b, ) => { - nativeLSPS0Message::Response ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS0MessageImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS0Message) }; - match native { - nativeLSPS0Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS0Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps0::msgs::LSPS0Request::native_into(b_nonref), - ) - }, - nativeLSPS0Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS0Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps0::msgs::LSPS0Response::native_into(b_nonref), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS0Message) -> Self { - match native { - nativeLSPS0Message::Request (mut a, mut b, ) => { - LSPS0Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps0::msgs::LSPS0Request::native_into(b), - ) - }, - nativeLSPS0Message::Response (mut a, mut b, ) => { - LSPS0Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps0::msgs::LSPS0Response::native_into(b), - ) - }, - } - } -} -/// Frees any resources used by the LSPS0Message -#[no_mangle] -pub extern "C" fn LSPS0Message_free(this_ptr: LSPS0Message) { } -/// Creates a copy of the LSPS0Message -#[no_mangle] -pub extern "C" fn LSPS0Message_clone(orig: &LSPS0Message) -> LSPS0Message { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Message_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS0Message)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0Message_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS0Message) }; -} -#[no_mangle] -/// Utility method to constructs a new Request-variant LSPS0Message -pub extern "C" fn LSPS0Message_request(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps0::msgs::LSPS0Request) -> LSPS0Message { - LSPS0Message::Request(a, b, ) -} -#[no_mangle] -/// Utility method to constructs a new Response-variant LSPS0Message -pub extern "C" fn LSPS0Message_response(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps0::msgs::LSPS0Response) -> LSPS0Message { - LSPS0Message::Response(a, b, ) -} -/// Get a string which allows debug introspection of a LSPS0Message object -pub extern "C" fn LSPS0Message_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::msgs::LSPS0Message }).into()} -/// Checks if two LSPS0Messages contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS0Message_eq(a: &LSPS0Message, b: &LSPS0Message) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps0/ser.rs b/lightning-c-bindings/src/lightning_liquidity/lsps0/ser.rs deleted file mode 100644 index e858272a..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/ser.rs +++ /dev/null @@ -1,803 +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. - -//! Contains basic data types that allow for the (de-)seralization of LSPS messages in the JSON-RPC 2.0 format. -//! -//! Please refer to the [bLIP-50 / LSPS0 -//! specification](https://github.com/lightning/blips/blob/master/blip-0050.md) for more -//! information. - -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}; - -/// The Lightning message type id for LSPS messages. - -#[no_mangle] -pub static LSPS_MESSAGE_TYPE_ID: u16 = lightning_liquidity::lsps0::ser::LSPS_MESSAGE_TYPE_ID; - -use lightning_liquidity::lsps0::ser::RawLSPSMessage as nativeRawLSPSMessageImport; -pub(crate) type nativeRawLSPSMessage = nativeRawLSPSMessageImport; - -/// Lightning message type used by LSPS protocols. -#[must_use] -#[repr(C)] -pub struct RawLSPSMessage { - /// 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 nativeRawLSPSMessage, - /// 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 core::ops::Deref for RawLSPSMessage { - type Target = nativeRawLSPSMessage; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for RawLSPSMessage { } -unsafe impl core::marker::Sync for RawLSPSMessage { } -impl Drop for RawLSPSMessage { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeRawLSPSMessage>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the RawLSPSMessage, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn RawLSPSMessage_free(this_obj: RawLSPSMessage) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn RawLSPSMessage_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRawLSPSMessage) }; -} -#[allow(unused)] -impl RawLSPSMessage { - pub(crate) fn get_native_ref(&self) -> &'static nativeRawLSPSMessage { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeRawLSPSMessage { - 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 nativeRawLSPSMessage { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The raw string payload that holds the actual message. -#[no_mangle] -pub extern "C" fn RawLSPSMessage_get_payload(this_ptr: &RawLSPSMessage) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payload; - inner_val.as_str().into() -} -/// The raw string payload that holds the actual message. -#[no_mangle] -pub extern "C" fn RawLSPSMessage_set_payload(this_ptr: &mut RawLSPSMessage, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payload = val.into_string(); -} -/// Constructs a new RawLSPSMessage given each field -#[must_use] -#[no_mangle] -pub extern "C" fn RawLSPSMessage_new(mut payload_arg: crate::c_types::Str) -> RawLSPSMessage { - RawLSPSMessage { inner: ObjOps::heap_alloc(nativeRawLSPSMessage { - payload: payload_arg.into_string(), - }), is_owned: true } -} -impl Clone for RawLSPSMessage { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeRawLSPSMessage>::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 RawLSPSMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRawLSPSMessage)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the RawLSPSMessage -pub extern "C" fn RawLSPSMessage_clone(orig: &RawLSPSMessage) -> RawLSPSMessage { - orig.clone() -} -/// Get a string which allows debug introspection of a RawLSPSMessage object -pub extern "C" fn RawLSPSMessage_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::ser::RawLSPSMessage }).into()} -/// Checks if two RawLSPSMessages 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 RawLSPSMessage_eq(a: &RawLSPSMessage, b: &RawLSPSMessage) -> 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 RawLSPSMessage object into a byte array which can be read by RawLSPSMessage_read -pub extern "C" fn RawLSPSMessage_write(obj: &crate::lightning_liquidity::lsps0::ser::RawLSPSMessage) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn RawLSPSMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_liquidity::lsps0::ser::nativeRawLSPSMessage) }) -} -#[no_mangle] -/// Read a RawLSPSMessage from a byte array, created by RawLSPSMessage_write -pub extern "C" fn RawLSPSMessage_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_RawLSPSMessageDecodeErrorZ { - 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_liquidity::lsps0::ser::RawLSPSMessage { 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 -} -impl From for crate::lightning::ln::wire::Type { - fn from(obj: nativeRawLSPSMessage) -> Self { - let rust_obj = crate::lightning_liquidity::lsps0::ser::RawLSPSMessage { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = RawLSPSMessage_as_Type(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn - core::mem::forget(rust_obj); - ret.free = Some(RawLSPSMessage_free_void); - ret - } -} -/// Constructs a new Type which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Type must be freed before this_arg is -#[no_mangle] -pub extern "C" fn RawLSPSMessage_as_Type(this_arg: &RawLSPSMessage) -> crate::lightning::ln::wire::Type { - crate::lightning::ln::wire::Type { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - type_id: RawLSPSMessage_Type_type_id, - debug_str: RawLSPSMessage_debug_str_void, - write: RawLSPSMessage_write_void, - cloned: Some(Type_RawLSPSMessage_cloned), - } -} - -#[must_use] -extern "C" fn RawLSPSMessage_Type_type_id(this_arg: *const c_void) -> u16 { - let mut ret = ::type_id(unsafe { &mut *(this_arg as *mut nativeRawLSPSMessage) }, ); - ret -} -extern "C" fn Type_RawLSPSMessage_cloned(new_obj: &mut crate::lightning::ln::wire::Type) { - new_obj.this_arg = RawLSPSMessage_clone_void(new_obj.this_arg); - new_obj.free = Some(RawLSPSMessage_free_void); -} - - -use lightning_liquidity::lsps0::ser::LSPSRequestId as nativeLSPSRequestIdImport; -pub(crate) type nativeLSPSRequestId = nativeLSPSRequestIdImport; - -/// A JSON-RPC request's `id`. -/// -/// Please refer to the [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification#request_object) for -/// more information. -#[must_use] -#[repr(C)] -pub struct LSPSRequestId { - /// 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 nativeLSPSRequestId, - /// 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 core::ops::Deref for LSPSRequestId { - type Target = nativeLSPSRequestId; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPSRequestId { } -unsafe impl core::marker::Sync for LSPSRequestId { } -impl Drop for LSPSRequestId { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPSRequestId>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPSRequestId, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPSRequestId_free(this_obj: LSPSRequestId) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPSRequestId_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPSRequestId) }; -} -#[allow(unused)] -impl LSPSRequestId { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPSRequestId { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPSRequestId { - 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 nativeLSPSRequestId { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -#[no_mangle] -pub extern "C" fn LSPSRequestId_get_a(this_ptr: &LSPSRequestId) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; - inner_val.as_str().into() -} -#[no_mangle] -pub extern "C" fn LSPSRequestId_set_a(this_ptr: &mut LSPSRequestId, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_string(); -} -/// Constructs a new LSPSRequestId given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPSRequestId_new(mut a_arg: crate::c_types::Str) -> LSPSRequestId { - LSPSRequestId { inner: ObjOps::heap_alloc(lightning_liquidity::lsps0::ser::LSPSRequestId ( - a_arg.into_string(), - )), is_owned: true } -} -impl Clone for LSPSRequestId { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPSRequestId>::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 LSPSRequestId_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPSRequestId)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPSRequestId -pub extern "C" fn LSPSRequestId_clone(orig: &LSPSRequestId) -> LSPSRequestId { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPSRequestId object -pub extern "C" fn LSPSRequestId_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::ser::LSPSRequestId }).into()} -/// Checks if two LSPSRequestIds 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 LSPSRequestId_eq(a: &LSPSRequestId, b: &LSPSRequestId) -> 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 } -} -/// Generates a non-cryptographic 64-bit hash of the LSPSRequestId. -#[no_mangle] -pub extern "C" fn LSPSRequestId_hash(o: &LSPSRequestId) -> 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) -} - -use lightning_liquidity::lsps0::ser::LSPSDateTime as nativeLSPSDateTimeImport; -pub(crate) type nativeLSPSDateTime = nativeLSPSDateTimeImport; - -/// An object representing datetimes as described in bLIP-50 / LSPS0. -#[must_use] -#[repr(C)] -pub struct LSPSDateTime { - /// 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 nativeLSPSDateTime, - /// 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 core::ops::Deref for LSPSDateTime { - type Target = nativeLSPSDateTime; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPSDateTime { } -unsafe impl core::marker::Sync for LSPSDateTime { } -impl Drop for LSPSDateTime { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPSDateTime>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPSDateTime, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPSDateTime_free(this_obj: LSPSDateTime) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPSDateTime_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPSDateTime) }; -} -#[allow(unused)] -impl LSPSDateTime { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPSDateTime { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPSDateTime { - 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 nativeLSPSDateTime { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -impl Clone for LSPSDateTime { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPSDateTime>::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 LSPSDateTime_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPSDateTime)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPSDateTime -pub extern "C" fn LSPSDateTime_clone(orig: &LSPSDateTime) -> LSPSDateTime { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPSDateTime object -pub extern "C" fn LSPSDateTime_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::ser::LSPSDateTime }).into()} -/// Checks if two LSPSDateTimes 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 LSPSDateTime_eq(a: &LSPSDateTime, b: &LSPSDateTime) -> 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 } -} -/// Generates a non-cryptographic 64-bit hash of the LSPSDateTime. -#[no_mangle] -pub extern "C" fn LSPSDateTime_hash(o: &LSPSDateTime) -> 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) -} -/// Returns the LSPSDateTime as RFC3339 formatted string. -#[must_use] -#[no_mangle] -pub extern "C" fn LSPSDateTime_to_rfc3339(this_arg: &crate::lightning_liquidity::lsps0::ser::LSPSDateTime) -> crate::c_types::Str { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_rfc3339(); - ret.into() -} - -/// Returns if the given time is in the past. -#[must_use] -#[no_mangle] -pub extern "C" fn LSPSDateTime_is_past(this_arg: &crate::lightning_liquidity::lsps0::ser::LSPSDateTime) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_past(); - ret -} - -#[no_mangle] -/// Read a LSPSDateTime object from a string -pub extern "C" fn LSPSDateTime_from_str(s: crate::c_types::Str) -> crate::c_types::derived::CResult_LSPSDateTimeNoneZ { - match lightning_liquidity::lsps0::ser::LSPSDateTime::from_str(s.into_str()) { - Ok(r) => { - crate::c_types::CResultTempl::ok( - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: ObjOps::heap_alloc(r), is_owned: true } - ) - }, - Err(e) => { - crate::c_types::CResultTempl::err( - () /*e*/ - ) - }, - }.into() -} -#[no_mangle] -/// Get the string representation of a LSPSDateTime object -pub extern "C" fn LSPSDateTime_to_str(o: &crate::lightning_liquidity::lsps0::ser::LSPSDateTime) -> Str { - alloc::format!("{}", o.get_native_ref()).into() -} - -use lightning_liquidity::lsps0::ser::LSPSResponseError as nativeLSPSResponseErrorImport; -pub(crate) type nativeLSPSResponseError = nativeLSPSResponseErrorImport; - -/// An error returned in response to an JSON-RPC request. -/// -/// Please refer to the [JSON-RPC 2.0 specification](https://www.jsonrpc.org/specification#error_object) for -/// more information. -#[must_use] -#[repr(C)] -pub struct LSPSResponseError { - /// 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 nativeLSPSResponseError, - /// 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 core::ops::Deref for LSPSResponseError { - type Target = nativeLSPSResponseError; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPSResponseError { } -unsafe impl core::marker::Sync for LSPSResponseError { } -impl Drop for LSPSResponseError { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPSResponseError>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPSResponseError, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPSResponseError_free(this_obj: LSPSResponseError) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPSResponseError_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPSResponseError) }; -} -#[allow(unused)] -impl LSPSResponseError { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPSResponseError { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPSResponseError { - 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 nativeLSPSResponseError { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// A string providing a short description of the error. -#[no_mangle] -pub extern "C" fn LSPSResponseError_get_message(this_ptr: &LSPSResponseError) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().message; - inner_val.as_str().into() -} -/// A string providing a short description of the error. -#[no_mangle] -pub extern "C" fn LSPSResponseError_set_message(this_ptr: &mut LSPSResponseError, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message = val.into_string(); -} -/// A primitive or structured value that contains additional information about the error. -#[no_mangle] -pub extern "C" fn LSPSResponseError_get_data(this_ptr: &LSPSResponseError) -> crate::c_types::derived::COption_StrZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().data; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into() }) }; - local_inner_val -} -/// A primitive or structured value that contains additional information about the error. -#[no_mangle] -pub extern "C" fn LSPSResponseError_set_data(this_ptr: &mut LSPSResponseError, mut val: crate::c_types::derived::COption_StrZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_string() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.data = local_val; -} -impl Clone for LSPSResponseError { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPSResponseError>::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 LSPSResponseError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPSResponseError)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPSResponseError -pub extern "C" fn LSPSResponseError_clone(orig: &LSPSResponseError) -> LSPSResponseError { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPSResponseError object -pub extern "C" fn LSPSResponseError_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::ser::LSPSResponseError }).into()} -/// Checks if two LSPSResponseErrors 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 LSPSResponseError_eq(a: &LSPSResponseError, b: &LSPSResponseError) -> 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 } -} -/// A (de-)serializable LSPS message allowing to be sent over the wire. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPSMessage { - /// An invalid variant. - Invalid( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), - /// An LSPS0 message. - LSPS0( - crate::lightning_liquidity::lsps0::msgs::LSPS0Message), - /// An LSPS1 message. - LSPS1( - crate::lightning_liquidity::lsps1::msgs::LSPS1Message), - /// An LSPS2 message. - LSPS2( - crate::lightning_liquidity::lsps2::msgs::LSPS2Message), -} -use lightning_liquidity::lsps0::ser::LSPSMessage as LSPSMessageImport; -pub(crate) type nativeLSPSMessage = LSPSMessageImport; - -impl LSPSMessage { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPSMessage { - match self { - LSPSMessage::Invalid (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPSMessage::Invalid ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPSMessage::LSPS0 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPSMessage::LSPS0 ( - a_nonref.into_native(), - ) - }, - LSPSMessage::LSPS1 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPSMessage::LSPS1 ( - a_nonref.into_native(), - ) - }, - LSPSMessage::LSPS2 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPSMessage::LSPS2 ( - a_nonref.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPSMessage { - match self { - LSPSMessage::Invalid (mut a, ) => { - nativeLSPSMessage::Invalid ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPSMessage::LSPS0 (mut a, ) => { - nativeLSPSMessage::LSPS0 ( - a.into_native(), - ) - }, - LSPSMessage::LSPS1 (mut a, ) => { - nativeLSPSMessage::LSPS1 ( - a.into_native(), - ) - }, - LSPSMessage::LSPS2 (mut a, ) => { - nativeLSPSMessage::LSPS2 ( - a.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPSMessageImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPSMessage) }; - match native { - nativeLSPSMessage::Invalid (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPSMessage::Invalid ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPSMessage::LSPS0 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPSMessage::LSPS0 ( - crate::lightning_liquidity::lsps0::msgs::LSPS0Message::native_into(a_nonref), - ) - }, - nativeLSPSMessage::LSPS1 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPSMessage::LSPS1 ( - crate::lightning_liquidity::lsps1::msgs::LSPS1Message::native_into(a_nonref), - ) - }, - nativeLSPSMessage::LSPS2 (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPSMessage::LSPS2 ( - crate::lightning_liquidity::lsps2::msgs::LSPS2Message::native_into(a_nonref), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPSMessage) -> Self { - match native { - nativeLSPSMessage::Invalid (mut a, ) => { - LSPSMessage::Invalid ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPSMessage::LSPS0 (mut a, ) => { - LSPSMessage::LSPS0 ( - crate::lightning_liquidity::lsps0::msgs::LSPS0Message::native_into(a), - ) - }, - nativeLSPSMessage::LSPS1 (mut a, ) => { - LSPSMessage::LSPS1 ( - crate::lightning_liquidity::lsps1::msgs::LSPS1Message::native_into(a), - ) - }, - nativeLSPSMessage::LSPS2 (mut a, ) => { - LSPSMessage::LSPS2 ( - crate::lightning_liquidity::lsps2::msgs::LSPS2Message::native_into(a), - ) - }, - } - } -} -/// Frees any resources used by the LSPSMessage -#[no_mangle] -pub extern "C" fn LSPSMessage_free(this_ptr: LSPSMessage) { } -/// Creates a copy of the LSPSMessage -#[no_mangle] -pub extern "C" fn LSPSMessage_clone(orig: &LSPSMessage) -> LSPSMessage { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPSMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPSMessage)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPSMessage_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPSMessage) }; -} -#[no_mangle] -/// Utility method to constructs a new Invalid-variant LSPSMessage -pub extern "C" fn LSPSMessage_invalid(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPSMessage { - LSPSMessage::Invalid(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS0-variant LSPSMessage -pub extern "C" fn LSPSMessage_lsps0(a: crate::lightning_liquidity::lsps0::msgs::LSPS0Message) -> LSPSMessage { - LSPSMessage::LSPS0(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS1-variant LSPSMessage -pub extern "C" fn LSPSMessage_lsps1(a: crate::lightning_liquidity::lsps1::msgs::LSPS1Message) -> LSPSMessage { - LSPSMessage::LSPS1(a, ) -} -#[no_mangle] -/// Utility method to constructs a new LSPS2-variant LSPSMessage -pub extern "C" fn LSPSMessage_lsps2(a: crate::lightning_liquidity::lsps2::msgs::LSPS2Message) -> LSPSMessage { - LSPSMessage::LSPS2(a, ) -} -/// Get a string which allows debug introspection of a LSPSMessage object -pub extern "C" fn LSPSMessage_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps0::ser::LSPSMessage }).into()} -/// Checks if two LSPSMessages contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPSMessage_eq(a: &LSPSMessage, b: &LSPSMessage) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -mod string_amount { - -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 string_amount_option { - -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 unchecked_address { - -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 unchecked_address_option { - -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 u32_fee_rate { - -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_liquidity/lsps0/service.rs b/lightning-c-bindings/src/lightning_liquidity/lsps0/service.rs deleted file mode 100644 index 3d734ba6..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps0/service.rs +++ /dev/null @@ -1,83 +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. - -//! Contains the main bLIP-50 / LSPS0 server-side object, [`LSPS0ServiceHandler`]. -//! -//! Please refer to the [bLIP-50 / LSPS0 -//! specifcation](https://github.com/lightning/blips/blob/master/blip-0050.md) for more -//! information. - -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_liquidity::lsps0::service::LSPS0ServiceHandler as nativeLSPS0ServiceHandlerImport; -pub(crate) type nativeLSPS0ServiceHandler = nativeLSPS0ServiceHandlerImport; - -/// The main server-side object allowing to send and receive bLIP-50 / LSPS0 messages. -#[must_use] -#[repr(C)] -pub struct LSPS0ServiceHandler { - /// 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 nativeLSPS0ServiceHandler, - /// 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 core::ops::Deref for LSPS0ServiceHandler { - type Target = nativeLSPS0ServiceHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS0ServiceHandler { } -unsafe impl core::marker::Sync for LSPS0ServiceHandler { } -impl Drop for LSPS0ServiceHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS0ServiceHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS0ServiceHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS0ServiceHandler_free(this_obj: LSPS0ServiceHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS0ServiceHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS0ServiceHandler) }; -} -#[allow(unused)] -impl LSPS0ServiceHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS0ServiceHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS0ServiceHandler { - 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 nativeLSPS0ServiceHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps1/client.rs b/lightning-c-bindings/src/lightning_liquidity/lsps1/client.rs deleted file mode 100644 index 113f3af4..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps1/client.rs +++ /dev/null @@ -1,222 +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. - -//! Contains the main bLIP-51 / LSPS1 client object, [`LSPS1ClientHandler`]. - -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_liquidity::lsps1::client::LSPS1ClientConfig as nativeLSPS1ClientConfigImport; -pub(crate) type nativeLSPS1ClientConfig = nativeLSPS1ClientConfigImport; - -/// Client-side configuration options for bLIP-51 / LSPS1 channel requests. -#[must_use] -#[repr(C)] -pub struct LSPS1ClientConfig { - /// 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 nativeLSPS1ClientConfig, - /// 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 core::ops::Deref for LSPS1ClientConfig { - type Target = nativeLSPS1ClientConfig; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1ClientConfig { } -unsafe impl core::marker::Sync for LSPS1ClientConfig { } -impl Drop for LSPS1ClientConfig { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1ClientConfig>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1ClientConfig, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1ClientConfig_free(this_obj: LSPS1ClientConfig) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1ClientConfig_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1ClientConfig) }; -} -#[allow(unused)] -impl LSPS1ClientConfig { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1ClientConfig { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1ClientConfig { - 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 nativeLSPS1ClientConfig { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The maximally allowed channel fees. -#[no_mangle] -pub extern "C" fn LSPS1ClientConfig_get_max_channel_fees_msat(this_ptr: &LSPS1ClientConfig) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_fees_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 maximally allowed channel fees. -#[no_mangle] -pub extern "C" fn LSPS1ClientConfig_set_max_channel_fees_msat(this_ptr: &mut LSPS1ClientConfig, 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_channel_fees_msat = local_val; -} -/// Constructs a new LSPS1ClientConfig given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1ClientConfig_new(mut max_channel_fees_msat_arg: crate::c_types::derived::COption_u64Z) -> LSPS1ClientConfig { - let mut local_max_channel_fees_msat_arg = if max_channel_fees_msat_arg.is_some() { Some( { max_channel_fees_msat_arg.take() }) } else { None }; - LSPS1ClientConfig { inner: ObjOps::heap_alloc(nativeLSPS1ClientConfig { - max_channel_fees_msat: local_max_channel_fees_msat_arg, - }), is_owned: true } -} -impl Clone for LSPS1ClientConfig { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1ClientConfig>::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 LSPS1ClientConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1ClientConfig)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1ClientConfig -pub extern "C" fn LSPS1ClientConfig_clone(orig: &LSPS1ClientConfig) -> LSPS1ClientConfig { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1ClientConfig object -pub extern "C" fn LSPS1ClientConfig_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::client::LSPS1ClientConfig }).into()} - -use lightning_liquidity::lsps1::client::LSPS1ClientHandler as nativeLSPS1ClientHandlerImport; -pub(crate) type nativeLSPS1ClientHandler = nativeLSPS1ClientHandlerImport; - -/// The main object allowing to send and receive bLIP-51 / LSPS1 messages. -#[must_use] -#[repr(C)] -pub struct LSPS1ClientHandler { - /// 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 nativeLSPS1ClientHandler, - /// 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 core::ops::Deref for LSPS1ClientHandler { - type Target = nativeLSPS1ClientHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1ClientHandler { } -unsafe impl core::marker::Sync for LSPS1ClientHandler { } -impl Drop for LSPS1ClientHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1ClientHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1ClientHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1ClientHandler_free(this_obj: LSPS1ClientHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1ClientHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1ClientHandler) }; -} -#[allow(unused)] -impl LSPS1ClientHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1ClientHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1ClientHandler { - 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 nativeLSPS1ClientHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Request the supported options from the LSP. -/// -/// The user will receive the LSP's response via an [`SupportedOptionsReady`] event. -/// -/// `counterparty_node_id` is the `node_id` of the LSP you would like to use. -/// -/// Returns the used [`LSPSRequestId`], which will be returned via [`SupportedOptionsReady`]. -/// -/// [`SupportedOptionsReady`]: crate::lsps1::event::LSPS1ClientEvent::SupportedOptionsReady -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1ClientHandler_request_supported_options(this_arg: &crate::lightning_liquidity::lsps1::client::LSPS1ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey) -> crate::lightning_liquidity::lsps0::ser::LSPSRequestId { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_supported_options(counterparty_node_id.into_rust()); - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Places an order with the connected LSP given its `counterparty_node_id`. -/// -/// The client agrees to paying channel fees according to the provided parameters. -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1ClientHandler_create_order(this_arg: &crate::lightning_liquidity::lsps1::client::LSPS1ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, mut refund_onchain_address: crate::c_types::derived::COption_AddressZ) -> crate::lightning_liquidity::lsps0::ser::LSPSRequestId { - let mut local_refund_onchain_address = { /*refund_onchain_address*/ let refund_onchain_address_opt = refund_onchain_address; if refund_onchain_address_opt.is_none() { None } else { Some({ { { refund_onchain_address_opt.take() }.into_rust() }})} }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_order(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(order.take_inner()) }, local_refund_onchain_address); - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Queries the status of a pending payment, i.e., whether a payment has been received by the LSP. -/// -/// Upon success an [`LSPS1ClientEvent::OrderStatus`] event will be emitted. -/// -/// [`LSPS1ClientEvent::OrderStatus`]: crate::lsps1::event::LSPS1ClientEvent::OrderStatus -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1ClientHandler_check_order_status(this_arg: &crate::lightning_liquidity::lsps1::client::LSPS1ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId) -> crate::lightning_liquidity::lsps0::ser::LSPSRequestId { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.check_order_status(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(order_id.take_inner()) }); - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps1/event.rs b/lightning-c-bindings/src/lightning_liquidity/lsps1/event.rs deleted file mode 100644 index f3a7fe7e..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps1/event.rs +++ /dev/null @@ -1,457 +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. - -//! Contains bLIP-51 / LSPS1 event types - -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}; - -/// An event which an bLIP-51 / LSPS1 client should take some action in response to. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1ClientEvent { - /// A request previously issued via [`LSPS1ClientHandler::request_supported_options`] - /// succeeded as the LSP returned the options it supports. - /// - /// You must check whether LSP supports the parameters the client wants and then call - /// [`LSPS1ClientHandler::create_order`] to place an order. - /// - /// [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - /// [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - SupportedOptionsReady { - /// The identifier of the issued bLIP-51 / LSPS1 `get_info` request, as returned by - /// [`LSPS1ClientHandler::request_supported_options`] - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP that provided this response. - counterparty_node_id: crate::c_types::PublicKey, - /// All options supported by the LSP. - supported_options: crate::lightning_liquidity::lsps1::msgs::LSPS1Options, - }, - /// A request previously issued via [`LSPS1ClientHandler::request_supported_options`] - /// failed as the LSP returned an error response. - /// - /// [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - SupportedOptionsRequestFailed { - /// The identifier of the issued bLIP-51 / LSPS1 `get_info` request, as returned by - /// [`LSPS1ClientHandler::request_supported_options`] - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS1ClientHandler::request_supported_options`]: crate::lsps1::client::LSPS1ClientHandler::request_supported_options - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP that provided this response. - counterparty_node_id: crate::c_types::PublicKey, - /// The error that was returned. - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError, - }, - /// Confirmation from the LSP about the order created by the client. - /// - /// When the payment is confirmed, the LSP will open a channel to you - /// with the below agreed upon parameters. - /// - /// You must pay the invoice or onchain address if you want to continue and then - /// call [`LSPS1ClientHandler::check_order_status`] with the order id - /// to get information from LSP about progress of the order. - /// - /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - OrderCreated { - /// The identifier of the issued bLIP-51 / LSPS1 `create_order` request, as returned by - /// [`LSPS1ClientHandler::create_order`] - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP. - counterparty_node_id: crate::c_types::PublicKey, - /// The id of the channel order. - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId, - /// The order created by client and approved by LSP. - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, - /// The details regarding payment of the order - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo, - /// The details regarding state of the channel ordered. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - channel: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo, - }, - /// Information from the LSP about the status of a previously created order. - /// - /// Will be emitted in response to calling [`LSPS1ClientHandler::check_order_status`]. - /// - /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - OrderStatus { - /// The identifier of the issued bLIP-51 / LSPS1 `get_order` request, as returned by - /// [`LSPS1ClientHandler::check_order_status`] - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP. - counterparty_node_id: crate::c_types::PublicKey, - /// The id of the channel order. - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId, - /// The order created by client and approved by LSP. - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, - /// The details regarding payment of the order - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo, - /// The details regarding state of the channel ordered. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - channel: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo, - }, - /// A request previously issued via [`LSPS1ClientHandler::create_order`] or [`LSPS1ClientHandler::check_order_status`]. - /// failed as the LSP returned an error response. - /// - /// [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - OrderRequestFailed { - /// The identifier of the issued LSPS1 `create_order` or `get_order` request, as returned by - /// [`LSPS1ClientHandler::create_order`] or [`LSPS1ClientHandler::check_order_status`]. - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS1ClientHandler::create_order`]: crate::lsps1::client::LSPS1ClientHandler::create_order - /// [`LSPS1ClientHandler::check_order_status`]: crate::lsps1::client::LSPS1ClientHandler::check_order_status - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP. - counterparty_node_id: crate::c_types::PublicKey, - /// The error that was returned. - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError, - }, -} -use lightning_liquidity::lsps1::event::LSPS1ClientEvent as LSPS1ClientEventImport; -pub(crate) type nativeLSPS1ClientEvent = LSPS1ClientEventImport; - -impl LSPS1ClientEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1ClientEvent { - match self { - LSPS1ClientEvent::SupportedOptionsReady {ref request_id, ref counterparty_node_id, ref supported_options, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut supported_options_nonref = Clone::clone(supported_options); - nativeLSPS1ClientEvent::SupportedOptionsReady { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - supported_options: *unsafe { Box::from_raw(supported_options_nonref.take_inner()) }, - } - }, - LSPS1ClientEvent::SupportedOptionsRequestFailed {ref request_id, ref counterparty_node_id, ref error, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut error_nonref = Clone::clone(error); - nativeLSPS1ClientEvent::SupportedOptionsRequestFailed { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - error: *unsafe { Box::from_raw(error_nonref.take_inner()) }, - } - }, - LSPS1ClientEvent::OrderCreated {ref request_id, ref counterparty_node_id, ref order_id, ref order, ref payment, ref channel, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut order_id_nonref = Clone::clone(order_id); - let mut order_nonref = Clone::clone(order); - let mut payment_nonref = Clone::clone(payment); - let mut channel_nonref = Clone::clone(channel); - let mut local_channel_nonref = if channel_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_nonref.take_inner()) } }) }; - nativeLSPS1ClientEvent::OrderCreated { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - order_id: *unsafe { Box::from_raw(order_id_nonref.take_inner()) }, - order: *unsafe { Box::from_raw(order_nonref.take_inner()) }, - payment: *unsafe { Box::from_raw(payment_nonref.take_inner()) }, - channel: local_channel_nonref, - } - }, - LSPS1ClientEvent::OrderStatus {ref request_id, ref counterparty_node_id, ref order_id, ref order, ref payment, ref channel, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut order_id_nonref = Clone::clone(order_id); - let mut order_nonref = Clone::clone(order); - let mut payment_nonref = Clone::clone(payment); - let mut channel_nonref = Clone::clone(channel); - let mut local_channel_nonref = if channel_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_nonref.take_inner()) } }) }; - nativeLSPS1ClientEvent::OrderStatus { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - order_id: *unsafe { Box::from_raw(order_id_nonref.take_inner()) }, - order: *unsafe { Box::from_raw(order_nonref.take_inner()) }, - payment: *unsafe { Box::from_raw(payment_nonref.take_inner()) }, - channel: local_channel_nonref, - } - }, - LSPS1ClientEvent::OrderRequestFailed {ref request_id, ref counterparty_node_id, ref error, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut error_nonref = Clone::clone(error); - nativeLSPS1ClientEvent::OrderRequestFailed { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - error: *unsafe { Box::from_raw(error_nonref.take_inner()) }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1ClientEvent { - match self { - LSPS1ClientEvent::SupportedOptionsReady {mut request_id, mut counterparty_node_id, mut supported_options, } => { - nativeLSPS1ClientEvent::SupportedOptionsReady { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - supported_options: *unsafe { Box::from_raw(supported_options.take_inner()) }, - } - }, - LSPS1ClientEvent::SupportedOptionsRequestFailed {mut request_id, mut counterparty_node_id, mut error, } => { - nativeLSPS1ClientEvent::SupportedOptionsRequestFailed { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - error: *unsafe { Box::from_raw(error.take_inner()) }, - } - }, - LSPS1ClientEvent::OrderCreated {mut request_id, mut counterparty_node_id, mut order_id, mut order, mut payment, mut channel, } => { - let mut local_channel = if channel.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel.take_inner()) } }) }; - nativeLSPS1ClientEvent::OrderCreated { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - order_id: *unsafe { Box::from_raw(order_id.take_inner()) }, - order: *unsafe { Box::from_raw(order.take_inner()) }, - payment: *unsafe { Box::from_raw(payment.take_inner()) }, - channel: local_channel, - } - }, - LSPS1ClientEvent::OrderStatus {mut request_id, mut counterparty_node_id, mut order_id, mut order, mut payment, mut channel, } => { - let mut local_channel = if channel.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel.take_inner()) } }) }; - nativeLSPS1ClientEvent::OrderStatus { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - order_id: *unsafe { Box::from_raw(order_id.take_inner()) }, - order: *unsafe { Box::from_raw(order.take_inner()) }, - payment: *unsafe { Box::from_raw(payment.take_inner()) }, - channel: local_channel, - } - }, - LSPS1ClientEvent::OrderRequestFailed {mut request_id, mut counterparty_node_id, mut error, } => { - nativeLSPS1ClientEvent::OrderRequestFailed { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - error: *unsafe { Box::from_raw(error.take_inner()) }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1ClientEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1ClientEvent) }; - match native { - nativeLSPS1ClientEvent::SupportedOptionsReady {ref request_id, ref counterparty_node_id, ref supported_options, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut supported_options_nonref = Clone::clone(supported_options); - LSPS1ClientEvent::SupportedOptionsReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - supported_options: crate::lightning_liquidity::lsps1::msgs::LSPS1Options { inner: ObjOps::heap_alloc(supported_options_nonref), is_owned: true }, - } - }, - nativeLSPS1ClientEvent::SupportedOptionsRequestFailed {ref request_id, ref counterparty_node_id, ref error, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut error_nonref = Clone::clone(error); - LSPS1ClientEvent::SupportedOptionsRequestFailed { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(error_nonref), is_owned: true }, - } - }, - nativeLSPS1ClientEvent::OrderCreated {ref request_id, ref counterparty_node_id, ref order_id, ref order, ref payment, ref channel, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut order_id_nonref = Clone::clone(order_id); - let mut order_nonref = Clone::clone(order); - let mut payment_nonref = Clone::clone(payment); - let mut channel_nonref = Clone::clone(channel); - let mut local_channel_nonref = crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { inner: if channel_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_nonref.unwrap())) } }, is_owned: true }; - LSPS1ClientEvent::OrderCreated { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: ObjOps::heap_alloc(order_id_nonref), is_owned: true }, - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: ObjOps::heap_alloc(order_nonref), is_owned: true }, - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { inner: ObjOps::heap_alloc(payment_nonref), is_owned: true }, - channel: local_channel_nonref, - } - }, - nativeLSPS1ClientEvent::OrderStatus {ref request_id, ref counterparty_node_id, ref order_id, ref order, ref payment, ref channel, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut order_id_nonref = Clone::clone(order_id); - let mut order_nonref = Clone::clone(order); - let mut payment_nonref = Clone::clone(payment); - let mut channel_nonref = Clone::clone(channel); - let mut local_channel_nonref = crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { inner: if channel_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_nonref.unwrap())) } }, is_owned: true }; - LSPS1ClientEvent::OrderStatus { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: ObjOps::heap_alloc(order_id_nonref), is_owned: true }, - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: ObjOps::heap_alloc(order_nonref), is_owned: true }, - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { inner: ObjOps::heap_alloc(payment_nonref), is_owned: true }, - channel: local_channel_nonref, - } - }, - nativeLSPS1ClientEvent::OrderRequestFailed {ref request_id, ref counterparty_node_id, ref error, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut error_nonref = Clone::clone(error); - LSPS1ClientEvent::OrderRequestFailed { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(error_nonref), is_owned: true }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1ClientEvent) -> Self { - match native { - nativeLSPS1ClientEvent::SupportedOptionsReady {mut request_id, mut counterparty_node_id, mut supported_options, } => { - LSPS1ClientEvent::SupportedOptionsReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - supported_options: crate::lightning_liquidity::lsps1::msgs::LSPS1Options { inner: ObjOps::heap_alloc(supported_options), is_owned: true }, - } - }, - nativeLSPS1ClientEvent::SupportedOptionsRequestFailed {mut request_id, mut counterparty_node_id, mut error, } => { - LSPS1ClientEvent::SupportedOptionsRequestFailed { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(error), is_owned: true }, - } - }, - nativeLSPS1ClientEvent::OrderCreated {mut request_id, mut counterparty_node_id, mut order_id, mut order, mut payment, mut channel, } => { - let mut local_channel = crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { inner: if channel.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel.unwrap())) } }, is_owned: true }; - LSPS1ClientEvent::OrderCreated { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: ObjOps::heap_alloc(order_id), is_owned: true }, - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: ObjOps::heap_alloc(order), is_owned: true }, - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { inner: ObjOps::heap_alloc(payment), is_owned: true }, - channel: local_channel, - } - }, - nativeLSPS1ClientEvent::OrderStatus {mut request_id, mut counterparty_node_id, mut order_id, mut order, mut payment, mut channel, } => { - let mut local_channel = crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { inner: if channel.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel.unwrap())) } }, is_owned: true }; - LSPS1ClientEvent::OrderStatus { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: ObjOps::heap_alloc(order_id), is_owned: true }, - order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: ObjOps::heap_alloc(order), is_owned: true }, - payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { inner: ObjOps::heap_alloc(payment), is_owned: true }, - channel: local_channel, - } - }, - nativeLSPS1ClientEvent::OrderRequestFailed {mut request_id, mut counterparty_node_id, mut error, } => { - LSPS1ClientEvent::OrderRequestFailed { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(error), is_owned: true }, - } - }, - } - } -} -/// Frees any resources used by the LSPS1ClientEvent -#[no_mangle] -pub extern "C" fn LSPS1ClientEvent_free(this_ptr: LSPS1ClientEvent) { } -/// Creates a copy of the LSPS1ClientEvent -#[no_mangle] -pub extern "C" fn LSPS1ClientEvent_clone(orig: &LSPS1ClientEvent) -> LSPS1ClientEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1ClientEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1ClientEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1ClientEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1ClientEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new SupportedOptionsReady-variant LSPS1ClientEvent -pub extern "C" fn LSPS1ClientEvent_supported_options_ready(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, supported_options: crate::lightning_liquidity::lsps1::msgs::LSPS1Options) -> LSPS1ClientEvent { - LSPS1ClientEvent::SupportedOptionsReady { - request_id, - counterparty_node_id, - supported_options, - } -} -#[no_mangle] -/// Utility method to constructs a new SupportedOptionsRequestFailed-variant LSPS1ClientEvent -pub extern "C" fn LSPS1ClientEvent_supported_options_request_failed(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS1ClientEvent { - LSPS1ClientEvent::SupportedOptionsRequestFailed { - request_id, - counterparty_node_id, - error, - } -} -#[no_mangle] -/// Utility method to constructs a new OrderCreated-variant LSPS1ClientEvent -pub extern "C" fn LSPS1ClientEvent_order_created(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId, order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo, channel: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo) -> LSPS1ClientEvent { - LSPS1ClientEvent::OrderCreated { - request_id, - counterparty_node_id, - order_id, - order, - payment, - channel, - } -} -#[no_mangle] -/// Utility method to constructs a new OrderStatus-variant LSPS1ClientEvent -pub extern "C" fn LSPS1ClientEvent_order_status(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, order_id: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId, order: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, payment: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo, channel: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo) -> LSPS1ClientEvent { - LSPS1ClientEvent::OrderStatus { - request_id, - counterparty_node_id, - order_id, - order, - payment, - channel, - } -} -#[no_mangle] -/// Utility method to constructs a new OrderRequestFailed-variant LSPS1ClientEvent -pub extern "C" fn LSPS1ClientEvent_order_request_failed(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, error: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS1ClientEvent { - LSPS1ClientEvent::OrderRequestFailed { - request_id, - counterparty_node_id, - error, - } -} -/// Get a string which allows debug introspection of a LSPS1ClientEvent object -pub extern "C" fn LSPS1ClientEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::event::LSPS1ClientEvent }).into()} -/// Checks if two LSPS1ClientEvents contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1ClientEvent_eq(a: &LSPS1ClientEvent, b: &LSPS1ClientEvent) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps1/msgs.rs b/lightning-c-bindings/src/lightning_liquidity/lsps1/msgs.rs deleted file mode 100644 index 35c97c26..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps1/msgs.rs +++ /dev/null @@ -1,2617 +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. - -//! Message, request, and other primitive types used to implement bLIP-51 / LSPS1. - -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_liquidity::lsps1::msgs::LSPS1OrderId as nativeLSPS1OrderIdImport; -pub(crate) type nativeLSPS1OrderId = nativeLSPS1OrderIdImport; - -/// The identifier of an order. -#[must_use] -#[repr(C)] -pub struct LSPS1OrderId { - /// 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 nativeLSPS1OrderId, - /// 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 core::ops::Deref for LSPS1OrderId { - type Target = nativeLSPS1OrderId; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1OrderId { } -unsafe impl core::marker::Sync for LSPS1OrderId { } -impl Drop for LSPS1OrderId { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1OrderId>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1OrderId, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1OrderId_free(this_obj: LSPS1OrderId) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OrderId_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1OrderId) }; -} -#[allow(unused)] -impl LSPS1OrderId { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1OrderId { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1OrderId { - 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 nativeLSPS1OrderId { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -#[no_mangle] -pub extern "C" fn LSPS1OrderId_get_a(this_ptr: &LSPS1OrderId) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; - inner_val.as_str().into() -} -#[no_mangle] -pub extern "C" fn LSPS1OrderId_set_a(this_ptr: &mut LSPS1OrderId, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_string(); -} -/// Constructs a new LSPS1OrderId given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1OrderId_new(mut a_arg: crate::c_types::Str) -> LSPS1OrderId { - LSPS1OrderId { inner: ObjOps::heap_alloc(lightning_liquidity::lsps1::msgs::LSPS1OrderId ( - a_arg.into_string(), - )), is_owned: true } -} -impl Clone for LSPS1OrderId { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1OrderId>::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 LSPS1OrderId_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1OrderId)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1OrderId -pub extern "C" fn LSPS1OrderId_clone(orig: &LSPS1OrderId) -> LSPS1OrderId { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1OrderId object -pub extern "C" fn LSPS1OrderId_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId }).into()} -/// Checks if two LSPS1OrderIds 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 LSPS1OrderId_eq(a: &LSPS1OrderId, b: &LSPS1OrderId) -> 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 } -} -/// Generates a non-cryptographic 64-bit hash of the LSPS1OrderId. -#[no_mangle] -pub extern "C" fn LSPS1OrderId_hash(o: &LSPS1OrderId) -> 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) -} - -use lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest as nativeLSPS1GetInfoRequestImport; -pub(crate) type nativeLSPS1GetInfoRequest = nativeLSPS1GetInfoRequestImport; - -/// A request made to an LSP to retrieve the supported options. -/// -/// Please refer to the [bLIP-51 / LSPS1 -/// specification](https://github.com/lightning/blips/blob/master/blip-0051.md#1-lsps1get_info) for -/// more information. -#[must_use] -#[repr(C)] -pub struct LSPS1GetInfoRequest { - /// 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 nativeLSPS1GetInfoRequest, - /// 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 core::ops::Deref for LSPS1GetInfoRequest { - type Target = nativeLSPS1GetInfoRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1GetInfoRequest { } -unsafe impl core::marker::Sync for LSPS1GetInfoRequest { } -impl Drop for LSPS1GetInfoRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1GetInfoRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1GetInfoRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1GetInfoRequest_free(this_obj: LSPS1GetInfoRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1GetInfoRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1GetInfoRequest) }; -} -#[allow(unused)] -impl LSPS1GetInfoRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1GetInfoRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1GetInfoRequest { - 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 nativeLSPS1GetInfoRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Constructs a new LSPS1GetInfoRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1GetInfoRequest_new() -> LSPS1GetInfoRequest { - LSPS1GetInfoRequest { inner: ObjOps::heap_alloc(nativeLSPS1GetInfoRequest { - }), is_owned: true } -} -impl Clone for LSPS1GetInfoRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1GetInfoRequest>::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 LSPS1GetInfoRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1GetInfoRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1GetInfoRequest -pub extern "C" fn LSPS1GetInfoRequest_clone(orig: &LSPS1GetInfoRequest) -> LSPS1GetInfoRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1GetInfoRequest object -pub extern "C" fn LSPS1GetInfoRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest }).into()} -/// Checks if two LSPS1GetInfoRequests 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 LSPS1GetInfoRequest_eq(a: &LSPS1GetInfoRequest, b: &LSPS1GetInfoRequest) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1Options as nativeLSPS1OptionsImport; -pub(crate) type nativeLSPS1Options = nativeLSPS1OptionsImport; - -/// An object representing the supported protocol options. -#[must_use] -#[repr(C)] -pub struct LSPS1Options { - /// 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 nativeLSPS1Options, - /// 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 core::ops::Deref for LSPS1Options { - type Target = nativeLSPS1Options; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1Options { } -unsafe impl core::marker::Sync for LSPS1Options { } -impl Drop for LSPS1Options { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1Options>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1Options, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1Options_free(this_obj: LSPS1Options) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Options_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1Options) }; -} -#[allow(unused)] -impl LSPS1Options { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1Options { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1Options { - 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 nativeLSPS1Options { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The smallest number of confirmations needed for the LSP to accept a channel as confirmed. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_min_required_channel_confirmations(this_ptr: &LSPS1Options) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_required_channel_confirmations; - *inner_val -} -/// The smallest number of confirmations needed for the LSP to accept a channel as confirmed. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_min_required_channel_confirmations(this_ptr: &mut LSPS1Options, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_required_channel_confirmations = val; -} -/// The smallest number of blocks in which the LSP can confirm the funding transaction. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_min_funding_confirms_within_blocks(this_ptr: &LSPS1Options) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_funding_confirms_within_blocks; - *inner_val -} -/// The smallest number of blocks in which the LSP can confirm the funding transaction. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_min_funding_confirms_within_blocks(this_ptr: &mut LSPS1Options, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_funding_confirms_within_blocks = val; -} -/// Indicates if the LSP supports zero reserve. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_supports_zero_channel_reserve(this_ptr: &LSPS1Options) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().supports_zero_channel_reserve; - *inner_val -} -/// Indicates if the LSP supports zero reserve. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_supports_zero_channel_reserve(this_ptr: &mut LSPS1Options, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.supports_zero_channel_reserve = val; -} -/// The maximum number of blocks a channel can be leased for. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_max_channel_expiry_blocks(this_ptr: &LSPS1Options) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_expiry_blocks; - *inner_val -} -/// The maximum number of blocks a channel can be leased for. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_max_channel_expiry_blocks(this_ptr: &mut LSPS1Options, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_channel_expiry_blocks = val; -} -/// The minimum number of satoshi that the client MUST request. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_min_initial_client_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_initial_client_balance_sat; - *inner_val -} -/// The minimum number of satoshi that the client MUST request. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_min_initial_client_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_initial_client_balance_sat = val; -} -/// The maximum number of satoshi that the client MUST request. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_max_initial_client_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_initial_client_balance_sat; - *inner_val -} -/// The maximum number of satoshi that the client MUST request. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_max_initial_client_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_initial_client_balance_sat = val; -} -/// The minimum number of satoshi that the LSP will provide to the channel. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_min_initial_lsp_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_initial_lsp_balance_sat; - *inner_val -} -/// The minimum number of satoshi that the LSP will provide to the channel. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_min_initial_lsp_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_initial_lsp_balance_sat = val; -} -/// The maximum number of satoshi that the LSP will provide to the channel. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_max_initial_lsp_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_initial_lsp_balance_sat; - *inner_val -} -/// The maximum number of satoshi that the LSP will provide to the channel. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_max_initial_lsp_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_initial_lsp_balance_sat = val; -} -/// The minimal channel size. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_min_channel_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_channel_balance_sat; - *inner_val -} -/// The minimal channel size. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_min_channel_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_channel_balance_sat = val; -} -/// The maximal channel size. -#[no_mangle] -pub extern "C" fn LSPS1Options_get_max_channel_balance_sat(this_ptr: &LSPS1Options) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_channel_balance_sat; - *inner_val -} -/// The maximal channel size. -#[no_mangle] -pub extern "C" fn LSPS1Options_set_max_channel_balance_sat(this_ptr: &mut LSPS1Options, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_channel_balance_sat = val; -} -/// Constructs a new LSPS1Options given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1Options_new(mut min_required_channel_confirmations_arg: u16, mut min_funding_confirms_within_blocks_arg: u16, mut supports_zero_channel_reserve_arg: bool, mut max_channel_expiry_blocks_arg: u32, mut min_initial_client_balance_sat_arg: u64, mut max_initial_client_balance_sat_arg: u64, mut min_initial_lsp_balance_sat_arg: u64, mut max_initial_lsp_balance_sat_arg: u64, mut min_channel_balance_sat_arg: u64, mut max_channel_balance_sat_arg: u64) -> LSPS1Options { - LSPS1Options { inner: ObjOps::heap_alloc(nativeLSPS1Options { - min_required_channel_confirmations: min_required_channel_confirmations_arg, - min_funding_confirms_within_blocks: min_funding_confirms_within_blocks_arg, - supports_zero_channel_reserve: supports_zero_channel_reserve_arg, - max_channel_expiry_blocks: max_channel_expiry_blocks_arg, - min_initial_client_balance_sat: min_initial_client_balance_sat_arg, - max_initial_client_balance_sat: max_initial_client_balance_sat_arg, - min_initial_lsp_balance_sat: min_initial_lsp_balance_sat_arg, - max_initial_lsp_balance_sat: max_initial_lsp_balance_sat_arg, - min_channel_balance_sat: min_channel_balance_sat_arg, - max_channel_balance_sat: max_channel_balance_sat_arg, - }), is_owned: true } -} -impl Clone for LSPS1Options { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1Options>::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 LSPS1Options_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1Options)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1Options -pub extern "C" fn LSPS1Options_clone(orig: &LSPS1Options) -> LSPS1Options { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1Options object -pub extern "C" fn LSPS1Options_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1Options }).into()} -/// Checks if two LSPS1Optionss 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 LSPS1Options_eq(a: &LSPS1Options, b: &LSPS1Options) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse as nativeLSPS1GetInfoResponseImport; -pub(crate) type nativeLSPS1GetInfoResponse = nativeLSPS1GetInfoResponseImport; - -/// A response to a [`LSPS1GetInfoRequest`]. -#[must_use] -#[repr(C)] -pub struct LSPS1GetInfoResponse { - /// 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 nativeLSPS1GetInfoResponse, - /// 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 core::ops::Deref for LSPS1GetInfoResponse { - type Target = nativeLSPS1GetInfoResponse; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1GetInfoResponse { } -unsafe impl core::marker::Sync for LSPS1GetInfoResponse { } -impl Drop for LSPS1GetInfoResponse { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1GetInfoResponse>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1GetInfoResponse, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1GetInfoResponse_free(this_obj: LSPS1GetInfoResponse) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1GetInfoResponse_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1GetInfoResponse) }; -} -#[allow(unused)] -impl LSPS1GetInfoResponse { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1GetInfoResponse { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1GetInfoResponse { - 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 nativeLSPS1GetInfoResponse { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// All options supported by the LSP. -#[no_mangle] -pub extern "C" fn LSPS1GetInfoResponse_get_options(this_ptr: &LSPS1GetInfoResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1Options { - let mut inner_val = &mut this_ptr.get_native_mut_ref().options; - crate::lightning_liquidity::lsps1::msgs::LSPS1Options { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1Options<>) as *mut _) }, is_owned: false } -} -/// All options supported by the LSP. -#[no_mangle] -pub extern "C" fn LSPS1GetInfoResponse_set_options(this_ptr: &mut LSPS1GetInfoResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1Options) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.options = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Constructs a new LSPS1GetInfoResponse given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1GetInfoResponse_new(mut options_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1Options) -> LSPS1GetInfoResponse { - LSPS1GetInfoResponse { inner: ObjOps::heap_alloc(nativeLSPS1GetInfoResponse { - options: *unsafe { Box::from_raw(options_arg.take_inner()) }, - }), is_owned: true } -} -impl Clone for LSPS1GetInfoResponse { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1GetInfoResponse>::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 LSPS1GetInfoResponse_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1GetInfoResponse)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1GetInfoResponse -pub extern "C" fn LSPS1GetInfoResponse_clone(orig: &LSPS1GetInfoResponse) -> LSPS1GetInfoResponse { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1GetInfoResponse object -pub extern "C" fn LSPS1GetInfoResponse_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse }).into()} -/// Checks if two LSPS1GetInfoResponses 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 LSPS1GetInfoResponse_eq(a: &LSPS1GetInfoResponse, b: &LSPS1GetInfoResponse) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest as nativeLSPS1CreateOrderRequestImport; -pub(crate) type nativeLSPS1CreateOrderRequest = nativeLSPS1CreateOrderRequestImport; - -/// A request made to an LSP to create an order. -/// -/// Please refer to the [bLIP-51 / LSPS1 -/// specification](https://github.com/lightning/blips/blob/master/blip-0051.md#2-lsps1create_order) -/// for more information. -#[must_use] -#[repr(C)] -pub struct LSPS1CreateOrderRequest { - /// 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 nativeLSPS1CreateOrderRequest, - /// 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 core::ops::Deref for LSPS1CreateOrderRequest { - type Target = nativeLSPS1CreateOrderRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1CreateOrderRequest { } -unsafe impl core::marker::Sync for LSPS1CreateOrderRequest { } -impl Drop for LSPS1CreateOrderRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1CreateOrderRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1CreateOrderRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_free(this_obj: LSPS1CreateOrderRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1CreateOrderRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1CreateOrderRequest) }; -} -#[allow(unused)] -impl LSPS1CreateOrderRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1CreateOrderRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1CreateOrderRequest { - 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 nativeLSPS1CreateOrderRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The order made. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_get_order(this_ptr: &LSPS1CreateOrderRequest) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order; - crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1OrderParams<>) as *mut _) }, is_owned: false } -} -/// The order made. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_set_order(this_ptr: &mut LSPS1CreateOrderRequest, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The address where the LSP will send the funds if the order fails. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_get_refund_onchain_address(this_ptr: &LSPS1CreateOrderRequest) -> crate::c_types::derived::COption_AddressZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().refund_onchain_address; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_AddressZ::None } else { crate::c_types::derived::COption_AddressZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::Address::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; - local_inner_val -} -/// The address where the LSP will send the funds if the order fails. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_set_refund_onchain_address(this_ptr: &mut LSPS1CreateOrderRequest, mut val: crate::c_types::derived::COption_AddressZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.refund_onchain_address = local_val; -} -/// Constructs a new LSPS1CreateOrderRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderRequest_new(mut order_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, mut refund_onchain_address_arg: crate::c_types::derived::COption_AddressZ) -> LSPS1CreateOrderRequest { - let mut local_refund_onchain_address_arg = { /*refund_onchain_address_arg*/ let refund_onchain_address_arg_opt = refund_onchain_address_arg; if refund_onchain_address_arg_opt.is_none() { None } else { Some({ { { refund_onchain_address_arg_opt.take() }.into_rust() }})} }; - LSPS1CreateOrderRequest { inner: ObjOps::heap_alloc(nativeLSPS1CreateOrderRequest { - order: *unsafe { Box::from_raw(order_arg.take_inner()) }, - refund_onchain_address: local_refund_onchain_address_arg, - }), is_owned: true } -} -impl Clone for LSPS1CreateOrderRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1CreateOrderRequest>::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 LSPS1CreateOrderRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1CreateOrderRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1CreateOrderRequest -pub extern "C" fn LSPS1CreateOrderRequest_clone(orig: &LSPS1CreateOrderRequest) -> LSPS1CreateOrderRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1CreateOrderRequest object -pub extern "C" fn LSPS1CreateOrderRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest }).into()} -/// Checks if two LSPS1CreateOrderRequests 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 LSPS1CreateOrderRequest_eq(a: &LSPS1CreateOrderRequest, b: &LSPS1CreateOrderRequest) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1OrderParams as nativeLSPS1OrderParamsImport; -pub(crate) type nativeLSPS1OrderParams = nativeLSPS1OrderParamsImport; - -/// An object representing an bLIP-51 / LSPS1 channel order. -#[must_use] -#[repr(C)] -pub struct LSPS1OrderParams { - /// 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 nativeLSPS1OrderParams, - /// 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 core::ops::Deref for LSPS1OrderParams { - type Target = nativeLSPS1OrderParams; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1OrderParams { } -unsafe impl core::marker::Sync for LSPS1OrderParams { } -impl Drop for LSPS1OrderParams { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1OrderParams>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1OrderParams, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_free(this_obj: LSPS1OrderParams) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OrderParams_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1OrderParams) }; -} -#[allow(unused)] -impl LSPS1OrderParams { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1OrderParams { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1OrderParams { - 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 nativeLSPS1OrderParams { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Indicates how many satoshi the LSP will provide on their side. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_lsp_balance_sat(this_ptr: &LSPS1OrderParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().lsp_balance_sat; - *inner_val -} -/// Indicates how many satoshi the LSP will provide on their side. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_lsp_balance_sat(this_ptr: &mut LSPS1OrderParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.lsp_balance_sat = val; -} -/// Indicates how many satoshi the client will provide on their side. -/// -/// The client sends these funds to the LSP, who will push them back to the client upon opening -/// the channel. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_client_balance_sat(this_ptr: &LSPS1OrderParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().client_balance_sat; - *inner_val -} -/// Indicates how many satoshi the client will provide on their side. -/// -/// The client sends these funds to the LSP, who will push them back to the client upon opening -/// the channel. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_client_balance_sat(this_ptr: &mut LSPS1OrderParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.client_balance_sat = val; -} -/// The number of confirmations the funding tx must have before the LSP sends `channel_ready`. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_required_channel_confirmations(this_ptr: &LSPS1OrderParams) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().required_channel_confirmations; - *inner_val -} -/// The number of confirmations the funding tx must have before the LSP sends `channel_ready`. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_required_channel_confirmations(this_ptr: &mut LSPS1OrderParams, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.required_channel_confirmations = val; -} -/// The maximum number of blocks the client wants to wait until the funding transaction is confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_funding_confirms_within_blocks(this_ptr: &LSPS1OrderParams) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_confirms_within_blocks; - *inner_val -} -/// The maximum number of blocks the client wants to wait until the funding transaction is confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_funding_confirms_within_blocks(this_ptr: &mut LSPS1OrderParams, mut val: u16) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_confirms_within_blocks = val; -} -/// Indicates how long the channel is leased for in block time. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_channel_expiry_blocks(this_ptr: &LSPS1OrderParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_expiry_blocks; - *inner_val -} -/// Indicates how long the channel is leased for in block time. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_channel_expiry_blocks(this_ptr: &mut LSPS1OrderParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_expiry_blocks = val; -} -/// May contain arbitrary associated data like a coupon code or a authentication token. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_token(this_ptr: &LSPS1OrderParams) -> crate::c_types::derived::COption_StrZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().token; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into() }) }; - local_inner_val -} -/// May contain arbitrary associated data like a coupon code or a authentication token. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_token(this_ptr: &mut LSPS1OrderParams, mut val: crate::c_types::derived::COption_StrZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_string() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.token = local_val; -} -/// Indicates if the channel should be announced to the network. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_get_announce_channel(this_ptr: &LSPS1OrderParams) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().announce_channel; - *inner_val -} -/// Indicates if the channel should be announced to the network. -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_set_announce_channel(this_ptr: &mut LSPS1OrderParams, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.announce_channel = val; -} -/// Constructs a new LSPS1OrderParams given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1OrderParams_new(mut lsp_balance_sat_arg: u64, mut client_balance_sat_arg: u64, mut required_channel_confirmations_arg: u16, mut funding_confirms_within_blocks_arg: u16, mut channel_expiry_blocks_arg: u32, mut token_arg: crate::c_types::derived::COption_StrZ, mut announce_channel_arg: bool) -> LSPS1OrderParams { - let mut local_token_arg = { /*token_arg*/ let token_arg_opt = token_arg; if token_arg_opt.is_none() { None } else { Some({ { { token_arg_opt.take() }.into_string() }})} }; - LSPS1OrderParams { inner: ObjOps::heap_alloc(nativeLSPS1OrderParams { - lsp_balance_sat: lsp_balance_sat_arg, - client_balance_sat: client_balance_sat_arg, - required_channel_confirmations: required_channel_confirmations_arg, - funding_confirms_within_blocks: funding_confirms_within_blocks_arg, - channel_expiry_blocks: channel_expiry_blocks_arg, - token: local_token_arg, - announce_channel: announce_channel_arg, - }), is_owned: true } -} -impl Clone for LSPS1OrderParams { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1OrderParams>::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 LSPS1OrderParams_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1OrderParams)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1OrderParams -pub extern "C" fn LSPS1OrderParams_clone(orig: &LSPS1OrderParams) -> LSPS1OrderParams { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1OrderParams object -pub extern "C" fn LSPS1OrderParams_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams }).into()} -/// Checks if two LSPS1OrderParamss 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 LSPS1OrderParams_eq(a: &LSPS1OrderParams, b: &LSPS1OrderParams) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse as nativeLSPS1CreateOrderResponseImport; -pub(crate) type nativeLSPS1CreateOrderResponse = nativeLSPS1CreateOrderResponseImport; - -/// A response to a [`LSPS1CreateOrderRequest`]. -#[must_use] -#[repr(C)] -pub struct LSPS1CreateOrderResponse { - /// 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 nativeLSPS1CreateOrderResponse, - /// 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 core::ops::Deref for LSPS1CreateOrderResponse { - type Target = nativeLSPS1CreateOrderResponse; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1CreateOrderResponse { } -unsafe impl core::marker::Sync for LSPS1CreateOrderResponse { } -impl Drop for LSPS1CreateOrderResponse { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1CreateOrderResponse>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1CreateOrderResponse, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_free(this_obj: LSPS1CreateOrderResponse) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1CreateOrderResponse_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1CreateOrderResponse) }; -} -#[allow(unused)] -impl LSPS1CreateOrderResponse { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1CreateOrderResponse { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1CreateOrderResponse { - 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 nativeLSPS1CreateOrderResponse { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The id of the channel order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_get_order_id(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order_id; - crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1OrderId<>) as *mut _) }, is_owned: false } -} -/// The id of the channel order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_order_id(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order_id = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The parameters of channel order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_get_order(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order; - crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1OrderParams<>) as *mut _) }, is_owned: false } -} -/// The parameters of channel order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_order(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The datetime when the order was created -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_get_created_at(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().created_at; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// The datetime when the order was created -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_created_at(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.created_at = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The current state of the order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_get_order_state(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OrderState { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order_state; - crate::lightning_liquidity::lsps1::msgs::LSPS1OrderState::from_native(inner_val) -} -/// The current state of the order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_order_state(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderState) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order_state = val.into_native(); -} -/// Contains details about how to pay for the order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_get_payment(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment; - crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo<>) as *mut _) }, is_owned: false } -} -/// Contains details about how to pay for the order. -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_payment(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Contains information about the channel state. -/// -/// 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 LSPS1CreateOrderResponse_get_channel(this_ptr: &LSPS1CreateOrderResponse) -> crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().channel; - let mut local_inner_val = crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// Contains information about the channel state. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_set_channel(this_ptr: &mut LSPS1CreateOrderResponse, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo) { - 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 = local_val; -} -/// Constructs a new LSPS1CreateOrderResponse given each field -/// -/// Note that channel_arg (or a relevant inner pointer) may be NULL or all-0s to represent None -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1CreateOrderResponse_new(mut order_id_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId, mut order_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderParams, mut created_at_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime, mut order_state_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderState, mut payment_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo, mut channel_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo) -> LSPS1CreateOrderResponse { - let mut local_channel_arg = if channel_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_arg.take_inner()) } }) }; - LSPS1CreateOrderResponse { inner: ObjOps::heap_alloc(nativeLSPS1CreateOrderResponse { - order_id: *unsafe { Box::from_raw(order_id_arg.take_inner()) }, - order: *unsafe { Box::from_raw(order_arg.take_inner()) }, - created_at: *unsafe { Box::from_raw(created_at_arg.take_inner()) }, - order_state: order_state_arg.into_native(), - payment: *unsafe { Box::from_raw(payment_arg.take_inner()) }, - channel: local_channel_arg, - }), is_owned: true } -} -impl Clone for LSPS1CreateOrderResponse { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1CreateOrderResponse>::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 LSPS1CreateOrderResponse_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1CreateOrderResponse)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1CreateOrderResponse -pub extern "C" fn LSPS1CreateOrderResponse_clone(orig: &LSPS1CreateOrderResponse) -> LSPS1CreateOrderResponse { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1CreateOrderResponse object -pub extern "C" fn LSPS1CreateOrderResponse_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse }).into()} -/// Checks if two LSPS1CreateOrderResponses 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 LSPS1CreateOrderResponse_eq(a: &LSPS1CreateOrderResponse, b: &LSPS1CreateOrderResponse) -> 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 } -} -/// An object representing the status of an order. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1OrderState { - /// The order has been created. - Created, - /// The LSP has opened the channel and published the funding transaction. - Completed, - /// The order failed. - Failed, -} -use lightning_liquidity::lsps1::msgs::LSPS1OrderState as LSPS1OrderStateImport; -pub(crate) type nativeLSPS1OrderState = LSPS1OrderStateImport; - -impl LSPS1OrderState { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1OrderState { - match self { - LSPS1OrderState::Created => nativeLSPS1OrderState::Created, - LSPS1OrderState::Completed => nativeLSPS1OrderState::Completed, - LSPS1OrderState::Failed => nativeLSPS1OrderState::Failed, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1OrderState { - match self { - LSPS1OrderState::Created => nativeLSPS1OrderState::Created, - LSPS1OrderState::Completed => nativeLSPS1OrderState::Completed, - LSPS1OrderState::Failed => nativeLSPS1OrderState::Failed, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1OrderStateImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1OrderState) }; - match native { - nativeLSPS1OrderState::Created => LSPS1OrderState::Created, - nativeLSPS1OrderState::Completed => LSPS1OrderState::Completed, - nativeLSPS1OrderState::Failed => LSPS1OrderState::Failed, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1OrderState) -> Self { - match native { - nativeLSPS1OrderState::Created => LSPS1OrderState::Created, - nativeLSPS1OrderState::Completed => LSPS1OrderState::Completed, - nativeLSPS1OrderState::Failed => LSPS1OrderState::Failed, - } - } -} -/// Creates a copy of the LSPS1OrderState -#[no_mangle] -pub extern "C" fn LSPS1OrderState_clone(orig: &LSPS1OrderState) -> LSPS1OrderState { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OrderState_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1OrderState)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OrderState_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1OrderState) }; -} -#[no_mangle] -/// Utility method to constructs a new Created-variant LSPS1OrderState -pub extern "C" fn LSPS1OrderState_created() -> LSPS1OrderState { - LSPS1OrderState::Created} -#[no_mangle] -/// Utility method to constructs a new Completed-variant LSPS1OrderState -pub extern "C" fn LSPS1OrderState_completed() -> LSPS1OrderState { - LSPS1OrderState::Completed} -#[no_mangle] -/// Utility method to constructs a new Failed-variant LSPS1OrderState -pub extern "C" fn LSPS1OrderState_failed() -> LSPS1OrderState { - LSPS1OrderState::Failed} -/// Get a string which allows debug introspection of a LSPS1OrderState object -pub extern "C" fn LSPS1OrderState_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1OrderState }).into()} -/// Checks if two LSPS1OrderStates contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1OrderState_eq(a: &LSPS1OrderState, b: &LSPS1OrderState) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} - -use lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo as nativeLSPS1PaymentInfoImport; -pub(crate) type nativeLSPS1PaymentInfo = nativeLSPS1PaymentInfoImport; - -/// Details regarding how to pay for an order. -#[must_use] -#[repr(C)] -pub struct LSPS1PaymentInfo { - /// 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 nativeLSPS1PaymentInfo, - /// 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 core::ops::Deref for LSPS1PaymentInfo { - type Target = nativeLSPS1PaymentInfo; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1PaymentInfo { } -unsafe impl core::marker::Sync for LSPS1PaymentInfo { } -impl Drop for LSPS1PaymentInfo { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1PaymentInfo>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1PaymentInfo, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1PaymentInfo_free(this_obj: LSPS1PaymentInfo) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1PaymentInfo_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1PaymentInfo) }; -} -#[allow(unused)] -impl LSPS1PaymentInfo { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1PaymentInfo { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1PaymentInfo { - 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 nativeLSPS1PaymentInfo { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// A Lightning payment using BOLT 11. -/// -/// 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 LSPS1PaymentInfo_get_bolt11(this_ptr: &LSPS1PaymentInfo) -> crate::lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().bolt11; - let mut local_inner_val = crate::lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// A Lightning payment using BOLT 11. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn LSPS1PaymentInfo_set_bolt11(this_ptr: &mut LSPS1PaymentInfo, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo) { - 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) }.bolt11 = local_val; -} -/// An onchain payment. -/// -/// 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 LSPS1PaymentInfo_get_onchain(this_ptr: &LSPS1PaymentInfo) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo { - let mut inner_val = &mut this_ptr.get_native_mut_ref().onchain; - let mut local_inner_val = crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo<>) as *mut _ }, is_owned: false }; - local_inner_val -} -/// An onchain payment. -/// -/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None -#[no_mangle] -pub extern "C" fn LSPS1PaymentInfo_set_onchain(this_ptr: &mut LSPS1PaymentInfo, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo) { - 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) }.onchain = local_val; -} -/// Constructs a new LSPS1PaymentInfo given each field -/// -/// Note that bolt11_arg (or a relevant inner pointer) may be NULL or all-0s to represent None -/// Note that onchain_arg (or a relevant inner pointer) may be NULL or all-0s to represent None -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1PaymentInfo_new(mut bolt11_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo, mut onchain_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo) -> LSPS1PaymentInfo { - let mut local_bolt11_arg = if bolt11_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(bolt11_arg.take_inner()) } }) }; - let mut local_onchain_arg = if onchain_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(onchain_arg.take_inner()) } }) }; - LSPS1PaymentInfo { inner: ObjOps::heap_alloc(nativeLSPS1PaymentInfo { - bolt11: local_bolt11_arg, - onchain: local_onchain_arg, - }), is_owned: true } -} -impl Clone for LSPS1PaymentInfo { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1PaymentInfo>::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 LSPS1PaymentInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1PaymentInfo)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1PaymentInfo -pub extern "C" fn LSPS1PaymentInfo_clone(orig: &LSPS1PaymentInfo) -> LSPS1PaymentInfo { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1PaymentInfo object -pub extern "C" fn LSPS1PaymentInfo_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentInfo }).into()} -/// Checks if two LSPS1PaymentInfos 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 LSPS1PaymentInfo_eq(a: &LSPS1PaymentInfo, b: &LSPS1PaymentInfo) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo as nativeLSPS1Bolt11PaymentInfoImport; -pub(crate) type nativeLSPS1Bolt11PaymentInfo = nativeLSPS1Bolt11PaymentInfoImport; - -/// A Lightning payment using BOLT 11. -#[must_use] -#[repr(C)] -pub struct LSPS1Bolt11PaymentInfo { - /// 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 nativeLSPS1Bolt11PaymentInfo, - /// 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 core::ops::Deref for LSPS1Bolt11PaymentInfo { - type Target = nativeLSPS1Bolt11PaymentInfo; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1Bolt11PaymentInfo { } -unsafe impl core::marker::Sync for LSPS1Bolt11PaymentInfo { } -impl Drop for LSPS1Bolt11PaymentInfo { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1Bolt11PaymentInfo>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1Bolt11PaymentInfo, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_free(this_obj: LSPS1Bolt11PaymentInfo) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Bolt11PaymentInfo_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1Bolt11PaymentInfo) }; -} -#[allow(unused)] -impl LSPS1Bolt11PaymentInfo { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1Bolt11PaymentInfo { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1Bolt11PaymentInfo { - 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 nativeLSPS1Bolt11PaymentInfo { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Indicates the current state of the payment. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_get_state(this_ptr: &LSPS1Bolt11PaymentInfo) -> crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState { - let mut inner_val = &mut this_ptr.get_native_mut_ref().state; - crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState::from_native(inner_val) -} -/// Indicates the current state of the payment. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_set_state(this_ptr: &mut LSPS1Bolt11PaymentInfo, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.state = val.into_native(); -} -/// The datetime when the payment option expires. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_get_expires_at(this_ptr: &LSPS1Bolt11PaymentInfo) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().expires_at; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// The datetime when the payment option expires. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_set_expires_at(this_ptr: &mut LSPS1Bolt11PaymentInfo, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.expires_at = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The total fee the LSP will charge to open this channel in satoshi. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_get_fee_total_sat(this_ptr: &LSPS1Bolt11PaymentInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_total_sat; - *inner_val -} -/// The total fee the LSP will charge to open this channel in satoshi. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_set_fee_total_sat(this_ptr: &mut LSPS1Bolt11PaymentInfo, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_total_sat = val; -} -/// The amount the client needs to pay to have the requested channel openend. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_get_order_total_sat(this_ptr: &LSPS1Bolt11PaymentInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order_total_sat; - *inner_val -} -/// The amount the client needs to pay to have the requested channel openend. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_set_order_total_sat(this_ptr: &mut LSPS1Bolt11PaymentInfo, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order_total_sat = val; -} -/// A BOLT11 invoice the client can pay to have to channel opened. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_get_invoice(this_ptr: &LSPS1Bolt11PaymentInfo) -> crate::lightning_invoice::Bolt11Invoice { - let mut inner_val = &mut this_ptr.get_native_mut_ref().invoice; - crate::lightning_invoice::Bolt11Invoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_invoice::Bolt11Invoice<>) as *mut _) }, is_owned: false } -} -/// A BOLT11 invoice the client can pay to have to channel opened. -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_set_invoice(this_ptr: &mut LSPS1Bolt11PaymentInfo, mut val: crate::lightning_invoice::Bolt11Invoice) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.invoice = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Constructs a new LSPS1Bolt11PaymentInfo given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1Bolt11PaymentInfo_new(mut state_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState, mut expires_at_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime, mut fee_total_sat_arg: u64, mut order_total_sat_arg: u64, mut invoice_arg: crate::lightning_invoice::Bolt11Invoice) -> LSPS1Bolt11PaymentInfo { - LSPS1Bolt11PaymentInfo { inner: ObjOps::heap_alloc(nativeLSPS1Bolt11PaymentInfo { - state: state_arg.into_native(), - expires_at: *unsafe { Box::from_raw(expires_at_arg.take_inner()) }, - fee_total_sat: fee_total_sat_arg, - order_total_sat: order_total_sat_arg, - invoice: *unsafe { Box::from_raw(invoice_arg.take_inner()) }, - }), is_owned: true } -} -impl Clone for LSPS1Bolt11PaymentInfo { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1Bolt11PaymentInfo>::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 LSPS1Bolt11PaymentInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1Bolt11PaymentInfo)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1Bolt11PaymentInfo -pub extern "C" fn LSPS1Bolt11PaymentInfo_clone(orig: &LSPS1Bolt11PaymentInfo) -> LSPS1Bolt11PaymentInfo { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1Bolt11PaymentInfo object -pub extern "C" fn LSPS1Bolt11PaymentInfo_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1Bolt11PaymentInfo }).into()} -/// Checks if two LSPS1Bolt11PaymentInfos 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 LSPS1Bolt11PaymentInfo_eq(a: &LSPS1Bolt11PaymentInfo, b: &LSPS1Bolt11PaymentInfo) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo as nativeLSPS1OnchainPaymentInfoImport; -pub(crate) type nativeLSPS1OnchainPaymentInfo = nativeLSPS1OnchainPaymentInfoImport; - -/// An onchain payment. -#[must_use] -#[repr(C)] -pub struct LSPS1OnchainPaymentInfo { - /// 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 nativeLSPS1OnchainPaymentInfo, - /// 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 core::ops::Deref for LSPS1OnchainPaymentInfo { - type Target = nativeLSPS1OnchainPaymentInfo; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1OnchainPaymentInfo { } -unsafe impl core::marker::Sync for LSPS1OnchainPaymentInfo { } -impl Drop for LSPS1OnchainPaymentInfo { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1OnchainPaymentInfo>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1OnchainPaymentInfo, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_free(this_obj: LSPS1OnchainPaymentInfo) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OnchainPaymentInfo_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1OnchainPaymentInfo) }; -} -#[allow(unused)] -impl LSPS1OnchainPaymentInfo { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1OnchainPaymentInfo { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1OnchainPaymentInfo { - 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 nativeLSPS1OnchainPaymentInfo { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Indicates the current state of the payment. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_state(this_ptr: &LSPS1OnchainPaymentInfo) -> crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState { - let mut inner_val = &mut this_ptr.get_native_mut_ref().state; - crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState::from_native(inner_val) -} -/// Indicates the current state of the payment. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_state(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.state = val.into_native(); -} -/// The datetime when the payment option expires. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_expires_at(this_ptr: &LSPS1OnchainPaymentInfo) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().expires_at; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// The datetime when the payment option expires. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_expires_at(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.expires_at = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The total fee the LSP will charge to open this channel in satoshi. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_fee_total_sat(this_ptr: &LSPS1OnchainPaymentInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fee_total_sat; - *inner_val -} -/// The total fee the LSP will charge to open this channel in satoshi. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_fee_total_sat(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.fee_total_sat = val; -} -/// The amount the client needs to pay to have the requested channel openend. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_order_total_sat(this_ptr: &LSPS1OnchainPaymentInfo) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order_total_sat; - *inner_val -} -/// The amount the client needs to pay to have the requested channel openend. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_order_total_sat(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order_total_sat = val; -} -/// An on-chain address the client can send [`Self::order_total_sat`] to to have the channel -/// opened. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_address(this_ptr: &LSPS1OnchainPaymentInfo) -> crate::c_types::Address { - let mut inner_val = &mut this_ptr.get_native_mut_ref().address; - crate::c_types::Address::from_rust(inner_val) -} -/// An on-chain address the client can send [`Self::order_total_sat`] to to have the channel -/// opened. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_address(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: crate::c_types::Address) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.address = val.into_rust(); -} -/// The minimum number of block confirmations that are required for the on-chain payment to be -/// considered confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_min_onchain_payment_confirmations(this_ptr: &LSPS1OnchainPaymentInfo) -> crate::c_types::derived::COption_u16Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_onchain_payment_confirmations; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; - local_inner_val -} -/// The minimum number of block confirmations that are required for the on-chain payment to be -/// considered confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_min_onchain_payment_confirmations(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: crate::c_types::derived::COption_u16Z) { - let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_onchain_payment_confirmations = local_val; -} -/// The address where the LSP will send the funds if the order fails. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_get_refund_onchain_address(this_ptr: &LSPS1OnchainPaymentInfo) -> crate::c_types::derived::COption_AddressZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().refund_onchain_address; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_AddressZ::None } else { crate::c_types::derived::COption_AddressZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::Address::from_rust(&(*inner_val.as_ref().unwrap()).clone()) }) }; - local_inner_val -} -/// The address where the LSP will send the funds if the order fails. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPaymentInfo_set_refund_onchain_address(this_ptr: &mut LSPS1OnchainPaymentInfo, mut val: crate::c_types::derived::COption_AddressZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_rust() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.refund_onchain_address = local_val; -} -impl Clone for LSPS1OnchainPaymentInfo { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1OnchainPaymentInfo>::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 LSPS1OnchainPaymentInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1OnchainPaymentInfo)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1OnchainPaymentInfo -pub extern "C" fn LSPS1OnchainPaymentInfo_clone(orig: &LSPS1OnchainPaymentInfo) -> LSPS1OnchainPaymentInfo { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1OnchainPaymentInfo object -pub extern "C" fn LSPS1OnchainPaymentInfo_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPaymentInfo }).into()} -/// Checks if two LSPS1OnchainPaymentInfos 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 LSPS1OnchainPaymentInfo_eq(a: &LSPS1OnchainPaymentInfo, b: &LSPS1OnchainPaymentInfo) -> 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 } -} -/// The state of a payment. -/// -/// *Note*: Previously, the spec also knew a `CANCELLED` state for BOLT11 payments, which has since -/// been deprecated and `REFUNDED` should be used instead. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1PaymentState { - /// A payment is expected. - ExpectPayment, - /// A sufficient payment has been received. - Paid, - /// The payment has been refunded. - Refunded, -} -use lightning_liquidity::lsps1::msgs::LSPS1PaymentState as LSPS1PaymentStateImport; -pub(crate) type nativeLSPS1PaymentState = LSPS1PaymentStateImport; - -impl LSPS1PaymentState { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1PaymentState { - match self { - LSPS1PaymentState::ExpectPayment => nativeLSPS1PaymentState::ExpectPayment, - LSPS1PaymentState::Paid => nativeLSPS1PaymentState::Paid, - LSPS1PaymentState::Refunded => nativeLSPS1PaymentState::Refunded, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1PaymentState { - match self { - LSPS1PaymentState::ExpectPayment => nativeLSPS1PaymentState::ExpectPayment, - LSPS1PaymentState::Paid => nativeLSPS1PaymentState::Paid, - LSPS1PaymentState::Refunded => nativeLSPS1PaymentState::Refunded, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1PaymentStateImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1PaymentState) }; - match native { - nativeLSPS1PaymentState::ExpectPayment => LSPS1PaymentState::ExpectPayment, - nativeLSPS1PaymentState::Paid => LSPS1PaymentState::Paid, - nativeLSPS1PaymentState::Refunded => LSPS1PaymentState::Refunded, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1PaymentState) -> Self { - match native { - nativeLSPS1PaymentState::ExpectPayment => LSPS1PaymentState::ExpectPayment, - nativeLSPS1PaymentState::Paid => LSPS1PaymentState::Paid, - nativeLSPS1PaymentState::Refunded => LSPS1PaymentState::Refunded, - } - } -} -/// Creates a copy of the LSPS1PaymentState -#[no_mangle] -pub extern "C" fn LSPS1PaymentState_clone(orig: &LSPS1PaymentState) -> LSPS1PaymentState { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1PaymentState_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1PaymentState)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1PaymentState_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1PaymentState) }; -} -#[no_mangle] -/// Utility method to constructs a new ExpectPayment-variant LSPS1PaymentState -pub extern "C" fn LSPS1PaymentState_expect_payment() -> LSPS1PaymentState { - LSPS1PaymentState::ExpectPayment} -#[no_mangle] -/// Utility method to constructs a new Paid-variant LSPS1PaymentState -pub extern "C" fn LSPS1PaymentState_paid() -> LSPS1PaymentState { - LSPS1PaymentState::Paid} -#[no_mangle] -/// Utility method to constructs a new Refunded-variant LSPS1PaymentState -pub extern "C" fn LSPS1PaymentState_refunded() -> LSPS1PaymentState { - LSPS1PaymentState::Refunded} -/// Get a string which allows debug introspection of a LSPS1PaymentState object -pub extern "C" fn LSPS1PaymentState_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1PaymentState }).into()} -/// Checks if two LSPS1PaymentStates contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1PaymentState_eq(a: &LSPS1PaymentState, b: &LSPS1PaymentState) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} - -use lightning_liquidity::lsps1::msgs::LSPS1OnchainPayment as nativeLSPS1OnchainPaymentImport; -pub(crate) type nativeLSPS1OnchainPayment = nativeLSPS1OnchainPaymentImport; - -/// Details regarding a detected on-chain payment. -#[must_use] -#[repr(C)] -pub struct LSPS1OnchainPayment { - /// 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 nativeLSPS1OnchainPayment, - /// 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 core::ops::Deref for LSPS1OnchainPayment { - type Target = nativeLSPS1OnchainPayment; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1OnchainPayment { } -unsafe impl core::marker::Sync for LSPS1OnchainPayment { } -impl Drop for LSPS1OnchainPayment { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1OnchainPayment>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1OnchainPayment, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_free(this_obj: LSPS1OnchainPayment) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1OnchainPayment_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1OnchainPayment) }; -} -#[allow(unused)] -impl LSPS1OnchainPayment { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1OnchainPayment { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1OnchainPayment { - 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 nativeLSPS1OnchainPayment { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The outpoint of the payment. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_get_outpoint(this_ptr: &LSPS1OnchainPayment) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; - inner_val.as_str().into() -} -/// The outpoint of the payment. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_set_outpoint(this_ptr: &mut LSPS1OnchainPayment, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outpoint = val.into_string(); -} -/// The amount of satoshi paid. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_get_sat(this_ptr: &LSPS1OnchainPayment) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().sat; - *inner_val -} -/// The amount of satoshi paid. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_set_sat(this_ptr: &mut LSPS1OnchainPayment, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.sat = val; -} -/// Indicates if the LSP regards the transaction as sufficiently confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_get_confirmed(this_ptr: &LSPS1OnchainPayment) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmed; - *inner_val -} -/// Indicates if the LSP regards the transaction as sufficiently confirmed. -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_set_confirmed(this_ptr: &mut LSPS1OnchainPayment, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmed = val; -} -/// Constructs a new LSPS1OnchainPayment given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1OnchainPayment_new(mut outpoint_arg: crate::c_types::Str, mut sat_arg: u64, mut confirmed_arg: bool) -> LSPS1OnchainPayment { - LSPS1OnchainPayment { inner: ObjOps::heap_alloc(nativeLSPS1OnchainPayment { - outpoint: outpoint_arg.into_string(), - sat: sat_arg, - confirmed: confirmed_arg, - }), is_owned: true } -} -impl Clone for LSPS1OnchainPayment { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1OnchainPayment>::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 LSPS1OnchainPayment_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1OnchainPayment)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1OnchainPayment -pub extern "C" fn LSPS1OnchainPayment_clone(orig: &LSPS1OnchainPayment) -> LSPS1OnchainPayment { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1OnchainPayment object -pub extern "C" fn LSPS1OnchainPayment_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1OnchainPayment }).into()} -/// Checks if two LSPS1OnchainPayments 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 LSPS1OnchainPayment_eq(a: &LSPS1OnchainPayment, b: &LSPS1OnchainPayment) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo as nativeLSPS1ChannelInfoImport; -pub(crate) type nativeLSPS1ChannelInfo = nativeLSPS1ChannelInfoImport; - -/// Details regarding the state of an ordered channel. -#[must_use] -#[repr(C)] -pub struct LSPS1ChannelInfo { - /// 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 nativeLSPS1ChannelInfo, - /// 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 core::ops::Deref for LSPS1ChannelInfo { - type Target = nativeLSPS1ChannelInfo; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1ChannelInfo { } -unsafe impl core::marker::Sync for LSPS1ChannelInfo { } -impl Drop for LSPS1ChannelInfo { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1ChannelInfo>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1ChannelInfo, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_free(this_obj: LSPS1ChannelInfo) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1ChannelInfo_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1ChannelInfo) }; -} -#[allow(unused)] -impl LSPS1ChannelInfo { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1ChannelInfo { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1ChannelInfo { - 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 nativeLSPS1ChannelInfo { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The datetime when the funding transaction has been published. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_get_funded_at(this_ptr: &LSPS1ChannelInfo) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funded_at; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// The datetime when the funding transaction has been published. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_set_funded_at(this_ptr: &mut LSPS1ChannelInfo, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funded_at = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The outpoint of the funding transaction. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_get_funding_outpoint(this_ptr: &LSPS1ChannelInfo) -> crate::lightning::chain::transaction::OutPoint { - let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_outpoint; - crate::c_types::bitcoin_to_C_outpoint(inner_val) -} -/// The outpoint of the funding transaction. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_set_funding_outpoint(this_ptr: &mut LSPS1ChannelInfo, mut val: crate::lightning::chain::transaction::OutPoint) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_outpoint = crate::c_types::C_to_bitcoin_outpoint(val); -} -/// The earliest datetime when the channel may be closed by the LSP. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_get_expires_at(this_ptr: &LSPS1ChannelInfo) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().expires_at; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// The earliest datetime when the channel may be closed by the LSP. -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_set_expires_at(this_ptr: &mut LSPS1ChannelInfo, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.expires_at = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Constructs a new LSPS1ChannelInfo given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1ChannelInfo_new(mut funded_at_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut expires_at_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) -> LSPS1ChannelInfo { - LSPS1ChannelInfo { inner: ObjOps::heap_alloc(nativeLSPS1ChannelInfo { - funded_at: *unsafe { Box::from_raw(funded_at_arg.take_inner()) }, - funding_outpoint: crate::c_types::C_to_bitcoin_outpoint(funding_outpoint_arg), - expires_at: *unsafe { Box::from_raw(expires_at_arg.take_inner()) }, - }), is_owned: true } -} -impl Clone for LSPS1ChannelInfo { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1ChannelInfo>::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 LSPS1ChannelInfo_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1ChannelInfo)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1ChannelInfo -pub extern "C" fn LSPS1ChannelInfo_clone(orig: &LSPS1ChannelInfo) -> LSPS1ChannelInfo { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1ChannelInfo object -pub extern "C" fn LSPS1ChannelInfo_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1ChannelInfo }).into()} -/// Checks if two LSPS1ChannelInfos 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 LSPS1ChannelInfo_eq(a: &LSPS1ChannelInfo, b: &LSPS1ChannelInfo) -> 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 } -} - -use lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest as nativeLSPS1GetOrderRequestImport; -pub(crate) type nativeLSPS1GetOrderRequest = nativeLSPS1GetOrderRequestImport; - -/// A request made to an LSP to retrieve information about an previously made order. -/// -/// Please refer to the [bLIP-51 / LSPS1 -/// specification](https://github.com/lightning/blips/blob/master/blip-0051.md#21-lsps1get_order) -/// for more information. -#[must_use] -#[repr(C)] -pub struct LSPS1GetOrderRequest { - /// 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 nativeLSPS1GetOrderRequest, - /// 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 core::ops::Deref for LSPS1GetOrderRequest { - type Target = nativeLSPS1GetOrderRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS1GetOrderRequest { } -unsafe impl core::marker::Sync for LSPS1GetOrderRequest { } -impl Drop for LSPS1GetOrderRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS1GetOrderRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS1GetOrderRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS1GetOrderRequest_free(this_obj: LSPS1GetOrderRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1GetOrderRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS1GetOrderRequest) }; -} -#[allow(unused)] -impl LSPS1GetOrderRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS1GetOrderRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS1GetOrderRequest { - 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 nativeLSPS1GetOrderRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The id of the order. -#[no_mangle] -pub extern "C" fn LSPS1GetOrderRequest_get_order_id(this_ptr: &LSPS1GetOrderRequest) -> crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { - let mut inner_val = &mut this_ptr.get_native_mut_ref().order_id; - crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps1::msgs::LSPS1OrderId<>) as *mut _) }, is_owned: false } -} -/// The id of the order. -#[no_mangle] -pub extern "C" fn LSPS1GetOrderRequest_set_order_id(this_ptr: &mut LSPS1GetOrderRequest, mut val: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.order_id = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// Constructs a new LSPS1GetOrderRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS1GetOrderRequest_new(mut order_id_arg: crate::lightning_liquidity::lsps1::msgs::LSPS1OrderId) -> LSPS1GetOrderRequest { - LSPS1GetOrderRequest { inner: ObjOps::heap_alloc(nativeLSPS1GetOrderRequest { - order_id: *unsafe { Box::from_raw(order_id_arg.take_inner()) }, - }), is_owned: true } -} -impl Clone for LSPS1GetOrderRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS1GetOrderRequest>::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 LSPS1GetOrderRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS1GetOrderRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS1GetOrderRequest -pub extern "C" fn LSPS1GetOrderRequest_clone(orig: &LSPS1GetOrderRequest) -> LSPS1GetOrderRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS1GetOrderRequest object -pub extern "C" fn LSPS1GetOrderRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest }).into()} -/// Checks if two LSPS1GetOrderRequests 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 LSPS1GetOrderRequest_eq(a: &LSPS1GetOrderRequest, b: &LSPS1GetOrderRequest) -> 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 } -} -/// An enum that captures all the valid JSON-RPC requests in the bLIP-51 / LSPS1 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1Request { - /// A request to learn about the options supported by the LSP. - GetInfo( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest), - /// A request to create a channel order. - CreateOrder( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest), - /// A request to query a previously created channel order. - GetOrder( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest), -} -use lightning_liquidity::lsps1::msgs::LSPS1Request as LSPS1RequestImport; -pub(crate) type nativeLSPS1Request = LSPS1RequestImport; - -impl LSPS1Request { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1Request { - match self { - LSPS1Request::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Request::GetInfo ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Request::CreateOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Request::CreateOrder ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Request::GetOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Request::GetOrder ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1Request { - match self { - LSPS1Request::GetInfo (mut a, ) => { - nativeLSPS1Request::GetInfo ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Request::CreateOrder (mut a, ) => { - nativeLSPS1Request::CreateOrder ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Request::GetOrder (mut a, ) => { - nativeLSPS1Request::GetOrder ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1RequestImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1Request) }; - match native { - nativeLSPS1Request::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Request::GetInfo ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Request::CreateOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Request::CreateOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Request::GetOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Request::GetOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1Request) -> Self { - match native { - nativeLSPS1Request::GetInfo (mut a, ) => { - LSPS1Request::GetInfo ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Request::CreateOrder (mut a, ) => { - LSPS1Request::CreateOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Request::GetOrder (mut a, ) => { - LSPS1Request::GetOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS1Request -#[no_mangle] -pub extern "C" fn LSPS1Request_free(this_ptr: LSPS1Request) { } -/// Creates a copy of the LSPS1Request -#[no_mangle] -pub extern "C" fn LSPS1Request_clone(orig: &LSPS1Request) -> LSPS1Request { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Request_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1Request)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Request_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1Request) }; -} -#[no_mangle] -/// Utility method to constructs a new GetInfo-variant LSPS1Request -pub extern "C" fn LSPS1Request_get_info(a: crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoRequest) -> LSPS1Request { - LSPS1Request::GetInfo(a, ) -} -#[no_mangle] -/// Utility method to constructs a new CreateOrder-variant LSPS1Request -pub extern "C" fn LSPS1Request_create_order(a: crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderRequest) -> LSPS1Request { - LSPS1Request::CreateOrder(a, ) -} -#[no_mangle] -/// Utility method to constructs a new GetOrder-variant LSPS1Request -pub extern "C" fn LSPS1Request_get_order(a: crate::lightning_liquidity::lsps1::msgs::LSPS1GetOrderRequest) -> LSPS1Request { - LSPS1Request::GetOrder(a, ) -} -/// Get a string which allows debug introspection of a LSPS1Request object -pub extern "C" fn LSPS1Request_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1Request }).into()} -/// Checks if two LSPS1Requests contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1Request_eq(a: &LSPS1Request, b: &LSPS1Request) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An enum that captures all the valid JSON-RPC responses in the bLIP-51 / LSPS1 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1Response { - /// A successful response to a [`LSPS1GetInfoRequest`]. - GetInfo( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse), - /// An error response to a [`LSPS1GetInfoRequest`]. - GetInfoError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), - /// A successful response to a [`LSPS1CreateOrderRequest`]. - CreateOrder( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse), - /// An error response to a [`LSPS1CreateOrderRequest`]. - CreateOrderError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), - /// A successful response to a [`LSPS1GetOrderRequest`]. - GetOrder( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse), - /// An error response to a [`LSPS1GetOrderRequest`]. - GetOrderError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), -} -use lightning_liquidity::lsps1::msgs::LSPS1Response as LSPS1ResponseImport; -pub(crate) type nativeLSPS1Response = LSPS1ResponseImport; - -impl LSPS1Response { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1Response { - match self { - LSPS1Response::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::GetInfo ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Response::GetInfoError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::GetInfoError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Response::CreateOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::CreateOrder ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Response::CreateOrderError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::CreateOrderError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Response::GetOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::GetOrder ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS1Response::GetOrderError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS1Response::GetOrderError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1Response { - match self { - LSPS1Response::GetInfo (mut a, ) => { - nativeLSPS1Response::GetInfo ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Response::GetInfoError (mut a, ) => { - nativeLSPS1Response::GetInfoError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Response::CreateOrder (mut a, ) => { - nativeLSPS1Response::CreateOrder ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Response::CreateOrderError (mut a, ) => { - nativeLSPS1Response::CreateOrderError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Response::GetOrder (mut a, ) => { - nativeLSPS1Response::GetOrder ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS1Response::GetOrderError (mut a, ) => { - nativeLSPS1Response::GetOrderError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1ResponseImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1Response) }; - match native { - nativeLSPS1Response::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::GetInfo ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Response::GetInfoError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::GetInfoError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Response::CreateOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::CreateOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Response::CreateOrderError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::CreateOrderError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Response::GetOrder (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::GetOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS1Response::GetOrderError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS1Response::GetOrderError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1Response) -> Self { - match native { - nativeLSPS1Response::GetInfo (mut a, ) => { - LSPS1Response::GetInfo ( - crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Response::GetInfoError (mut a, ) => { - LSPS1Response::GetInfoError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Response::CreateOrder (mut a, ) => { - LSPS1Response::CreateOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Response::CreateOrderError (mut a, ) => { - LSPS1Response::CreateOrderError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Response::GetOrder (mut a, ) => { - LSPS1Response::GetOrder ( - crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS1Response::GetOrderError (mut a, ) => { - LSPS1Response::GetOrderError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS1Response -#[no_mangle] -pub extern "C" fn LSPS1Response_free(this_ptr: LSPS1Response) { } -/// Creates a copy of the LSPS1Response -#[no_mangle] -pub extern "C" fn LSPS1Response_clone(orig: &LSPS1Response) -> LSPS1Response { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Response_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1Response)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Response_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1Response) }; -} -#[no_mangle] -/// Utility method to constructs a new GetInfo-variant LSPS1Response -pub extern "C" fn LSPS1Response_get_info(a: crate::lightning_liquidity::lsps1::msgs::LSPS1GetInfoResponse) -> LSPS1Response { - LSPS1Response::GetInfo(a, ) -} -#[no_mangle] -/// Utility method to constructs a new GetInfoError-variant LSPS1Response -pub extern "C" fn LSPS1Response_get_info_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS1Response { - LSPS1Response::GetInfoError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new CreateOrder-variant LSPS1Response -pub extern "C" fn LSPS1Response_create_order(a: crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse) -> LSPS1Response { - LSPS1Response::CreateOrder(a, ) -} -#[no_mangle] -/// Utility method to constructs a new CreateOrderError-variant LSPS1Response -pub extern "C" fn LSPS1Response_create_order_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS1Response { - LSPS1Response::CreateOrderError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new GetOrder-variant LSPS1Response -pub extern "C" fn LSPS1Response_get_order(a: crate::lightning_liquidity::lsps1::msgs::LSPS1CreateOrderResponse) -> LSPS1Response { - LSPS1Response::GetOrder(a, ) -} -#[no_mangle] -/// Utility method to constructs a new GetOrderError-variant LSPS1Response -pub extern "C" fn LSPS1Response_get_order_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS1Response { - LSPS1Response::GetOrderError(a, ) -} -/// Get a string which allows debug introspection of a LSPS1Response object -pub extern "C" fn LSPS1Response_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1Response }).into()} -/// Checks if two LSPS1Responses contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1Response_eq(a: &LSPS1Response, b: &LSPS1Response) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An enum that captures all valid JSON-RPC messages in the bLIP-51 / LSPS1 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS1Message { - /// An LSPS1 JSON-RPC request. - Request( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps1::msgs::LSPS1Request), - /// An LSPS1 JSON-RPC response. - Response( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps1::msgs::LSPS1Response), -} -use lightning_liquidity::lsps1::msgs::LSPS1Message as LSPS1MessageImport; -pub(crate) type nativeLSPS1Message = LSPS1MessageImport; - -impl LSPS1Message { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS1Message { - match self { - LSPS1Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS1Message::Request ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - LSPS1Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS1Message::Response ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS1Message { - match self { - LSPS1Message::Request (mut a, mut b, ) => { - nativeLSPS1Message::Request ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - LSPS1Message::Response (mut a, mut b, ) => { - nativeLSPS1Message::Response ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS1MessageImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS1Message) }; - match native { - nativeLSPS1Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS1Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps1::msgs::LSPS1Request::native_into(b_nonref), - ) - }, - nativeLSPS1Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS1Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps1::msgs::LSPS1Response::native_into(b_nonref), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS1Message) -> Self { - match native { - nativeLSPS1Message::Request (mut a, mut b, ) => { - LSPS1Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps1::msgs::LSPS1Request::native_into(b), - ) - }, - nativeLSPS1Message::Response (mut a, mut b, ) => { - LSPS1Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps1::msgs::LSPS1Response::native_into(b), - ) - }, - } - } -} -/// Frees any resources used by the LSPS1Message -#[no_mangle] -pub extern "C" fn LSPS1Message_free(this_ptr: LSPS1Message) { } -/// Creates a copy of the LSPS1Message -#[no_mangle] -pub extern "C" fn LSPS1Message_clone(orig: &LSPS1Message) -> LSPS1Message { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Message_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS1Message)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS1Message_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS1Message) }; -} -#[no_mangle] -/// Utility method to constructs a new Request-variant LSPS1Message -pub extern "C" fn LSPS1Message_request(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps1::msgs::LSPS1Request) -> LSPS1Message { - LSPS1Message::Request(a, b, ) -} -#[no_mangle] -/// Utility method to constructs a new Response-variant LSPS1Message -pub extern "C" fn LSPS1Message_response(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps1::msgs::LSPS1Response) -> LSPS1Message { - LSPS1Message::Response(a, b, ) -} -/// Get a string which allows debug introspection of a LSPS1Message object -pub extern "C" fn LSPS1Message_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps1::msgs::LSPS1Message }).into()} -/// Checks if two LSPS1Messages contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS1Message_eq(a: &LSPS1Message, b: &LSPS1Message) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps2/client.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/client.rs deleted file mode 100644 index b0c9ace0..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/client.rs +++ /dev/null @@ -1,224 +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. - -//! Contains the main bLIP-52 / LSPS2 client object, [`LSPS2ClientHandler`]. - -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_liquidity::lsps2::client::LSPS2ClientConfig as nativeLSPS2ClientConfigImport; -pub(crate) type nativeLSPS2ClientConfig = nativeLSPS2ClientConfigImport; - -/// Client-side configuration options for JIT channels. -#[must_use] -#[repr(C)] -pub struct LSPS2ClientConfig { - /// 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 nativeLSPS2ClientConfig, - /// 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 core::ops::Deref for LSPS2ClientConfig { - type Target = nativeLSPS2ClientConfig; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2ClientConfig { } -unsafe impl core::marker::Sync for LSPS2ClientConfig { } -impl Drop for LSPS2ClientConfig { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2ClientConfig>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2ClientConfig, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2ClientConfig_free(this_obj: LSPS2ClientConfig) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ClientConfig_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2ClientConfig) }; -} -#[allow(unused)] -impl LSPS2ClientConfig { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2ClientConfig { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2ClientConfig { - 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 nativeLSPS2ClientConfig { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Constructs a new LSPS2ClientConfig given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ClientConfig_new() -> LSPS2ClientConfig { - LSPS2ClientConfig { inner: ObjOps::heap_alloc(nativeLSPS2ClientConfig { - }), is_owned: true } -} -impl Clone for LSPS2ClientConfig { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2ClientConfig>::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 LSPS2ClientConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2ClientConfig)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2ClientConfig -pub extern "C" fn LSPS2ClientConfig_clone(orig: &LSPS2ClientConfig) -> LSPS2ClientConfig { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2ClientConfig object -pub extern "C" fn LSPS2ClientConfig_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::client::LSPS2ClientConfig }).into()} - -use lightning_liquidity::lsps2::client::LSPS2ClientHandler as nativeLSPS2ClientHandlerImport; -pub(crate) type nativeLSPS2ClientHandler = nativeLSPS2ClientHandlerImport; - -/// The main object allowing to send and receive bLIP-52 / LSPS2 messages. -/// -/// Note that currently only the 'client-trusts-LSP' trust model is supported, i.e., we don't -/// provide any additional API guidance to allow withholding the preimage until the channel is -/// opened. Please refer to the [`bLIP-52 / LSPS2 specification`] for more information. -/// -/// [`bLIP-52 / LSPS2 specification`]: https://github.com/lightning/blips/blob/master/blip-0052.md#trust-models -#[must_use] -#[repr(C)] -pub struct LSPS2ClientHandler { - /// 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 nativeLSPS2ClientHandler, - /// 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 core::ops::Deref for LSPS2ClientHandler { - type Target = nativeLSPS2ClientHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2ClientHandler { } -unsafe impl core::marker::Sync for LSPS2ClientHandler { } -impl Drop for LSPS2ClientHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2ClientHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2ClientHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2ClientHandler_free(this_obj: LSPS2ClientHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ClientHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2ClientHandler) }; -} -#[allow(unused)] -impl LSPS2ClientHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2ClientHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2ClientHandler { - 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 nativeLSPS2ClientHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Request the channel opening parameters from the LSP. -/// -/// This initiates the JIT-channel flow that, at the end of it, will have the LSP -/// open a channel with sufficient inbound liquidity to be able to receive the payment. -/// -/// The user will receive the LSP's response via an [`OpeningParametersReady`] event. -/// -/// `counterparty_node_id` is the `node_id` of the LSP you would like to use. -/// -/// `token` is an optional `String` that will be provided to the LSP. -/// It can be used by the LSP as an API key, coupon code, or some other way to identify a user. -/// -/// Returns the used [`LSPSRequestId`], which will be returned via [`OpeningParametersReady`]. -/// -/// [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ClientHandler_request_opening_params(this_arg: &crate::lightning_liquidity::lsps2::client::LSPS2ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut token: crate::c_types::derived::COption_StrZ) -> crate::lightning_liquidity::lsps0::ser::LSPSRequestId { - let mut local_token = { /*token*/ let token_opt = token; if token_opt.is_none() { None } else { Some({ { { token_opt.take() }.into_string() }})} }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_opening_params(counterparty_node_id.into_rust(), local_token); - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Confirms a set of chosen channel opening parameters to use for the JIT channel and -/// requests the necessary invoice generation parameters from the LSP. -/// -/// Should be called in response to receiving a [`OpeningParametersReady`] event. -/// -/// The user will receive the LSP's response via an [`InvoiceParametersReady`] event. -/// -/// If `payment_size_msat` is [`Option::Some`] then the invoice will be for a fixed amount -/// and MPP can be used to pay it. -/// -/// If `payment_size_msat` is [`Option::None`] then the invoice can be for an arbitrary amount -/// but MPP can no longer be used to pay it. -/// -/// The client agrees to paying an opening fee equal to -/// `max(min_fee_msat, proportional*(payment_size_msat/1_000_000))`. -/// -/// [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady -/// [`InvoiceParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::InvoiceParametersReady -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ClientHandler_select_opening_params(this_arg: &crate::lightning_liquidity::lsps2::client::LSPS2ClientHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut payment_size_msat: crate::c_types::derived::COption_u64Z, mut opening_fee_params: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams) -> crate::c_types::derived::CResult_LSPSRequestIdAPIErrorZ { - let mut local_payment_size_msat = if payment_size_msat.is_some() { Some( { payment_size_msat.take() }) } else { None }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.select_opening_params(counterparty_node_id.into_rust(), local_payment_size_msat, *unsafe { Box::from_raw(opening_fee_params.take_inner()) }); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; - local_ret -} - diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps2/event.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/event.rs deleted file mode 100644 index 1f15be7f..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/event.rs +++ /dev/null @@ -1,502 +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. - -//! Contains bLIP-52 / LSPS2 event types - -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}; - -/// An event which an LSPS2 client should take some action in response to. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS2ClientEvent { - /// Information from the LSP about their current fee rates and channel parameters. - /// - /// You must call [`LSPS2ClientHandler::select_opening_params`] with the fee parameter - /// you want to use if you wish to proceed opening a channel. - /// - /// [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params - OpeningParametersReady { - /// The identifier of the issued bLIP-52 / LSPS2 `get_info` request, as returned by - /// [`LSPS2ClientHandler::request_opening_params`] - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS2ClientHandler::request_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::request_opening_params - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP that provided this response. - counterparty_node_id: crate::c_types::PublicKey, - /// The menu of fee parameters the LSP is offering at this time. - /// You must select one of these if you wish to proceed. - opening_fee_params_menu: crate::c_types::derived::CVec_LSPS2OpeningFeeParamsZ, - }, - /// Provides the necessary information to generate a payable invoice that then may be given to - /// the payer. - /// - /// When the invoice is paid, the LSP will open a channel with the previously agreed upon - /// parameters to you. - InvoiceParametersReady { - /// The identifier of the issued bLIP-52 / LSPS2 `buy` request, as returned by - /// [`LSPS2ClientHandler::select_opening_params`]. - /// - /// This can be used to track which request this event corresponds to. - /// - /// [`LSPS2ClientHandler::select_opening_params`]: crate::lsps2::client::LSPS2ClientHandler::select_opening_params - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the LSP. - counterparty_node_id: crate::c_types::PublicKey, - /// The intercept short channel id to use in the route hint. - intercept_scid: u64, - /// The `cltv_expiry_delta` to use in the route hint. - cltv_expiry_delta: u32, - /// The initial payment size you specified. - payment_size_msat: crate::c_types::derived::COption_u64Z, - }, -} -use lightning_liquidity::lsps2::event::LSPS2ClientEvent as LSPS2ClientEventImport; -pub(crate) type nativeLSPS2ClientEvent = LSPS2ClientEventImport; - -impl LSPS2ClientEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS2ClientEvent { - match self { - LSPS2ClientEvent::OpeningParametersReady {ref request_id, ref counterparty_node_id, ref opening_fee_params_menu, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut opening_fee_params_menu_nonref = Clone::clone(opening_fee_params_menu); - let mut local_opening_fee_params_menu_nonref = Vec::new(); for mut item in opening_fee_params_menu_nonref.into_rust().drain(..) { local_opening_fee_params_menu_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - nativeLSPS2ClientEvent::OpeningParametersReady { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - opening_fee_params_menu: local_opening_fee_params_menu_nonref, - } - }, - LSPS2ClientEvent::InvoiceParametersReady {ref request_id, ref counterparty_node_id, ref intercept_scid, ref cltv_expiry_delta, ref payment_size_msat, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut intercept_scid_nonref = Clone::clone(intercept_scid); - let mut cltv_expiry_delta_nonref = Clone::clone(cltv_expiry_delta); - let mut payment_size_msat_nonref = Clone::clone(payment_size_msat); - let mut local_payment_size_msat_nonref = if payment_size_msat_nonref.is_some() { Some( { payment_size_msat_nonref.take() }) } else { None }; - nativeLSPS2ClientEvent::InvoiceParametersReady { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - intercept_scid: intercept_scid_nonref, - cltv_expiry_delta: cltv_expiry_delta_nonref, - payment_size_msat: local_payment_size_msat_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS2ClientEvent { - match self { - LSPS2ClientEvent::OpeningParametersReady {mut request_id, mut counterparty_node_id, mut opening_fee_params_menu, } => { - let mut local_opening_fee_params_menu = Vec::new(); for mut item in opening_fee_params_menu.into_rust().drain(..) { local_opening_fee_params_menu.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - nativeLSPS2ClientEvent::OpeningParametersReady { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - opening_fee_params_menu: local_opening_fee_params_menu, - } - }, - LSPS2ClientEvent::InvoiceParametersReady {mut request_id, mut counterparty_node_id, mut intercept_scid, mut cltv_expiry_delta, mut payment_size_msat, } => { - let mut local_payment_size_msat = if payment_size_msat.is_some() { Some( { payment_size_msat.take() }) } else { None }; - nativeLSPS2ClientEvent::InvoiceParametersReady { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - intercept_scid: intercept_scid, - cltv_expiry_delta: cltv_expiry_delta, - payment_size_msat: local_payment_size_msat, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS2ClientEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS2ClientEvent) }; - match native { - nativeLSPS2ClientEvent::OpeningParametersReady {ref request_id, ref counterparty_node_id, ref opening_fee_params_menu, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut opening_fee_params_menu_nonref = Clone::clone(opening_fee_params_menu); - let mut local_opening_fee_params_menu_nonref = Vec::new(); for mut item in opening_fee_params_menu_nonref.drain(..) { local_opening_fee_params_menu_nonref.push( { crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - LSPS2ClientEvent::OpeningParametersReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - opening_fee_params_menu: local_opening_fee_params_menu_nonref.into(), - } - }, - nativeLSPS2ClientEvent::InvoiceParametersReady {ref request_id, ref counterparty_node_id, ref intercept_scid, ref cltv_expiry_delta, ref payment_size_msat, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut intercept_scid_nonref = Clone::clone(intercept_scid); - let mut cltv_expiry_delta_nonref = Clone::clone(cltv_expiry_delta); - let mut payment_size_msat_nonref = Clone::clone(payment_size_msat); - let mut local_payment_size_msat_nonref = if payment_size_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { payment_size_msat_nonref.unwrap() }) }; - LSPS2ClientEvent::InvoiceParametersReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - intercept_scid: intercept_scid_nonref, - cltv_expiry_delta: cltv_expiry_delta_nonref, - payment_size_msat: local_payment_size_msat_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS2ClientEvent) -> Self { - match native { - nativeLSPS2ClientEvent::OpeningParametersReady {mut request_id, mut counterparty_node_id, mut opening_fee_params_menu, } => { - let mut local_opening_fee_params_menu = Vec::new(); for mut item in opening_fee_params_menu.drain(..) { local_opening_fee_params_menu.push( { crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - LSPS2ClientEvent::OpeningParametersReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - opening_fee_params_menu: local_opening_fee_params_menu.into(), - } - }, - nativeLSPS2ClientEvent::InvoiceParametersReady {mut request_id, mut counterparty_node_id, mut intercept_scid, mut cltv_expiry_delta, mut payment_size_msat, } => { - let mut local_payment_size_msat = if payment_size_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { payment_size_msat.unwrap() }) }; - LSPS2ClientEvent::InvoiceParametersReady { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - intercept_scid: intercept_scid, - cltv_expiry_delta: cltv_expiry_delta, - payment_size_msat: local_payment_size_msat, - } - }, - } - } -} -/// Frees any resources used by the LSPS2ClientEvent -#[no_mangle] -pub extern "C" fn LSPS2ClientEvent_free(this_ptr: LSPS2ClientEvent) { } -/// Creates a copy of the LSPS2ClientEvent -#[no_mangle] -pub extern "C" fn LSPS2ClientEvent_clone(orig: &LSPS2ClientEvent) -> LSPS2ClientEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ClientEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS2ClientEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ClientEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS2ClientEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new OpeningParametersReady-variant LSPS2ClientEvent -pub extern "C" fn LSPS2ClientEvent_opening_parameters_ready(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, opening_fee_params_menu: crate::c_types::derived::CVec_LSPS2OpeningFeeParamsZ) -> LSPS2ClientEvent { - LSPS2ClientEvent::OpeningParametersReady { - request_id, - counterparty_node_id, - opening_fee_params_menu, - } -} -#[no_mangle] -/// Utility method to constructs a new InvoiceParametersReady-variant LSPS2ClientEvent -pub extern "C" fn LSPS2ClientEvent_invoice_parameters_ready(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, intercept_scid: u64, cltv_expiry_delta: u32, payment_size_msat: crate::c_types::derived::COption_u64Z) -> LSPS2ClientEvent { - LSPS2ClientEvent::InvoiceParametersReady { - request_id, - counterparty_node_id, - intercept_scid, - cltv_expiry_delta, - payment_size_msat, - } -} -/// Get a string which allows debug introspection of a LSPS2ClientEvent object -pub extern "C" fn LSPS2ClientEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::event::LSPS2ClientEvent }).into()} -/// Checks if two LSPS2ClientEvents contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS2ClientEvent_eq(a: &LSPS2ClientEvent, b: &LSPS2ClientEvent) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An event which an bLIP-52 / LSPS2 server should take some action in response to. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS2ServiceEvent { - /// A request from a client for information about JIT Channel parameters. - /// - /// You must calculate the parameters for this client and pass them to - /// [`LSPS2ServiceHandler::opening_fee_params_generated`]. - /// - /// If an unrecognized or stale token is provided you can use - /// `[LSPS2ServiceHandler::invalid_token_provided`] to error the request. - /// - /// [`LSPS2ServiceHandler::opening_fee_params_generated`]: crate::lsps2::service::LSPS2ServiceHandler::opening_fee_params_generated - /// [`LSPS2ServiceHandler::invalid_token_provided`]: crate::lsps2::service::LSPS2ServiceHandler::invalid_token_provided - GetInfo { - /// An identifier that must be passed to [`LSPS2ServiceHandler::opening_fee_params_generated`]. - /// - /// [`LSPS2ServiceHandler::opening_fee_params_generated`]: crate::lsps2::service::LSPS2ServiceHandler::opening_fee_params_generated - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The node id of the client making the information request. - counterparty_node_id: crate::c_types::PublicKey, - /// An optional token that can be used as an API key, coupon code, etc. - token: crate::c_types::derived::COption_StrZ, - }, - /// A client has selected a opening fee parameter to use and would like to - /// purchase a channel with an optional initial payment size. - /// - /// If `payment_size_msat` is [`Option::Some`] then the payer is allowed to use MPP. - /// If `payment_size_msat` is [`Option::None`] then the payer cannot use MPP. - /// - /// You must generate an intercept scid and `cltv_expiry_delta` for them to use - /// and call [`LSPS2ServiceHandler::invoice_parameters_generated`]. - /// - /// [`LSPS2ServiceHandler::invoice_parameters_generated`]: crate::lsps2::service::LSPS2ServiceHandler::invoice_parameters_generated - BuyRequest { - /// An identifier that must be passed into [`LSPS2ServiceHandler::invoice_parameters_generated`]. - /// - /// [`LSPS2ServiceHandler::invoice_parameters_generated`]: crate::lsps2::service::LSPS2ServiceHandler::invoice_parameters_generated - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - /// The client node id that is making this request. - counterparty_node_id: crate::c_types::PublicKey, - /// The channel parameters they have selected. - opening_fee_params: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams, - /// The size of the initial payment they would like to receive. - payment_size_msat: crate::c_types::derived::COption_u64Z, - }, - /// You should open a channel using [`ChannelManager::create_channel`]. - /// - /// [`ChannelManager::create_channel`]: lightning::ln::channelmanager::ChannelManager::create_channel - OpenChannel { - /// The node to open channel with. - their_network_key: crate::c_types::PublicKey, - /// The amount to forward after fees. - amt_to_forward_msat: u64, - /// The fee earned for opening the channel. - opening_fee_msat: u64, - /// A user specified id used to track channel open. - user_channel_id: crate::c_types::U128, - /// The intercept short channel id to use in the route hint. - intercept_scid: u64, - }, -} -use lightning_liquidity::lsps2::event::LSPS2ServiceEvent as LSPS2ServiceEventImport; -pub(crate) type nativeLSPS2ServiceEvent = LSPS2ServiceEventImport; - -impl LSPS2ServiceEvent { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS2ServiceEvent { - match self { - LSPS2ServiceEvent::GetInfo {ref request_id, ref counterparty_node_id, ref token, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut token_nonref = Clone::clone(token); - let mut local_token_nonref = { /*token_nonref*/ let token_nonref_opt = token_nonref; if token_nonref_opt.is_none() { None } else { Some({ { { token_nonref_opt.take() }.into_string() }})} }; - nativeLSPS2ServiceEvent::GetInfo { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - token: local_token_nonref, - } - }, - LSPS2ServiceEvent::BuyRequest {ref request_id, ref counterparty_node_id, ref opening_fee_params, ref payment_size_msat, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut opening_fee_params_nonref = Clone::clone(opening_fee_params); - let mut payment_size_msat_nonref = Clone::clone(payment_size_msat); - let mut local_payment_size_msat_nonref = if payment_size_msat_nonref.is_some() { Some( { payment_size_msat_nonref.take() }) } else { None }; - nativeLSPS2ServiceEvent::BuyRequest { - request_id: *unsafe { Box::from_raw(request_id_nonref.take_inner()) }, - counterparty_node_id: counterparty_node_id_nonref.into_rust(), - opening_fee_params: *unsafe { Box::from_raw(opening_fee_params_nonref.take_inner()) }, - payment_size_msat: local_payment_size_msat_nonref, - } - }, - LSPS2ServiceEvent::OpenChannel {ref their_network_key, ref amt_to_forward_msat, ref opening_fee_msat, ref user_channel_id, ref intercept_scid, } => { - let mut their_network_key_nonref = Clone::clone(their_network_key); - let mut amt_to_forward_msat_nonref = Clone::clone(amt_to_forward_msat); - let mut opening_fee_msat_nonref = Clone::clone(opening_fee_msat); - let mut user_channel_id_nonref = Clone::clone(user_channel_id); - let mut intercept_scid_nonref = Clone::clone(intercept_scid); - nativeLSPS2ServiceEvent::OpenChannel { - their_network_key: their_network_key_nonref.into_rust(), - amt_to_forward_msat: amt_to_forward_msat_nonref, - opening_fee_msat: opening_fee_msat_nonref, - user_channel_id: user_channel_id_nonref.into(), - intercept_scid: intercept_scid_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS2ServiceEvent { - match self { - LSPS2ServiceEvent::GetInfo {mut request_id, mut counterparty_node_id, mut token, } => { - let mut local_token = { /*token*/ let token_opt = token; if token_opt.is_none() { None } else { Some({ { { token_opt.take() }.into_string() }})} }; - nativeLSPS2ServiceEvent::GetInfo { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - token: local_token, - } - }, - LSPS2ServiceEvent::BuyRequest {mut request_id, mut counterparty_node_id, mut opening_fee_params, mut payment_size_msat, } => { - let mut local_payment_size_msat = if payment_size_msat.is_some() { Some( { payment_size_msat.take() }) } else { None }; - nativeLSPS2ServiceEvent::BuyRequest { - request_id: *unsafe { Box::from_raw(request_id.take_inner()) }, - counterparty_node_id: counterparty_node_id.into_rust(), - opening_fee_params: *unsafe { Box::from_raw(opening_fee_params.take_inner()) }, - payment_size_msat: local_payment_size_msat, - } - }, - LSPS2ServiceEvent::OpenChannel {mut their_network_key, mut amt_to_forward_msat, mut opening_fee_msat, mut user_channel_id, mut intercept_scid, } => { - nativeLSPS2ServiceEvent::OpenChannel { - their_network_key: their_network_key.into_rust(), - amt_to_forward_msat: amt_to_forward_msat, - opening_fee_msat: opening_fee_msat, - user_channel_id: user_channel_id.into(), - intercept_scid: intercept_scid, - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS2ServiceEventImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS2ServiceEvent) }; - match native { - nativeLSPS2ServiceEvent::GetInfo {ref request_id, ref counterparty_node_id, ref token, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut token_nonref = Clone::clone(token); - let mut local_token_nonref = if token_nonref.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some( { token_nonref.unwrap().into() }) }; - LSPS2ServiceEvent::GetInfo { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - token: local_token_nonref, - } - }, - nativeLSPS2ServiceEvent::BuyRequest {ref request_id, ref counterparty_node_id, ref opening_fee_params, ref payment_size_msat, } => { - let mut request_id_nonref = Clone::clone(request_id); - let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); - let mut opening_fee_params_nonref = Clone::clone(opening_fee_params); - let mut payment_size_msat_nonref = Clone::clone(payment_size_msat); - let mut local_payment_size_msat_nonref = if payment_size_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { payment_size_msat_nonref.unwrap() }) }; - LSPS2ServiceEvent::BuyRequest { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id_nonref), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), - opening_fee_params: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: ObjOps::heap_alloc(opening_fee_params_nonref), is_owned: true }, - payment_size_msat: local_payment_size_msat_nonref, - } - }, - nativeLSPS2ServiceEvent::OpenChannel {ref their_network_key, ref amt_to_forward_msat, ref opening_fee_msat, ref user_channel_id, ref intercept_scid, } => { - let mut their_network_key_nonref = Clone::clone(their_network_key); - let mut amt_to_forward_msat_nonref = Clone::clone(amt_to_forward_msat); - let mut opening_fee_msat_nonref = Clone::clone(opening_fee_msat); - let mut user_channel_id_nonref = Clone::clone(user_channel_id); - let mut intercept_scid_nonref = Clone::clone(intercept_scid); - LSPS2ServiceEvent::OpenChannel { - their_network_key: crate::c_types::PublicKey::from_rust(&their_network_key_nonref), - amt_to_forward_msat: amt_to_forward_msat_nonref, - opening_fee_msat: opening_fee_msat_nonref, - user_channel_id: user_channel_id_nonref.into(), - intercept_scid: intercept_scid_nonref, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS2ServiceEvent) -> Self { - match native { - nativeLSPS2ServiceEvent::GetInfo {mut request_id, mut counterparty_node_id, mut token, } => { - let mut local_token = if token.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some( { token.unwrap().into() }) }; - LSPS2ServiceEvent::GetInfo { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - token: local_token, - } - }, - nativeLSPS2ServiceEvent::BuyRequest {mut request_id, mut counterparty_node_id, mut opening_fee_params, mut payment_size_msat, } => { - let mut local_payment_size_msat = if payment_size_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { payment_size_msat.unwrap() }) }; - LSPS2ServiceEvent::BuyRequest { - request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(request_id), is_owned: true }, - counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), - opening_fee_params: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: ObjOps::heap_alloc(opening_fee_params), is_owned: true }, - payment_size_msat: local_payment_size_msat, - } - }, - nativeLSPS2ServiceEvent::OpenChannel {mut their_network_key, mut amt_to_forward_msat, mut opening_fee_msat, mut user_channel_id, mut intercept_scid, } => { - LSPS2ServiceEvent::OpenChannel { - their_network_key: crate::c_types::PublicKey::from_rust(&their_network_key), - amt_to_forward_msat: amt_to_forward_msat, - opening_fee_msat: opening_fee_msat, - user_channel_id: user_channel_id.into(), - intercept_scid: intercept_scid, - } - }, - } - } -} -/// Frees any resources used by the LSPS2ServiceEvent -#[no_mangle] -pub extern "C" fn LSPS2ServiceEvent_free(this_ptr: LSPS2ServiceEvent) { } -/// Creates a copy of the LSPS2ServiceEvent -#[no_mangle] -pub extern "C" fn LSPS2ServiceEvent_clone(orig: &LSPS2ServiceEvent) -> LSPS2ServiceEvent { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ServiceEvent_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS2ServiceEvent)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ServiceEvent_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS2ServiceEvent) }; -} -#[no_mangle] -/// Utility method to constructs a new GetInfo-variant LSPS2ServiceEvent -pub extern "C" fn LSPS2ServiceEvent_get_info(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, token: crate::c_types::derived::COption_StrZ) -> LSPS2ServiceEvent { - LSPS2ServiceEvent::GetInfo { - request_id, - counterparty_node_id, - token, - } -} -#[no_mangle] -/// Utility method to constructs a new BuyRequest-variant LSPS2ServiceEvent -pub extern "C" fn LSPS2ServiceEvent_buy_request(request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, counterparty_node_id: crate::c_types::PublicKey, opening_fee_params: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams, payment_size_msat: crate::c_types::derived::COption_u64Z) -> LSPS2ServiceEvent { - LSPS2ServiceEvent::BuyRequest { - request_id, - counterparty_node_id, - opening_fee_params, - payment_size_msat, - } -} -#[no_mangle] -/// Utility method to constructs a new OpenChannel-variant LSPS2ServiceEvent -pub extern "C" fn LSPS2ServiceEvent_open_channel(their_network_key: crate::c_types::PublicKey, amt_to_forward_msat: u64, opening_fee_msat: u64, user_channel_id: crate::c_types::U128, intercept_scid: u64) -> LSPS2ServiceEvent { - LSPS2ServiceEvent::OpenChannel { - their_network_key, - amt_to_forward_msat, - opening_fee_msat, - user_channel_id, - intercept_scid, - } -} -/// Get a string which allows debug introspection of a LSPS2ServiceEvent object -pub extern "C" fn LSPS2ServiceEvent_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::event::LSPS2ServiceEvent }).into()} -/// Checks if two LSPS2ServiceEvents contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS2ServiceEvent_eq(a: &LSPS2ServiceEvent, b: &LSPS2ServiceEvent) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps2/mod.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/mod.rs deleted file mode 100644 index 13cf51e9..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/mod.rs +++ /dev/null @@ -1,36 +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. - -//! Implementation of bLIP-52 / LSPS2: JIT Channel Negotiation specification. - -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 client; -pub mod event; -pub mod msgs; -pub mod service; -pub mod utils; -mod payment_queue { - -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_liquidity/lsps2/msgs.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/msgs.rs deleted file mode 100644 index d083b1f6..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/msgs.rs +++ /dev/null @@ -1,1389 +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. - -//! Message, request, and other primitive types used to implement bLIP-52 / LSPS2. - -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_liquidity::lsps2::msgs::LSPS2GetInfoRequest as nativeLSPS2GetInfoRequestImport; -pub(crate) type nativeLSPS2GetInfoRequest = nativeLSPS2GetInfoRequestImport; - -/// A request made to an LSP to learn their current channel fees and parameters. -#[must_use] -#[repr(C)] -pub struct LSPS2GetInfoRequest { - /// 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 nativeLSPS2GetInfoRequest, - /// 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 core::ops::Deref for LSPS2GetInfoRequest { - type Target = nativeLSPS2GetInfoRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2GetInfoRequest { } -unsafe impl core::marker::Sync for LSPS2GetInfoRequest { } -impl Drop for LSPS2GetInfoRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2GetInfoRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2GetInfoRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoRequest_free(this_obj: LSPS2GetInfoRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2GetInfoRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2GetInfoRequest) }; -} -#[allow(unused)] -impl LSPS2GetInfoRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2GetInfoRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2GetInfoRequest { - 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 nativeLSPS2GetInfoRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// An optional token to provide to the LSP. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoRequest_get_token(this_ptr: &LSPS2GetInfoRequest) -> crate::c_types::derived::COption_StrZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().token; - let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_StrZ::None } else { crate::c_types::derived::COption_StrZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { (*inner_val.as_ref().unwrap()).clone().into() }) }; - local_inner_val -} -/// An optional token to provide to the LSP. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoRequest_set_token(this_ptr: &mut LSPS2GetInfoRequest, mut val: crate::c_types::derived::COption_StrZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { { val_opt.take() }.into_string() }})} }; - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.token = local_val; -} -/// Constructs a new LSPS2GetInfoRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2GetInfoRequest_new(mut token_arg: crate::c_types::derived::COption_StrZ) -> LSPS2GetInfoRequest { - let mut local_token_arg = { /*token_arg*/ let token_arg_opt = token_arg; if token_arg_opt.is_none() { None } else { Some({ { { token_arg_opt.take() }.into_string() }})} }; - LSPS2GetInfoRequest { inner: ObjOps::heap_alloc(nativeLSPS2GetInfoRequest { - token: local_token_arg, - }), is_owned: true } -} -impl Clone for LSPS2GetInfoRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2GetInfoRequest>::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 LSPS2GetInfoRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2GetInfoRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2GetInfoRequest -pub extern "C" fn LSPS2GetInfoRequest_clone(orig: &LSPS2GetInfoRequest) -> LSPS2GetInfoRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2GetInfoRequest object -pub extern "C" fn LSPS2GetInfoRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoRequest }).into()} -/// Checks if two LSPS2GetInfoRequests 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 LSPS2GetInfoRequest_eq(a: &LSPS2GetInfoRequest, b: &LSPS2GetInfoRequest) -> 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 } -} - -use lightning_liquidity::lsps2::msgs::LSPS2RawOpeningFeeParams as nativeLSPS2RawOpeningFeeParamsImport; -pub(crate) type nativeLSPS2RawOpeningFeeParams = nativeLSPS2RawOpeningFeeParamsImport; - -/// Fees and parameters for a JIT Channel without the promise. -/// -/// The promise will be calculated automatically for the LSP and this type converted -/// into an [`LSPS2OpeningFeeParams`] for transit over the wire. -#[must_use] -#[repr(C)] -pub struct LSPS2RawOpeningFeeParams { - /// 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 nativeLSPS2RawOpeningFeeParams, - /// 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 core::ops::Deref for LSPS2RawOpeningFeeParams { - type Target = nativeLSPS2RawOpeningFeeParams; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2RawOpeningFeeParams { } -unsafe impl core::marker::Sync for LSPS2RawOpeningFeeParams { } -impl Drop for LSPS2RawOpeningFeeParams { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2RawOpeningFeeParams>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2RawOpeningFeeParams, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_free(this_obj: LSPS2RawOpeningFeeParams) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2RawOpeningFeeParams_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2RawOpeningFeeParams) }; -} -#[allow(unused)] -impl LSPS2RawOpeningFeeParams { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2RawOpeningFeeParams { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2RawOpeningFeeParams { - 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 nativeLSPS2RawOpeningFeeParams { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The minimum fee required for the channel open. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_min_fee_msat(this_ptr: &LSPS2RawOpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_fee_msat; - *inner_val -} -/// The minimum fee required for the channel open. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_min_fee_msat(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_fee_msat = val; -} -/// A fee proportional to the size of the initial payment. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_proportional(this_ptr: &LSPS2RawOpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().proportional; - *inner_val -} -/// A fee proportional to the size of the initial payment. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_proportional(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.proportional = val; -} -/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_valid_until(this_ptr: &LSPS2RawOpeningFeeParams) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().valid_until; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_valid_until(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.valid_until = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_min_lifetime(this_ptr: &LSPS2RawOpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_lifetime; - *inner_val -} -/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_min_lifetime(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_lifetime = val; -} -/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_max_client_to_self_delay(this_ptr: &LSPS2RawOpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_client_to_self_delay; - *inner_val -} -/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_max_client_to_self_delay(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_client_to_self_delay = val; -} -/// The minimum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_min_payment_size_msat(this_ptr: &LSPS2RawOpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_payment_size_msat; - *inner_val -} -/// The minimum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_min_payment_size_msat(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_payment_size_msat = val; -} -/// The maximum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_get_max_payment_size_msat(this_ptr: &LSPS2RawOpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_payment_size_msat; - *inner_val -} -/// The maximum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_set_max_payment_size_msat(this_ptr: &mut LSPS2RawOpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_payment_size_msat = val; -} -/// Constructs a new LSPS2RawOpeningFeeParams given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2RawOpeningFeeParams_new(mut min_fee_msat_arg: u64, mut proportional_arg: u32, mut valid_until_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime, mut min_lifetime_arg: u32, mut max_client_to_self_delay_arg: u32, mut min_payment_size_msat_arg: u64, mut max_payment_size_msat_arg: u64) -> LSPS2RawOpeningFeeParams { - LSPS2RawOpeningFeeParams { inner: ObjOps::heap_alloc(nativeLSPS2RawOpeningFeeParams { - min_fee_msat: min_fee_msat_arg, - proportional: proportional_arg, - valid_until: *unsafe { Box::from_raw(valid_until_arg.take_inner()) }, - min_lifetime: min_lifetime_arg, - max_client_to_self_delay: max_client_to_self_delay_arg, - min_payment_size_msat: min_payment_size_msat_arg, - max_payment_size_msat: max_payment_size_msat_arg, - }), is_owned: true } -} - -use lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams as nativeLSPS2OpeningFeeParamsImport; -pub(crate) type nativeLSPS2OpeningFeeParams = nativeLSPS2OpeningFeeParamsImport; - -/// Fees and parameters for a JIT Channel including the promise. -/// -/// The promise is an HMAC calculated using a secret known to the LSP and the rest of the fields as input. -/// It exists so the LSP can verify the authenticity of a client provided LSPS2OpeningFeeParams by recalculating -/// the promise using the secret. Once verified they can be confident it was not modified by the client. -#[must_use] -#[repr(C)] -pub struct LSPS2OpeningFeeParams { - /// 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 nativeLSPS2OpeningFeeParams, - /// 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 core::ops::Deref for LSPS2OpeningFeeParams { - type Target = nativeLSPS2OpeningFeeParams; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2OpeningFeeParams { } -unsafe impl core::marker::Sync for LSPS2OpeningFeeParams { } -impl Drop for LSPS2OpeningFeeParams { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2OpeningFeeParams>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2OpeningFeeParams, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_free(this_obj: LSPS2OpeningFeeParams) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2OpeningFeeParams_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2OpeningFeeParams) }; -} -#[allow(unused)] -impl LSPS2OpeningFeeParams { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2OpeningFeeParams { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2OpeningFeeParams { - 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 nativeLSPS2OpeningFeeParams { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The minimum fee required for the channel open. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_min_fee_msat(this_ptr: &LSPS2OpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_fee_msat; - *inner_val -} -/// The minimum fee required for the channel open. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_min_fee_msat(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_fee_msat = val; -} -/// A fee proportional to the size of the initial payment. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_proportional(this_ptr: &LSPS2OpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().proportional; - *inner_val -} -/// A fee proportional to the size of the initial payment. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_proportional(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.proportional = val; -} -/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_valid_until(this_ptr: &LSPS2OpeningFeeParams) -> crate::lightning_liquidity::lsps0::ser::LSPSDateTime { - let mut inner_val = &mut this_ptr.get_native_mut_ref().valid_until; - crate::lightning_liquidity::lsps0::ser::LSPSDateTime { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps0::ser::LSPSDateTime<>) as *mut _) }, is_owned: false } -} -/// An [`ISO8601`](https://www.iso.org/iso-8601-date-and-time-format.html) formatted date for which these params are valid. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_valid_until(this_ptr: &mut LSPS2OpeningFeeParams, mut val: crate::lightning_liquidity::lsps0::ser::LSPSDateTime) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.valid_until = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_min_lifetime(this_ptr: &LSPS2OpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_lifetime; - *inner_val -} -/// The number of blocks after confirmation that the LSP promises it will keep the channel alive without closing. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_min_lifetime(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_lifetime = val; -} -/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_max_client_to_self_delay(this_ptr: &LSPS2OpeningFeeParams) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_client_to_self_delay; - *inner_val -} -/// The maximum number of blocks that the client is allowed to set its `to_self_delay` parameter. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_max_client_to_self_delay(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_client_to_self_delay = val; -} -/// The minimum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_min_payment_size_msat(this_ptr: &LSPS2OpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().min_payment_size_msat; - *inner_val -} -/// The minimum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_min_payment_size_msat(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_payment_size_msat = val; -} -/// The maximum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_max_payment_size_msat(this_ptr: &LSPS2OpeningFeeParams) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().max_payment_size_msat; - *inner_val -} -/// The maximum payment size that the LSP will accept when opening a channel. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_max_payment_size_msat(this_ptr: &mut LSPS2OpeningFeeParams, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.max_payment_size_msat = val; -} -/// The HMAC used to verify the authenticity of these parameters. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_get_promise(this_ptr: &LSPS2OpeningFeeParams) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().promise; - inner_val.as_str().into() -} -/// The HMAC used to verify the authenticity of these parameters. -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_set_promise(this_ptr: &mut LSPS2OpeningFeeParams, mut val: crate::c_types::Str) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.promise = val.into_string(); -} -/// Constructs a new LSPS2OpeningFeeParams given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2OpeningFeeParams_new(mut min_fee_msat_arg: u64, mut proportional_arg: u32, mut valid_until_arg: crate::lightning_liquidity::lsps0::ser::LSPSDateTime, mut min_lifetime_arg: u32, mut max_client_to_self_delay_arg: u32, mut min_payment_size_msat_arg: u64, mut max_payment_size_msat_arg: u64, mut promise_arg: crate::c_types::Str) -> LSPS2OpeningFeeParams { - LSPS2OpeningFeeParams { inner: ObjOps::heap_alloc(nativeLSPS2OpeningFeeParams { - min_fee_msat: min_fee_msat_arg, - proportional: proportional_arg, - valid_until: *unsafe { Box::from_raw(valid_until_arg.take_inner()) }, - min_lifetime: min_lifetime_arg, - max_client_to_self_delay: max_client_to_self_delay_arg, - min_payment_size_msat: min_payment_size_msat_arg, - max_payment_size_msat: max_payment_size_msat_arg, - promise: promise_arg.into_string(), - }), is_owned: true } -} -impl Clone for LSPS2OpeningFeeParams { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2OpeningFeeParams>::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 LSPS2OpeningFeeParams_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2OpeningFeeParams)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2OpeningFeeParams -pub extern "C" fn LSPS2OpeningFeeParams_clone(orig: &LSPS2OpeningFeeParams) -> LSPS2OpeningFeeParams { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2OpeningFeeParams object -pub extern "C" fn LSPS2OpeningFeeParams_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams }).into()} -/// Checks if two LSPS2OpeningFeeParamss 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 LSPS2OpeningFeeParams_eq(a: &LSPS2OpeningFeeParams, b: &LSPS2OpeningFeeParams) -> 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 } -} - -use lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse as nativeLSPS2GetInfoResponseImport; -pub(crate) type nativeLSPS2GetInfoResponse = nativeLSPS2GetInfoResponseImport; - -/// A response to a [`LSPS2GetInfoRequest`] -#[must_use] -#[repr(C)] -pub struct LSPS2GetInfoResponse { - /// 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 nativeLSPS2GetInfoResponse, - /// 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 core::ops::Deref for LSPS2GetInfoResponse { - type Target = nativeLSPS2GetInfoResponse; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2GetInfoResponse { } -unsafe impl core::marker::Sync for LSPS2GetInfoResponse { } -impl Drop for LSPS2GetInfoResponse { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2GetInfoResponse>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2GetInfoResponse, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoResponse_free(this_obj: LSPS2GetInfoResponse) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2GetInfoResponse_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2GetInfoResponse) }; -} -#[allow(unused)] -impl LSPS2GetInfoResponse { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2GetInfoResponse { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2GetInfoResponse { - 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 nativeLSPS2GetInfoResponse { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// A set of opening fee parameters. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoResponse_get_opening_fee_params_menu(this_ptr: &LSPS2GetInfoResponse) -> crate::c_types::derived::CVec_LSPS2OpeningFeeParamsZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().opening_fee_params_menu; - let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams<>) as *mut _) }, is_owned: false } }); }; - local_inner_val.into() -} -/// A set of opening fee parameters. -#[no_mangle] -pub extern "C" fn LSPS2GetInfoResponse_set_opening_fee_params_menu(this_ptr: &mut LSPS2GetInfoResponse, mut val: crate::c_types::derived::CVec_LSPS2OpeningFeeParamsZ) { - 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) }.opening_fee_params_menu = local_val; -} -/// Constructs a new LSPS2GetInfoResponse given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2GetInfoResponse_new(mut opening_fee_params_menu_arg: crate::c_types::derived::CVec_LSPS2OpeningFeeParamsZ) -> LSPS2GetInfoResponse { - let mut local_opening_fee_params_menu_arg = Vec::new(); for mut item in opening_fee_params_menu_arg.into_rust().drain(..) { local_opening_fee_params_menu_arg.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - LSPS2GetInfoResponse { inner: ObjOps::heap_alloc(nativeLSPS2GetInfoResponse { - opening_fee_params_menu: local_opening_fee_params_menu_arg, - }), is_owned: true } -} -impl Clone for LSPS2GetInfoResponse { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2GetInfoResponse>::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 LSPS2GetInfoResponse_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2GetInfoResponse)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2GetInfoResponse -pub extern "C" fn LSPS2GetInfoResponse_clone(orig: &LSPS2GetInfoResponse) -> LSPS2GetInfoResponse { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2GetInfoResponse object -pub extern "C" fn LSPS2GetInfoResponse_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse }).into()} -/// Checks if two LSPS2GetInfoResponses 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 LSPS2GetInfoResponse_eq(a: &LSPS2GetInfoResponse, b: &LSPS2GetInfoResponse) -> 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 } -} - -use lightning_liquidity::lsps2::msgs::LSPS2BuyRequest as nativeLSPS2BuyRequestImport; -pub(crate) type nativeLSPS2BuyRequest = nativeLSPS2BuyRequestImport; - -/// A request to buy a JIT channel. -#[must_use] -#[repr(C)] -pub struct LSPS2BuyRequest { - /// 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 nativeLSPS2BuyRequest, - /// 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 core::ops::Deref for LSPS2BuyRequest { - type Target = nativeLSPS2BuyRequest; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2BuyRequest { } -unsafe impl core::marker::Sync for LSPS2BuyRequest { } -impl Drop for LSPS2BuyRequest { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2BuyRequest>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2BuyRequest, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_free(this_obj: LSPS2BuyRequest) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2BuyRequest_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2BuyRequest) }; -} -#[allow(unused)] -impl LSPS2BuyRequest { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2BuyRequest { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2BuyRequest { - 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 nativeLSPS2BuyRequest { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The fee parameters you would like to use. -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_get_opening_fee_params(this_ptr: &LSPS2BuyRequest) -> crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { - let mut inner_val = &mut this_ptr.get_native_mut_ref().opening_fee_params; - crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams<>) as *mut _) }, is_owned: false } -} -/// The fee parameters you would like to use. -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_set_opening_fee_params(this_ptr: &mut LSPS2BuyRequest, mut val: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.opening_fee_params = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The size of the initial payment you expect to receive. -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_get_payment_size_msat(this_ptr: &LSPS2BuyRequest) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_size_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 size of the initial payment you expect to receive. -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_set_payment_size_msat(this_ptr: &mut LSPS2BuyRequest, 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) }.payment_size_msat = local_val; -} -/// Constructs a new LSPS2BuyRequest given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2BuyRequest_new(mut opening_fee_params_arg: crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams, mut payment_size_msat_arg: crate::c_types::derived::COption_u64Z) -> LSPS2BuyRequest { - let mut local_payment_size_msat_arg = if payment_size_msat_arg.is_some() { Some( { payment_size_msat_arg.take() }) } else { None }; - LSPS2BuyRequest { inner: ObjOps::heap_alloc(nativeLSPS2BuyRequest { - opening_fee_params: *unsafe { Box::from_raw(opening_fee_params_arg.take_inner()) }, - payment_size_msat: local_payment_size_msat_arg, - }), is_owned: true } -} -impl Clone for LSPS2BuyRequest { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2BuyRequest>::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 LSPS2BuyRequest_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2BuyRequest)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2BuyRequest -pub extern "C" fn LSPS2BuyRequest_clone(orig: &LSPS2BuyRequest) -> LSPS2BuyRequest { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2BuyRequest object -pub extern "C" fn LSPS2BuyRequest_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2BuyRequest }).into()} -/// Checks if two LSPS2BuyRequests 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 LSPS2BuyRequest_eq(a: &LSPS2BuyRequest, b: &LSPS2BuyRequest) -> 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 } -} - -use lightning_liquidity::lsps2::msgs::LSPS2InterceptScid as nativeLSPS2InterceptScidImport; -pub(crate) type nativeLSPS2InterceptScid = nativeLSPS2InterceptScidImport; - -/// A newtype that holds a `short_channel_id` in human readable format of BBBxTTTx000. -#[must_use] -#[repr(C)] -pub struct LSPS2InterceptScid { - /// 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 nativeLSPS2InterceptScid, - /// 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 core::ops::Deref for LSPS2InterceptScid { - type Target = nativeLSPS2InterceptScid; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2InterceptScid { } -unsafe impl core::marker::Sync for LSPS2InterceptScid { } -impl Drop for LSPS2InterceptScid { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2InterceptScid>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2InterceptScid, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2InterceptScid_free(this_obj: LSPS2InterceptScid) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2InterceptScid_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2InterceptScid) }; -} -#[allow(unused)] -impl LSPS2InterceptScid { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2InterceptScid { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2InterceptScid { - 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 nativeLSPS2InterceptScid { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -impl Clone for LSPS2InterceptScid { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2InterceptScid>::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 LSPS2InterceptScid_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2InterceptScid)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2InterceptScid -pub extern "C" fn LSPS2InterceptScid_clone(orig: &LSPS2InterceptScid) -> LSPS2InterceptScid { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2InterceptScid object -pub extern "C" fn LSPS2InterceptScid_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid }).into()} -/// Checks if two LSPS2InterceptScids 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 LSPS2InterceptScid_eq(a: &LSPS2InterceptScid, b: &LSPS2InterceptScid) -> 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 } -} -/// Try to convert a [`LSPS2InterceptScid`] into a u64 used by LDK. -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2InterceptScid_to_scid(this_arg: &crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid) -> crate::c_types::derived::CResult_u64NoneZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.to_scid(); - 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 -} - - -use lightning_liquidity::lsps2::msgs::LSPS2BuyResponse as nativeLSPS2BuyResponseImport; -pub(crate) type nativeLSPS2BuyResponse = nativeLSPS2BuyResponseImport; - -/// A response to a [`LSPS2BuyRequest`]. -/// -/// Includes information needed to construct an invoice. -#[must_use] -#[repr(C)] -pub struct LSPS2BuyResponse { - /// 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 nativeLSPS2BuyResponse, - /// 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 core::ops::Deref for LSPS2BuyResponse { - type Target = nativeLSPS2BuyResponse; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2BuyResponse { } -unsafe impl core::marker::Sync for LSPS2BuyResponse { } -impl Drop for LSPS2BuyResponse { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2BuyResponse>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2BuyResponse, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_free(this_obj: LSPS2BuyResponse) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2BuyResponse_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2BuyResponse) }; -} -#[allow(unused)] -impl LSPS2BuyResponse { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2BuyResponse { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2BuyResponse { - 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 nativeLSPS2BuyResponse { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// The intercept short channel id used by LSP to identify need to open channel. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_get_jit_channel_scid(this_ptr: &LSPS2BuyResponse) -> crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid { - let mut inner_val = &mut this_ptr.get_native_mut_ref().jit_channel_scid; - crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_liquidity::lsps2::msgs::LSPS2InterceptScid<>) as *mut _) }, is_owned: false } -} -/// The intercept short channel id used by LSP to identify need to open channel. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_set_jit_channel_scid(this_ptr: &mut LSPS2BuyResponse, mut val: crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.jit_channel_scid = *unsafe { Box::from_raw(val.take_inner()) }; -} -/// The locktime expiry delta the lsp requires. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_get_lsp_cltv_expiry_delta(this_ptr: &LSPS2BuyResponse) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().lsp_cltv_expiry_delta; - *inner_val -} -/// The locktime expiry delta the lsp requires. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_set_lsp_cltv_expiry_delta(this_ptr: &mut LSPS2BuyResponse, mut val: u32) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.lsp_cltv_expiry_delta = val; -} -/// A flag that indicates who is trusting who. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_get_client_trusts_lsp(this_ptr: &LSPS2BuyResponse) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().client_trusts_lsp; - *inner_val -} -/// A flag that indicates who is trusting who. -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_set_client_trusts_lsp(this_ptr: &mut LSPS2BuyResponse, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.client_trusts_lsp = val; -} -/// Constructs a new LSPS2BuyResponse given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2BuyResponse_new(mut jit_channel_scid_arg: crate::lightning_liquidity::lsps2::msgs::LSPS2InterceptScid, mut lsp_cltv_expiry_delta_arg: u32, mut client_trusts_lsp_arg: bool) -> LSPS2BuyResponse { - LSPS2BuyResponse { inner: ObjOps::heap_alloc(nativeLSPS2BuyResponse { - jit_channel_scid: *unsafe { Box::from_raw(jit_channel_scid_arg.take_inner()) }, - lsp_cltv_expiry_delta: lsp_cltv_expiry_delta_arg, - client_trusts_lsp: client_trusts_lsp_arg, - }), is_owned: true } -} -impl Clone for LSPS2BuyResponse { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2BuyResponse>::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 LSPS2BuyResponse_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2BuyResponse)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2BuyResponse -pub extern "C" fn LSPS2BuyResponse_clone(orig: &LSPS2BuyResponse) -> LSPS2BuyResponse { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2BuyResponse object -pub extern "C" fn LSPS2BuyResponse_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2BuyResponse }).into()} -/// Checks if two LSPS2BuyResponses 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 LSPS2BuyResponse_eq(a: &LSPS2BuyResponse, b: &LSPS2BuyResponse) -> 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 } -} -/// An enum that captures all the valid JSON-RPC requests in the bLIP-52 / LSPS2 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS2Request { - /// A request to learn an LSP's channel fees and parameters. - GetInfo( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoRequest), - /// A request to buy a JIT channel from an LSP. - Buy( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyRequest), -} -use lightning_liquidity::lsps2::msgs::LSPS2Request as LSPS2RequestImport; -pub(crate) type nativeLSPS2Request = LSPS2RequestImport; - -impl LSPS2Request { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS2Request { - match self { - LSPS2Request::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Request::GetInfo ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS2Request::Buy (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Request::Buy ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS2Request { - match self { - LSPS2Request::GetInfo (mut a, ) => { - nativeLSPS2Request::GetInfo ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS2Request::Buy (mut a, ) => { - nativeLSPS2Request::Buy ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS2RequestImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS2Request) }; - match native { - nativeLSPS2Request::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Request::GetInfo ( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS2Request::Buy (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Request::Buy ( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyRequest { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS2Request) -> Self { - match native { - nativeLSPS2Request::GetInfo (mut a, ) => { - LSPS2Request::GetInfo ( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS2Request::Buy (mut a, ) => { - LSPS2Request::Buy ( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyRequest { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS2Request -#[no_mangle] -pub extern "C" fn LSPS2Request_free(this_ptr: LSPS2Request) { } -/// Creates a copy of the LSPS2Request -#[no_mangle] -pub extern "C" fn LSPS2Request_clone(orig: &LSPS2Request) -> LSPS2Request { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Request_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS2Request)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Request_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS2Request) }; -} -#[no_mangle] -/// Utility method to constructs a new GetInfo-variant LSPS2Request -pub extern "C" fn LSPS2Request_get_info(a: crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoRequest) -> LSPS2Request { - LSPS2Request::GetInfo(a, ) -} -#[no_mangle] -/// Utility method to constructs a new Buy-variant LSPS2Request -pub extern "C" fn LSPS2Request_buy(a: crate::lightning_liquidity::lsps2::msgs::LSPS2BuyRequest) -> LSPS2Request { - LSPS2Request::Buy(a, ) -} -/// Get a string which allows debug introspection of a LSPS2Request object -pub extern "C" fn LSPS2Request_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2Request }).into()} -/// Checks if two LSPS2Requests contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS2Request_eq(a: &LSPS2Request, b: &LSPS2Request) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An enum that captures all the valid JSON-RPC responses in the bLIP-52 / LSPS2 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS2Response { - /// A successful response to a [`LSPS2Request::GetInfo`] request. - GetInfo( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse), - /// An error response to a [`LSPS2Request::GetInfo`] request. - GetInfoError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), - /// A successful response to a [`LSPS2Request::Buy`] request. - Buy( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyResponse), - /// An error response to a [`LSPS2Request::Buy`] request. - BuyError( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError), -} -use lightning_liquidity::lsps2::msgs::LSPS2Response as LSPS2ResponseImport; -pub(crate) type nativeLSPS2Response = LSPS2ResponseImport; - -impl LSPS2Response { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS2Response { - match self { - LSPS2Response::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Response::GetInfo ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS2Response::GetInfoError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Response::GetInfoError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS2Response::Buy (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Response::Buy ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - LSPS2Response::BuyError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeLSPS2Response::BuyError ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS2Response { - match self { - LSPS2Response::GetInfo (mut a, ) => { - nativeLSPS2Response::GetInfo ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS2Response::GetInfoError (mut a, ) => { - nativeLSPS2Response::GetInfoError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS2Response::Buy (mut a, ) => { - nativeLSPS2Response::Buy ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - LSPS2Response::BuyError (mut a, ) => { - nativeLSPS2Response::BuyError ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS2ResponseImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS2Response) }; - match native { - nativeLSPS2Response::GetInfo (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Response::GetInfo ( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS2Response::GetInfoError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Response::GetInfoError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS2Response::Buy (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Response::Buy ( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyResponse { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - nativeLSPS2Response::BuyError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - LSPS2Response::BuyError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS2Response) -> Self { - match native { - nativeLSPS2Response::GetInfo (mut a, ) => { - LSPS2Response::GetInfo ( - crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS2Response::GetInfoError (mut a, ) => { - LSPS2Response::GetInfoError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS2Response::Buy (mut a, ) => { - LSPS2Response::Buy ( - crate::lightning_liquidity::lsps2::msgs::LSPS2BuyResponse { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - nativeLSPS2Response::BuyError (mut a, ) => { - LSPS2Response::BuyError ( - crate::lightning_liquidity::lsps0::ser::LSPSResponseError { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, - } - } -} -/// Frees any resources used by the LSPS2Response -#[no_mangle] -pub extern "C" fn LSPS2Response_free(this_ptr: LSPS2Response) { } -/// Creates a copy of the LSPS2Response -#[no_mangle] -pub extern "C" fn LSPS2Response_clone(orig: &LSPS2Response) -> LSPS2Response { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Response_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS2Response)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Response_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS2Response) }; -} -#[no_mangle] -/// Utility method to constructs a new GetInfo-variant LSPS2Response -pub extern "C" fn LSPS2Response_get_info(a: crate::lightning_liquidity::lsps2::msgs::LSPS2GetInfoResponse) -> LSPS2Response { - LSPS2Response::GetInfo(a, ) -} -#[no_mangle] -/// Utility method to constructs a new GetInfoError-variant LSPS2Response -pub extern "C" fn LSPS2Response_get_info_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS2Response { - LSPS2Response::GetInfoError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new Buy-variant LSPS2Response -pub extern "C" fn LSPS2Response_buy(a: crate::lightning_liquidity::lsps2::msgs::LSPS2BuyResponse) -> LSPS2Response { - LSPS2Response::Buy(a, ) -} -#[no_mangle] -/// Utility method to constructs a new BuyError-variant LSPS2Response -pub extern "C" fn LSPS2Response_buy_error(a: crate::lightning_liquidity::lsps0::ser::LSPSResponseError) -> LSPS2Response { - LSPS2Response::BuyError(a, ) -} -/// Get a string which allows debug introspection of a LSPS2Response object -pub extern "C" fn LSPS2Response_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2Response }).into()} -/// Checks if two LSPS2Responses contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS2Response_eq(a: &LSPS2Response, b: &LSPS2Response) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} -/// An enum that captures all valid JSON-RPC messages in the bLIP-52 / LSPS2 protocol. -#[derive(Clone)] -#[must_use] -#[repr(C)] -pub enum LSPS2Message { - /// An LSPS2 JSON-RPC request. - Request( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps2::msgs::LSPS2Request), - /// An LSPS2 JSON-RPC response. - Response( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId, - crate::lightning_liquidity::lsps2::msgs::LSPS2Response), -} -use lightning_liquidity::lsps2::msgs::LSPS2Message as LSPS2MessageImport; -pub(crate) type nativeLSPS2Message = LSPS2MessageImport; - -impl LSPS2Message { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeLSPS2Message { - match self { - LSPS2Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS2Message::Request ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - LSPS2Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - nativeLSPS2Message::Response ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - b_nonref.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeLSPS2Message { - match self { - LSPS2Message::Request (mut a, mut b, ) => { - nativeLSPS2Message::Request ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - LSPS2Message::Response (mut a, mut b, ) => { - nativeLSPS2Message::Response ( - *unsafe { Box::from_raw(a.take_inner()) }, - b.into_native(), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &LSPS2MessageImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeLSPS2Message) }; - match native { - nativeLSPS2Message::Request (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS2Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps2::msgs::LSPS2Request::native_into(b_nonref), - ) - }, - nativeLSPS2Message::Response (ref a, ref b, ) => { - let mut a_nonref = Clone::clone(a); - let mut b_nonref = Clone::clone(b); - LSPS2Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - crate::lightning_liquidity::lsps2::msgs::LSPS2Response::native_into(b_nonref), - ) - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeLSPS2Message) -> Self { - match native { - nativeLSPS2Message::Request (mut a, mut b, ) => { - LSPS2Message::Request ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps2::msgs::LSPS2Request::native_into(b), - ) - }, - nativeLSPS2Message::Response (mut a, mut b, ) => { - LSPS2Message::Response ( - crate::lightning_liquidity::lsps0::ser::LSPSRequestId { inner: ObjOps::heap_alloc(a), is_owned: true }, - crate::lightning_liquidity::lsps2::msgs::LSPS2Response::native_into(b), - ) - }, - } - } -} -/// Frees any resources used by the LSPS2Message -#[no_mangle] -pub extern "C" fn LSPS2Message_free(this_ptr: LSPS2Message) { } -/// Creates a copy of the LSPS2Message -#[no_mangle] -pub extern "C" fn LSPS2Message_clone(orig: &LSPS2Message) -> LSPS2Message { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Message_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const LSPS2Message)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2Message_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut LSPS2Message) }; -} -#[no_mangle] -/// Utility method to constructs a new Request-variant LSPS2Message -pub extern "C" fn LSPS2Message_request(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps2::msgs::LSPS2Request) -> LSPS2Message { - LSPS2Message::Request(a, b, ) -} -#[no_mangle] -/// Utility method to constructs a new Response-variant LSPS2Message -pub extern "C" fn LSPS2Message_response(a: crate::lightning_liquidity::lsps0::ser::LSPSRequestId,b: crate::lightning_liquidity::lsps2::msgs::LSPS2Response) -> LSPS2Message { - LSPS2Message::Response(a, b, ) -} -/// Get a string which allows debug introspection of a LSPS2Message object -pub extern "C" fn LSPS2Message_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::msgs::LSPS2Message }).into()} -/// Checks if two LSPS2Messages contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn LSPS2Message_eq(a: &LSPS2Message, b: &LSPS2Message) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps2/service.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/service.rs deleted file mode 100644 index d752d2a7..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/service.rs +++ /dev/null @@ -1,292 +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. - -//! Contains the main bLIP-52 / LSPS2 server-side object, [`LSPS2ServiceHandler`]. - -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_liquidity::lsps2::service::LSPS2ServiceConfig as nativeLSPS2ServiceConfigImport; -pub(crate) type nativeLSPS2ServiceConfig = nativeLSPS2ServiceConfigImport; - -/// Server-side configuration options for JIT channels. -#[must_use] -#[repr(C)] -pub struct LSPS2ServiceConfig { - /// 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 nativeLSPS2ServiceConfig, - /// 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 core::ops::Deref for LSPS2ServiceConfig { - type Target = nativeLSPS2ServiceConfig; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2ServiceConfig { } -unsafe impl core::marker::Sync for LSPS2ServiceConfig { } -impl Drop for LSPS2ServiceConfig { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2ServiceConfig>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2ServiceConfig, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2ServiceConfig_free(this_obj: LSPS2ServiceConfig) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ServiceConfig_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2ServiceConfig) }; -} -#[allow(unused)] -impl LSPS2ServiceConfig { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2ServiceConfig { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2ServiceConfig { - 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 nativeLSPS2ServiceConfig { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Used to calculate the promise for channel parameters supplied to clients. -/// -/// Note: If this changes then old promises given out will be considered invalid. -#[no_mangle] -pub extern "C" fn LSPS2ServiceConfig_get_promise_secret(this_ptr: &LSPS2ServiceConfig) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().promise_secret; - inner_val -} -/// Used to calculate the promise for channel parameters supplied to clients. -/// -/// Note: If this changes then old promises given out will be considered invalid. -#[no_mangle] -pub extern "C" fn LSPS2ServiceConfig_set_promise_secret(this_ptr: &mut LSPS2ServiceConfig, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.promise_secret = val.data; -} -/// Constructs a new LSPS2ServiceConfig given each field -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceConfig_new(mut promise_secret_arg: crate::c_types::ThirtyTwoBytes) -> LSPS2ServiceConfig { - LSPS2ServiceConfig { inner: ObjOps::heap_alloc(nativeLSPS2ServiceConfig { - promise_secret: promise_secret_arg.data, - }), is_owned: true } -} -impl Clone for LSPS2ServiceConfig { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeLSPS2ServiceConfig>::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 LSPS2ServiceConfig_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeLSPS2ServiceConfig)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the LSPS2ServiceConfig -pub extern "C" fn LSPS2ServiceConfig_clone(orig: &LSPS2ServiceConfig) -> LSPS2ServiceConfig { - orig.clone() -} -/// Get a string which allows debug introspection of a LSPS2ServiceConfig object -pub extern "C" fn LSPS2ServiceConfig_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning_liquidity::lsps2::service::LSPS2ServiceConfig }).into()} - -use lightning_liquidity::lsps2::service::LSPS2ServiceHandler as nativeLSPS2ServiceHandlerImport; -pub(crate) type nativeLSPS2ServiceHandler = nativeLSPS2ServiceHandlerImport; - -/// The main object allowing to send and receive bLIP-52 / LSPS2 messages. -#[must_use] -#[repr(C)] -pub struct LSPS2ServiceHandler { - /// 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 nativeLSPS2ServiceHandler, - /// 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 core::ops::Deref for LSPS2ServiceHandler { - type Target = nativeLSPS2ServiceHandler; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for LSPS2ServiceHandler { } -unsafe impl core::marker::Sync for LSPS2ServiceHandler { } -impl Drop for LSPS2ServiceHandler { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeLSPS2ServiceHandler>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the LSPS2ServiceHandler, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_free(this_obj: LSPS2ServiceHandler) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn LSPS2ServiceHandler_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLSPS2ServiceHandler) }; -} -#[allow(unused)] -impl LSPS2ServiceHandler { - pub(crate) fn get_native_ref(&self) -> &'static nativeLSPS2ServiceHandler { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeLSPS2ServiceHandler { - 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 nativeLSPS2ServiceHandler { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Used by LSP to inform a client requesting a JIT Channel the token they used is invalid. -/// -/// Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event. -/// -/// [`LSPS2ServiceEvent::GetInfo`]: crate::lsps2::event::LSPS2ServiceEvent::GetInfo -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_invalid_token_provided(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invalid_token_provided(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(request_id.take_inner()) }); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; - local_ret -} - -/// Used by LSP to provide fee parameters to a client requesting a JIT Channel. -/// -/// Should be called in response to receiving a [`LSPS2ServiceEvent::GetInfo`] event. -/// -/// [`LSPS2ServiceEvent::GetInfo`]: crate::lsps2::event::LSPS2ServiceEvent::GetInfo -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_opening_fee_params_generated(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, mut opening_fee_params_menu: crate::c_types::derived::CVec_LSPS2RawOpeningFeeParamsZ) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut local_opening_fee_params_menu = Vec::new(); for mut item in opening_fee_params_menu.into_rust().drain(..) { local_opening_fee_params_menu.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.opening_fee_params_generated(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(request_id.take_inner()) }, local_opening_fee_params_menu); - 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 -} - -/// Used by LSP to provide client with the intercept scid and cltv_expiry_delta to use in their invoice. -/// -/// Should be called in response to receiving a [`LSPS2ServiceEvent::BuyRequest`] event. -/// -/// [`LSPS2ServiceEvent::BuyRequest`]: crate::lsps2::event::LSPS2ServiceEvent::BuyRequest -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_invoice_parameters_generated(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut counterparty_node_id: crate::c_types::PublicKey, mut request_id: crate::lightning_liquidity::lsps0::ser::LSPSRequestId, mut intercept_scid: u64, mut cltv_expiry_delta: u32, mut client_trusts_lsp: bool, mut user_channel_id: crate::c_types::U128) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_parameters_generated(&counterparty_node_id.into_rust(), *unsafe { Box::from_raw(request_id.take_inner()) }, intercept_scid, cltv_expiry_delta, client_trusts_lsp, 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 -} - -/// Forward [`Event::HTLCIntercepted`] event parameters into this function. -/// -/// Will fail the intercepted HTLC if the intercept scid matches a payment we are expecting -/// but the payment amount is incorrect or the expiry has passed. -/// -/// Will generate a [`LSPS2ServiceEvent::OpenChannel`] event if the intercept scid matches a payment we are expected -/// and the payment amount is correct and the offer has not expired. -/// -/// Will do nothing if the intercept scid does not match any of the ones we gave out. -/// -/// [`Event::HTLCIntercepted`]: lightning::events::Event::HTLCIntercepted -/// [`LSPS2ServiceEvent::OpenChannel`]: crate::lsps2::event::LSPS2ServiceEvent::OpenChannel -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_htlc_intercepted(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut intercept_scid: u64, mut intercept_id: crate::c_types::ThirtyTwoBytes, mut expected_outbound_amount_msat: u64, mut payment_hash: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.htlc_intercepted(intercept_scid, ::lightning::ln::channelmanager::InterceptId(intercept_id.data), expected_outbound_amount_msat, ::lightning::types::payment::PaymentHash(payment_hash.data)); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; - local_ret -} - -/// Forward [`Event::HTLCHandlingFailed`] event parameter into this function. -/// -/// Will attempt to forward the next payment in the queue if one is present. -/// Will do nothing if the intercept scid does not match any of the ones we gave out -/// or if the payment queue is empty -/// -/// [`Event::HTLCHandlingFailed`]: lightning::events::Event::HTLCHandlingFailed -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_htlc_handling_failed(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut failed_next_destination: crate::lightning::events::HTLCDestination) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.htlc_handling_failed(failed_next_destination.into_native()); - 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 -} - -/// Forward [`Event::PaymentForwarded`] event parameter into this function. -/// -/// Will register the forwarded payment as having paid the JIT channel fee, and forward any held -/// and future HTLCs for the SCID of the initial invoice. In the future, this will verify the -/// `skimmed_fee_msat` in [`Event::PaymentForwarded`]. -/// -/// Note that `next_channel_id` is required to be provided. Therefore, the corresponding -/// [`Event::PaymentForwarded`] events need to be generated and serialized by LDK versions -/// greater or equal to 0.0.107. -/// -/// [`Event::PaymentForwarded`]: lightning::events::Event::PaymentForwarded -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_payment_forwarded(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut next_channel_id: crate::lightning::ln::types::ChannelId) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_forwarded(*unsafe { Box::from_raw(next_channel_id.take_inner()) }); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; - local_ret -} - -/// Forward [`Event::ChannelReady`] event parameters into this function. -/// -/// Will forward the intercepted HTLC if it matches a channel -/// we need to forward a payment over otherwise it will be ignored. -/// -/// [`Event::ChannelReady`]: lightning::events::Event::ChannelReady -#[must_use] -#[no_mangle] -pub extern "C" fn LSPS2ServiceHandler_channel_ready(this_arg: &crate::lightning_liquidity::lsps2::service::LSPS2ServiceHandler, mut user_channel_id: crate::c_types::U128, channel_id: &crate::lightning::ln::types::ChannelId, mut counterparty_node_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.channel_ready(user_channel_id.into(), channel_id.get_native_ref(), &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 -} - diff --git a/lightning-c-bindings/src/lightning_liquidity/lsps2/utils.rs b/lightning-c-bindings/src/lightning_liquidity/lsps2/utils.rs deleted file mode 100644 index 19627b74..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/lsps2/utils.rs +++ /dev/null @@ -1,45 +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 for implementing the bLIP-52 / LSPS2 standard. - -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}; - -/// Determines if the given parameters are valid given the secret used to generate the promise. -#[no_mangle] -pub extern "C" fn is_valid_opening_fee_params(fee_params: &crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams, promise_secret: *const [u8; 32]) -> bool { - let mut ret = lightning_liquidity::lsps2::utils::is_valid_opening_fee_params(fee_params.get_native_ref(), unsafe { &*promise_secret}); - ret -} - -/// Determines if the given parameters are expired, or still valid. -#[no_mangle] -pub extern "C" fn is_expired_opening_fee_params(fee_params: &crate::lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams) -> bool { - let mut ret = lightning_liquidity::lsps2::utils::is_expired_opening_fee_params(fee_params.get_native_ref()); - ret -} - -/// Computes the opening fee given a payment size and the fee parameters. -/// -/// Returns [`Option::None`] when the computation overflows. -/// -/// See the [`specification`](https://github.com/lightning/blips/blob/master/blip-0052.md#computing-the-opening_fee) for more details. -#[no_mangle] -pub extern "C" fn compute_opening_fee(mut payment_size_msat: u64, mut opening_fee_min_fee_msat: u64, mut opening_fee_proportional: u64) -> crate::c_types::derived::COption_u64Z { - let mut ret = lightning_liquidity::lsps2::utils::compute_opening_fee(payment_size_msat, opening_fee_min_fee_msat, opening_fee_proportional); - 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 -} - diff --git a/lightning-c-bindings/src/lightning_liquidity/message_queue.rs b/lightning-c-bindings/src/lightning_liquidity/message_queue.rs deleted file mode 100644 index 6c396786..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/message_queue.rs +++ /dev/null @@ -1,145 +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. - -//! Holds types and traits used to implement message queues for [`LSPSMessage`]s. - -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_liquidity::message_queue::MessageQueue as nativeMessageQueueImport; -pub(crate) type nativeMessageQueue = nativeMessageQueueImport; - -/// The default [`MessageQueue`] Implementation used by [`LiquidityManager`]. -/// -/// [`LiquidityManager`]: crate::LiquidityManager -#[must_use] -#[repr(C)] -pub struct MessageQueue { - /// 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 nativeMessageQueue, - /// 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 core::ops::Deref for MessageQueue { - type Target = nativeMessageQueue; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for MessageQueue { } -unsafe impl core::marker::Sync for MessageQueue { } -impl Drop for MessageQueue { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeMessageQueue>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the MessageQueue, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn MessageQueue_free(this_obj: MessageQueue) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn MessageQueue_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMessageQueue) }; -} -#[allow(unused)] -impl MessageQueue { - pub(crate) fn get_native_ref(&self) -> &'static nativeMessageQueue { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMessageQueue { - 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 nativeMessageQueue { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// A callback which will be called to trigger network message processing. -/// -/// Usually, this should call [`PeerManager::process_events`]. -/// -/// [`PeerManager::process_events`]: lightning::ln::peer_handler::PeerManager::process_events -#[repr(C)] -pub struct ProcessMessagesCallback { - /// 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, - /// The method which is called. - pub call: extern "C" fn (this_arg: *const c_void), - /// 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 ProcessMessagesCallback {} -unsafe impl Sync for ProcessMessagesCallback {} -#[allow(unused)] -pub(crate) fn ProcessMessagesCallback_clone_fields(orig: &ProcessMessagesCallback) -> ProcessMessagesCallback { - ProcessMessagesCallback { - this_arg: orig.this_arg, - call: Clone::clone(&orig.call), - free: Clone::clone(&orig.free), - } -} - -use lightning_liquidity::message_queue::ProcessMessagesCallback as rustProcessMessagesCallback; -impl rustProcessMessagesCallback for ProcessMessagesCallback { - fn call(&self) { - (self.call)(self.this_arg) - } -} - -pub struct ProcessMessagesCallbackRef(ProcessMessagesCallback); -impl rustProcessMessagesCallback for ProcessMessagesCallbackRef { - fn call(&self) { - (self.0.call)(self.0.this_arg) - } -} - -// 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 ProcessMessagesCallback { - type Target = ProcessMessagesCallbackRef; - fn deref(&self) -> &Self::Target { - unsafe { &*(self as *const _ as *const ProcessMessagesCallbackRef) } - } -} -impl core::ops::DerefMut for ProcessMessagesCallback { - fn deref_mut(&mut self) -> &mut ProcessMessagesCallbackRef { - unsafe { &mut *(self as *mut _ as *mut ProcessMessagesCallbackRef) } - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn ProcessMessagesCallback_free(this_ptr: ProcessMessagesCallback) { } -impl Drop for ProcessMessagesCallback { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} diff --git a/lightning-c-bindings/src/lightning_liquidity/mod.rs b/lightning-c-bindings/src/lightning_liquidity/mod.rs deleted file mode 100644 index 35a36a85..00000000 --- a/lightning-c-bindings/src/lightning_liquidity/mod.rs +++ /dev/null @@ -1,127 +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. - -//!lightning_liquidity -//! The goal of this crate is to provide types and primitives to integrate a spec-compliant LSP -//! with an LDK-based node. To this end, this crate provides client-side as well as service-side -//! logic to implement the LSPS specifications. -//! -//! **Note**: Service-side support is currently considered \"beta\", i.e., not fully ready for -//! production use. -//! -//! Currently the following specifications are supported: -//! - [bLIP-50 / LSPS0] defines the transport protocol with the LSP over which the other protocols communicate. -//! - [bLIP-51 / LSPS1] defines a protocol for ordering Lightning channels from an LSP. This is useful when the client needs -//! inbound Lightning liquidity for which they are willing and able to pay in bitcoin. -//! - [bLIP-52 / LSPS2] defines a protocol for generating a special invoice for which, when paid, -//! an LSP will open a \"just-in-time\" channel. This is useful for the initial on-boarding of -//! clients as the channel opening fees are deducted from the incoming payment, i.e., no funds are -//! required client-side to initiate this flow. -//! -//! To get started, you'll want to setup a [`LiquidityManager`] and configure it to be the -//! [`CustomMessageHandler`] of your LDK node. You can then for example call -//! [`LiquidityManager::lsps1_client_handler`] / [`LiquidityManager::lsps2_client_handler`], or -//! [`LiquidityManager::lsps2_service_handler`], to access the respective client-side or -//! service-side handlers. -//! -//! [`LiquidityManager`] uses an eventing system to notify the user about important updates to the -//! protocol flow. To this end, you will need to handle events emitted via one of the event -//! handling methods provided by [`LiquidityManager`], e.g., [`LiquidityManager::next_event`]. -//! -//! [bLIP-50 / LSPS0]: https://github.com/lightning/blips/blob/master/blip-0050.md -//! [bLIP-51 / LSPS1]: https://github.com/lightning/blips/blob/master/blip-0051.md -//! [bLIP-52 / LSPS2]: https://github.com/lightning/blips/blob/master/blip-0052.md -//! [`CustomMessageHandler`]: lightning::ln::peer_handler::CustomMessageHandler -//! [`LiquidityManager::next_event`]: crate::LiquidityManager::next_event - -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 events; -pub mod lsps0; -pub mod lsps1; -pub mod lsps2; -pub mod message_queue; -mod prelude { - -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 manager { - -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 sync { - -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 fairrwlock { - -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 ext_impl { - -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; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -} diff --git a/lightning-c-bindings/src/lightning_persister/fs_store.rs b/lightning-c-bindings/src/lightning_persister/fs_store.rs index 06ecdad2..eca460c0 100644 --- a/lightning-c-bindings/src/lightning_persister/fs_store.rs +++ b/lightning-c-bindings/src/lightning_persister/fs_store.rs @@ -21,7 +21,9 @@ 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. +/// A [`KVStore`] and [`KVStoreSync`] implementation that writes to and reads from the file system. +/// +/// [`KVStore`]: lightning::util::persist::KVStore #[must_use] #[repr(C)] pub struct FilesystemStore { @@ -77,6 +79,25 @@ impl FilesystemStore { Self { inner: self.inner, is_owned: false } } } +impl Clone for FilesystemStore { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeFilesystemStore>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, + 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 FilesystemStore_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeFilesystemStore) }))) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the FilesystemStore +pub extern "C" fn FilesystemStore_clone(orig: &FilesystemStore) -> FilesystemStore { + Clone::clone(orig) +} /// Constructs a new [`FilesystemStore`]. #[must_use] #[no_mangle] @@ -93,54 +114,60 @@ pub extern "C" fn FilesystemStore_get_data_dir(this_arg: &crate::lightning_persi ret.into() } -impl From for crate::lightning::util::persist::KVStore { +impl From for crate::lightning::util::persist::KVStoreSync { fn from(obj: nativeFilesystemStore) -> Self { let rust_obj = crate::lightning_persister::fs_store::FilesystemStore { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = FilesystemStore_as_KVStore(&rust_obj); + let mut ret = FilesystemStore_as_KVStoreSync(&rust_obj); // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn core::mem::forget(rust_obj); 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 +/// Constructs a new KVStoreSync which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned KVStoreSync 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 { +pub extern "C" fn FilesystemStore_as_KVStoreSync(this_arg: &FilesystemStore) -> crate::lightning::util::persist::KVStoreSync { + crate::lightning::util::persist::KVStoreSync { 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, + read: FilesystemStore_KVStoreSync_read, + write: FilesystemStore_KVStoreSync_write, + remove: FilesystemStore_KVStoreSync_remove, + list: FilesystemStore_KVStoreSync_list, + cloned: Some(KVStoreSync_FilesystemStore_cloned), } } #[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()); +extern "C" fn FilesystemStore_KVStoreSync_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_bitcoin(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()); +extern "C" fn FilesystemStore_KVStoreSync_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::derived::CVec_u8Z) -> crate::c_types::derived::CResult_NoneIOErrorZ { + let mut local_buf = Vec::new(); for mut item in buf.into_rust().drain(..) { local_buf.push( { item }); }; + let mut ret = ::write(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, primary_namespace.into_str(), secondary_namespace.into_str(), key.into_str(), local_buf); 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_bitcoin(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); +extern "C" fn FilesystemStore_KVStoreSync_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_bitcoin(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()); +extern "C" fn FilesystemStore_KVStoreSync_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_bitcoin(e) }).into() }; local_ret } +extern "C" fn KVStoreSync_FilesystemStore_cloned(new_obj: &mut crate::lightning::util::persist::KVStoreSync) { + new_obj.this_arg = FilesystemStore_clone_void(new_obj.this_arg); + new_obj.free = Some(FilesystemStore_free_void); +} impl From for crate::lightning::util::persist::MigratableKVStore { fn from(obj: nativeFilesystemStore) -> Self { @@ -160,14 +187,16 @@ pub extern "C" fn FilesystemStore_as_MigratableKVStore(this_arg: &FilesystemStor this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, list_all_keys: FilesystemStore_MigratableKVStore_list_all_keys, - KVStore: crate::lightning::util::persist::KVStore { + KVStoreSync: crate::lightning::util::persist::KVStoreSync { 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, + read: FilesystemStore_KVStoreSync_read, + write: FilesystemStore_KVStoreSync_write, + remove: FilesystemStore_KVStoreSync_remove, + list: FilesystemStore_KVStoreSync_list, + cloned: Some(KVStoreSync_FilesystemStore_cloned), }, + cloned: Some(MigratableKVStore_FilesystemStore_cloned), } } @@ -177,4 +206,10 @@ extern "C" fn FilesystemStore_MigratableKVStore_list_all_keys(this_arg: *const c 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, mut orig_ret_0_0_2) = item; let mut local_ret_0_0 = (orig_ret_0_0_0.into(), orig_ret_0_0_1.into(), orig_ret_0_0_2.into()).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_bitcoin(e) }).into() }; local_ret } +extern "C" fn MigratableKVStore_FilesystemStore_cloned(new_obj: &mut crate::lightning::util::persist::MigratableKVStore) { + new_obj.this_arg = FilesystemStore_clone_void(new_obj.this_arg); + new_obj.free = Some(FilesystemStore_free_void); + new_obj.KVStoreSync.this_arg = new_obj.this_arg; + new_obj.KVStoreSync.free = None; +} diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs index d20f8725..80ff512a 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs @@ -193,6 +193,30 @@ pub extern "C" fn GraphSyncError_lightning_error(a: crate::lightning::ln::msgs:: /// Get a string which allows debug introspection of a GraphSyncError object pub extern "C" fn GraphSyncError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning_rapid_gossip_sync::GraphSyncError }).into()} +#[no_mangle] +/// Build a GraphSyncError from a IOError +pub extern "C" fn GraphSyncError_from_IOError(f: crate::c_types::IOError) -> crate::lightning_rapid_gossip_sync::GraphSyncError { + let from_obj = f.to_rust(); + crate::lightning_rapid_gossip_sync::GraphSyncError::native_into((lightning_rapid_gossip_sync::GraphSyncError::from(from_obj))) +} +#[no_mangle] +/// Build a GraphSyncError from a Secp256k1Error +pub extern "C" fn GraphSyncError_from_Secp256k1Error(f: crate::c_types::Secp256k1Error) -> crate::lightning_rapid_gossip_sync::GraphSyncError { + let from_obj = f.into_rust(); + crate::lightning_rapid_gossip_sync::GraphSyncError::native_into((lightning_rapid_gossip_sync::GraphSyncError::from(from_obj))) +} +#[no_mangle] +/// Build a GraphSyncError from a DecodeError +pub extern "C" fn GraphSyncError_from_DecodeError(f: crate::lightning::ln::msgs::DecodeError) -> crate::lightning_rapid_gossip_sync::GraphSyncError { + let from_obj = f.into_native(); + crate::lightning_rapid_gossip_sync::GraphSyncError::native_into((lightning_rapid_gossip_sync::GraphSyncError::from(from_obj))) +} +#[no_mangle] +/// Build a GraphSyncError from a LightningError +pub extern "C" fn GraphSyncError_from_LightningError(f: crate::lightning::ln::msgs::LightningError) -> crate::lightning_rapid_gossip_sync::GraphSyncError { + let from_obj = *unsafe { Box::from_raw(f.take_inner()) }; + crate::lightning_rapid_gossip_sync::GraphSyncError::native_into((lightning_rapid_gossip_sync::GraphSyncError::from(from_obj))) +} use lightning_rapid_gossip_sync::RapidGossipSync as nativeRapidGossipSyncImport; pub(crate) type nativeRapidGossipSync = nativeRapidGossipSyncImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger, >; diff --git a/lightning-c-bindings/src/lightning_types/features.rs b/lightning-c-bindings/src/lightning_types/features.rs index 77eeea07..c95b07cf 100644 --- a/lightning-c-bindings/src/lightning_types/features.rs +++ b/lightning-c-bindings/src/lightning_types/features.rs @@ -20,62 +20,74 @@ //! //! The following features are currently required in the LDK: //! - `VariableLengthOnion` - requires/supports variable-length routing onion payloads -//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md) for more information). +//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md) for more information). //! - `StaticRemoteKey` - requires/supports static key for remote output -//! (see [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more information). +//! (see [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more information). //! //! The following features are currently supported in the LDK: //! - `DataLossProtect` - requires/supports that a node which has somehow fallen behind, e.g., has been restored from an old backup, -//! can detect that it has fallen behind -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). +//! can detect that it has fallen behind +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). //! - `InitialRoutingSync` - requires/supports that the sending node needs a complete routing information dump -//! (see [BOLT-7](https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#initial-sync) for more information). +//! (see [BOLT-7](https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#initial-sync) for more information). //! - `UpfrontShutdownScript` - commits to a shutdown scriptpubkey when opening a channel -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message) for more information). //! - `GossipQueries` - requires/supports more sophisticated gossip control -//! (see [BOLT-7](https://github.com/lightning/bolts/blob/master/07-routing-gossip.md) for more information). +//! (see [BOLT-7](https://github.com/lightning/bolts/blob/master/07-routing-gossip.md) for more information). //! - `PaymentSecret` - requires/supports that a node supports payment_secret field -//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md) for more information). +//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md) for more information). //! - `BasicMPP` - requires/supports that a node can receive basic multi-part payments -//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#basic-multi-part-payments) for more information). +//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#basic-multi-part-payments) for more information). //! - `Wumbo` - requires/supports that a node create large channels. Called `option_support_large_channel` in the spec. -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message) for more information). //! - `AnchorsZeroFeeHtlcTx` - requires/supports that commitment transactions include anchor outputs -//! and HTLC transactions are pre-signed with zero fee (see -//! [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more -//! information). +//! and HTLC transactions are pre-signed with zero fee (see +//! [BOLT-3](https://github.com/lightning/bolts/blob/master/03-transactions.md) for more +//! information). //! - `RouteBlinding` - requires/supports that a node can relay payments over blinded paths -//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#route-blinding) for more information). +//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#route-blinding) for more information). //! - `ShutdownAnySegwit` - requires/supports that future segwit versions are allowed in `shutdown` -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). //! - `DualFund` - requires/supports V2 channel establishment -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment-v2) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment-v2) for more information). +//! - `SimpleClose` - requires/supports simplified closing negotiation +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_complete-and-closing_sig) for more information). //! - `OnionMessages` - requires/supports forwarding onion messages -//! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information). +//! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#onion-messages) for more information). //! - `ChannelType` - node supports the channel_type field in open/accept -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). //! - `SCIDPrivacy` - supply channel aliases for routing -//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). //! - `PaymentMetadata` - include additional data in invoices which is passed to recipients in the -//! onion. -//! (see [BOLT-11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) for -//! more). +//! onion. +//! (see [BOLT-11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md) for +//! more). //! - `ZeroConf` - supports accepting HTLCs and using channels prior to funding confirmation -//! (see -//! [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message) -//! for more info). +//! (see +//! [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message) +//! for more info). //! - `Keysend` - send funds to a node without an invoice -//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information). +//! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information). //! - `Trampoline` - supports receiving and forwarding Trampoline payments -//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information). +//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information). //! - `DnsResolver` - supports resolving DNS names to TXT DNSSEC proofs for BIP 353 payments -//! (see [bLIP 32](https://github.com/lightning/blips/blob/master/blip-0032.md) for more information). +//! (see [bLIP 32](https://github.com/lightning/blips/blob/master/blip-0032.md) for more information). +//! - `ProvideStorage` - Indicates that we offer the capability to store data of our peers +//! (see [BOLT PR #1110](https://github.com/lightning/bolts/pull/1110) for more info). +//! - `Quiescence` - protocol to quiesce a channel by indicating that \"SomeThing Fundamental is Underway\" +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-quiescence) for more information). +//! - `ZeroFeeCommitments` - A channel type which always uses zero transaction fee on commitment transactions. +//! (see [BOLT PR #1228](https://github.com/lightning/bolts/pull/1228) for more info). +//! - `Splice` - Allows replacing the currently-locked funding transaction with a new one +//! (see [BOLT PR #1160](https://github.com/lightning/bolts/pull/1160) for more information). +//! - `HtlcHold` - requires/supports holding HTLCs and forwarding on receipt of an onion message +//! (see [BOLT-2](https://github.com/lightning/bolts/pull/989/files) for more information). //! //! LDK knows about the following features, but does not support them: //! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be -//! vulnerable (see this -//! [mailing list post](https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html) -//! for more information). +//! vulnerable (see this +//! [mailing list post](https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-September/002796.html) +//! for more information). //! //! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md @@ -111,6 +123,12 @@ pub extern "C" fn InitFeatures_set_data_loss_protect_required(this_arg: &mut cra unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_data_loss_protect_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_data_loss_protect(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_data_loss_protect() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -131,6 +149,12 @@ pub extern "C" fn NodeFeatures_set_data_loss_protect_required(this_arg: &mut cra unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_data_loss_protect_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_data_loss_protect(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_data_loss_protect() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -167,6 +191,12 @@ pub extern "C" fn InitFeatures_set_initial_routing_sync_required(this_arg: &mut unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_initial_routing_sync_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_initial_routing_sync(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_initial_routing_sync() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -187,6 +217,12 @@ pub extern "C" fn InitFeatures_set_upfront_shutdown_script_required(this_arg: &m unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_upfront_shutdown_script_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_upfront_shutdown_script(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_upfront_shutdown_script() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -207,6 +243,12 @@ pub extern "C" fn NodeFeatures_set_upfront_shutdown_script_required(this_arg: &m unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_upfront_shutdown_script_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_upfront_shutdown_script(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_upfront_shutdown_script() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -243,6 +285,12 @@ pub extern "C" fn InitFeatures_set_gossip_queries_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_gossip_queries_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_gossip_queries(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_gossip_queries() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -263,6 +311,12 @@ pub extern "C" fn NodeFeatures_set_gossip_queries_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_gossip_queries_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_gossip_queries(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_gossip_queries() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -299,6 +353,12 @@ pub extern "C" fn InitFeatures_set_variable_length_onion_required(this_arg: &mut unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_variable_length_onion_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_variable_length_onion(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_variable_length_onion() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -319,6 +379,12 @@ pub extern "C" fn NodeFeatures_set_variable_length_onion_required(this_arg: &mut unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_variable_length_onion_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_variable_length_onion(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_variable_length_onion() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -339,6 +405,12 @@ pub extern "C" fn Bolt11InvoiceFeatures_set_variable_length_onion_required(this_ unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_variable_length_onion_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_clear_variable_length_onion(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.clear_variable_length_onion() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -383,6 +455,12 @@ pub extern "C" fn InitFeatures_set_static_remote_key_required(this_arg: &mut cra unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_static_remote_key_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_static_remote_key(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_static_remote_key() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -403,6 +481,12 @@ pub extern "C" fn NodeFeatures_set_static_remote_key_required(this_arg: &mut cra unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_static_remote_key_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_static_remote_key(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_static_remote_key() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -423,6 +507,12 @@ pub extern "C" fn ChannelTypeFeatures_set_static_remote_key_required(this_arg: & unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_static_remote_key_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_static_remote_key(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_static_remote_key() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -467,6 +557,12 @@ pub extern "C" fn InitFeatures_set_payment_secret_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_payment_secret_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_payment_secret(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_payment_secret() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -487,6 +583,12 @@ pub extern "C" fn NodeFeatures_set_payment_secret_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_payment_secret_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_payment_secret(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_payment_secret() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -507,6 +609,12 @@ pub extern "C" fn Bolt11InvoiceFeatures_set_payment_secret_required(this_arg: &m unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_payment_secret_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_clear_payment_secret(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.clear_payment_secret() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -551,6 +659,12 @@ pub extern "C" fn InitFeatures_set_basic_mpp_required(this_arg: &mut crate::ligh unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_basic_mpp_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_basic_mpp(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_basic_mpp() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -571,6 +685,12 @@ pub extern "C" fn NodeFeatures_set_basic_mpp_required(this_arg: &mut crate::ligh unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_basic_mpp_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_basic_mpp(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_basic_mpp() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -591,6 +711,12 @@ pub extern "C" fn Bolt11InvoiceFeatures_set_basic_mpp_required(this_arg: &mut cr unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_basic_mpp_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_clear_basic_mpp(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.clear_basic_mpp() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -611,6 +737,12 @@ pub extern "C" fn Bolt12InvoiceFeatures_set_basic_mpp_required(this_arg: &mut cr unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_basic_mpp_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_clear_basic_mpp(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.clear_basic_mpp() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -663,6 +795,12 @@ pub extern "C" fn InitFeatures_set_wumbo_required(this_arg: &mut crate::lightnin unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_wumbo_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_wumbo(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_wumbo() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -683,6 +821,12 @@ pub extern "C" fn NodeFeatures_set_wumbo_required(this_arg: &mut crate::lightnin unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_wumbo_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_wumbo(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_wumbo() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -719,6 +863,12 @@ pub extern "C" fn InitFeatures_set_anchors_nonzero_fee_htlc_tx_required(this_arg unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_anchors_nonzero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_anchors_nonzero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_anchors_nonzero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -739,6 +889,12 @@ pub extern "C" fn NodeFeatures_set_anchors_nonzero_fee_htlc_tx_required(this_arg unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_anchors_nonzero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_anchors_nonzero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_anchors_nonzero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -759,6 +915,12 @@ pub extern "C" fn ChannelTypeFeatures_set_anchors_nonzero_fee_htlc_tx_required(t unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_anchors_nonzero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_anchors_nonzero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_anchors_nonzero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -803,6 +965,12 @@ pub extern "C" fn InitFeatures_set_anchors_zero_fee_htlc_tx_required(this_arg: & unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_anchors_zero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_anchors_zero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -823,6 +991,12 @@ pub extern "C" fn NodeFeatures_set_anchors_zero_fee_htlc_tx_required(this_arg: & unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_anchors_zero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_anchors_zero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -843,6 +1017,12 @@ pub extern "C" fn ChannelTypeFeatures_set_anchors_zero_fee_htlc_tx_required(this unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_anchors_zero_fee_htlc_tx_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_anchors_zero_fee_htlc_tx() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -887,6 +1067,12 @@ pub extern "C" fn InitFeatures_set_route_blinding_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_route_blinding_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_route_blinding(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_route_blinding() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -907,6 +1093,12 @@ pub extern "C" fn NodeFeatures_set_route_blinding_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_route_blinding_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_route_blinding(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_route_blinding() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -943,6 +1135,12 @@ pub extern "C" fn InitFeatures_set_shutdown_any_segwit_required(this_arg: &mut c unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_shutdown_any_segwit_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_shutdown_anysegwit(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_shutdown_anysegwit() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -963,6 +1161,12 @@ pub extern "C" fn NodeFeatures_set_shutdown_any_segwit_required(this_arg: &mut c unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_shutdown_any_segwit_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_shutdown_anysegwit(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_shutdown_anysegwit() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -999,6 +1203,12 @@ pub extern "C" fn InitFeatures_set_dual_fund_required(this_arg: &mut crate::ligh unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_dual_fund_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_dual_fund(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_dual_fund() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1019,6 +1229,12 @@ pub extern "C" fn NodeFeatures_set_dual_fund_required(this_arg: &mut crate::ligh unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dual_fund_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_dual_fund(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_dual_fund() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1055,6 +1271,12 @@ pub extern "C" fn InitFeatures_set_taproot_required(this_arg: &mut crate::lightn unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_taproot_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_taproot(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_taproot() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1075,6 +1297,12 @@ pub extern "C" fn NodeFeatures_set_taproot_required(this_arg: &mut crate::lightn unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_taproot_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_taproot(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_taproot() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1095,6 +1323,12 @@ pub extern "C" fn ChannelTypeFeatures_set_taproot_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_taproot_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_taproot(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_taproot() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1127,6 +1361,74 @@ pub extern "C" fn ChannelTypeFeatures_requires_taproot(this_arg: &crate::lightni ret } +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_quiescence_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_quiescence_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_quiescence_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_quiescence_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_quiescence(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_quiescence() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_quiescence(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_quiescence(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_quiescence_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_quiescence_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_quiescence_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_quiescence_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_quiescence(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_quiescence() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_quiescence(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_quiescence(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_quiescence(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_quiescence(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_quiescence(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_quiescence(); + ret +} + /// Set this feature as optional. #[no_mangle] pub extern "C" fn InitFeatures_set_onion_messages_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { @@ -1139,6 +1441,12 @@ pub extern "C" fn InitFeatures_set_onion_messages_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_onion_messages_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_onion_messages(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_onion_messages() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1159,6 +1467,12 @@ pub extern "C" fn NodeFeatures_set_onion_messages_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_onion_messages_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_onion_messages(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_onion_messages() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1183,6 +1497,74 @@ pub extern "C" fn NodeFeatures_requires_onion_messages(this_arg: &crate::lightni ret } +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_provide_storage_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_provide_storage_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_provide_storage_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_provide_storage_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_provide_storage(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_provide_storage() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_provide_storage(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_provide_storage(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_provide_storage_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_provide_storage_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_provide_storage_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_provide_storage_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_provide_storage(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_provide_storage() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_provide_storage(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_provide_storage(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_provide_storage(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_provide_storage(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_provide_storage(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_provide_storage(); + ret +} + /// Set this feature as optional. #[no_mangle] pub extern "C" fn InitFeatures_set_channel_type_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { @@ -1195,6 +1577,12 @@ pub extern "C" fn InitFeatures_set_channel_type_required(this_arg: &mut crate::l unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_channel_type_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_channel_type(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_channel_type() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1215,6 +1603,12 @@ pub extern "C" fn NodeFeatures_set_channel_type_required(this_arg: &mut crate::l unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_channel_type_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_channel_type(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_channel_type() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1251,327 +1645,749 @@ pub extern "C" fn InitFeatures_set_scid_privacy_required(this_arg: &mut crate::l unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_scid_privacy_required() } -/// Checks if this feature is supported. +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_scid_privacy() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_scid_privacy_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_scid_privacy_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_scid_privacy() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_scid_privacy_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_scid_privacy_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_scid_privacy() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_payment_metadata_optional(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_payment_metadata_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_payment_metadata_required(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_payment_metadata_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_clear_payment_metadata(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.clear_payment_metadata() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_supports_payment_metadata(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_metadata(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_requires_payment_metadata(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_metadata(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_zero_conf_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_zero_conf_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_supports_zero_conf(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.supports_zero_conf() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_zero_conf_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_zero_conf_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_zero_conf(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.supports_zero_conf() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_zero_conf_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_zero_conf_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_supports_zero_conf(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.supports_zero_conf() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_keysend_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_keysend_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_keysend_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_keysend(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_keysend() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_keysend(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_keysend(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_keysend(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_keysend(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_trampoline_routing_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_trampoline_routing_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_trampoline_routing(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_trampoline_routing() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_trampoline_routing_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_trampoline_routing_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_trampoline_routing(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_trampoline_routing() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_trampoline_routing_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_trampoline_routing_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_clear_trampoline_routing(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.clear_trampoline_routing() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_clear_trampoline_routing(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.clear_trampoline_routing() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); + ret +} + +/// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); +pub extern "C" fn Bolt12InvoiceFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn NodeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_scid_privacy_optional() +pub extern "C" fn InitFeatures_set_simple_close_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_simple_close_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn NodeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_scid_privacy_required() +pub extern "C" fn InitFeatures_set_simple_close_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_simple_close_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_simple_close(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_simple_close() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); +pub extern "C" fn InitFeatures_supports_simple_close(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_simple_close(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_optional(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_scid_privacy_optional() +pub extern "C" fn NodeFeatures_set_simple_close_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_simple_close_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_set_scid_privacy_required(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_scid_privacy_required() +pub extern "C" fn NodeFeatures_set_simple_close_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_simple_close_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_simple_close(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_simple_close() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_supports_scid_privacy(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_scid_privacy(); +pub extern "C" fn NodeFeatures_supports_simple_close(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_simple_close(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); +pub extern "C" fn InitFeatures_requires_simple_close(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_simple_close(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); +pub extern "C" fn NodeFeatures_requires_simple_close(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_simple_close(); ret } -/// Checks if this feature is required. +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_splicing_production_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_splicing_production_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_splicing_production_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_splicing_production_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_splicing_production(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_splicing_production() +} + +/// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_requires_scid_privacy(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_scid_privacy(); +pub extern "C" fn InitFeatures_supports_splicing_production(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_splicing_production(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_set_payment_metadata_optional(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_payment_metadata_optional() +pub extern "C" fn NodeFeatures_set_splicing_production_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_splicing_production_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_set_payment_metadata_required(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_payment_metadata_required() +pub extern "C" fn NodeFeatures_set_splicing_production_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_splicing_production_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_splicing_production(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_splicing_production() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_supports_payment_metadata(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_payment_metadata(); +pub extern "C" fn NodeFeatures_supports_splicing_production(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_splicing_production(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_requires_payment_metadata(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_payment_metadata(); +pub extern "C" fn InitFeatures_requires_splicing_production(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_splicing_production(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_splicing_production(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_splicing_production(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn InitFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_zero_conf_optional() +pub extern "C" fn InitFeatures_set_anchor_zero_fee_commitments_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_anchor_zero_fee_commitments_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn InitFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_zero_conf_required() +pub extern "C" fn InitFeatures_set_anchor_zero_fee_commitments_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_anchor_zero_fee_commitments_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_anchor_zero_fee_commitments(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_anchor_zero_fee_commitments() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_supports_zero_conf(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf(); +pub extern "C" fn InitFeatures_supports_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_anchor_zero_fee_commitments(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn NodeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_zero_conf_optional() +pub extern "C" fn NodeFeatures_set_anchor_zero_fee_commitments_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_anchor_zero_fee_commitments_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn NodeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_zero_conf_required() +pub extern "C" fn NodeFeatures_set_anchor_zero_fee_commitments_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_anchor_zero_fee_commitments_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_anchor_zero_fee_commitments(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_anchor_zero_fee_commitments() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_supports_zero_conf(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf(); +pub extern "C" fn NodeFeatures_supports_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_anchor_zero_fee_commitments(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_set_zero_conf_optional(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_zero_conf_optional() +pub extern "C" fn ChannelTypeFeatures_set_anchor_zero_fee_commitments_optional(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_anchor_zero_fee_commitments_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_set_zero_conf_required(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_zero_conf_required() +pub extern "C" fn ChannelTypeFeatures_set_anchor_zero_fee_commitments_required(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.set_anchor_zero_fee_commitments_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_clear_anchor_zero_fee_commitments(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_anchor_zero_fee_commitments() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_supports_zero_conf(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_zero_conf(); +pub extern "C" fn ChannelTypeFeatures_supports_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_anchor_zero_fee_commitments(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn InitFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); +pub extern "C" fn InitFeatures_requires_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_anchor_zero_fee_commitments(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); +pub extern "C" fn NodeFeatures_requires_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_anchor_zero_fee_commitments(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn ChannelTypeFeatures_requires_zero_conf(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_zero_conf(); +pub extern "C" fn ChannelTypeFeatures_requires_anchor_zero_fee_commitments(this_arg: &crate::lightning_types::features::ChannelTypeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_anchor_zero_fee_commitments(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn NodeFeatures_set_keysend_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_keysend_optional() +pub extern "C" fn InitFeatures_set_htlc_hold_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_htlc_hold_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn NodeFeatures_set_keysend_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_keysend_required() +pub extern "C" fn InitFeatures_set_htlc_hold_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_htlc_hold_required() } -/// Checks if this feature is supported. -#[must_use] +/// Unsets this feature. #[no_mangle] -pub extern "C" fn NodeFeatures_supports_keysend(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_keysend(); - ret +pub extern "C" fn InitFeatures_clear_htlc_hold(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_htlc_hold() } -/// Checks if this feature is required. +/// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_requires_keysend(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_keysend(); +pub extern "C" fn InitFeatures_supports_htlc_hold(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_htlc_hold(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn InitFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_trampoline_routing_optional() +pub extern "C" fn NodeFeatures_set_htlc_hold_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_htlc_hold_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn InitFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_trampoline_routing_required() +pub extern "C" fn NodeFeatures_set_htlc_hold_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_htlc_hold_required() } -/// Checks if this feature is supported. -#[must_use] +/// Unsets this feature. #[no_mangle] -pub extern "C" fn InitFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); - ret +pub extern "C" fn NodeFeatures_clear_htlc_hold(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_htlc_hold() } -/// Set this feature as optional. +/// Checks if this feature is supported. +#[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_trampoline_routing_optional() +pub extern "C" fn NodeFeatures_supports_htlc_hold(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_htlc_hold(); + ret } -/// Set this feature as required. +/// Checks if this feature is required. +#[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_trampoline_routing_required() +pub extern "C" fn InitFeatures_requires_htlc_hold(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_htlc_hold(); + ret } -/// Checks if this feature is supported. +/// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); +pub extern "C" fn NodeFeatures_requires_htlc_hold(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_htlc_hold(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_trampoline_routing_optional() +pub extern "C" fn InitFeatures_set_splicing_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_splicing_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::Bolt11InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt11InvoiceFeatures)) }.set_trampoline_routing_required() +pub extern "C" fn InitFeatures_set_splicing_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_splicing_required() +} + +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn InitFeatures_clear_splicing(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_splicing() } /// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); +pub extern "C" fn InitFeatures_supports_splicing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_splicing(); ret } /// Set this feature as optional. #[no_mangle] -pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_optional() +pub extern "C" fn NodeFeatures_set_splicing_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_splicing_optional() } /// Set this feature as required. #[no_mangle] -pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_required() -} - -/// Checks if this feature is supported. -#[must_use] -#[no_mangle] -pub extern "C" fn Bolt12InvoiceFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); - ret +pub extern "C" fn NodeFeatures_set_splicing_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_splicing_required() } -/// Checks if this feature is required. -#[must_use] +/// Unsets this feature. #[no_mangle] -pub extern "C" fn InitFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); - ret +pub extern "C" fn NodeFeatures_clear_splicing(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_splicing() } -/// Checks if this feature is required. +/// Checks if this feature is supported. #[must_use] #[no_mangle] -pub extern "C" fn NodeFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); +pub extern "C" fn NodeFeatures_supports_splicing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_splicing(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn Bolt11InvoiceFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); +pub extern "C" fn InitFeatures_requires_splicing(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_splicing(); ret } /// Checks if this feature is required. #[must_use] #[no_mangle] -pub extern "C" fn Bolt12InvoiceFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); +pub extern "C" fn NodeFeatures_requires_splicing(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_splicing(); ret } @@ -1587,6 +2403,12 @@ pub extern "C" fn NodeFeatures_set_dns_resolution_required(this_arg: &mut crate: unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dns_resolution_required() } +/// Unsets this feature. +#[no_mangle] +pub extern "C" fn NodeFeatures_clear_dns_resolution(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_dns_resolution() +} + /// Checks if this feature is supported. #[must_use] #[no_mangle] @@ -1603,93 +2425,12 @@ pub extern "C" fn NodeFeatures_requires_dns_resolution(this_arg: &crate::lightni ret } -} -/// Checks if two InitFeaturess 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 InitFeatures_eq(a: &InitFeatures, b: &InitFeatures) -> 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 } -} -/// Checks if two NodeFeaturess 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 NodeFeatures_eq(a: &NodeFeatures, b: &NodeFeatures) -> 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 } -} -/// Checks if two ChannelFeaturess 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 ChannelFeatures_eq(a: &ChannelFeatures, b: &ChannelFeatures) -> 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 } -} -/// Checks if two Bolt11InvoiceFeaturess 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 Bolt11InvoiceFeatures_eq(a: &Bolt11InvoiceFeatures, b: &Bolt11InvoiceFeatures) -> 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 } -} -/// Checks if two OfferFeaturess 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 OfferFeatures_eq(a: &OfferFeatures, b: &OfferFeatures) -> 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 } -} -/// Checks if two InvoiceRequestFeaturess 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 InvoiceRequestFeatures_eq(a: &InvoiceRequestFeatures, b: &InvoiceRequestFeatures) -> 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 } -} -/// Checks if two Bolt12InvoiceFeaturess 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 Bolt12InvoiceFeatures_eq(a: &Bolt12InvoiceFeatures, b: &Bolt12InvoiceFeatures) -> 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 } -} -/// Checks if two BlindedHopFeaturess 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 BlindedHopFeatures_eq(a: &BlindedHopFeatures, b: &BlindedHopFeatures) -> 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 } -} -/// Checks if two ChannelTypeFeaturess 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 ChannelTypeFeatures_eq(a: &ChannelTypeFeatures, b: &ChannelTypeFeatures) -> 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 } } impl Clone for InitFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeInitFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1697,18 +2438,18 @@ impl Clone for InitFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InitFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInitFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInitFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InitFeatures pub extern "C" fn InitFeatures_clone(orig: &InitFeatures) -> InitFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for NodeFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeNodeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1716,18 +2457,18 @@ impl Clone for NodeFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeNodeFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeNodeFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the NodeFeatures pub extern "C" fn NodeFeatures_clone(orig: &NodeFeatures) -> NodeFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for ChannelFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1735,18 +2476,18 @@ impl Clone for ChannelFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelFeatures pub extern "C" fn ChannelFeatures_clone(orig: &ChannelFeatures) -> ChannelFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for Bolt11InvoiceFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt11InvoiceFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1754,18 +2495,18 @@ impl Clone for Bolt11InvoiceFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt11InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11InvoiceFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt11InvoiceFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt11InvoiceFeatures pub extern "C" fn Bolt11InvoiceFeatures_clone(orig: &Bolt11InvoiceFeatures) -> Bolt11InvoiceFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for OfferFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeOfferFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1773,18 +2514,18 @@ impl Clone for OfferFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OfferFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeOfferFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeOfferFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the OfferFeatures pub extern "C" fn OfferFeatures_clone(orig: &OfferFeatures) -> OfferFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for InvoiceRequestFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeInvoiceRequestFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1792,18 +2533,18 @@ impl Clone for InvoiceRequestFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceRequestFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequestFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeInvoiceRequestFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the InvoiceRequestFeatures pub extern "C" fn InvoiceRequestFeatures_clone(orig: &InvoiceRequestFeatures) -> InvoiceRequestFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for Bolt12InvoiceFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeBolt12InvoiceFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1811,18 +2552,18 @@ impl Clone for Bolt12InvoiceFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt12InvoiceFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12InvoiceFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBolt12InvoiceFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the Bolt12InvoiceFeatures pub extern "C" fn Bolt12InvoiceFeatures_clone(orig: &Bolt12InvoiceFeatures) -> Bolt12InvoiceFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for BlindedHopFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeBlindedHopFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1830,18 +2571,18 @@ impl Clone for BlindedHopFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BlindedHopFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBlindedHopFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeBlindedHopFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the BlindedHopFeatures pub extern "C" fn BlindedHopFeatures_clone(orig: &BlindedHopFeatures) -> BlindedHopFeatures { - orig.clone() + Clone::clone(orig) } impl Clone for ChannelTypeFeatures { fn clone(&self) -> Self { Self { inner: if <*mut nativeChannelTypeFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -1849,12 +2590,12 @@ impl Clone for ChannelTypeFeatures { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelTypeFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeChannelTypeFeatures)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeChannelTypeFeatures) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the ChannelTypeFeatures pub extern "C" fn ChannelTypeFeatures_clone(orig: &ChannelTypeFeatures) -> ChannelTypeFeatures { - orig.clone() + Clone::clone(orig) } /// Generates a non-cryptographic 64-bit hash of the InitFeatures. #[no_mangle] @@ -2552,6 +3293,14 @@ pub extern "C" fn ChannelTypeFeatures_anchors_zero_htlc_fee_and_dependencies() - crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Constructs a ChannelTypeFeatures with zero fee commitment anchors support. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelTypeFeatures_anchors_zero_fee_commitments() -> crate::lightning_types::features::ChannelTypeFeatures { + let mut ret = lightning_types::features::ChannelTypeFeatures::anchors_zero_fee_commitments(); + crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// Create a blank Features with no features set #[must_use] #[no_mangle] @@ -3632,99 +4381,3 @@ pub extern "C" fn ChannelTypeFeatures_set_optional_custom_bit(this_arg: &mut cra local_ret } -/// Unsets the `upfront_shutdown_script` feature -#[must_use] -#[no_mangle] -pub extern "C" fn InitFeatures_clear_upfront_shutdown_script(mut this_arg: crate::lightning_types::features::InitFeatures) -> crate::lightning_types::features::InitFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_upfront_shutdown_script(); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `upfront_shutdown_script` feature -#[must_use] -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_upfront_shutdown_script(mut this_arg: crate::lightning_types::features::NodeFeatures) -> crate::lightning_types::features::NodeFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_upfront_shutdown_script(); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `shutdown_anysegwit` feature -#[must_use] -#[no_mangle] -pub extern "C" fn InitFeatures_clear_shutdown_anysegwit(mut this_arg: crate::lightning_types::features::InitFeatures) -> crate::lightning_types::features::InitFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_shutdown_anysegwit(); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `shutdown_anysegwit` feature -#[must_use] -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_shutdown_anysegwit(mut this_arg: crate::lightning_types::features::NodeFeatures) -> crate::lightning_types::features::NodeFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_shutdown_anysegwit(); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `wumbo` feature -#[must_use] -#[no_mangle] -pub extern "C" fn InitFeatures_clear_wumbo(mut this_arg: crate::lightning_types::features::InitFeatures) -> crate::lightning_types::features::InitFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_wumbo(); - crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `wumbo` feature -#[must_use] -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_wumbo(mut this_arg: crate::lightning_types::features::NodeFeatures) -> crate::lightning_types::features::NodeFeatures { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).clear_wumbo(); - crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -/// Unsets the `scid_privacy` feature -#[no_mangle] -pub extern "C" fn InitFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_scid_privacy() -} - -/// Unsets the `scid_privacy` feature -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_scid_privacy() -} - -/// Unsets the `scid_privacy` feature -#[no_mangle] -pub extern "C" fn ChannelTypeFeatures_clear_scid_privacy(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_scid_privacy() -} - -/// Unsets the `anchors_zero_fee_htlc_tx` feature -#[no_mangle] -pub extern "C" fn InitFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_anchors_zero_fee_htlc_tx() -} - -/// Unsets the `anchors_zero_fee_htlc_tx` feature -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_anchors_zero_fee_htlc_tx() -} - -/// Unsets the `anchors_zero_fee_htlc_tx` feature -#[no_mangle] -pub extern "C" fn ChannelTypeFeatures_clear_anchors_zero_fee_htlc_tx(this_arg: &mut crate::lightning_types::features::ChannelTypeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeChannelTypeFeatures)) }.clear_anchors_zero_fee_htlc_tx() -} - -/// Unsets the `route_blinding` feature -#[no_mangle] -pub extern "C" fn InitFeatures_clear_route_blinding(this_arg: &mut crate::lightning_types::features::InitFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.clear_route_blinding() -} - -/// Unsets the `route_blinding` feature -#[no_mangle] -pub extern "C" fn NodeFeatures_clear_route_blinding(this_arg: &mut crate::lightning_types::features::NodeFeatures) { - unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.clear_route_blinding() -} - diff --git a/lightning-c-bindings/src/lightning_types/routing.rs b/lightning-c-bindings/src/lightning_types/routing.rs index a9d86b2f..c7829fd2 100644 --- a/lightning-c-bindings/src/lightning_types/routing.rs +++ b/lightning-c-bindings/src/lightning_types/routing.rs @@ -81,7 +81,7 @@ impl RoutingFees { /// Flat routing fee in millisatoshis. #[no_mangle] pub extern "C" fn RoutingFees_get_base_msat(this_ptr: &RoutingFees) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().base_msat; + let mut inner_val = &mut RoutingFees::get_native_mut_ref(this_ptr).base_msat; *inner_val } /// Flat routing fee in millisatoshis. @@ -93,7 +93,7 @@ pub extern "C" fn RoutingFees_set_base_msat(this_ptr: &mut RoutingFees, mut val: /// In other words, 10000 is 1%. #[no_mangle] pub extern "C" fn RoutingFees_get_proportional_millionths(this_ptr: &RoutingFees) -> u32 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().proportional_millionths; + let mut inner_val = &mut RoutingFees::get_native_mut_ref(this_ptr).proportional_millionths; *inner_val } /// Liquidity-based routing fee in millionths of a routed amount. @@ -124,7 +124,7 @@ impl Clone for RoutingFees { fn clone(&self) -> Self { Self { inner: if <*mut nativeRoutingFees>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -132,12 +132,12 @@ impl Clone for RoutingFees { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RoutingFees_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRoutingFees)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRoutingFees) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RoutingFees pub extern "C" fn RoutingFees_clone(orig: &RoutingFees) -> RoutingFees { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RoutingFees object pub extern "C" fn RoutingFees_debug_str_void(o: *const c_void) -> Str { @@ -214,7 +214,7 @@ impl RouteHint { } #[no_mangle] pub extern "C" fn RouteHint_get_a(this_ptr: &RouteHint) -> crate::c_types::derived::CVec_RouteHintHopZ { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut RouteHint::get_native_mut_ref(this_ptr).0; let mut local_inner_val = Vec::new(); for item in inner_val.iter() { local_inner_val.push( { crate::lightning_types::routing::RouteHintHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner((item as *const lightning_types::routing::RouteHintHop<>) as *mut _) }, is_owned: false } }); }; local_inner_val.into() } @@ -236,7 +236,7 @@ impl Clone for RouteHint { fn clone(&self) -> Self { Self { inner: if <*mut nativeRouteHint>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -244,12 +244,12 @@ impl Clone for RouteHint { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHint_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHint)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRouteHint) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RouteHint pub extern "C" fn RouteHint_clone(orig: &RouteHint) -> RouteHint { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RouteHint object pub extern "C" fn RouteHint_debug_str_void(o: *const c_void) -> Str { @@ -340,7 +340,7 @@ impl RouteHintHop { /// The node_id of the non-target end of the route #[no_mangle] pub extern "C" fn RouteHintHop_get_src_node_id(this_ptr: &RouteHintHop) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().src_node_id; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).src_node_id; crate::c_types::PublicKey::from_rust(&inner_val) } /// The node_id of the non-target end of the route @@ -351,7 +351,7 @@ pub extern "C" fn RouteHintHop_set_src_node_id(this_ptr: &mut RouteHintHop, mut /// The short_channel_id of this channel #[no_mangle] pub extern "C" fn RouteHintHop_get_short_channel_id(this_ptr: &RouteHintHop) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().short_channel_id; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).short_channel_id; *inner_val } /// The short_channel_id of this channel @@ -362,7 +362,7 @@ pub extern "C" fn RouteHintHop_set_short_channel_id(this_ptr: &mut RouteHintHop, /// The fees which must be paid to use this channel #[no_mangle] pub extern "C" fn RouteHintHop_get_fees(this_ptr: &RouteHintHop) -> crate::lightning_types::routing::RoutingFees { - let mut inner_val = &mut this_ptr.get_native_mut_ref().fees; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).fees; crate::lightning_types::routing::RoutingFees { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning_types::routing::RoutingFees<>) as *mut _) }, is_owned: false } } /// The fees which must be paid to use this channel @@ -373,7 +373,7 @@ pub extern "C" fn RouteHintHop_set_fees(this_ptr: &mut RouteHintHop, mut val: cr /// The difference in CLTV values between this node and the next node. #[no_mangle] pub extern "C" fn RouteHintHop_get_cltv_expiry_delta(this_ptr: &RouteHintHop) -> u16 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().cltv_expiry_delta; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).cltv_expiry_delta; *inner_val } /// The difference in CLTV values between this node and the next node. @@ -384,7 +384,7 @@ pub extern "C" fn RouteHintHop_set_cltv_expiry_delta(this_ptr: &mut RouteHintHop /// The minimum value, in msat, which must be relayed to the next hop. #[no_mangle] pub extern "C" fn RouteHintHop_get_htlc_minimum_msat(this_ptr: &RouteHintHop) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_minimum_msat; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).htlc_minimum_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 } @@ -397,7 +397,7 @@ pub extern "C" fn RouteHintHop_set_htlc_minimum_msat(this_ptr: &mut RouteHintHop /// The maximum value in msat available for routing with a single HTLC. #[no_mangle] pub extern "C" fn RouteHintHop_get_htlc_maximum_msat(this_ptr: &RouteHintHop) -> crate::c_types::derived::COption_u64Z { - let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_maximum_msat; + let mut inner_val = &mut RouteHintHop::get_native_mut_ref(this_ptr).htlc_maximum_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 } @@ -426,7 +426,7 @@ impl Clone for RouteHintHop { fn clone(&self) -> Self { Self { inner: if <*mut nativeRouteHintHop>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -434,12 +434,12 @@ impl Clone for RouteHintHop { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHintHop_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeRouteHintHop)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeRouteHintHop) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the RouteHintHop pub extern "C" fn RouteHintHop_clone(orig: &RouteHintHop) -> RouteHintHop { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a RouteHintHop object pub extern "C" fn RouteHintHop_debug_str_void(o: *const c_void) -> Str { diff --git a/lightning-c-bindings/src/lightning_types/string.rs b/lightning-c-bindings/src/lightning_types/string.rs index db3a5fdd..c8619662 100644 --- a/lightning-c-bindings/src/lightning_types/string.rs +++ b/lightning-c-bindings/src/lightning_types/string.rs @@ -79,7 +79,7 @@ impl UntrustedString { } #[no_mangle] pub extern "C" fn UntrustedString_get_a(this_ptr: &UntrustedString) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut UntrustedString::get_native_mut_ref(this_ptr).0; inner_val.as_str().into() } #[no_mangle] @@ -98,7 +98,7 @@ impl Clone for UntrustedString { fn clone(&self) -> Self { Self { inner: if <*mut nativeUntrustedString>::is_null(self.inner) { core::ptr::null_mut() } else { - ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + ObjOps::heap_alloc(Clone::clone(unsafe { &*ObjOps::untweak_ptr(self.inner) })) }, is_owned: true, } } @@ -106,12 +106,12 @@ impl Clone for UntrustedString { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UntrustedString_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUntrustedString)).clone() })) as *mut c_void + Box::into_raw(Box::new(Clone::clone(unsafe { &*(this_ptr as *const nativeUntrustedString) }))) as *mut c_void } #[no_mangle] /// Creates a copy of the UntrustedString pub extern "C" fn UntrustedString_clone(orig: &UntrustedString) -> UntrustedString { - orig.clone() + Clone::clone(orig) } /// Get a string which allows debug introspection of a UntrustedString object pub extern "C" fn UntrustedString_debug_str_void(o: *const c_void) -> Str { @@ -203,7 +203,7 @@ impl PrintableString { } #[no_mangle] pub extern "C" fn PrintableString_get_a(this_ptr: &PrintableString) -> crate::c_types::Str { - let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + let mut inner_val = &mut PrintableString::get_native_mut_ref(this_ptr).0; inner_val.into() } #[no_mangle]